update nama cawangan dalam carian nama arcc
This commit is contained in:
@@ -391,11 +391,26 @@ class CallCenterController extends Controller
|
|||||||
$customers = $response->json();
|
$customers = $response->json();
|
||||||
|
|
||||||
// Jika lebih dari satu pelanggan dijumpai
|
// Jika lebih dari satu pelanggan dijumpai
|
||||||
if (is_array($customers) && count($customers) > 1) {
|
if (is_array($customers) && count($customers) > 1) {
|
||||||
Session::put('customer_list', $customers);
|
// Tambah nama cawangan untuk setiap pelanggan
|
||||||
return redirect()->route('arcc.pilihpelanggan');
|
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
|
// Jika satu pelanggan dijumpai
|
||||||
$customer_info = $customers[0] ?? null;
|
$customer_info = $customers[0] ?? null;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Nama</th>
|
<th>Nama</th>
|
||||||
<th>No KP</th>
|
<th>No KP</th>
|
||||||
<th>Kod Cawangan</th>
|
<th>Nama Cawangan</th>
|
||||||
<th>Tindakan</th>
|
<th>Tindakan</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
{{ $noic }}</td>
|
{{ $noic }}</td>
|
||||||
<td>{{ $customer['kodcaw'] }}</td>
|
<td>{{ $customer['nama_cawangan'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
<form action="{{ route('arcc.pilihpelanggan.proceed') }}" method="POST">
|
<form action="{{ route('arcc.pilihpelanggan.proceed') }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
|
|||||||
Reference in New Issue
Block a user