ifnex/04_Laravel/resources/views/filament/pages/ifnex-settings.blade.php
Kazem Alghasi 499e0731b1 feat(pricing): centralize exchange rate management via ExchangeRateService
Migrate exchange rate handling from static system settings to a
centralized `ExchangeRateService`. This change ensures that currency
rates are managed through a single source of truth that supports
history tracking, approval workflows, and API updates.

Laravel:
- Remove manual exchange rate fields (`aed_to_irr`, `usd_to_irr`, etc.)
  from `IfnexSettingsPage` and the `SystemSetting` persistence logic.
- Update `PricingPageController` and `PriceCalculatorService` to
  retrieve live rates from `ExchangeRateService` instead of `SystemSetting`.
- Refactor `IfnexSettingsPage` UI to display current rates as
  read-only information with a link to the dedicated exchange rate
  management resource.

Documentation:
- Update `CLIENT_DELIVERY.md` to reflect the change in exchange rate
  management workflow.
2026-10-03 07:20:32 +03:30

91 lines
5.9 KiB
PHP

<x-filament::page>
<div class="space-y-6">
<x-filament::card>
<h2 class="text-lg font-medium text-gray-900 mb-4">تنظیمات مالی</h2>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<div>
<label class="block text-sm font-medium text-gray-700">VAT Rate</label>
<input type="number" step="0.01" wire:model="vat_rate" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
<p class="mt-1 text-sm text-gray-500">Example: 0.09 for 9%</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Default Packing Cost (IRR)</label>
<input type="number" wire:model="packing_cost_default" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Profit Margin</label>
<input type="number" step="0.01" wire:model="profit_margin" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
<p class="mt-1 text-sm text-gray-500">Example: 1.25 for 25% margin</p>
</div>
</div>
{{-- نرخ‌های ارز: فقط نمایش — تغییر فقط از منوی «نرخ ارز» (تاریخچه + گردش تأیید) --}}
<div class="mt-6 rounded-lg border border-amber-200 bg-amber-50 dark:border-gray-700 dark:bg-gray-800 p-4">
<div class="flex items-center justify-between flex-wrap gap-3">
<div>
<h3 class="text-sm font-semibold text-gray-900 dark:text-white">💱 نرخ‌های ارز (فقط نمایش)</h3>
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
تغییر نرخ فقط از منوی «نرخ ارز» انجام می‌شود — همیشه با تاریخچه، امکان آپدیت از API و گردش تأیید.
</p>
</div>
<a href="{{ \App\Filament\Resources\ExchangeRateHistoryResource::getUrl() }}"
class="text-xs font-semibold text-amber-600 hover:text-amber-700 dark:text-amber-400">
مدیریت نرخ‌ها در منوی نرخ ارز ←
</a>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3 mt-3">
@foreach ($this->getCurrentRates() as $currency => $rate)
<div class="flex items-center justify-between rounded-md bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 px-3 py-2">
<span class="text-sm text-gray-600 dark:text-gray-300">{{ $currency }} → IRR</span>
<span class="text-sm font-bold text-gray-900 dark:text-white">{{ number_format($rate) }} ریال</span>
</div>
@endforeach
</div>
</div>
</x-filament::card>
<x-filament::card>
<h2 class="text-lg font-medium text-gray-900 mb-4">تنظیمات SMS (کاوه‌نگار)</h2>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<div>
<label class="block text-sm font-medium text-gray-700">API Key</label>
<input type="text" wire:model="kavenegar_api_key" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Sender Number</label>
<input type="text" wire:model="kavenegar_sender" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm">
</div>
<div class="flex items-center gap-2">
<input type="checkbox" wire:model="kavenegar_send_shipment_approved" id="kavenegar_send_shipment_approved" class="rounded border-gray-300">
<label for="kavenegar_send_shipment_approved" class="text-sm font-medium text-gray-700">ارسال SMS هنگام تأیید سفارش</label>
</div>
<div class="flex items-center gap-2">
<input type="checkbox" wire:model="kavenegar_send_shipment_rejected" id="kavenegar_send_shipment_rejected" class="rounded border-gray-300">
<label for="kavenegar_send_shipment_rejected" class="text-sm font-medium text-gray-700">ارسال SMS هنگام رد سفارش</label>
</div>
<div class="flex items-center gap-2">
<input type="checkbox" wire:model="kavenegar_send_payment_success" id="kavenegar_send_payment_success" class="rounded border-gray-300">
<label for="kavenegar_send_payment_success" class="text-sm font-medium text-gray-700">ارسال SMS هنگام پرداخت موفق</label>
</div>
<div class="flex items-center gap-2">
<input type="checkbox" wire:model="kavenegar_send_tracking_update" id="kavenegar_send_tracking_update" class="rounded border-gray-300">
<label for="kavenegar_send_tracking_update" class="text-sm font-medium text-gray-700">ارسال SMS هنگام به‌روزرسانی رهگیری</label>
</div>
</div>
</x-filament::card>
<div class="mt-6">
<button type="button" wire:click="save" class="filament-button filament-button-size-md inline-flex items-center justify-center py-2 px-4 rounded-md text-sm font-medium text-white bg-primary-600 hover:bg-primary-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
Save Settings
</button>
</div>
</div>
</x-filament::page>