refactor(shipping): clean up import logic and fix PDF asset paths

Refactor the shipping rates import process to remove redundant comments
and simplify variable assignments. Additionally, update PDF templates
to use the `asset()` helper instead of `public_path()` for logo
rendering to ensure consistent asset loading.

- refactor(import): simplify `ShippingRatesImport` logic and variable naming
- fix(pdf): update logo image source from `public_path` to `asset` in AWB and Label templates
This commit is contained in:
Kazem Alghasi 2026-08-23 22:56:08 +03:30
parent b051ce4496
commit ab591dc9f8
3 changed files with 4 additions and 11 deletions

View File

@ -147,7 +147,6 @@ class SimpleRateSheetImport implements OnEachRow, WithStartRow
{
$cells = $row->toArray();
// بررسی اعتبار ستون وزن (ستون اول)
if (empty($cells[0]) || !is_numeric($cells[0])) {
$this->skipped++;
return;
@ -157,26 +156,20 @@ class SimpleRateSheetImport implements OnEachRow, WithStartRow
$weight = (float) $cells[0];
$zoneNumber = (int) $cells[1];
$rawValue = str_replace([',', ' '], '', (string) ($cells[2] ?? 0));
$rawValue = is_numeric($rawValue) ? (float) $rawValue : 0;
$value = is_numeric($rawValue) ? (float) $rawValue : 0;
// بررسی اعتبار شماره زون و قیمت
if ($zoneNumber < 1 || $zoneNumber > 10 || $rawValue <= 0) {
if ($zoneNumber < 1 || $zoneNumber > 10 || $value <= 0) {
$this->skipped++;
return;
}
// نرخ‌ها به صورت AED در دیتابیس ذخیره می‌شوند
$value = $rawValue;
$zoneColumn = 'zone_' . $zoneNumber;
// ایجاد مقادیر پیش‌فرض برای زون‌ها
$defaults = [];
for ($i = 1; $i <= 10; $i++) {
$defaults['zone_' . $i] = 0;
}
// یافتن یا ایجاد رکورد و به‌روزرسانی قیمت زون
$record = ShippingRate::firstOrCreate(
[
'direction' => $this->direction,

View File

@ -43,7 +43,7 @@
<body>
<div class="container">
<div class="header">
<img src="{{ public_path('logo.png') }}" class="logo" alt="IFNEX Logo">
<img src="{{ asset('logo.png') }}" class="logo" alt="IFNEX Logo">
<div class="title-area">
<div class="title">Shipment Waybill</div>
<div class="subtitle">We Deliver Value</div>

View File

@ -50,7 +50,7 @@
<div class="page">
<div class="label-box">
<div class="header">
<img src="{{ public_path('logo.png') }}" class="logo" alt="IFNEX Logo">
<img src="{{ asset('logo.png') }}" class="logo" alt="IFNEX Logo">
<div class="company-name">IFNEX LOGISTICS</div>
</div>