diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index fd34d91..1d33fa0 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -47,16 +47,10 @@ class CustomersController extends Controller $customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json(); $customer_info = $customers_info[0]; - $belum_tebus = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/belum_tebus')->json(); - $sudah_tebus = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/sudah_tebus')->json(); - $lelong = Http::get(config('api.url') . '/api/customers/'. $noic .'/gadai/lelong')->json(); - // dd($belum_tebus); - $search = true; if($customer_info){ Session::put('customer_info',$customer_info); - Session::put('belum_tebus',$belum_tebus); - return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info,'belum_tebus'=>$belum_tebus,'sudah_tebus'=>$sudah_tebus,'lelong'=>$lelong]); + return redirect()->route('customer_info')->with( ['customer_info' => $customer_info,'cawangan_info'=>$cawangan_info]); }else{ return view('customers.index',compact('customer_info','search','noic','cawangan_info')); } diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php index 6f27abe..c73a2e1 100644 --- a/app/Http/Controllers/GadaianController.php +++ b/app/Http/Controllers/GadaianController.php @@ -7,6 +7,7 @@ use App\Services\CustomerService; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Auth; +use Carbon\Carbon; class GadaianController extends Controller { @@ -18,12 +19,22 @@ class GadaianController extends Controller public function index(Request $request) { + $current = Carbon::now(); + $current = new Carbon(); + $curent_year = substr($current->year,2,2); + $curent_month = sprintf("%02d", $current->month); + $current_day = sprintf("%02d", $current->day); + // dd($current_day); $noic = $request->noic; - $customer_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json(); + $customers_info = Http::get(config('api.url') . '/api/customers/'. $noic)->json(); + $customer_info = $customers_info[0]; // $limit_pinjaman_semasa = $customer_info['limit_pinjaman'] - $customer_info['pinjaman_semasa']; $limit_pinjaman_semasa = 0; $auth_user = Auth::user(); + $gadai_transaction = sizeof(Http::get(config('api.url') . '/api/gadai/'. $auth_user['cawangan'] . '/' . $current->toDateString())->json()); + $new_transaction = sprintf("%04d",$gadai_transaction+1); + $norujukan = strtoupper($auth_user['cawangan']) . $curent_year . $curent_month . $current_day . '-' .$new_transaction; $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); - return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info')); + return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan')); } } diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index c202e71..6c440bb 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -3,6 +3,9 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Session; +use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Auth; class MarhunController extends Controller { @@ -12,6 +15,8 @@ class MarhunController extends Controller } public function index(){ - return view('marhun.index'); + $auth_user = Auth::user(); + $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json(); + return view('marhun.index',compact('cawangan_info')); } } diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php index 6de21bc..61f54a8 100644 --- a/resources/views/customers/info.blade.php +++ b/resources/views/customers/info.blade.php @@ -3,7 +3,6 @@ @section('content')
@@ -104,7 +103,7 @@ var tablegadai = $('#myTable').DataTable(); function gadaiTable(data){ var counter = 1; - tablegadai.clear(); + tablegadai.clear().draw(); $.each(data,function(index,gadai){ $.each(gadai, function(index,gadai_detail){ tablegadai.row.add([ @@ -114,7 +113,7 @@ 'RM '+ gadai_detail['pinjaman'].toLocaleString("en-GB"), 'RM '+ gadai_detail['nilaimarhun'].toLocaleString("en-GB"), '0', - 'RM '+ ((gadai_detail['kadarupah']/100)*gadai_detail['pinjaman']*gadai_detail['tempoh']) + 'RM '+ parseFloat(((gadai_detail['kadarupah']/100)*gadai_detail['pinjaman']*gadai_detail['tempoh']).toLocaleString("en-GB")).toFixed(2) ]).draw(); counter = counter + 1; @@ -136,7 +135,7 @@ } ); function gadaiOptionButton(noic){ - tablegadai.clear(); + tablegadai.clear().draw(); if($("input[name='options']:checked").val() == 'belum_tebus'){ // console.log(noic); $.ajax({ diff --git a/resources/views/gadaian/index.blade.php b/resources/views/gadaian/index.blade.php index 64182cb..6f5ec64 100644 --- a/resources/views/gadaian/index.blade.php +++ b/resources/views/gadaian/index.blade.php @@ -6,13 +6,13 @@

gadaian

-
+
Nama
- +
@@ -32,7 +32,7 @@ No Rujukan
- +