diff --git a/app/Http/Controllers/V3/Dashboard/AccidentReceiptController.php b/app/Http/Controllers/V3/Dashboard/AccidentReceiptController.php index 9a31cdb2..530b4add 100644 --- a/app/Http/Controllers/V3/Dashboard/AccidentReceiptController.php +++ b/app/Http/Controllers/V3/Dashboard/AccidentReceiptController.php @@ -45,7 +45,7 @@ class AccidentReceiptController extends Controller auth()->user()->addActivityComplete(1126); $name = 'گزارش از خسارات وارده به ابنیه فنی و تاسیسات راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx'; $data = $accidentReceiptTableService->dataTable($request, true); - return Excel::download(new DataTableReport($data), $name); + return Excel::download(new DataTableReport($data['data']), $name); } public function accidentDamage(Accident $accident): JsonResponse diff --git a/app/Models/Accident.php b/app/Models/Accident.php index 510df15d..f1495dce 100644 --- a/app/Models/Accident.php +++ b/app/Models/Accident.php @@ -2,10 +2,12 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use App\Traits\ReceiptReportAble; use Illuminate\Database\Eloquent\Relations\MorphMany; +use Illuminate\Support\Facades\Storage; class Accident extends Model { @@ -95,4 +97,25 @@ class Accident extends Model { return $this->morphMany(File::class, 'fileable'); } + + protected function damagePicture1(): Attribute + { + return Attribute::make( + get: fn($value) => $value == null ? null : Storage::disk('public')->url($value) + ); + } + + protected function damagePicture2(): Attribute + { + return Attribute::make( + get: fn($value) => $value == null ? null : Storage::disk('public')->url($value) + ); + } + + protected function policeFile(): Attribute + { + return Attribute::make( + get: fn($value) => $value == null ? null : Storage::disk('public')->url($value) + ); + } } diff --git a/resources/views/v3/Reports/AccidentReceipt/DataTableReport.blade.php b/resources/views/v3/Reports/AccidentReceipt/DataTableReport.blade.php index 024c9621..beb27f54 100644 --- a/resources/views/v3/Reports/AccidentReceipt/DataTableReport.blade.php +++ b/resources/views/v3/Reports/AccidentReceipt/DataTableReport.blade.php @@ -22,21 +22,16 @@ - شناسه ثبت در سامانه RMS - تاریخ ثبت در سامانه - نام استان - نام شهرستان + کد یکتا + استان + شهرستان + نام محور + نوع تصادف تاریخ تصادف - ساعت تصادف - - نوع خسارت - - نوع تجهیزات خسارت دیده - مبلغ برآورد اولیه - آخرین وضعیت - مبلغ وصولی به حساب اداره - میزان فرانشیز کسر شده - میزان داغی تجهیزات خسارت دیده موجود انبار اداره + مبلغ کل خسارت + پلاک + تاریخ ثبت + آخرین وضعیت مبلغ فیش مبلغ بیمه مبلغ داغی @@ -47,30 +42,15 @@ @foreach ($data as $item) {{$item->id}} - {{Hekmatinasser\Verta\Verta::instance($item->created_at)->format('Y/n/j')}} {{$item->province_fa}} {{$item->city_fa}} - {{Hekmatinasser\Verta\Verta::instance($item->accident_date)->format('Y/n/j')}} - {{$item->accident_time}} - + {{$item->axis_name}} {{$item->accident_type_fa}} - @php - $temp = ''; - @endphp - @foreach ($item->damages as $damage) - @php - $temp .= $damage->title." (".$damage->pivot->value." ".$damage->unit.") - "; - @endphp - @endforeach - - {{$temp}} - - + {{Hekmatinasser\Verta\Verta::instance($item->accident_date)->format('Y/n/j') ($item->accident_time)}} {{$item->sum ?? 0}} + {{$item->plaque}} + {{Hekmatinasser\Verta\Verta::instance($item->created_at)->format('Y/n/j')}} {{$item->status_fa}} - {{$item->deposit_insurance_amount + $item->final_amount}} - - {{$item->final_amount}} {{$item->deposit_insurance_amount}} {{$item->deposit_daghi_amount}}