buat history and notifikasi

This commit is contained in:
hafifierahman
2021-01-09 19:52:59 +08:00
parent f37591f304
commit 3619c36e22
19 changed files with 2205 additions and 186 deletions
@@ -159,4 +159,58 @@ class GadaianController extends Controller
return view('print.sag',compact('gadai_detail','customer_detail','marhun_detail','cawangan_detail','api_url','pembayaran_segera'));
}
public function resit($id)
{
$transaction = Http::get(config('api.url') . '/api/transaction/id/'. $id)->json();
if(sizeof($transaction) != 0)
$transaction = $transaction[0];
$gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $transaction['norujukan'])->json();
if(sizeof($gadai) != 0)
$gadai = $gadai[0][0];
$customers_info = Http::get(config('api.url') . '/api/customers/'. $gadai['nokp'])->json();
if(sizeof($customers_info) != 0)
$customers_info = $customers_info[0];
return view('print.resitansuran',compact('transaction','gadai','customers_info'));
}
public function history(Request $request)
{
$auth_user = Auth::user();
$gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $request->norujukan)->json();
if(sizeof($gadai) > 0)
$history = $gadai[0][0]['historygadaian'];
$count = 0;
$arrayhist = [];
while($history != "0" && $history != '')
{
$gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $history)->json();
$tebus = Http::get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],[
"norujukan" => $history
])->json();
array_push($arrayhist,["norujukan" => $history,"jenistebus" => $tebus[0]['jenistebus'],"jbg" => $tebus[0]['jbg'],"t_tebus" => $tebus[0]['t_tebus']]);
if(sizeof($gadai) > 0)
$history = $gadai[0][0]['historygadaian'];
$count++;
}
return response()->json($arrayhist,200);
}
}
@@ -2,6 +2,11 @@
namespace App\Http\Controllers;
//Events
use App\Events\StatusLiked;
use App\Events\NotifikasiPembayaran;
use App\User;
use App\Cawangan;
@@ -302,6 +307,8 @@ class KhazanahController extends Controller
// 'teller' => $request->teller
])->json();
event(new StatusLiked('Penghantaran kepada Khazanah!'));
return response()->json($createlulus,201);
}
@@ -341,6 +348,8 @@ class KhazanahController extends Controller
$auth_user = Auth::user();
$gadai = Http::put(config('api.url').'/api/gadai/serah_marhun/khazanah/'. $auth_user['cawangan'] .'/' . $request->norujukan_barcode)->json();
event(new NotifikasiPembayaran('TellerkepadaKhazanah'));
return redirect()->route('khazanah.gadaian');
}
+29 -2
View File
@@ -112,6 +112,16 @@ class PenebusanController extends Controller
'kuantiti_marhun' => $request->kuantiti_marhun
])->json();
////////////////////////////
////Update History Gadaian///
////////////////////////////
$updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[
'historygadaian' => $request->norujukan
])->json();
///////////////////////////
/// MARHUN UPDATE TABLE////
//////////////////////////
@@ -221,6 +231,15 @@ class PenebusanController extends Controller
'kuantiti_marhun' => $request->kuantiti_marhun
])->json();
////////////////////////////
////Update History Gadaian///
////////////////////////////
$updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[
'historygadaian' => $request->norujukan
])->json();
///////////////////////////
/// MARHUN UPDATE TABLE////
//////////////////////////
@@ -298,7 +317,6 @@ class PenebusanController extends Controller
$new_transaction = sprintf("%04d",$new_sirig);
$norujukanbaru = strtoupper($auth_user['cawangan']) . $curent_year . $curent_month . $current_day . '-' .$new_transaction;
// dd($norujukan);
$gadai = Http::post(config('api.url').'/api/gadai/'.$auth_user['cawangan'],[
'norujukan' => $norujukanbaru,
'nopelanggan' => $request->nopelanggan,
@@ -306,7 +324,7 @@ class PenebusanController extends Controller
'sirig' => $new_sirig
]);
//////////////////////
////Update SAG BARU///
/////////////////////
@@ -334,7 +352,16 @@ class PenebusanController extends Controller
'kuantiti_marhun' => $request->kuantiti_marhun
])->json();
////////////////////////////
////Update History Gadaian///
////////////////////////////
$updatehistorygadaian = Http::put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[
'historygadaian' => $request->norujukan
])->json();
dd($updatehistorygadaian);
///////////////////////////
/// MARHUN UPDATE TABLE////