update tangguh lelong pc

This commit is contained in:
faiqahzaman
2022-06-05 16:54:15 +08:00
parent 643d33d3e8
commit b5a1cfa4c6
7 changed files with 143 additions and 33 deletions
@@ -58,30 +58,51 @@ class TangguhLelongController extends Controller
{
// dd($request->all());
$user = Auth::user();
$namacaw = Cawangan::where('caw_code', $user['kodcaw'])->first();
$checkkodcaw = Customer::join('lelongbid', 'customer.kodcaw', '=', 'lelongbid.kodcaw')
->where('lelongbid.kodcaw', $user['kodcaw'])
->where('customer.kpbaru', $request->nokp)
->orWhere('customer.kplama', $request->nokp)
->first();
if($request->nokp == null)
{
return redirect()->route('tangguhlelong.carian', $request->lelong_id)->with('success','Sila Masukkan No Kad Pengenalan');
return redirect()->route('tangguhlelong.carian', $request->lelong_id)->with('failed','Sila Masukkan No Kad Pengenalan');
}
else if($checkkodcaw == null)
{
return redirect()->route('tangguhlelong.carian', $request->lelong_id)->with('failed','No Kad Pengenalan Tiada Dalam Rekod');
}
else if($request->nokp != null)
{
$lelong = Lelong::where('id', $request->lelong_id)->first();
$getic = Customer::join('gadai', 'customer.kpbaru', '=', 'gadai.nokp')
->where('gadai.nokp', '=', $request->nokp)
// ->where('gadai.tempoh', '=', $lelong->jbg)
$getic = LelongBid::join('gadai', 'lelongbid.norujukan', '=', 'gadai.norujukan')
->where('lelongbid.kodcaw', $user['kodcaw'])
->where('gadai.nokp', $request->nokp)
->where('lelongbid.lelong_id', $request->lelong_id)
->get();
// dd($getic);
foreach($getic as $index1=>$ic)
{
// dd($ic);
$getnorujukan = LelongBid::join('lelongbidmarhun', 'lelongbid.id', '=', 'lelongbidmarhun.lelongbid_id')
->where('norujukan', $ic->norujukan)
->where('jbg', $ic->tempoh)
->where('lelongbid.kodcaw', $user['kodcaw'])
->where('lelong_id', $request->lelong_id)
->get();
// dd($getnorujukan);
$customer_detail = Customer::where('kpbaru', $ic['nokp'])
->orWhere('kplama', $ic['nokp'])
->first();
// $getic['customer_detail'] = $customer_detail;
// $getic2 = $customer_detail;
// dd($getic2);
foreach($getnorujukan as $norujukan)
{
// dd($norujukan);
@@ -104,21 +125,27 @@ class TangguhLelongController extends Controller
}
else
{
//
$getic[$index1]['user_details'] = $getnorujukan;
$getic[$index1]['t_lelong'] = $getnorujukan[0]['t_lelong'];
$getic[$index1]['sdhadapengesahan'] = $adapengesahan;
}
$getic[$index1]['user_details'] = $getnorujukan;
// dd($getic[$index1]['user_details']);
$getic[$index1]['sdhadapengesahan'] = $adapengesahan;
}
}
// $icarray = [];
// foreach($getic->toArray() as $array)
// {
// if(sizeof($array) == 170)
// array_push($icarray, $array);
// }
// dd($getic->toArray());
$getic_array = $getic->toArray();
dd($getic_array);
$lelong_id = $request->lelong_id;
return view('tangguhlelong.searchbyic', compact('getic', 'user', 'lelong_id'));
return view('tangguhlelong.searchbyic', compact('getic', 'customer_detail', 'user', 'lelong_id', 'namacaw'));
}