ifnex/04_Laravel/app/Filament/Resources/views/rate-import.blade.php
Kazem Alghasi 58493feca4 refactor(currency): IRR as single base currency for all shipping rates
Make Iranian Rial (IRR) the sole base currency for shipping rates:
- RateImportService now converts all imported rates to IRR at import
  time using the current daily exchange rate (source currency AED/USD/
  EUR/IRR). Rates are stored in rate_entries with currency='IRR'.
- PriceCalculatorService looks up IRR rates directly — no conversion
  at calc time. Also fixes a pre-existing bug where extras (in IRR)
  were incorrectly added to the AED base before conversion.
- RateEntry::lookup() default currency changed from 'AED' to 'IRR'.
- Migration changes the column default to 'IRR'.
- Filament import form: relabel 'Rate currency' to 'Source currency
  (in Excel file)' with helper text explaining the conversion.
- WordPress JS: update price summary labels from 'درهم' to 'ریال'
  and drop the deprecated net_dirham field.

Architectural benefit: rates are 'frozen' in IRR at import time —
daily exchange rate changes only affect NEW imports, not already-
stored rates. This is more stable and predictable for customers.
2026-10-29 17:01:30 +03:30

47 lines
3.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<x-filament-panels::page>
<div class="space-y-4">
<div class="filament-card p-6">
<h2 class="text-lg font-semibold mb-2">Rate Excel Import</h2>
<p class="text-sm text-gray-600 mb-4">
Upload an Excel file matching the IFNEX Rate Template format.
The importer expects sheets named <code>Import Rate</code>, <code>Export Rate</code>, and optionally <code>Zone</code>.
Each rate sheet must contain two sections: <code>DOCUMENT</code> and <code>NON-DOCUMENT</code>.
</p>
<form wire:submit="import">
{{ $this->form }}
<div class="mt-4">
<x-filament::button type="submit" color="success" icon="heroicon-o-arrow-up-tray">
Import Rates
</x-filament::button>
</div>
</form>
</div>
<div class="filament-card p-4 bg-amber-50 border border-amber-200">
<h3 class="text-sm font-semibold text-amber-800 mb-2">📋 نکات مهم</h3>
<ul class="text-xs text-amber-700 list-disc ml-5 space-y-1">
<li>نام شیت‌ها باید دقیقاً <code>Import Rate</code> و <code>Export Rate</code> باشد.</li>
<li>مارکرهای بخش باید در ستون E باشند: <code>DOCUMENT</code> / <code>NON - DOCUMENT</code>.</li>
<li>سرستون‌ها: <code>Weight (kg)</code> و <code>Zone 1</code>..<code>Zone 10</code> (یا اعداد ۱..۱۰).</li>
<li>وزن‌ها باید عدد اعشاری در ستون A باشند (0.5, 1, 1.5, ...).</li>
<li>سلول‌های خالی نادیده گرفته می‌شوند.</li>
<li><strong>ارز مبدأ:</strong> ارزی که نرخ‌های فایل اکسل به آن هستند را انتخاب کنید. سیستم با نرخ روز آن ارز → ریال تبدیل کرده و در دیتابیس ذخیره می‌کند.</li>
<li><strong>نکته:</strong> قبل از ایمپورت، مطمئن شوید نرخ روز ارز مبدأ در پنل «ارزها» تنظیم شده است.</li>
</ul>
</div>
<div class="filament-card p-4">
<h3 class="text-sm font-semibold mb-2">دانلود قالب خالی</h3>
<p class="text-xs text-gray-600 mb-2">
اگر قالب خالی را می‌خواهید،
<a href="{{ route('download.rate-template') }}" class="text-blue-600 underline">دانلود IFNEX_Rate_Template.xlsx</a>
(فرمت ۴-رُبعی: Import Rate، Export Rate، Zone).
</p>
<p class="text-xs text-amber-600 mt-2">
⚠️ توجه: فایل اصلی مشتری (با داده‌های نرخ واقعی) را مستقیم آپلود کنید — این قالب فقط فرمت خالی است.
</p>
</div>
</div>
</x-filament-panels::page>