diff --git a/app/Http/Controllers/CallCenterController.php b/app/Http/Controllers/CallCenterController.php index 2a1fa5c..b481ee6 100644 --- a/app/Http/Controllers/CallCenterController.php +++ b/app/Http/Controllers/CallCenterController.php @@ -391,11 +391,26 @@ class CallCenterController extends Controller $customers = $response->json(); // Jika lebih dari satu pelanggan dijumpai - if (is_array($customers) && count($customers) > 1) { - Session::put('customer_list', $customers); - return redirect()->route('arcc.pilihpelanggan'); + if (is_array($customers) && count($customers) > 1) { + // Tambah nama cawangan untuk setiap pelanggan + foreach ($customers as &$customer) { + $kodcaw = $customer['kodcaw'] ?? null; + + if ($kodcaw) { + $cawangan = Http::withOptions(['verify' => config('app.api_verify')]) + ->get($api_url . '/api/cawangan/' . $kodcaw) + ->json(); + + $customer['nama_cawangan'] = $cawangan['details_caw'] ?? $kodcaw; + } else { + $customer['nama_cawangan'] = '-'; + } } + Session::put('customer_list', $customers); + return redirect()->route('arcc.pilihpelanggan'); + } + // Jika satu pelanggan dijumpai $customer_info = $customers[0] ?? null; } else { diff --git a/resources/views/callcenter/pilihpelanggan.blade.php b/resources/views/callcenter/pilihpelanggan.blade.php index 4d5a2bc..8386d1e 100644 --- a/resources/views/callcenter/pilihpelanggan.blade.php +++ b/resources/views/callcenter/pilihpelanggan.blade.php @@ -9,7 +9,7 @@ Nama No KP - Kod Cawangan + Nama Cawangan Tindakan @@ -25,7 +25,7 @@ } @endphp {{ $noic }} - {{ $customer['kodcaw'] }} + {{ $customer['nama_cawangan'] }}
@csrf