From 88a5f876730520182c87d1635553c55f1ebb8a41 Mon Sep 17 00:00:00 2001 From: daengdeni Date: Thu, 4 Apr 2024 15:13:47 +0700 Subject: [PATCH] fix laporan penagihan --- Http/Controllers/ReportController.php | 35 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Http/Controllers/ReportController.php b/Http/Controllers/ReportController.php index 5870f7e..ef68683 100644 --- a/Http/Controllers/ReportController.php +++ b/Http/Controllers/ReportController.php @@ -236,20 +236,35 @@ $date = Carbon::create($row->tanggal_hapus_buku); return $date->locale('id')->translatedFormat('d F Y'); })->editColumn('branch', function ($row) { - return 'A'; - //return $row->branch->kode . ' - ' . $row->branch->name; + if(isset($row->branch->kode) && isset($row->branch->name)){ + return $row->branch->kode . ' - ' . $row->branch->name; + }else{ + return '-'; + } })->editColumn('debitur', function ($row) { - return 'B'; - //return $row->debitur->kode . ' - ' . $row->debitur->name; + if (isset($row->debitur->kode) && isset($row->debitur->name)) { + return $row->debitur->kode . ' - ' . $row->debitur->name; + } else { + return '-'; + } })->editColumn('alamat', function ($row) { - return 'E'; - //return $row->debitur->address; + if (isset($row->debitur->address)) { + return $row->debitur->address; + } else { + return '-'; + } })->editColumn('facility_type', function ($row) { - return 'C'; - //return $row->facility_type->kode . ' - ' . $row->facility_type->name; + if (isset($row->facility_type->kode) && isset($row->facility_type->name)) { + return $row->facility_type->kode . ' - ' . $row->facility_type->name; + } else { + return '-'; + } })->editColumn('loan_type', function ($row) { - return 'D'; - //return $row->loan_type->kode . ' - ' . $row->loan_type->name; + if (isset($row->loan_type->kode) && isset($row->loan_type->name)) { + return $row->loan_type->kode . ' - ' . $row->loan_type->name; + } else { + return '-'; + } })->editColumn('guarantee_type', function ($row) { $guarantee = GuaranteeType::where('id', $row->guarantee_type_id)->first(); if (isset($guarantee->id)) {