10 Commits

52 changed files with 2735 additions and 424 deletions
+4 -1
View File
@@ -47,4 +47,7 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MYKAD_READER_PORT=8085
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
COMMODITY_SHORAKA_ENABLED=true
COMMODITY_BSAS_ENABLED=true
+4 -1
View File
@@ -53,4 +53,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MYKAD_READER_PORT=8085
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
INTERNAL_NOTIFICATION_SECRET=erahn-local-notification-secret
INTERNAL_NOTIFICATION_SECRET=erahn-local-notification-secret
COMMODITY_SHORAKA_ENABLED=true
COMMODITY_BSAS_ENABLED=true
+4 -1
View File
@@ -52,4 +52,7 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MYKAD_READER_PORT=8085
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
MYKAD_READER_ENABLED_CAWANGAN='' # IF NO CAWANGAN STATED, ALL CAWANGAN IS ENABLED
COMMODITY_SHORAKA_ENABLED=true
COMMODITY_BSAS_ENABLED=true
+5
View File
@@ -52,3 +52,8 @@ MYKAD_READER_ENABLED_CAWANGAN=''
INTERNAL_NOTIFICATION_SECRET=
LOGVIEWER_PASSWORD=
# Commodity providers available when a teller submits gadai.
# Turn either or both on. When both are true, the teller chooses on the form.
COMMODITY_SHORAKA_ENABLED=true
COMMODITY_BSAS_ENABLED=true
+4 -1
View File
@@ -50,4 +50,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MYKAD_READER_PORT=17321
MYKAD_READER_ENABLED_CAWANGAN=''
INTERNAL_NOTIFICATION_SECRET="nIDTe(u@6[)VLJyd"
INTERNAL_NOTIFICATION_SECRET="nIDTe(u@6[)VLJyd"
COMMODITY_SHORAKA_ENABLED=true
COMMODITY_BSAS_ENABLED=true
+4 -1
View File
@@ -54,4 +54,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MYKAD_READER_PORT=17321
MYKAD_READER_ENABLED_CAWANGAN=''
INTERNAL_NOTIFICATION_SECRET=staging_noti_secret
INTERNAL_NOTIFICATION_SECRET=staging_noti_secret
COMMODITY_SHORAKA_ENABLED=true
COMMODITY_BSAS_ENABLED=true
+12 -12
View File
@@ -125,10 +125,10 @@ class AliranTunaiController extends Controller
$auth_user = Auth::user();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan_gadai)->json();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan_gadai)->throw()->json();
$gadai_detail = $gadai[0];
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $teller])->json();
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $teller])->throw()->json();
$keluar = $getTunai2['keluar'];
$bakiakhir = $getTunai2['baki'];
@@ -143,7 +143,7 @@ class AliranTunaiController extends Controller
'keluar' => $keluar,
'masuk' => $masuk,
'bakiakhir' => $bakiakhir
]);
])->throw();
return response()->json($updateTunai,201);
@@ -153,13 +153,13 @@ class AliranTunaiController extends Controller
$auth_user = Auth::user();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan)->json();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan)->throw()->json();
$gadai_detail = $gadai[0];
$tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],['norujukan' => $request->norujukan])->json();
$tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],['norujukan' => $request->norujukan])->throw()->json();
$tebus_detail = $tebus[0];
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $tebus_detail['teller']])->json();
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $tebus_detail['teller']])->throw()->json();
$keluar=$getTunai2['keluar'];
$baki=$getTunai2['baki'];
@@ -181,7 +181,7 @@ class AliranTunaiController extends Controller
'keluar'=>$keluar,
'masuk'=>$masuk,
'bakiakhir'=>$bakiakhir
]);
])->throw();
}else{
@@ -199,7 +199,7 @@ class AliranTunaiController extends Controller
'keluar'=>$keluar,
'masuk'=>$masuk,
'bakiakhir'=>$bakiakhir
]);
])->throw();
}
}
@@ -208,13 +208,13 @@ class AliranTunaiController extends Controller
$auth_user = Auth::user();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan)->json();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' .$request->norujukan)->throw()->json();
$gadai_detail = $gadai[0];
$tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],['norujukan' => $request->norujukan])->json();
$tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/listpenebusanhistory/'. $auth_user['cawangan'],['norujukan' => $request->norujukan])->throw()->json();
$tebus_detail = $tebus[0];
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $tebus_detail['teller']])->json();
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $tebus_detail['teller']])->throw()->json();
$keluar=$getTunai2['keluar'];
$baki=$getTunai2['baki'];
@@ -228,7 +228,7 @@ class AliranTunaiController extends Controller
'keluar'=>$keluar,
'masuk'=>$masuk,
'bakiakhir'=>$bakiakhir
]);
])->throw();
}
public function alirantunaiUpahBknTawarruq(Request $request){
+191 -52
View File
@@ -180,17 +180,17 @@ class GadaianController extends Controller
Session::put('nopelanggan', $customer_info['nopelanggan']);
Session::put('page_reload', true);
Session::forget('borang_online_printed');
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/gadai/' . $auth_user['cawangan'], [
Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/gadai/' . $auth_user['cawangan'], [
'norujukan' => $norujukan,
'nopelanggan' => $customer_info['nopelanggan'],
'nokp' => $noic,
'sirig' => $new_sirig
]);
'sirig' => $new_sirig,
])->throw();
} else {
$norujukan = Session::get('norujukan');
$nokp = Session::get('nokp');
$nopelanggan = Session::get('nopelanggan');
$gadai_session = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/check/sag', ['kodcaw' => $auth_user['cawangan'], 'norujukan' => $norujukan, 'nokp' => $nokp])->json();
$gadai_session = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/check/sag', ['kodcaw' => $auth_user['cawangan'], 'norujukan' => $norujukan, 'nokp' => $nokp])->throw()->json();
if ($gadai_session == null) {
$gadai_transaction = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/' . $auth_user['cawangan'] . '/' . $current->toDateString())->json();
if ($gadai_transaction) {
@@ -205,12 +205,12 @@ class GadaianController extends Controller
Session::put('nopelanggan', $nopelanggan);
Session::put('page_reload', true);
Session::forget('borang_online_printed');
$gadai_baru = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/gadai/' . $auth_user['cawangan'], [
Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/gadai/' . $auth_user['cawangan'], [
'norujukan' => $norujukan_baru,
'nopelanggan' => $nopelanggan,
'nokp' => $nokp,
'sirig' => $new_sirig
]);
'sirig' => $new_sirig,
])->throw();
$norujukan = $norujukan_baru;
}
}
@@ -285,6 +285,24 @@ class GadaianController extends Controller
public function store(Request $request)
{
$auth_user = Auth::user();
if (!config('commodity.shoraka') && !config('commodity.bsas')) {
return $this->gadaiStoreResult($request, false, 'Tiada pembekal komoditi diaktifkan.');
}
$provider = $this->selectedCommodityProvider($request);
if ($provider === null) {
return $this->gadaiStoreResult($request, false, 'Sila pilih pembekal komoditi yang diaktifkan.');
}
$shoraka = null;
if ($provider === 'shoraka') {
$shoraka = app(\App\Services\ShorakaFinancingService::class);
if ($shoraka->hasOrder($request->norujukan_gadai)) {
return $this->gadaiStoreResult($request, false, 'Order Shoraka telah dihantar. Jangan hantar semula.');
}
$shoraka->ensureReady();
}
$caraTerima = strtoupper((string) $request->input('cara_terima', 'TUNAI'));
$pinjamanAmt = round((float) $request->pinjaman, 2);
@@ -298,7 +316,7 @@ class GadaianController extends Controller
}
if ($caraTerima === 'ONLINE' && !$this->hasMatchingBorangOnlinePrint($request)) {
return redirect()->back()->with('error', 'Sila cetak borang pengesahan pelanggan sebelum tekan Terima.');
return $this->gadaiStoreResult($request, false, 'Sila cetak borang pengesahan pelanggan sebelum tekan Terima.');
}
//$total_nilai_marhun = $request->total_nilai_marhun;
@@ -320,6 +338,28 @@ class GadaianController extends Controller
$keuntungan12bulan = $keuntungan_sebln * 12;
$hargajualan = $request->pinjaman + $keuntungan12bulan;
if ($provider === 'bsas') {
$bsas = Http::withOptions(['verify' => config('app.api_verify')])
->timeout(60)
->post(config('api.url') . '/api/komuditi/bsas/order', [
'norujukan' => $request->norujukan_gadai,
'kodcaw' => $auth_user['cawangan'],
'pinjaman' => round((float) $request->pinjaman, 2),
'hargajualan' => round((float) $hargajualan, 2),
'nama_pelanggan' => $request->nama_pelanggan ?: $request->nama_akaun,
'teller' => $auth_user['name'],
]);
if (!$bsas->successful()) {
$body = $bsas->json();
$msg = is_array($body) && isset($body['message'])
? $body['message']
: 'Gagal pembelian komoditi BSAS. Sila cuba lagi.';
return $this->gadaiStoreResult($request, false, $msg);
}
}
//Log::info('DEBUG NOKP:' . $request->nokp);
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/gadai/norujukan/' . $auth_user['cawangan'] . '/' . $request->norujukan_gadai, [
'kodcaw' => $auth_user['cawangan'],
@@ -342,16 +382,43 @@ class GadaianController extends Controller
'nokp' => $request->nokp,
'kadar_rebate' => $this->parseMoney($request->kadar_rebate),
'rebate' => $this->parseMoney($request->rebate),
])->json();
])->throw()->json();
if ($provider === 'shoraka') {
return $shoraka->hold($request, $request->norujukan_gadai, 'gadai', [
'cara_terima' => $caraTerima,
'pinjaman' => $pinjamanAmt,
'temporary_gadai' => true,
]);
}
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/komuditi/transaksi', [
'unit_komuditi' => round($request->pinjaman, 2),
'norujukan' => $request->norujukan_gadai,
'kodcaw' => $auth_user['cawangan'],
'teller' => $auth_user['name']
]);
$error = $this->disburseGadai($request, $auth_user, $caraTerima, $pinjamanAmt);
if ($error !== null) {
return $this->gadaiStoreResult($request, false, $error);
}
return $this->gadaiStoreResult($request, true);
}
public function completeShorakaFinancing(Request $request)
{
$auth_user = Auth::user();
$caraTerima = $request->cara_terima;
$pinjamanAmt = round((float) $request->pinjaman, 2);
$error = $this->disburseGadai($request, $auth_user, $caraTerima, $pinjamanAmt);
if ($error !== null) {
throw new \RuntimeException($error);
}
return redirect()->route('customer_info');
}
/**
* Cash or online disbursement after the commodity order and gadai save.
* Returns an error message, or null when disbursement succeeded.
*/
protected function disburseGadai(Request $request, $auth_user, string $caraTerima, float $pinjamanAmt): ?string
{
if ($caraTerima === 'ONLINE') {
$online = Http::withOptions(['verify' => config('app.api_verify')])
->asForm()
@@ -371,10 +438,9 @@ class GadaianController extends Controller
if (!$online->successful()) {
$body = $online->json();
$msg = is_array($body) && isset($body['message'])
return is_array($body) && isset($body['message'])
? $body['message']
: 'Gagal daftar pembiayaan online. Sila cuba lagi.';
return redirect()->back()->with('error', $msg);
}
$this->notifyPcPembiayaanOnlinePending($auth_user, $request, $pinjamanAmt);
@@ -388,8 +454,57 @@ class GadaianController extends Controller
$request->session()->forget('norujukan');
$request->session()->forget('borang_online_printed');
$request->session()->flash('activate_tab', 'SAG_baru');
if ($caraTerima === 'ONLINE') {
$request->session()->flash('message', 'Gadai berjaya. Pembiayaan online menunggu semakan PC.');
$request->session()->flash('message', $caraTerima === 'ONLINE'
? 'Gadai berjaya. Pembiayaan online menunggu semakan PC.'
: 'Pembiayaan berjaya dihantar.');
return null;
}
/**
* Provider chosen on the gadai form, limited to those enabled in config.
*/
protected function selectedCommodityProvider(Request $request): ?string
{
$enabled = array_values(array_filter([
config('commodity.shoraka') ? 'shoraka' : null,
config('commodity.bsas') ? 'bsas' : null,
]));
if ($enabled === []) {
return null;
}
$selected = strtolower(trim((string) $request->input('commodity_provider', '')));
if ($selected === '' && count($enabled) === 1) {
return $enabled[0];
}
return in_array($selected, $enabled, true) ? $selected : null;
}
/**
* JSON for AJAX Terima (BSAS progress UI); normal redirect otherwise.
*/
protected function gadaiStoreResult(Request $request, bool $ok, ?string $message = null)
{
if ($request->ajax() || $request->wantsJson()) {
if (!$ok) {
return response()->json([
'ok' => false,
'message' => $message ?: 'Gadai tidak berjaya.',
], 422);
}
return response()->json([
'ok' => true,
'message' => $message ?: 'Gadai berjaya.',
'redirect' => route('customer_info'),
]);
}
if (!$ok) {
return redirect()->back()->with('error', $message ?: 'Gadai tidak berjaya.');
}
return redirect()->route('customer_info');
@@ -535,31 +650,55 @@ class GadaianController extends Controller
$keuntungan6bulan = $keuntungan_sebln * 6;
$keuntungan12bulan = $keuntungan_sebln * 12;
$hargajualan = $request->pinjaman + $keuntungan12bulan;
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/gadai/norujukan/' . $auth_user['cawangan'] . '/' . $request->norujukan_gadai, [
'kodcaw' => $auth_user['cawangan'],
'nilaimarhun' => round($total_nilai_marhun, 2),
'berat' => round($request->total_berat, 2),
'pinjaman' => round($request->pinjaman, 2),
'kadarupah' => round($kadarupah, 2),
'marhun' => $request->marhun_detail,
'percentpinj' => $margin_pinjaman,
'teller' => $auth_user['name'],
'upah6' => $keuntungan6bulan,
'upah12' => $keuntungan12bulan,
'hargajualan' => $hargajualan,
'kuantiti_marhun' => $request->kuantiti_marhun,
'transaction' => 'Ubah Gadai',
'kadarujrah' => round($kadarupah, 2),
'ujrah' => $ujrah,
'onepercent' => $onepercent,
'margin_semasa' => $margin_pinjaman,
'kadar_rebate' => $this->parseMoney($request->kadar_rebate),
'rebate' => $this->parseMoney($request->rebate),
])->json();
$update_komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/komuditi/update', [
'unit_komuditi' => round($request->pinjaman, 2),
'norujukan' => $request->norujukan_gadai
])->json();
try {
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/gadai/norujukan/' . $auth_user['cawangan'] . '/' . $request->norujukan_gadai, [
'kodcaw' => $auth_user['cawangan'],
'nilaimarhun' => round($total_nilai_marhun, 2),
'berat' => round($request->total_berat, 2),
'pinjaman' => round($request->pinjaman, 2),
'kadarupah' => round($kadarupah, 2),
'marhun' => $request->marhun_detail,
'percentpinj' => $margin_pinjaman,
'teller' => $auth_user['name'],
'upah6' => $keuntungan6bulan,
'upah12' => $keuntungan12bulan,
'hargajualan' => $hargajualan,
'kuantiti_marhun' => $request->kuantiti_marhun,
'transaction' => 'Ubah Gadai',
'kadarujrah' => round($kadarupah, 2),
'ujrah' => $ujrah,
'onepercent' => $onepercent,
'margin_semasa' => $margin_pinjaman,
'kadar_rebate' => $this->parseMoney($request->kadar_rebate),
'rebate' => $this->parseMoney($request->rebate),
]);
} catch (\Illuminate\Http\Client\ConnectionException $exception) {
return back()->withInput()->with('gadai_edit_error',
'Sambungan terganggu. Semak rekod gadai sebelum mencuba semula.');
}
if (!$gadai->successful()) {
$message = 'Ubah Gadai tidak berjaya. Sila semak dengan operasi.';
if ($gadai->status() === 409 || $gadai->status() === 422) {
$apiMessage = $gadai->json()['message'] ?? null;
if (is_string($apiMessage) && $apiMessage !== '') {
$message = $apiMessage;
}
}
return back()->withInput()->with('gadai_edit_error', $message);
}
try {
$update_komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/komuditi/update', [
'unit_komuditi' => round($request->pinjaman, 2),
'norujukan' => $request->norujukan_gadai
]);
} catch (\Illuminate\Http\Client\ConnectionException $exception) {
return back()->with('gadai_edit_error',
'Rekod gadai telah dikemas kini tetapi kemas kini komoditi tidak dapat disahkan. Sila semak dengan operasi.');
}
if (!$update_komuditi->successful()) {
return back()->with('gadai_edit_error',
'Rekod gadai telah dikemas kini tetapi kemas kini komoditi gagal. Sila semak dengan operasi.');
}
event(new GadaiNotify('lulus', $auth_user['cawangan']));
@@ -573,7 +712,7 @@ class GadaianController extends Controller
$norujukan = $request->norujukan;
$auth_user = Auth::user();
Http::withOptions(['verify' => config('app.api_verify')])->delete(config('api.url') . '/api/gadai/batal/' . $auth_user['cawangan'] . '/' . $norujukan);
Http::withOptions(['verify' => config('app.api_verify')])->delete(config('api.url') . '/api/gadai/batal/' . $auth_user['cawangan'] . '/' . $norujukan)->throw();
$request->session()->forget('page_reload');
$request->session()->forget('norujukan');
$request->session()->forget('borang_online_printed');
@@ -594,6 +733,7 @@ class GadaianController extends Controller
public function cetakSAG(Request $request)
{
app(\App\Services\ShorakaFinancingService::class)->printData($request->norujukan_modal);
$auth_user = Auth::user();
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/gadai/norujukan/cetak/' . $auth_user['cawangan'] . '/' . $request->norujukan_modal);
@@ -614,6 +754,7 @@ class GadaianController extends Controller
}
foreach ($arraynorujukan as $index => $norujukan) {
app(\App\Services\ShorakaFinancingService::class)->printData($norujukan);
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/gadai/norujukan/serah/' . $auth_user['cawangan'] . '/' . $norujukan);
if ($gadai->failed()) {
@@ -671,13 +812,11 @@ class GadaianController extends Controller
// $pembayaran_segera = "https://spare.arrahn.com.my/pembayaransegera";
$pembayaran_segera = "https://pay.arrahn.com.my";
$komoditi = Http::withOptions(['verify' => config('app.api_verify')])
->get($api_url . '/api/komuditi/check')
->json();
$product = Http::withOptions(['verify' => config('app.api_verify')])
->get($api_url . '/api/komuditi/description', ['kodproduk' => $komoditi['kodproduct']])
->json();
$kuantiti = $gadai_detail['pinjaman'] / $komoditi['nilai'];
$commodityPrint = app(\App\Services\CommodityCertificate::class)
->forReference($gadai_detail['norujukan'], $gadai_detail['pinjaman'] ?? 0);
$komoditi = $commodityPrint['komoditi'];
$product = $commodityPrint['product'];
$kuantiti = $commodityPrint['kuantiti'];
if ($gadai_detail['tagbaru'] == 1) {
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])
+270
View File
@@ -55,4 +55,274 @@ class KomuditiController extends Controller
return redirect()->route('komuditi');
}
/**
* Khazanah branch list of BSAS commodity orders.
*/
public function khazanahBsas()
{
$auth_user = Auth::user();
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/api/cawangan/' . $auth_user['cawangan'])
->json();
return view('homepage.khazanah.bsas_komoditi', compact('cawangan_info'));
}
/**
* Dummy BSAS eCert layout preview (bid, OTC, STB, then one commodity schedule).
*/
public function previewBsasEcert()
{
$line = [
['SUPPLIER' => 'FGV TRADING SDN BHD', 'VOLUME' => '0.75276406'],
];
return view('print.bsas_ecert', $this->presentBsasCertificates([
'e_cert_no' => 'CPO21OCT26-0000031-000',
'serial_number' => '1',
'otc_counter_party' => 'ALI BIN ABU',
'otc_murabaha_value' => '3,814.40',
'product_code' => 'CPO-MSIA-09',
'bid_ecert' => [
'ECERTNO' => 'CPO21OCT26-0000031-000',
'BUYER' => 'KOPERASI PERMODALAN KELANTAN BERHAD',
'OWNER' => 'KOPERASI PERMODALAN KELANTAN BERHAD',
'BIDNO' => '8',
'TOTALVALUE' => '3,200.00',
'CURRENCY' => 'MYR',
'PRICE' => '4,251.00',
'PRICE_MYR_EQUIVALENT' => '4,251.00',
'PURCHASETIMEDATE' => '15:11:53.316 21 Oct 2026',
'VALUEDATE' => '21 Oct 2026',
'PNAME' => 'CPO-MSIA-09',
'PVOLUME' => '0.75276406',
'LINE' => $line,
],
'otc_ecert' => [
'ECERTNO' => 'CPO21OCT26-0000031-000',
'SELLER' => 'KOPERASI PERMODALAN KELANTAN BERHAD',
'BUYER' => 'ALI BIN ABU',
'REPORTINGTIMEDATE' => '15:11:53.320 21 Oct 2026',
'VALUEDATE' => '21 Oct 2026',
'PNAME' => 'CPO-MSIA-09',
'PVOLUME' => '0.75276406',
'CURRENCY' => 'MYR',
'PRICE' => '4,251.00',
'PRICE_MYR_EQUIVALENT' => '4,251.00',
'TOTALVALUE' => '3,200.00',
'MURABAHAVALUE' => '3,814.40',
'LINE' => $line,
],
'stb_ecert' => [
'ECERTNO' => 'CPO21OCT26-0000031-000',
'SELLER' => 'ALI BIN ABU',
'BUYER' => 'BURSA MALAYSIA ISLAMIC SERVICES',
'TOTALVALUE' => '3,200.00',
'CURRENCY' => 'MYR',
'PRICE' => '4,251.00',
'PRICE_MYR_EQUIVALENT' => '4,251.00',
'SELLINGTIMEDATE' => '15:11:53.325 21 Oct 2026',
'VALUEDATE' => '21 Oct 2026',
'PNAME' => 'CPO-MSIA-09',
'PVOLUME' => '0.75276406',
'LINE' => $line,
],
], true));
}
/**
* Live BSAS eCerts from stored bid, OTC and STB payloads.
*/
public function showBsasEcert($uuid)
{
$response = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/api/komuditi/bsas/order/' . urlencode($uuid) . '/ecert');
if ($response->status() === 404) {
abort(404, $response->json('message') ?: 'eCert tidak dijumpai.');
}
if (!$response->successful()) {
abort(502, 'Gagal memuatkan eCert BSAS.');
}
$payload = $response->json();
if (!is_array($payload)) {
abort(502, 'Gagal memuatkan eCert BSAS.');
}
$presented = $this->presentBsasCertificates($payload, false);
if ($presented['certificates'] === []) {
abort(404, 'eCert belum tersedia untuk order ini.');
}
return view('print.bsas_ecert', $presented);
}
/**
* Bid, OTC and STB pages, plus one shared commodity schedule.
*/
protected function presentBsasCertificates(array $payload, bool $isDummy): array
{
$certificates = [];
$bid = $payload['bid_ecert'] ?? null;
if (is_array($bid) && $bid !== []) {
$certificates[] = $this->mapBidCertificate($bid, $payload);
}
$otc = $payload['otc_ecert'] ?? null;
if (is_array($otc) && $otc !== []) {
$certificates[] = $this->mapOtcCertificate($otc, $payload);
}
$stb = $payload['stb_ecert'] ?? null;
if (is_array($stb) && $stb !== []) {
$certificates[] = $this->mapStbCertificate($stb, $payload);
}
$scheduleSource = [];
if (is_array($otc) && $otc !== []) {
$scheduleSource = $otc;
} elseif (is_array($bid) && $bid !== []) {
$scheduleSource = $bid;
} elseif (is_array($stb) && $stb !== []) {
$scheduleSource = $stb;
}
$ecertNo = $scheduleSource['ECERTNO'] ?? ($payload['e_cert_no'] ?? '-');
return [
'certificates' => $certificates,
'ecert_no' => $ecertNo,
'lines' => $this->mapBsasLines($scheduleSource),
'isDummy' => $isDummy,
];
}
protected function mapBidCertificate(array $ecert, array $orderMeta): array
{
[$time, $date] = $this->splitBsasDateTime((string) ($ecert['PURCHASETIMEDATE'] ?? ''));
return $this->certificatePage(
'Certificate of Purchase',
'This is to certify that the following bid transaction has been executed<br>through the Bursa Suq Al-Sila\' in accordance with the<br>Rules of Bursa Suq Al-Sila\'.',
$ecert,
$orderMeta,
array_merge([
['label' => 'Buyer', 'value' => $ecert['BUYER'] ?? '-'],
['label' => 'Owner', 'value' => $ecert['OWNER'] ?? '-'],
['label' => 'Bid No', 'value' => $ecert['BIDNO'] ?? ($orderMeta['serial_number'] ?? '-')],
['label' => 'Purchase Time / Date', 'value' => $time . ' / ' . $date],
], $this->commodityDetailRows($ecert, $orderMeta))
);
}
protected function mapOtcCertificate(array $ecert, array $orderMeta): array
{
[$time, $date] = $this->splitBsasDateTime((string) ($ecert['REPORTINGTIMEDATE'] ?? ''));
$page = $this->certificatePage(
'Certificate of Murabahah',
'This is to certify that the following transaction has been executed<br>through the Bursa Suq Al-Sila\' in accordance with the<br>Rules of Bursa Suq Al-Sila\'.',
$ecert,
$orderMeta,
array_merge([
['label' => 'Seller', 'value' => $ecert['SELLER'] ?? 'KOPERASI PERMODALAN KELANTAN BERHAD'],
['label' => 'Buyer', 'value' => $ecert['BUYER'] ?? ($orderMeta['otc_counter_party'] ?? '-')],
['label' => 'Bid No', 'value' => $orderMeta['serial_number'] ?? '1'],
['label' => 'Reporting Time / Date', 'value' => $time . ' / ' . $date],
], $this->commodityDetailRows($ecert, $orderMeta), [
['label' => 'Transaction Type', 'value' => '-'],
])
);
$page['show_murabaha'] = true;
$page['murabaha'] = $ecert['MURABAHAVALUE'] ?? ($orderMeta['otc_murabaha_value'] ?? '-');
return $page;
}
protected function mapStbCertificate(array $ecert, array $orderMeta): array
{
[$time, $date] = $this->splitBsasDateTime((string) ($ecert['SELLINGTIMEDATE'] ?? ''));
return $this->certificatePage(
'Certificate of Sale',
'This is to certify that the following sale transaction has been executed<br>through the Bursa Suq Al-Sila\' in accordance with the<br>Rules of Bursa Suq Al-Sila\'.',
$ecert,
$orderMeta,
array_merge([
['label' => 'Seller', 'value' => $ecert['SELLER'] ?? ($orderMeta['otc_counter_party'] ?? '-')],
['label' => 'Buyer', 'value' => $ecert['BUYER'] ?? '-'],
['label' => 'Selling Time / Date', 'value' => $time . ' / ' . $date],
], $this->commodityDetailRows($ecert, $orderMeta))
);
}
protected function certificatePage(string $title, string $statement, array $ecert, array $orderMeta, array $rows): array
{
return [
'title' => $title,
'statement' => $statement,
'ecert_no' => $ecert['ECERTNO'] ?? ($orderMeta['e_cert_no'] ?? '-'),
'currency' => $ecert['CURRENCY'] ?? 'MYR',
'rows' => $rows,
'show_murabaha' => false,
'murabaha' => null,
];
}
protected function commodityDetailRows(array $ecert, array $orderMeta): array
{
return [
['label' => 'Value Date', 'value' => isset($ecert['VALUEDATE']) ? strtoupper((string) $ecert['VALUEDATE']) : '-'],
['label' => 'Product Code / Description', 'value' => $ecert['PNAME'] ?? ($orderMeta['product_code'] ?? '-')],
['label' => 'Unit', 'value' => 'Tonnage'],
['label' => 'Volume', 'value' => $ecert['PVOLUME'] ?? '-'],
['label' => 'Currency', 'value' => $ecert['CURRENCY'] ?? 'MYR'],
['label' => 'Price (MYR)', 'value' => $ecert['PRICE'] ?? '-'],
['label' => 'Price (MYR Equivalent)', 'value' => $ecert['PRICE_MYR_EQUIVALENT'] ?? ($ecert['PRICE'] ?? '-')],
['label' => 'Value', 'value' => $ecert['TOTALVALUE'] ?? '-'],
];
}
protected function mapBsasLines(array $ecert): array
{
$lines = [];
foreach (($ecert['LINE'] ?? []) as $line) {
if (!is_array($line)) {
continue;
}
$lines[] = [
'supplier' => $line['SUPPLIER'] ?? '-',
'volume' => $line['VOLUME'] ?? ($ecert['PVOLUME'] ?? '-'),
];
}
if ($lines === []) {
$lines[] = [
'supplier' => '-',
'volume' => $ecert['PVOLUME'] ?? '-',
];
}
return $lines;
}
protected function splitBsasDateTime(string $value): array
{
$value = trim($value);
if ($value === '') {
return ['-', '-'];
}
$parts = explode(' ', $value, 2);
return [
$parts[0] ?? '-',
isset($parts[1]) ? strtoupper($parts[1]) : '-',
];
}
}
@@ -585,15 +585,11 @@ class PembiayaanOnlineController extends Controller
$pembayaran_segera = 'https://pay.arrahn.com.my';
$komoditi = $this->api()->get($api_url . '/api/komuditi/check')->json();
$product = $this->api()
->get($api_url . '/api/komuditi/description', [
'kodproduk' => is_array($komoditi) ? ($komoditi['kodproduct'] ?? '') : '',
])
->json();
$nilai = is_array($komoditi) ? (float) ($komoditi['nilai'] ?? 0) : 0;
$kuantiti = $nilai > 0 ? ((float) ($gadai_detail['pinjaman'] ?? 0) / $nilai) : 0;
$commodityPrint = app(\App\Services\CommodityCertificate::class)
->forReference($gadai_detail['norujukan'], $gadai_detail['pinjaman'] ?? 0);
$komoditi = $commodityPrint['komoditi'];
$product = $commodityPrint['product'];
$kuantiti = $commodityPrint['kuantiti'];
if (($gadai_detail['tagbaru'] ?? 0) == 1) {
$cawangan_info = $this->api()
+24 -64
View File
@@ -271,6 +271,7 @@ class PenebusanController extends Controller
public function tambahpinjaman(Request $request)
{
app(\App\Services\ShorakaFinancingService::class)->ensureReady();
$api_url = config('api.url');
$current = Carbon::now();
$current = new Carbon();
@@ -405,33 +406,16 @@ class PenebusanController extends Controller
'upah12' => $keuntungan12bulan,
'hargajualan' => $hargajualan,
'kuantiti_marhun' => $request->kuantiti_marhun
])->json();
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/komuditi/transaksi',[
'unit_komuditi' => round($request->pinjaman, 2),
'norujukan' => $norujukanbaru,
'kodcaw' => $auth_user['cawangan'],
'teller' => $auth_user['name']
]);
////////////////////////////
////Update History Gadaian///
////////////////////////////
$updatehistorygadaian = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[
'historygadaian' => $request->norujukan,
'jenistebus' => $request->jenistebus,
])->json();
event(new TebusNotify('lulus',Auth::user()->cawangan));
event(new GadaiNotify('lulus',Auth::user()->cawangan));
$this->AliranTunaiController->alirantunaiTebus($request);
])->throw()->json();
return app(\App\Services\ShorakaFinancingService::class)->hold(
$request, $norujukanbaru, 'refinance', ['update_history' => true]
);
}
public function tambahpinjaman_latest(Request $request)
{
app(\App\Services\ShorakaFinancingService::class)->ensureReady();
$api_url = config('api.url');
$current = Carbon::now();
$current = new Carbon();
@@ -475,17 +459,18 @@ class PenebusanController extends Controller
])->json();
if($updatetebus['result'] == 'success'){
event(new TebusNotify('lulus',Auth::user()->cawangan));
event(new GadaiNotify('lulus',Auth::user()->cawangan));
$this->AliranTunaiController->alirantunaiTebus($request);
if (($updatetebus['result'] ?? null) === 'success') {
abort_unless(!empty($updatetebus['norujukan_baru']), 502, 'Rujukan gadaian baharu tidak diterima.');
return app(\App\Services\ShorakaFinancingService::class)->hold(
$request, $updatetebus['norujukan_baru'], 'refinance'
);
}
return response()->json($updatetebus['result'],200);
return response()->json($updatetebus['result'] ?? 'error', 200);
}
public function tebusautotawarruq(Request $request)
{
app(\App\Services\ShorakaFinancingService::class)->ensureReady();
$auth_user = Auth::user();
////////////////////////
@@ -515,17 +500,18 @@ class PenebusanController extends Controller
"noic" => $request->noic,
"jenisAT" => $request->jenisAT,
])->json();
if($updatetebus['result'] == 'success'){
$alirantunai = new AliranTunaiController();
event(new TebusNotify('lulus',Auth::user()->cawangan));
event(new GadaiNotify('lulus',Auth::user()->cawangan));
$alirantunai->alirantunaiTebusAutoTawarruq($request);
if (($updatetebus['result'] ?? null) === 'success') {
abort_unless(!empty($updatetebus['norujukan_baru']), 502, 'Rujukan gadaian baharu tidak diterima.');
return app(\App\Services\ShorakaFinancingService::class)->hold(
$request, $updatetebus['norujukan_baru'], 'autotawarruq'
);
}
return response()->json($updatetebus['result'],200);
return response()->json($updatetebus['result'] ?? 'error', 200);
}
public function tebusseparuh(Request $request)
{
app(\App\Services\ShorakaFinancingService::class)->ensureReady();
$api_url = config('api.url');
$current = Carbon::now();
$current = new Carbon();
@@ -666,39 +652,13 @@ class PenebusanController extends Controller
'upah12' => $keuntungan12bulan,
'hargajualan' => $hargajualan,
'kuantiti_marhun' => $request->kuantiti_marhun
])->json();
])->throw()->json();
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/komuditi/transaksi',[
'unit_komuditi' => round($request->pinjaman, 2),
'norujukan' => $norujukanbaru,
'kodcaw' => $auth_user['cawangan'],
'teller' => $auth_user['name']
]);
////////////////////////////
////Update History Gadaian///
////////////////////////////
$updatehistorygadaian = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[
'historygadaian' => $request->norujukan,
'jenistebus' => $request->jenistebus,
])->json();
$alirantunai = new AliranTunaiController();
event(new TebusNotify('lulus',Auth::user()->cawangan));
event(new GadaiNotify('lulus',Auth::user()->cawangan));
$alirantunai->alirantunaiTebus($request);
return response()->json($updatemarhun,200);
return app(\App\Services\ShorakaFinancingService::class)->hold(
$request, $norujukanbaru, 'refinance', ['update_history' => true]
);
}
//Wakil Function
public function getfirstWakil()
{
$auth_user = Auth::user();
@@ -0,0 +1,67 @@
<?php
namespace App\Http\Controllers;
use App\Services\ShorakaFinancingService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Throwable;
class ShorakaController extends Controller
{
public function index()
{
$records = app(ShorakaFinancingService::class)->listForBranch(Auth::user()->cawangan);
$cawangan_info = ['details_caw' => Auth::user()->cawangan, 'kodcaw' => Auth::user()->cawangan];
return view('shoraka.index', compact('records', 'cawangan_info'));
}
public function operasiIndex(Request $request)
{
abort_unless(in_array(Auth::user()->roles, ['operasi', 'pc', 'ppc'], true), 403);
$isOperasi = Auth::user()->roles === 'operasi';
$filters = $request->validate([
'kodcaw' => 'nullable|string|max:30',
'norujukan' => 'nullable|string|max:100',
'status' => 'nullable|in:PENDING,Active,Completed,Cancelled,UNKNOWN,FAILED',
'date_from' => 'nullable|date_format:Y-m-d',
'date_to' => 'nullable|date_format:Y-m-d' . ($request->filled('date_from') ? '|after_or_equal:date_from' : ''),
]);
[$records, $branches] = app(ShorakaFinancingService::class)->search(
$filters,
$isOperasi ? null : Auth::user()->cawangan
);
$cawangan_info = ['details_caw' => Auth::user()->cawangan, 'kodcaw' => Auth::user()->cawangan];
return view('shoraka.operasi', compact('records', 'branches', 'filters', 'isOperasi', 'cawangan_info'));
}
public function pcIndex(Request $request)
{
abort_unless(in_array(Auth::user()->roles, ['pc', 'ppc'], true), 403);
return $this->operasiIndex($request);
}
public function show(string $norujukan, ShorakaFinancingService $service)
{
$data = null;
$error = null;
try {
$data = $service->snapshot($norujukan);
} catch (Throwable $exception) {
$error = 'Maklumat Shoraka tidak dapat diambil. Bayaran dan SAG masih ditahan.';
}
$cawangan_info = ['details_caw' => Auth::user()->cawangan, 'kodcaw' => Auth::user()->cawangan];
return view('shoraka.show', compact('norujukan', 'data', 'error', 'cawangan_info'));
}
public function certificate(string $norujukan, ShorakaFinancingService $service)
{
$response = $service->api()->get($service->url($norujukan, '/certificate'))->throw();
abort_unless(substr($response->body(), 0, 5) === '%PDF-', 502);
return response($response->body(), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="sijil-shoraka.pdf"',
'Cache-Control' => 'private, no-store',
]);
}
}
+94
View File
@@ -0,0 +1,94 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
class CommodityCertificate
{
/**
* Certificate fields for a SAG. Shoraka is used when that order exists,
* otherwise the BSAS order, otherwise the legacy daily commodity stock.
*/
public function forReference(string $reference, $pinjaman = null): array
{
$shoraka = $this->shorakaPrint($reference);
if ($shoraka) {
return $this->normalize($shoraka['komoditi'], $shoraka['product'], $shoraka['kuantiti']);
}
$bsas = Http::withOptions(['verify' => config('app.api_verify')])
->get(rtrim((string) config('api.url'), '/') . '/api/komuditi/bsas/order/norujukan/' . urlencode($reference));
if ($bsas->successful() && is_array($bsas->json())) {
$payload = $bsas->json();
return $this->normalize(
$payload['komoditi'] ?? [],
$payload['product'] ?? [],
(float) ($payload['kuantiti'] ?? 0)
);
}
return $this->legacy($pinjaman);
}
private function shorakaPrint(string $reference): ?array
{
try {
return app(ShorakaFinancingService::class)->printData($reference);
} catch (HttpException $exception) {
if ($exception->getStatusCode() === 409) {
throw $exception;
}
return null;
} catch (Throwable $exception) {
return null;
}
}
private function legacy($pinjaman): array
{
$api = rtrim((string) config('api.url'), '/');
$komoditi = Http::withOptions(['verify' => config('app.api_verify')])
->get($api . '/api/komuditi/check')
->json();
if (!is_array($komoditi)) {
$komoditi = [];
}
$product = Http::withOptions(['verify' => config('app.api_verify')])
->get($api . '/api/komuditi/description', [
'kodproduk' => $komoditi['kodproduct'] ?? '',
])
->json();
$nilai = (float) ($komoditi['nilai'] ?? 0);
$kuantiti = $nilai > 0 ? ((float) $pinjaman / $nilai) : 0;
return $this->normalize($komoditi, is_array($product) ? $product : [], $kuantiti);
}
private function normalize($komoditi, $product, $kuantiti): array
{
if (!is_array($komoditi)) {
$komoditi = [];
}
if (!is_array($product)) {
$product = [];
}
$code = $product['product_code'] ?? $product['kodproduk'] ?? ($komoditi['kodproduct'] ?? '');
$product['product_code'] = $product['product_code'] ?? $code;
$product['kodproduk'] = $product['kodproduk'] ?? $code;
$product['description'] = $product['description'] ?? '';
$product['unit'] = $product['unit'] ?? 'TAN';
return [
'komoditi' => $komoditi,
'product' => $product,
'kuantiti' => $kuantiti,
];
}
}
+215
View File
@@ -0,0 +1,215 @@
<?php
namespace App\Services;
use App\Http\Controllers\GadaianController;
use App\Http\Controllers\AliranTunaiController;
use App\Events\Dashboard\GadaiNotify;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Http;
use Throwable;
class ShorakaFinancingService
{
public function ensureReady(): void
{
$response = $this->api()->get(rtrim(config('api.url'), '/') . '/api/shoraka/readiness')->throw()->json();
abort_unless(!empty($response['ready']), 503, 'Shoraka belum dikonfigurasi. Pembiayaan baharu ditahan.');
}
public function api()
{
return Http::withOptions(['verify' => config('app.api_verify')])
->acceptJson()->timeout(75);
}
public function url(string $reference, string $suffix = ''): string
{
return rtrim(config('api.url'), '/') . '/api/shoraka/gadai/'
. rawurlencode(Auth::user()->cawangan) . '/' . rawurlencode($reference) . $suffix;
}
public function hasOrder(string $reference): bool
{
$snapshot = $this->snapshot($reference);
return !empty($snapshot['order']);
}
public function snapshot(string $reference): array
{
$response = $this->api()->get($this->url($reference));
if ($response->status() === 404) {
return [];
}
if ($response->serverError()) {
abort(503, 'Shoraka belum dikonfigurasi. Pembiayaan baharu ditahan.');
}
$response->throw();
return $response->json()['data'] ?? [];
}
public function listForBranch(string $branch)
{
$response = $this->api()->get(rtrim(config('api.url'), '/') . '/api/shoraka/transactions', [
'kodcaw' => $branch,
'per_page' => 100,
])->throw()->json();
return collect($response['data'] ?? []);
}
public function search(array $filters, ?string $onlyBranch): array
{
$query = [
'per_page' => 25,
'page' => max(1, (int) request()->input('page', 1)),
'with_branches' => 1,
];
if ($onlyBranch) {
$query['kodcaw'] = $onlyBranch;
$query['branch_scope'] = $onlyBranch;
} elseif (!empty($filters['kodcaw'])) {
$query['kodcaw'] = $filters['kodcaw'];
}
foreach (['norujukan', 'status', 'date_from', 'date_to'] as $field) {
if (!empty($filters[$field])) {
$query[$field] = $filters[$field];
}
}
$response = $this->api()->get(rtrim(config('api.url'), '/') . '/api/shoraka/transactions', $query)->throw()->json();
$items = collect($response['data'] ?? []);
$records = new LengthAwarePaginator(
$items,
(int) ($response['total'] ?? 0),
(int) ($response['per_page'] ?? 25),
(int) ($response['current_page'] ?? 1),
['path' => request()->url(), 'query' => request()->query()]
);
return [$records, collect($response['branches'] ?? [])];
}
public function hold(Request $request, string $reference, string $action, array $extra = [])
{
if ($this->hasOrder($reference)) {
return $this->failed($request, 'Order Shoraka telah dihantar. Jangan hantar semula.');
}
$context = array_merge($request->except(['_token', 'password']), $extra, ['action' => $action]);
try {
$response = $this->api()->post($this->url($reference, '/submit'), [
'teller' => Auth::user()->name,
]);
} catch (Throwable $exception) {
if ($this->hasOrder($reference)) {
return $this->failed($request, 'Order Shoraka telah dihantar. Jangan hantar semula.');
}
return $this->failed($request, 'Order Shoraka tidak berjaya dihantar. Gadaian tidak dihantar.');
}
if (!$response->successful()) {
$message = $response->json()['message'] ?? ($this->hasOrder($reference)
? 'Order Shoraka telah dihantar. Jangan hantar semula.'
: 'Order Shoraka tidak berjaya dihantar. Gadaian tidak dihantar.');
return $this->failed($request, $message);
}
$snapshot = $this->waitUntilCompleted($reference);
$status = $snapshot['order']['status'] ?? null;
if ($status !== 'Completed') {
return $this->failed($request, 'Pengesahan Shoraka belum Completed. Jangan hantar semula.');
}
if (empty($snapshot['can_complete'])
|| (array_key_exists('pinjaman', $context)
&& number_format((float) $context['pinjaman'], 2, '.', '')
!== number_format((float) ($snapshot['order_amount'] ?? 0), 2, '.', ''))) {
return $this->failed($request, 'Amaun pembiayaan berubah. Bayaran tidak diproses.');
}
return $this->complete($request, $reference, $context);
}
private function waitUntilCompleted(string $reference): array
{
set_time_limit(150);
$deadline = microtime(true) + 120;
$snapshot = [];
do {
try {
$this->api()->post($this->url($reference, '/refresh'))->throw();
$snapshot = $this->snapshot($reference);
} catch (Throwable $exception) {
$snapshot = [];
}
$status = $snapshot['order']['status'] ?? null;
if ($status === 'Completed' || in_array($status, ['Cancelled', 'FAILED', 'UNKNOWN'], true)) {
return $snapshot;
}
if (microtime(true) >= $deadline) {
return $snapshot;
}
sleep(2);
} while (true);
}
private function complete(Request $request, string $reference, array $context)
{
$branch = Auth::user()->cawangan;
$saved = new Request($context);
$saved->setLaravelSession($request->session());
if (($context['action'] ?? null) === 'gadai') {
return app(GadaianController::class)->completeShorakaFinancing($saved);
}
if (!empty($context['update_history'])) {
$this->api()->put(rtrim(config('api.url'), '/') . '/api/gadai/updatehistory/'
. rawurlencode($branch) . '/' . rawurlencode($reference), [
'historygadaian' => $saved->norujukan,
'jenistebus' => $saved->jenistebus,
])->throw();
}
$cash = app(AliranTunaiController::class);
if (($context['action'] ?? null) === 'autotawarruq') {
$cash->alirantunaiTebusAutoTawarruq($saved);
} else {
$cash->alirantunaiTebus($saved);
}
event(new \App\Events\Dashboard\TebusNotify('lulus', $branch));
event(new GadaiNotify('lulus', $branch));
return redirect()->route('customer_info');
}
public function printData(string $reference): ?array
{
$response = $this->api()->get($this->url($reference))->throw()->json()['data'];
$order = $response['order'] ?? null;
if (!$order) {
return null;
}
abort_unless(!empty($response['can_complete']), 409, 'SAG ditahan: Shoraka belum Completed.');
$details = $response['details'] ?? [];
$certificateDetails = $details['certificateDetails1'] ?? '';
if (is_array($certificateDetails)) {
$certificateDetails = $certificateDetails[0] ?? '';
}
$certificate = is_string($certificateDetails) ? trim(explode('|', $certificateDetails)[0]) : '';
abort_unless($certificate !== '' && isset($details['unit'], $details['volume'], $details['commodityType']),
409, 'Maklumat sijil belum lengkap. Semak status Shoraka dahulu.');
return [
'komoditi' => ['no_sijil' => $certificate],
'product' => [
'kodproduk' => $details['commodityType'],
'description' => $details['commodityType'] === '000-COPPER' ? 'Copper' : 'Plastic resin',
'unit' => $details['unit'],
],
'kuantiti' => $details['volume'],
];
}
private function failed(Request $request, string $message)
{
if ($request->ajax() || $request->expectsJson()) {
abort(502, $message);
}
return redirect()->back()->with('error', $message);
}
}
+2 -2
View File
@@ -2,13 +2,13 @@
if (!function_exists('api_url_for_browser')) {
/**
* Base URL for JavaScript in the browser, derived from API_URL (config api.url).
* Base URL for JavaScript, using API_BROWSER_URL when configured.
* Docker dev often uses host.docker.internal for PHP→host; browsers may not resolve it.
* Same host-mapped port is reachable at 127.0.0.1. Production URLs are unchanged.
*/
function api_url_for_browser(): string
{
$url = rtrim((string) config('api.url'), '/');
$url = rtrim((string) (config('api.browser_url') ?: config('api.url')), '/');
return str_ireplace('host.docker.internal', '127.0.0.1', $url);
}
+1
View File
@@ -1,6 +1,7 @@
<?php
return [
'url' => env('API_URL'),
'browser_url' => env('API_BROWSER_URL'),
'url_koop' => env('API_URL_KOOP','https://apiujrah.erahn.com.my'),
'url_pkb' => env('API_URL_PKB','http://localhost:8000'),
];
+10
View File
@@ -0,0 +1,10 @@
<?php
return [
/*
| Which commodity providers a teller may use when submitting gadai.
| Set either or both to true. When both are true, the teller chooses.
*/
'shoraka' => filter_var(env('COMMODITY_SHORAKA_ENABLED', false), FILTER_VALIDATE_BOOLEAN),
'bsas' => filter_var(env('COMMODITY_BSAS_ENABLED', false), FILTER_VALIDATE_BOOLEAN),
];
+11 -2
View File
@@ -2,7 +2,14 @@ FROM php:7.4-fpm AS base
WORKDIR /var/www/html
RUN apt-get update \
# php:7.4-fpm is Debian 11 (bullseye); after LTS end, packages live on archive.debian.org
RUN sed -i \
-e 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' \
-e 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' \
-e 's|http://deb.debian.org/debian-security|http://archive.debian.org/debian-security|g' \
/etc/apt/sources.list \
&& printf 'Acquire::Check-Valid-Until "false";\n' > /etc/apt/apt.conf.d/99no-check-valid-until \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
git \
pkg-config \
@@ -28,7 +35,9 @@ COPY docker/php/php.ini /usr/local/etc/php/conf.d/app.ini
COPY docker/php/zz-clear-env.conf /usr/local/etc/php-fpm.d/zz-clear-env.conf
COPY docker/php/entrypoint.sh /usr/local/bin/app-entrypoint.sh
RUN chmod +x /usr/local/bin/app-entrypoint.sh \
# Normalize Windows checkout line endings before executing the script.
RUN sed -i 's/\r$//' /usr/local/bin/app-entrypoint.sh \
&& chmod +x /usr/local/bin/app-entrypoint.sh \
&& usermod -u 1000 www-data && groupmod -g 1000 www-data
ENTRYPOINT ["app-entrypoint.sh"]
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="1136" viewBox="0 0 1600 1136">
<title>Vectorized Arabic calligraphy logo</title>
<path d="M 379,572 L 385,578 L 403,585 L 418,593 L 423,594 L 429,598 L 415,588 Z M 949,551 L 945,547 L 939,546 L 933,550 L 928,557 L 851,719 L 814,784 L 784,827 L 754,862 L 720,894 L 690,917 L 647,944 L 595,969 L 543,987 L 504,996 L 453,1002 L 406,1002 L 374,999 L 344,994 L 312,986 L 274,973 L 249,962 L 227,950 L 255,967 L 267,972 L 268,974 L 322,995 L 376,1008 L 417,1013 L 438,1014 L 499,1011 L 543,1003 L 572,995 L 606,983 L 660,958 L 708,928 L 748,896 L 785,858 L 815,819 L 836,787 L 864,737 L 895,674 L 930,597 L 943,571 L 950,563 Z M 292,508 L 288,515 L 247,563 L 256,571 L 260,573 L 266,572 L 303,528 L 303,519 Z M 989,450 L 969,456 L 945,459 L 917,458 L 900,451 L 894,451 L 888,454 L 880,462 L 869,476 L 842,504 L 802,536 L 765,557 L 741,567 L 722,573 L 676,582 L 630,584 L 600,582 L 573,578 L 525,566 L 523,567 L 520,573 L 520,585 L 530,614 L 538,654 L 538,687 L 535,707 L 529,729 L 516,757 L 498,782 L 472,807 L 429,836 L 393,854 L 358,867 L 312,878 L 287,881 L 235,880 L 194,871 L 162,857 L 179,868 L 214,883 L 238,889 L 273,893 L 308,892 L 347,886 L 386,875 L 418,862 L 440,851 L 465,836 L 500,809 L 523,783 L 531,771 L 541,751 L 548,730 L 552,710 L 553,666 L 545,627 L 535,596 L 535,590 L 540,581 L 543,579 L 551,579 L 578,587 L 607,592 L 638,595 L 675,595 L 697,593 L 741,584 L 777,571 L 804,557 L 827,542 L 853,521 L 881,493 L 893,478 L 907,465 L 918,463 L 935,469 L 962,470 Z M 1071,446 L 1064,445 L 1063,450 L 1057,461 L 1047,471 L 1035,480 L 1011,505 L 1001,520 L 993,536 L 987,555 L 984,576 L 984,594 L 987,613 L 991,625 L 999,640 L 1007,650 L 1018,659 L 1010,648 L 1009,643 L 1007,641 L 1000,615 L 999,598 L 1003,566 L 1010,546 L 1023,523 L 1046,497 L 1069,478 L 1076,468 L 1078,462 L 1078,454 L 1076,450 Z M 1247,419 L 1238,416 L 1233,418 L 1228,423 L 1200,481 L 1191,494 L 1179,507 L 1170,531 L 1170,536 L 1177,534 L 1189,525 L 1203,511 L 1217,492 L 1241,441 L 1245,435 L 1252,430 L 1252,426 Z M 1403,405 L 1394,406 L 1388,412 L 1383,423 L 1378,473 L 1374,491 L 1369,505 L 1367,523 L 1363,536 L 1362,545 L 1365,545 L 1375,533 L 1387,511 L 1395,475 L 1396,451 L 1399,435 L 1405,424 L 1409,420 L 1415,418 L 1411,411 Z M 1474,363 L 1486,379 L 1493,393 L 1500,416 L 1506,464 L 1506,502 L 1502,540 L 1495,575 L 1482,617 L 1470,646 L 1443,696 L 1422,727 L 1390,766 L 1331,825 L 1223,928 L 1149,1004 L 1136,1027 L 1132,1037 L 1132,1047 L 1137,1046 L 1177,1003 L 1251,929 L 1329,855 L 1401,784 L 1426,755 L 1447,727 L 1471,688 L 1492,644 L 1507,601 L 1516,561 L 1521,519 L 1520,462 L 1513,422 L 1508,407 L 1502,395 L 1492,381 Z M 1289,362 L 1286,360 L 1293,369 L 1302,386 L 1309,413 L 1309,458 L 1305,496 L 1296,538 L 1286,569 L 1269,606 L 1247,641 L 1218,676 L 1195,698 L 1159,726 L 1131,742 L 1103,752 L 1063,759 L 1044,759 L 1029,757 L 1002,748 L 1007,750 L 1014,756 L 1029,763 L 1058,770 L 1092,769 L 1114,765 L 1135,759 L 1166,744 L 1207,714 L 1241,681 L 1265,651 L 1284,620 L 1303,578 L 1316,533 L 1324,476 L 1325,437 L 1320,408 L 1307,382 Z M 896,320 L 883,320 L 875,324 L 871,328 L 866,341 L 866,357 L 869,367 L 874,375 L 885,384 L 886,383 L 883,378 L 881,368 L 881,358 L 884,347 L 890,338 L 900,332 L 910,332 L 902,323 Z M 953,302 L 952,303 L 958,320 L 958,340 L 953,364 L 940,394 L 941,398 L 945,401 L 959,400 L 969,375 L 973,355 L 973,335 L 970,323 L 959,306 L 957,306 Z M 939,267 L 940,273 L 942,276 L 946,278 L 955,278 L 971,266 L 977,266 L 982,269 L 973,262 L 956,253 L 951,254 L 947,260 Z M 1053,228 L 1072,251 L 1086,277 L 1092,295 L 1095,310 L 1095,333 L 1089,357 L 1073,385 L 1051,410 L 1034,425 L 1020,434 L 1042,428 L 1050,428 L 1056,430 L 1061,428 L 1079,410 L 1096,387 L 1105,368 L 1109,354 L 1110,323 L 1102,299 L 1100,288 L 1080,256 L 1076,253 L 1076,251 Z M 1152,174 L 1142,186 L 1141,191 L 1153,227 L 1166,255 L 1176,271 L 1189,287 L 1205,301 L 1199,296 L 1199,294 L 1189,282 L 1189,280 L 1182,271 L 1171,248 L 1157,209 L 1155,196 L 1155,176 L 1154,174 Z M 363,117 L 359,124 L 354,145 L 353,176 L 347,215 L 335,255 L 325,279 L 311,307 L 285,349 L 263,379 L 216,436 L 185,483 L 164,525 L 155,548 L 145,581 L 138,615 L 135,648 L 136,672 L 140,695 L 146,715 L 159,743 L 171,760 L 186,773 L 179,766 L 165,739 L 157,716 L 152,693 L 151,647 L 157,608 L 162,588 L 177,544 L 193,510 L 209,482 L 237,442 L 274,398 L 300,363 L 327,319 L 345,282 L 361,234 L 368,191 L 368,140 L 365,120 Z M 930,105 L 929,108 L 940,125 L 951,138 L 968,154 L 960,146 L 958,141 L 949,131 L 934,104 Z M 1363,78 L 1363,86 L 1358,98 L 1343,115 L 1332,137 L 1329,151 L 1329,168 L 1332,184 L 1337,199 L 1348,222 L 1368,254 L 1391,283 L 1423,316 L 1401,292 L 1401,290 L 1391,279 L 1370,249 L 1353,215 L 1347,197 L 1344,176 L 1347,152 L 1355,134 L 1375,108 L 1378,98 L 1378,92 L 1375,85 L 1370,80 Z" fill="#111111" fill-rule="evenodd"/>
<path d="M 240,467 L 225,482 L 198,514 L 195,520 L 199,527 L 203,529 L 237,559 L 245,563 L 252,557 L 290,510 L 290,507 L 287,502 L 283,500 L 275,492 L 272,491 L 270,488 L 267,487 L 247,470 Z M 1300,384 L 1293,371 L 1279,352 L 1258,336 L 1228,319 L 1205,303 L 1186,285 L 1177,274 L 1157,239 L 1143,203 L 1139,183 L 1139,160 L 1141,151 L 1139,149 L 1114,185 L 1105,203 L 1098,231 L 1098,272 L 1103,298 L 1111,322 L 1127,351 L 1152,384 L 1160,402 L 1165,418 L 1168,449 L 1164,478 L 1162,481 L 1162,486 L 1158,500 L 1144,531 L 1151,528 L 1174,511 L 1189,495 L 1200,479 L 1227,423 L 1237,415 L 1247,418 L 1251,422 L 1254,430 L 1254,436 L 1256,441 L 1256,475 L 1250,499 L 1237,527 L 1225,546 L 1216,557 L 1216,559 L 1212,562 L 1172,610 L 1147,635 L 1121,656 L 1106,665 L 1090,672 L 1065,676 L 1052,675 L 1037,671 L 1013,657 L 1004,648 L 996,637 L 989,623 L 985,610 L 983,596 L 983,575 L 986,555 L 994,531 L 1009,506 L 1026,487 L 1055,462 L 1061,452 L 1063,440 L 1059,432 L 1044,429 L 1026,433 L 1025,430 L 1041,418 L 1063,396 L 1081,371 L 1090,351 L 1093,338 L 1093,304 L 1084,275 L 1074,256 L 1061,238 L 1032,208 L 976,163 L 948,136 L 929,111 L 927,105 L 920,95 L 915,81 L 913,81 L 896,126 L 892,141 L 890,161 L 894,183 L 900,193 L 910,202 L 915,209 L 919,219 L 920,260 L 922,264 L 926,266 L 937,267 L 942,264 L 952,252 L 957,252 L 986,270 L 1011,293 L 1022,308 L 1031,326 L 1036,343 L 1036,352 L 1034,358 L 1024,371 L 1005,386 L 985,396 L 971,400 L 944,402 L 940,399 L 939,394 L 952,364 L 957,339 L 956,316 L 949,298 L 939,288 L 920,280 L 897,280 L 871,288 L 852,300 L 838,316 L 832,328 L 826,356 L 826,382 L 831,399 L 840,414 L 855,429 L 855,433 L 814,465 L 794,478 L 768,492 L 745,502 L 715,512 L 688,518 L 659,522 L 604,522 L 595,520 L 585,520 L 561,516 L 528,508 L 496,498 L 494,496 L 485,494 L 478,490 L 460,484 L 417,464 L 373,440 L 368,440 L 366,445 L 364,464 L 364,479 L 357,550 L 358,558 L 362,563 L 401,580 L 422,591 L 431,597 L 454,619 L 469,641 L 480,666 L 480,670 L 482,673 L 482,692 L 480,698 L 473,709 L 464,719 L 422,759 L 395,778 L 373,788 L 341,796 L 306,799 L 265,798 L 232,794 L 219,791 L 201,784 L 179,769 L 165,754 L 152,732 L 141,703 L 135,673 L 134,643 L 137,614 L 143,584 L 156,542 L 165,520 L 181,488 L 198,460 L 217,433 L 268,371 L 295,332 L 312,303 L 333,257 L 344,223 L 349,199 L 352,174 L 353,138 L 347,91 L 345,88 L 343,91 L 336,129 L 317,191 L 292,253 L 278,279 L 255,311 L 186,385 L 145,436 L 113,484 L 86,536 L 76,561 L 68,587 L 60,632 L 60,694 L 64,719 L 69,738 L 76,758 L 88,783 L 110,814 L 124,829 L 144,846 L 176,863 L 213,875 L 247,880 L 296,879 L 327,874 L 354,867 L 383,857 L 410,845 L 450,822 L 473,805 L 496,783 L 516,755 L 526,734 L 531,719 L 537,685 L 537,656 L 535,640 L 528,611 L 519,585 L 519,572 L 523,566 L 529,565 L 545,571 L 586,579 L 632,583 L 675,581 L 710,575 L 758,559 L 791,542 L 827,516 L 847,498 L 878,463 L 891,451 L 901,450 L 918,457 L 955,457 L 983,451 L 984,454 L 960,472 L 940,493 L 902,538 L 858,600 L 816,665 L 764,741 L 735,781 L 704,819 L 675,848 L 649,869 L 634,879 L 601,896 L 547,916 L 525,922 L 520,922 L 496,928 L 489,928 L 484,930 L 432,935 L 374,935 L 336,932 L 286,924 L 240,912 L 220,905 L 180,886 L 161,873 L 151,864 L 149,864 L 133,849 L 128,847 L 130,856 L 146,883 L 173,911 L 175,911 L 192,927 L 194,927 L 202,934 L 225,948 L 258,965 L 309,984 L 350,994 L 409,1001 L 451,1001 L 476,999 L 518,992 L 549,984 L 602,965 L 626,954 L 664,933 L 687,918 L 716,896 L 743,872 L 761,853 L 782,828 L 801,802 L 828,759 L 863,693 L 923,564 L 931,551 L 939,545 L 947,547 L 951,553 L 950,574 L 938,608 L 936,618 L 936,645 L 941,670 L 947,687 L 960,710 L 967,719 L 988,739 L 1009,750 L 1025,755 L 1046,758 L 1071,757 L 1106,750 L 1126,743 L 1148,732 L 1174,714 L 1214,679 L 1243,645 L 1264,613 L 1284,571 L 1299,522 L 1307,470 L 1308,414 L 1305,398 Z M 888,318 L 899,320 L 908,327 L 914,337 L 918,349 L 918,364 L 914,376 L 906,384 L 896,388 L 881,383 L 872,374 L 867,365 L 864,351 L 866,336 L 870,328 L 879,320 Z M 1349,62 L 1336,62 L 1328,65 L 1321,70 L 1306,87 L 1296,108 L 1288,138 L 1282,176 L 1281,224 L 1284,254 L 1293,296 L 1302,324 L 1318,362 L 1340,403 L 1344,413 L 1350,437 L 1352,458 L 1350,493 L 1346,517 L 1336,543 L 1335,549 L 1362,515 L 1371,497 L 1377,472 L 1380,432 L 1384,417 L 1394,405 L 1403,404 L 1413,412 L 1424,431 L 1434,464 L 1434,469 L 1438,483 L 1441,509 L 1442,536 L 1440,563 L 1434,594 L 1422,629 L 1407,660 L 1376,708 L 1336,756 L 1309,784 L 1260,829 L 1232,857 L 1196,897 L 1176,922 L 1154,952 L 1121,1004 L 1112,1024 L 1110,1037 L 1111,1042 L 1143,1010 L 1162,988 L 1230,920 L 1337,818 L 1385,770 L 1410,741 L 1445,691 L 1467,650 L 1483,611 L 1495,570 L 1503,524 L 1505,499 L 1505,465 L 1500,422 L 1491,391 L 1483,376 L 1474,364 L 1453,343 L 1409,304 L 1375,265 L 1349,226 L 1333,191 L 1328,169 L 1328,150 L 1330,140 L 1337,123 L 1344,112 L 1357,98 L 1362,85 L 1362,75 L 1359,70 Z" fill="#F2CC00" fill-rule="evenodd"/>
</svg>

After

Width:  |  Height:  |  Size: 9.6 KiB

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 50 KiB

@@ -2814,25 +2814,25 @@
$.ajax({
method:'get',
url: api + '/api/komuditi/check',
url: api + '/api/shoraka/readiness',
success:function(komoditi){
var check_komuditi = Object.keys(komoditi).length;
if(check_komuditi == 0){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
}else{
if(Number(komoditi['unit_komuditi']) < pinjaman_baru){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
@@ -0,0 +1,50 @@
@props([
'note' => '',
'page' => null,
'total' => null,
])
<style>
.bsas-ecert-footer {
flex: 0 0 auto;
margin-top: auto;
padding-top: 12px;
border-top: 2px solid var(--accent, #0f4c5c);
font-family: Arial, Helvetica, sans-serif;
color: var(--muted, #5a6570);
}
.bsas-ecert-footer .footer-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.bsas-ecert-footer .footer-note {
margin: 0;
font-size: 10px;
text-align: left;
line-height: 1.4;
}
.bsas-ecert-footer .page-no {
flex: 0 0 auto;
font-size: 10px;
white-space: nowrap;
}
</style>
<footer {{ $attributes->merge(['class' => 'bsas-ecert-footer']) }}>
<div class="footer-row">
<p class="footer-note">
@if(trim($slot) !== '')
{{ $slot }}
@else
{{ $note }}
@endif
</p>
@if($page !== null && $total !== null)
<div class="page-no">Page {{ $page }} of {{ $total }}</div>
@elseif($page !== null)
<div class="page-no">{{ $page }}</div>
@endif
</div>
</footer>
@@ -0,0 +1,63 @@
@props([
'company' => 'Koperasi Permodalan Kelantan Berhad',
'leftLogo' => null,
'rightLogo' => null,
])
@php
$leftLogo = $leftLogo ?? asset('img/svg/logo-kopkb.svg');
$rightLogo = $rightLogo ?? asset('img/svg/logo-arrahn-new.svg');
@endphp
<style>
.bsas-ecert-header {
flex: 0 0 auto;
padding-bottom: 8px;
margin-bottom: 14px;
}
.bsas-ecert-header .brand-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.bsas-ecert-header .logos {
display: flex;
align-items: center;
gap: 12px;
}
.bsas-ecert-header .logos img {
height: 78px;
width: auto;
object-fit: contain;
}
.bsas-ecert-header .logos.is-end {
justify-content: flex-end;
}
.bsas-ecert-header .company-heading {
text-align: center;
margin: 14px 0 0;
}
.bsas-ecert-header .company-heading .name {
margin: 0;
font-size: 16px;
font-weight: 700;
letter-spacing: .06em;
color: var(--accent, #0f4c5c);
text-transform: uppercase;
}
</style>
<header {{ $attributes->merge(['class' => 'bsas-ecert-header']) }}>
<div class="brand-row">
<div class="logos">
<img src="{{ $leftLogo }}" alt="KPKB">
</div>
<div class="logos is-end">
<img src="{{ $rightLogo }}" alt="Ar-Rahn">
</div>
</div>
<div class="company-heading">
<p class="name">{{ $company }}</p>
</div>
</header>
@@ -0,0 +1,35 @@
@props([
'leftLogo' => null,
'rightLogo' => null,
])
@php
$leftLogo = $leftLogo ?? asset('img/svg/logo-kopkb.svg');
$rightLogo = $rightLogo ?? asset('img/logo-arrahn.jpeg');
@endphp
<style>
.bsas-ecert-watermark {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 28px;
pointer-events: none;
z-index: 0;
opacity: .09;
}
.bsas-ecert-watermark img {
height: 230px;
width: auto;
max-width: 300px;
object-fit: contain;
filter: grayscale(1);
}
</style>
<div {{ $attributes->merge(['class' => 'bsas-ecert-watermark']) }} aria-hidden="true">
<img src="{{ $leftLogo }}" alt="">
<img src="{{ $rightLogo }}" alt="">
</div>
+7 -7
View File
@@ -461,25 +461,25 @@
}else{
$.ajax({
method:'get',
url: api_url + '/api/komuditi/check',
url: api_url + '/api/shoraka/readiness',
success:function(data){
var check_komuditi = Object.keys(data).length;
if(check_komuditi == 0){
if (!data.ready){
Swal.fire({
icon: 'error',
title: 'Unit Komoditi Berbaki Minima',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komoditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
$("#daftar_gadai").prop('disabled', false);
event.preventDefault();
return false;
}else{
if(Number(data['unit_komuditi']) <= min_komoditi){
if (!data.ready){
$("#daftar_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komoditi Berbaki Minima',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komoditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
+45 -32
View File
@@ -716,8 +716,6 @@
var api_url = "{{ api_url_for_browser() }}";
var kodcaw = "{{ $cawangan_info['kodcaw'] }}";
var tagarrahnbid = "{{ $cawangan_info['tagarrahnbid'] }}";
var min_komoditi = "{{ $min_komoditi }}";
console.log('test api_arrahnbid: ', api_arrahnbid);
$('#daftar_gadai').on('click', async function(event) {
event.preventDefault();
if ($(this).prop('disabled')) {
@@ -756,42 +754,57 @@
event.preventDefault();
return false;
} else {
$.ajax({
method: 'get',
url: api_url + '/api/komuditi/check',
success: function(data) {
var check_komuditi = Object.keys(data).length;
if (check_komuditi == 0) {
Swal.fire({
icon: 'error',
title: 'Unit Komoditi Berbaki Minima',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komoditi'
});
$("#daftar_gadai").prop('disabled', false);
event.preventDefault();
return false;
} else {
if (Number(data['unit_komuditi']) <= min_komoditi) {
$("#daftar_gadai").prop('disabled', false);
var commodityShoraka = @json((bool) config('commodity.shoraka'));
var commodityBsas = @json((bool) config('commodity.bsas'));
var openGadaian = function () {
if (icbaru.length > 0) {
window.location.href =
"{{ route('gadaian', ['noic' => $customer_info['kpbaru']]) }}";
} else {
window.location.href =
"{{ route('gadaian', ['noic' => $customer_info['kplama']]) }}";
}
};
if (!commodityShoraka && !commodityBsas) {
Swal.fire({
icon: 'error',
title: 'Komoditi tidak diaktifkan',
text: 'Tiada pembekal komoditi diaktifkan. Hubungi operasi.'
});
$("#daftar_gadai").prop('disabled', false);
return false;
}
if (commodityShoraka && !commodityBsas) {
$.ajax({
method: 'get',
url: api_url + '/api/shoraka/readiness',
success: function (data) {
if (!data || !data.ready) {
Swal.fire({
icon: 'error',
title: 'Unit Komoditi Berbaki Minima',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komoditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
$("#daftar_gadai").prop('disabled', false);
return false;
} else {
if (icbaru.length > 0) {
window.location.href =
"{{ route('gadaian', ['noic' => $customer_info['kpbaru']]) }}";
} else {
window.location.href =
"{{ route('gadaian', ['noic' => $customer_info['kplama']]) }}";
}
}
openGadaian();
},
error: function () {
Swal.fire({
icon: 'error',
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
$("#daftar_gadai").prop('disabled', false);
}
}
});
});
return false;
}
openGadaian();
}
});
+6 -5
View File
@@ -5,6 +5,9 @@
@section('content')
@include('modal.editmarhun')
<div class="container">
@if(session('gadai_edit_error'))
<div class="alert alert-danger" role="alert">{{ session('gadai_edit_error') }}</div>
@endif
<div class="row justify-content-center">
<div class="col-md-12 col-lg-12">
<h3 class="text-center text-uppercase">Pembiayaan</h3>
@@ -946,6 +949,7 @@
text: `Komen : ${data.komen}`
}).then(function(){
$(func).attr("onSubmit","return true;");
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan').val()));
$(func).submit();
return true;
});
@@ -1058,6 +1062,7 @@
}).then(function(){
$(func).attr("onSubmit","return true;");
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan').val()));
$(func).submit();
return true;
@@ -1092,11 +1097,7 @@
return false;
}
else if(pinjaman < 10000 && pinjaman <= Number(pembiayaan_max_teller)){
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Pembiayaan Berjaya Disimpan'
});
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan').val()));
return true;
}
}
+10 -10
View File
@@ -819,25 +819,25 @@
}else{
$.ajax({
method:'get',
url: api_url + '/api/komuditi/check',
url: api_url + '/api/shoraka/readiness',
success:function(data){
var check_komuditi = Object.keys(data).length;
if(check_komuditi == 0){
if (!data.ready){
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
}else{
if(Number(data['unit_komuditi']) < pinjaman){
if (!data.ready){
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
@@ -1162,9 +1162,9 @@
return false;
} else {
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Pembiayaan Berjaya Disimpan'
icon: 'info',
title: 'Sedang diproses',
text: 'Sedang menghantar pembiayaan untuk pengesahan Shoraka.'
});
$(func).attr("onSubmit","return true;");
+6 -5
View File
@@ -5,6 +5,9 @@
@section('content')
@include('modal.editmarhun')
<div class="container">
@if(session('gadai_edit_error'))
<div class="alert alert-danger" role="alert">{{ session('gadai_edit_error') }}</div>
@endif
<div class="row justify-content-center">
<div class="col-md-12 col-lg-12">
<h3 class="text-center text-uppercase">Pembiayaan</h3>
@@ -1612,6 +1615,7 @@
text: `Komen : ${data.komen}`
}).then(function(){
$(func).attr("onSubmit","return true;");
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan').val()));
$(func).submit();
return true;
});
@@ -1724,6 +1728,7 @@
}).then(function(){
$(func).attr("onSubmit","return true;");
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan').val()));
$(func).submit();
return true;
@@ -1758,11 +1763,7 @@
return false;
}
else if(pinjaman < 10000 && pinjaman <= Number(pembiayaan_max_teller)){
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Pembiayaan Berjaya Disimpan'
});
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan').val()));
return true;
}
}
+209 -47
View File
@@ -294,6 +294,35 @@
</div>
</div>
</div>
<div class="col-12" id="commodity_provider_section">
@php
$commodityProviders = array_values(array_filter([
config('commodity.shoraka') ? ['id' => 'shoraka', 'label' => 'Shoraka'] : null,
config('commodity.bsas') ? ['id' => 'bsas', 'label' => 'BSAS'] : null,
]));
@endphp
<div class="form-group row mb-2">
<div class="col-md-3">Pembekal Komoditi</div>
<div class="col-md-9">
@if (count($commodityProviders) === 0)
<span class="text-danger">Tiada pembekal komoditi diaktifkan.</span>
@elseif (count($commodityProviders) === 1)
<input type="hidden" name="commodity_provider" value="{{ $commodityProviders[0]['id'] }}">
<span>{{ $commodityProviders[0]['label'] }}</span>
@else
@foreach ($commodityProviders as $provider)
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="commodity_provider"
id="commodity_provider_{{ $provider['id'] }}"
value="{{ $provider['id'] }}">
<label class="form-check-label" for="commodity_provider_{{ $provider['id'] }}">{{ $provider['label'] }}</label>
</div>
@endforeach
<div class="text-muted small">Pilih pembekal sebelum tekan Terima.</div>
@endif
</div>
</div>
</div>
<div class="col-12">
<input type="text" name="norujukan_gadai" id="norujukan_gadai" value="{{ $norujukan }}" hidden>
<input type="text" name="marhun_detail" id="marhun_detail" value="" hidden>
@@ -435,7 +464,6 @@
text: @json(session('error'))
});
@endif
$.ajax({
method:'GET',
url: api_url + '/api/jemas',
@@ -1562,6 +1590,183 @@
return true;
}
function bsasProgressHtml() {
return '' +
'<div class="text-left" id="bsas-progress-box">' +
'<p class="mb-2">Sedang memproses pembelian komoditi...</p>' +
'<ol class="mb-2 pl-3" style="list-style:none;padding-left:0;">' +
'<li id="bsas-step-1" class="mb-2 small text-muted" data-state="pending">' +
'<span class="bsas-step-icon mr-1">○</span>' +
'<strong>1.</strong> Menghantar order ke BSAS' +
'<div class="bsas-step-remark text-muted" style="margin-left:1.25rem;"></div>' +
'</li>' +
'<li id="bsas-step-2" class="mb-2 small text-muted" data-state="pending">' +
'<span class="bsas-step-icon mr-1">○</span>' +
'<strong>2.</strong> Menunggu keputusan (long poll)' +
'<div class="bsas-step-remark text-muted" style="margin-left:1.25rem;"></div>' +
'</li>' +
'<li id="bsas-step-3" class="mb-2 small text-muted" data-state="pending">' +
'<span class="bsas-step-icon mr-1">○</span>' +
'<strong>3.</strong> Mengambil e-Cert bid, OTC dan STB &amp; simpan gadai' +
'<div class="bsas-step-remark text-muted" style="margin-left:1.25rem;"></div>' +
'</li>' +
'</ol>' +
'<p class="mb-0 small text-muted">Sila tunggu, proses ini boleh mengambil masa 10–30 saat.</p>' +
'</div>';
}
function setBsasStep(step, state, remark) {
var $el = $('#bsas-step-' + step);
if (!$el.length) {
return;
}
var icon = '○';
var color = 'text-muted';
if (state === 'active') {
icon = '●';
color = 'text-primary font-weight-bold';
} else if (state === 'done') {
icon = '✓';
color = 'text-success';
} else if (state === 'error') {
icon = '✕';
color = 'text-danger';
}
$el.attr('data-state', state)
.removeClass('text-muted text-primary text-success text-danger font-weight-bold')
.addClass(color);
$el.find('.bsas-step-icon').text(icon);
$el.find('.bsas-step-remark').text(remark || '');
}
function delayMs(ms) {
return new Promise(function (resolve) {
setTimeout(resolve, ms);
});
}
async function submitGadaiWithBsasProgress(func) {
$("#terima_gadai").prop('disabled', true);
Swal.fire({
title: 'Pembelian Komoditi BSAS',
html: bsasProgressHtml(),
allowOutsideClick: false,
allowEscapeKey: false,
showConfirmButton: false,
didOpen: function () {
Swal.showLoading();
}
});
try {
setBsasStep(1, 'active', 'Menyediakan & menghantar order...');
await delayMs(1200);
setBsasStep(1, 'done', 'Order dihantar.');
setBsasStep(2, 'active', 'Menunggu padanan BSAS...');
await delayMs(800);
var response = await $.ajax({
url: $(func).attr('action'),
method: 'POST',
data: $(func).serialize(),
dataType: 'json',
headers: {
'Accept': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
},
timeout: 90000
});
setBsasStep(2, 'done', 'Keputusan diterima.');
setBsasStep(3, 'active', 'Mengambil e-Cert bid, OTC dan STB & menyimpan gadai...');
await delayMs(1000);
setBsasStep(3, 'done', 'Selesai.');
await delayMs(600);
window.location.href = (response && response.redirect)
? response.redirect
: "{{ route('customer_info') }}";
} catch (err) {
var msg = 'Gagal pembelian komoditi BSAS. Sila cuba lagi.';
if (err && err.responseJSON && err.responseJSON.message) {
msg = err.responseJSON.message;
} else if (err && err.statusText === 'timeout') {
msg = 'Proses BSAS tamat masa. Sila semak rekod BSAS / cuba semula.';
}
var activeStep = $('#bsas-progress-box li[data-state="active"]').attr('id');
var stepNum = activeStep ? parseInt(activeStep.replace('bsas-step-', ''), 10) : 2;
setBsasStep(stepNum, 'error', msg);
Swal.fire({
icon: 'error',
title: 'Tidak Berjaya',
text: msg
}).then(function () {
$("#terima_gadai").prop('disabled', false);
});
}
}
function selectedCommodityProvider() {
var checked = $('input[name="commodity_provider"]:checked').val();
if (checked) {
return checked;
}
var hidden = $('input[name="commodity_provider"][type="hidden"]').val();
return hidden || '';
}
function submitGadaiByProvider(func) {
var provider = selectedCommodityProvider();
if (!provider) {
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Pembekal Komoditi',
text: 'Sila pilih pembekal komoditi.'
});
return false;
}
if (provider === 'shoraka') {
$.ajax({
method: 'get',
url: api_url + '/api/shoraka/readiness',
success: function (data) {
if (!data || !data.ready) {
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
return false;
}
$(func).attr('onSubmit', 'return true;');
if (typeof window.shorakaTrack === 'function') {
window.shorakaTrack(api_url + '/api/shoraka/gadai/' + encodeURIComponent($('#kodcaw').val()) + '/' + encodeURIComponent($('#norujukan_gadai').val()));
}
$(func).submit();
},
error: function () {
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
}
});
return true;
}
submitGadaiWithBsasProgress(func);
return true;
}
async function verifyGadai(func){
$("#terima_gadai").prop('disabled', true);
if (typeof event !== 'undefined' && event && event.preventDefault) {
@@ -1653,32 +1858,6 @@
event.preventDefault();
return false;
}else{
$.ajax({
method:'get',
url: api_url + '/api/komuditi/check',
success:function(data){
var check_komuditi = Object.keys(data).length;
if(check_komuditi == 0){
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
});
event.preventDefault();
return false;
}else{
if(Number(data['unit_komuditi']) < pinjaman){
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
});
event.preventDefault();
return false;
}
else{
if(pinjaman >= 10000 && pinjaman <= Number(pembiyaan_max_pelulus)){
//new added
$.ajax({
@@ -1785,9 +1964,7 @@
title: 'Telah Disahkan',
text: `Komen : ${data.komen}`
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
submitGadaiByProvider(func);
return true;
});
@@ -1933,12 +2110,8 @@
icon: 'success',
title: 'Telah Disahkan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
submitGadaiByProvider(func);
return true;
});
}
else if(data.kelulusan == 'batal')
@@ -1999,14 +2172,7 @@
return false;
} else {
//insert code asal
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Pembiayaan Berjaya Disimpan'
});
$(func).attr("onSubmit","return true;");
$(func).submit();
submitGadaiByProvider(func);
return true;
//end insert code asal
}
@@ -2018,10 +2184,6 @@
}
}
}
}
});
}
}
@@ -0,0 +1,168 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<nav aria-label="breadcrumb">
<ol class="breadcrumb pb-3">
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Komoditi BSAS</li>
</ol>
</nav>
<div class="card-header text-center">{{ __('Rekod Komoditi BSAS') }}</div>
<div class="card-body text-center">
<div class="row justify-content-between mb-4">
<div class="col text-left">
<div class="form-group d-flex align-items-center">
<label for="limit_view_bsas" style="width: 600px" class="mb-0">Had Paparan Rekod BSAS</label>
<select onchange="loadBsasRecord()" name="limit_view_bsas" id="limit_view_bsas" class="form-control">
<option selected value="20">20</option>
<option value="100">100</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
</div>
<div class="col text-right">
<button type="button" class="btn btn-primary" id="refresh_bsas" title="Muat Semula">
<i class="fas fa-sync-alt" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="spinner-border" role="status" id="loading-spinner-bsas" style="display:none;">
<span class="sr-only">Loading...</span>
</div>
<x-datatable
id="rekod_bsas"
filename="Rekod_Komoditi_BSAS"
class="text-center"
:columns="['Bil', 'Tarikh', 'UUID', 'No Rujukan', 'Cawangan', 'Pembeli', 'Bid Value', 'Murabaha', 'eCert No', 'Status', 'Oleh', 'Tindakan']"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2
});
let api = "{{ api_url_for_browser() }}";
let kodcaw = "{{ Auth::user()->cawangan }}";
var tablebsas = initErahnDatatable('#rekod_bsas', {
pageLength: 1000,
bLengthChange: false,
deferRender: true,
order: [[1, 'desc']],
});
$('#refresh_bsas').on('click', function () {
loadBsasRecord();
});
$(function () {
loadBsasRecord();
});
function bsasStatusBadge(status) {
var label = status || '-';
var cls = 'secondary';
if (status === 'confirmed') cls = 'success';
else if (status === 'failed') cls = 'danger';
else if (status === 'submitted' || status === 'pending') cls = 'warning';
return '<span class="badge badge-' + cls + '">' + label + '</span>';
}
function formatBsasDateTime(value) {
if (!value) {
return '-';
}
var date = new Date(value);
if (isNaN(date.getTime())) {
return value;
}
var pad = function (n) { return String(n).padStart(2, '0'); };
return date.getFullYear() + '-' +
pad(date.getMonth() + 1) + '-' +
pad(date.getDate()) + ' ' +
pad(date.getHours()) + ':' +
pad(date.getMinutes()) + ':' +
pad(date.getSeconds());
}
function bsasEcertAction(row) {
var ecertNo = row['e_cert_no'] || '';
var hasEcert = !!(row['has_bid_ecert'] || row['has_otc_ecert'] || row['has_stb_ecert']);
var uuid = row['uuid'] || '';
if (!hasEcert || !uuid) {
return '<span class="text-muted">-</span>';
}
var url = "{{ url('/khazanah/komoditi/bsas/ecert') }}/" + encodeURIComponent(uuid);
return '<a class="btn btn-sm btn-outline-primary" href="' + url + '" target="_blank" title="Lihat eCert ' + ecertNo + '">' +
'<i class="fa fa-print" aria-hidden="true"></i> eCert' +
'</a>';
}
function loadBsasRecord() {
var selectedLimitView = $('#limit_view_bsas').find(':selected').val();
$('#loading-spinner-bsas').show();
tablebsas.clear().draw();
$.ajax({
method: 'get',
url: api + '/api/komuditi/bsas/orders',
data: {
'limit_view': selectedLimitView,
'kodcaw': kodcaw,
},
success: function (rekod) {
var bilcount = 0;
$.each(rekod, function (index, row) {
bilcount++;
var ecertNo = row['e_cert_no'] || '-';
if ((row['has_bid_ecert'] || row['has_otc_ecert'] || row['has_stb_ecert']) && row['uuid']) {
ecertNo = '<a href="{{ url('/khazanah/komoditi/bsas/ecert') }}/' + encodeURIComponent(row['uuid']) + '" target="_blank">' +
(row['e_cert_no'] || 'eCert') +
'</a>';
}
tablebsas.row.add([
bilcount,
formatBsasDateTime(row['created_at']),
row['uuid'] || '-',
row['norujukan'] || '-',
row['kodcaw'] || '-',
row['otc_counter_party'] || '-',
formatter.format(Number(row['bid_value'] || 0)),
formatter.format(Number(row['otc_murabaha_value'] || 0)),
ecertNo,
bsasStatusBadge(row['status']),
row['created_by'] || '-',
bsasEcertAction(row),
]).draw(false);
});
tablebsas.draw();
$('#loading-spinner-bsas').hide();
},
error: function () {
$('#loading-spinner-bsas').hide();
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Gagal memuatkan rekod BSAS'
});
}
});
}
</script>
@endsection
@@ -268,6 +268,11 @@
<a href="{{ route('khazanah.harga_emas') }}"
class="btn btn-info btn-lg btn-block mb-3">Harga Emas</a>
</div>
@if(config('commodity.shoraka') && in_array(Auth::user()->roles, ['pc', 'ppc'], true))
<div class="col-4 px-2">
<a href="{{ route('pc.shoraka.index') }}" class="btn btn-info btn-lg btn-block mb-3">Komoditi Shoraka</a>
</div>
@endif
@if(!empty(($cawangan_info['features'] ?? [])['pembiayaan_online']))
<div class="col-4 px-2">
<a href="{{ route('pembiayaan.online.pc') }}"
@@ -282,6 +287,12 @@
<a href="{{ route('khazanah.indexwakil') }}"
class="btn btn-info btn-lg btn-block mb-3">Surat Wakil</a>
</div>
@if(config('commodity.bsas'))
<div class="col-4 px-2">
<a href="{{ route('khazanah.bsas') }}"
class="btn btn-info btn-lg btn-block mb-3">Komoditi BSAS</a>
</div>
@endif
</div>
</div>
@@ -16,6 +16,9 @@
<div class="card-body text-center">
<a href="{{ route('operasi.kelulusananggota') }}" class="btn btn-info btn-lg d-inline-block m-1">Kelulusan Anggota</a>
<a href="{{ route('operasi.kelulusan') }}" class="btn btn-info btn-lg d-inline-block m-1">Kelulusan</a>
@if(config('commodity.shoraka'))
<a href="{{ route('operasi.shoraka.index') }}" class="btn btn-info btn-lg d-inline-block m-1">Komoditi Shoraka</a>
@endif
<a href="{{ route('pembiayaan.online.operasi') }}" class="btn btn-info btn-lg d-inline-block m-1">Pembiayaan Online</a>
<a href="{{ route('pembiayaan.online.operasi.topup') }}" class="btn btn-info btn-lg d-inline-block m-1">Modal Online</a>
<a href="{{ route('pembiayaan.online.operasi.eod') }}" class="btn btn-info btn-lg d-inline-block m-1">EOD Modal Online</a>
+54 -3
View File
@@ -1,16 +1,67 @@
@extends('layouts.app')
@section('content')
<style>
.teller-home-card {
border: 0;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 8px 24px rgba(31, 45, 61, .12);
}
.teller-home-card .card-header {
padding: 20px;
border: 0;
font-size: 20px;
font-weight: 600;
}
.teller-home-menu {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
padding: 28px;
}
.teller-home-menu .btn {
display: flex;
align-items: center;
justify-content: center;
min-height: 88px;
padding: 18px 16px;
border-radius: 8px;
white-space: normal;
font-size: 18px;
font-weight: 600;
letter-spacing: .3px;
transition: background-color .15s ease, box-shadow .15s ease;
}
.teller-home-menu .btn:hover,
.teller-home-menu .btn:focus-visible {
box-shadow: 0 4px 12px rgba(23, 162, 184, .25);
}
@media (max-width: 575.98px) {
.teller-home-menu {
grid-template-columns: minmax(0, 1fr);
gap: 12px;
padding: 20px;
}
.teller-home-menu .btn {
min-height: 68px;
font-size: 16px;
}
}
</style>
<div class="container">
<div class="row justify-content-center" style="margin-top:60px;">
<div class="col-md-8">
<div class="card">
<div class="card-header bg-secondary text-center"><span style="font-weight:500;">{{ __('Paparan Utama') }}</span></div>
<div class="card teller-home-card">
<div class="card-header bg-secondary text-center">{{ __('Paparan Utama') }}</div>
<div class="card-body text-center">
<div class="card-body teller-home-menu text-center">
<a class="btn btn-info btn-lg" href="#" onclick="pelangganclick()">PELANGGAN</a>
<a class="btn btn-info btn-lg" href="{{ url('/harga_emas') }}">HARGA EMAS</a>
<a class="btn btn-info btn-lg" href="{{ url('/aliran_tunai') }}">ALIRAN TUNAI</a>
@if(config('commodity.shoraka') && (in_array(Auth::user()->roles, ['teller', 'penilai', 'pc', 'ppc', 'admin', 'masteradmin', 'operasi']) || Auth::user()->role_harian === 'teller'))
<a class="btn btn-info btn-lg" href="{{ route('shoraka.index') }}">KOMODITI SHORAKA</a>
@endif
{{-- <a class="btn btn-info btn-lg" href="#">TETAPAN</a> --}}
</div>
</div>
+48 -78
View File
@@ -25,6 +25,18 @@
</ol>
</nav>
@if(!empty($customer_info['photo_base64']))
<div class="form-group row col-md-12">
<div class="col-md-12 d-flex justify-content-center pb-3">
<img src="data:{{ $customer_info['photo_mime'] ?? 'image/jpeg' }};base64,{{ $customer_info['photo_base64'] }}"
alt="Gambar MyKad"
width="120"
height="160"
style="object-fit: cover;">
</div>
</div>
@endif
<div class="form-group row col-md-12">
<div class="col-md-6">
<div class="form-group row">
@@ -154,7 +166,7 @@
<nav class="mb-3">
<div class="nav nav-tabs" id="nav-tab" role="tablist">
@php
$activate_tab = request()->session()->pull('activate_tab', 'SAG_lama');
$activate_tab = request()->session()->pull('activate_tab', 'SAG_baru');
$activate_tab_SAG_baru = $activate_tab === 'SAG_baru' ? 'active' : '';
$aria_selected_SAG_baru = $activate_tab === 'SAG_baru' ? 'true' : 'false';
@@ -171,79 +183,36 @@
</nav>
<div class="tab-content" id="navtawarruqdannottawarruq">
<div class="tab-pane fade {{ $activate_pane_SAG_baru }}" id="nav-tawarruq" role="tabpanel" aria-labelledby="nav-tawarruq-tab">
<table class="table table-striped table-hover" id="myTable" style="width: 100%">
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh Pembiayaan</th>
<th>Tarikh Matang</th>
<th>Baki Harga Jualan</th>
<th>Baki Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
<th>Keuntungan</th>
<th>Lelong</th>
<th>Pembayaran Terakhir</th>
<th>Tarikh Ansuran Terkini</th>
</tr>
</thead>
</table>
<x-datatable
id="myTable"
filename="SAG_Baru"
:columns="['Bil', 'No Rujukan', 'Tarikh Pembiayaan', 'Tarikh Matang', 'Baki Harga Jualan', 'Baki Pembiayaan', 'Margin', 'Tempoh', 'Keuntungan', 'Lelong', 'Pembayaran Terakhir', 'Tarikh Ansuran Terkini']"
/>
</div>
<div class="tab-pane fade {{ $activate_pane_SAG_lama }}" id="nav-xtawarruq" role="tabpanel" aria-labelledby="nav-xtawarruq-tab">
<table id="xtawarruq" class="table table-striped table-hover" style="width:100%">
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh Pembiayaan</th>
<th>Tarikh Matang</th>
<th>Baki Harga Jualan</th>
<th>Baki Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
<th>Keuntungan</th>
<th>Lelong</th>
<th>Pembayaran Terakhir</th>
<th>Tarikh Ansuran Terkini</th>
</tr>
</thead>
</table>
<x-datatable
id="xtawarruq"
filename="SAG_Lama"
:columns="['Bil', 'No Rujukan', 'Tarikh Pembiayaan', 'Tarikh Matang', 'Baki Harga Jualan', 'Baki Pembiayaan', 'Margin', 'Tempoh', 'Keuntungan', 'Lelong', 'Pembayaran Terakhir', 'Tarikh Ansuran Terkini']"
/>
</div>
</div>
{{-- Sudah Tebus --}}
<table id="dahtebusTable" class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh Penyelesaian Pembiayaan</th>
<th>Baki Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
</tr>
</thead>
</table>
<x-datatable
id="dahtebusTable"
filename="SAG_Sudah_Tebus"
:columns="['Bil', 'No Rujukan', 'Tarikh Penyelesaian Pembiayaan', 'Baki Pembiayaan', 'Margin', 'Tempoh']"
/>
{{-- Lelong --}}
<table id="lelongTable" class="table table-striped table-hover" style="width:100%">
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh Lelong</th>
<th>Tarikh Tuntut</th>
<th>Pembiayaan</th>
<th>Harga Jual</th>
<th>Jum Tuntut/Bayar</th>
<th>Keuntungan</th>
<th>Caj Lelong</th>
</tr>
</thead>
</table>
<x-datatable
id="lelongTable"
filename="SAG_Lelong"
:columns="['Bil', 'No Rujukan', 'Tarikh Lelong', 'Tarikh Tuntut', 'Pembiayaan', 'Harga Jual', 'Jum Tuntut/Bayar', 'Keuntungan', 'Caj Lelong']"
/>
<div class="text-center">
<button class="btn btn-primary" onclick="histfunc()">Rekod Pembiayaan</button>
@@ -504,21 +473,15 @@
var tablegadai = $('#myTable').DataTable({
"scrollX": true,
order: [[1,'desc']]
var tablegadai = initErahnDatatable('#myTable', {
order: [[1, 'desc']]
});
var xtawarruq = $('#xtawarruq').DataTable({
"scrollX": true,
});
var xtawarruq = initErahnDatatable('#xtawarruq');
var tabledahtebus = $('#dahtebusTable').DataTable({
});
var tabledahtebus = initErahnDatatable('#dahtebusTable');
var tablelelong = $('#lelongTable').DataTable({
"scrollX": true
});
var tablelelong = initErahnDatatable('#lelongTable');
var historybayarandatatable = $('#tablehistorybayaran').DataTable({
"ordering": false
@@ -960,6 +923,9 @@
success: function(data){
$('#myTable').parents('div.dataTables_wrapper').first().show();
gadaiTable(data,"belum_tebus");
if (typeof adjustErahnDatatables === 'function') {
adjustErahnDatatables();
}
}
});
@@ -1493,6 +1459,9 @@
url: api_url + "/api/customers/"+noic+"/gadai/belum_tebus/"+kodcaw,
success: function(data){
gadaiTable(data,"belum_tebus");
if (typeof adjustErahnDatatables === 'function') {
adjustErahnDatatables();
}
}
});
}
@@ -1741,9 +1710,10 @@
});
document.addEventListener('DOMContentLoaded', function(){
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e){
$($.fn.dataTable.tables(true)).DataTable()
.columns.adjust();
$('a[data-toggle="tab"]').on('shown.bs.tab', function(){
if (typeof adjustErahnDatatables === 'function') {
adjustErahnDatatables();
}
});
});
</script>
+1
View File
@@ -405,6 +405,7 @@
@endif
<main class="py-4">
@include('shoraka.navigation')
@yield('content')
</main>
</div>
+200 -38
View File
@@ -73,43 +73,81 @@
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">{{ __('Rekod Pembelian/Penjualan Komoditi') }}</div>
<div class="card-header">{{ __('Rekod Komoditi') }}</div>
<div class="card-body text-center">
<div class="row justify-content-between mb-4">
<div class="col text-left">
<div class="form-group d-flex align-items-center">
<label for="limit-komoditi" style="width: 600px" class="mb-0">Had Paparan Rekod Komoditi</label>
<select onchange="loadKomoditiRecord()" name="limit_view" id="limit_view" class="form-control">
<option selected value="20">20</option>
<option value="100">100</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option disabled>Untuk rekod keseluruhan, sila print</option>
</select>
</div>
<ul class="nav nav-tabs mb-3" id="komoditi-rekod-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="tab-manual-link" data-toggle="tab" href="#tab-manual" role="tab" aria-controls="tab-manual" aria-selected="true">Beli / Jual Manual</a>
</li>
<li class="nav-item">
<a class="nav-link" id="tab-bsas-link" data-toggle="tab" href="#tab-bsas" role="tab" aria-controls="tab-bsas" aria-selected="false">Pembelian BSAS</a>
</li>
</ul>
<div class="tab-content" id="komoditi-rekod-tabContent">
<div class="tab-pane fade show active" id="tab-manual" role="tabpanel" aria-labelledby="tab-manual-link">
<div class="row justify-content-between mb-4">
<div class="col text-left">
<div class="form-group d-flex align-items-center">
<label for="limit_view" style="width: 600px" class="mb-0">Had Paparan Rekod Komoditi</label>
<select onchange="loadKomoditiRecord()" name="limit_view" id="limit_view" class="form-control">
<option selected value="20">20</option>
<option value="100">100</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option disabled>Untuk rekod keseluruhan, sila print</option>
</select>
</div>
</div>
<div class="col text-right">
<a href="{{ route('laporan.komoditi') }}" target="_blank" class="btn btn-primary" title="Cetak Rekod Jual/Beli Komoditi"><i class="fa fa-print" aria-hidden="true"></i></a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="spinner-border" role="status" id="loading-spinner">
<span class="sr-only">Loading...</span>
</div>
<x-datatable
id="rekod_komuditi"
filename="Rekod_Komoditi_Manual"
class="text-center"
:columns="['Bil', 'No Sijil', 'Tarikh', 'Masa', 'Nilai Komoditi', 'Transaksi Oleh', 'Transaksi']"
/>
</div>
</div>
</div>
<div class="col text-right">
<a href="{{ route('laporan.komoditi') }}" target="_blank" class="btn btn-primary" title="Cetak Rekod Jual/Beli Komoditi"><i class="fa fa-print" aria-hidden="true"></i></a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="spinner-border" role="status" id="loading-spinner">
<span class="sr-only">Loading...</span>
</div>
<table id="rekod_komuditi" class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Bil</th>
<th>No Sijil</th>
<th>Tarikh</th>
<th>Masa</th>
<th>Nilai Komoditi</th>
<th>Transaksi Oleh</th>
<th>Transaksi</th>
</tr>
</thead>
</table>
<div class="tab-pane fade" id="tab-bsas" role="tabpanel" aria-labelledby="tab-bsas-link">
<div class="row justify-content-between mb-4">
<div class="col text-left">
<div class="form-group d-flex align-items-center">
<label for="limit_view_bsas" style="width: 600px" class="mb-0">Had Paparan Rekod BSAS</label>
<select onchange="loadBsasRecord()" name="limit_view_bsas" id="limit_view_bsas" class="form-control">
<option selected value="20">20</option>
<option value="100">100</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
</div>
<div class="col text-right">
<button type="button" class="btn btn-primary" id="refresh_bsas" title="Muat Semula">
<i class="fas fa-sync-alt" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="spinner-border" role="status" id="loading-spinner-bsas" style="display:none;">
<span class="sr-only">Loading...</span>
</div>
<x-datatable
id="rekod_bsas"
filename="Rekod_Komoditi_BSAS"
class="text-center"
:columns="['Bil', 'Tarikh', 'UUID', 'No Rujukan', 'Cawangan', 'Pembeli', 'Bid Value', 'Murabaha', 'eCert No', 'Status', 'Oleh', 'Tindakan']"
/>
</div>
</div>
</div>
</div>
</div>
@@ -239,15 +277,44 @@
<script>
let api_url = "{{ api_url_for_browser() }}";
var tablerekod = $('#rekod_komuditi').DataTable( {
"pageLength": 1000,
"bLengthChange": false,
var tablerekod = initErahnDatatable('#rekod_komuditi', {
pageLength: 1000,
bLengthChange: false,
deferRender: true,
order: [[2, 'desc']],
});
var tablebsas = initErahnDatatable('#rekod_bsas', {
pageLength: 1000,
bLengthChange: false,
deferRender: true,
order: [[1, 'desc']],
});
var bsasLoaded = false;
$(document).ready( function () {
checkKomuditi();
});
$('#komoditi-rekod-tab a[data-toggle="tab"]').on('shown.bs.tab', function () {
if (typeof adjustErahnDatatables === 'function') {
adjustErahnDatatables();
}
});
$('#tab-bsas-link').on('shown.bs.tab', function () {
if (!bsasLoaded) {
loadBsasRecord();
} else if (typeof adjustErahnDatatables === 'function') {
adjustErahnDatatables();
}
});
$('#refresh_bsas').on('click', function () {
loadBsasRecord();
});
const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2
});
@@ -395,6 +462,101 @@
})
}
function bsasStatusBadge(status) {
var label = status || '-';
var cls = 'secondary';
if (status === 'confirmed') cls = 'success';
else if (status === 'failed') cls = 'danger';
else if (status === 'submitted' || status === 'pending') cls = 'warning';
return '<span class="badge badge-' + cls + '">' + label + '</span>';
}
function formatBsasDateTime(value) {
if (!value) {
return '-';
}
var date = new Date(value);
if (isNaN(date.getTime())) {
return value;
}
var pad = function (n) { return String(n).padStart(2, '0'); };
return date.getFullYear() + '-' +
pad(date.getMonth() + 1) + '-' +
pad(date.getDate()) + ' ' +
pad(date.getHours()) + ':' +
pad(date.getMinutes()) + ':' +
pad(date.getSeconds());
}
function bsasEcertAction(row) {
var ecertNo = row['e_cert_no'] || '';
var hasEcert = !!(row['has_bid_ecert'] || row['has_otc_ecert'] || row['has_stb_ecert']);
var uuid = row['uuid'] || '';
if (!hasEcert || !uuid) {
return '<span class="text-muted">-</span>';
}
var url = "{{ url('/komoditi/bsas/ecert') }}/" + encodeURIComponent(uuid);
return '<a class="btn btn-sm btn-outline-primary" href="' + url + '" target="_blank" title="Lihat eCert ' + ecertNo + '">' +
'<i class="fa fa-print" aria-hidden="true"></i> eCert' +
'</a>';
}
function loadBsasRecord()
{
var selectedLimitView = $('#limit_view_bsas').find(':selected').val();
$('#loading-spinner-bsas').show();
tablebsas.clear().draw();
$.ajax({
method: 'get',
url: api_url + '/api/komuditi/bsas/orders',
data: {
'limit_view': selectedLimitView,
},
success: function (rekod) {
var bilcount = 0;
$.each(rekod, function (index, row) {
bilcount++;
var ecertNo = row['e_cert_no'] || '-';
if ((row['has_bid_ecert'] || row['has_otc_ecert'] || row['has_stb_ecert']) && row['uuid']) {
ecertNo = '<a href="{{ url('/komoditi/bsas/ecert') }}/' + encodeURIComponent(row['uuid']) + '" target="_blank">' +
(row['e_cert_no'] || 'eCert') +
'</a>';
}
tablebsas.row.add([
bilcount,
formatBsasDateTime(row['created_at']),
row['uuid'] || '-',
row['norujukan'] || '-',
row['kodcaw'] || '-',
row['otc_counter_party'] || '-',
formatter.format(Number(row['bid_value'] || 0)),
formatter.format(Number(row['otc_murabaha_value'] || 0)),
ecertNo,
bsasStatusBadge(row['status']),
row['created_by'] || '-',
bsasEcertAction(row),
]).draw(false);
});
tablebsas.draw();
bsasLoaded = true;
$('#loading-spinner-bsas').hide();
},
error: function () {
bsasLoaded = false;
$('#loading-spinner-bsas').hide();
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Gagal memuatkan rekod BSAS'
});
}
});
}
$('#detail_komuditi').on('show.bs.modal', function(event) {
var button = $(event.relatedTarget);
var kodproduk = button.data('kodproduk');
@@ -47,6 +47,7 @@
</div>
</div>
<script>
var api_url = '{{ api_url_for_browser() }}';
var table_margin = $('#table-margin').DataTable();
$.ajax({
+7 -7
View File
@@ -2022,25 +2022,25 @@
$.ajax({
method:'get',
url: api + '/api/komuditi/check',
url: api + '/api/shoraka/readiness',
success:function(komoditi){
var check_komuditi = Object.keys(komoditi).length;
if(check_komuditi == 0){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
}else{
if(Number(komoditi['unit_komuditi']) < pinjaman_baru){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
@@ -2258,25 +2258,25 @@
$.ajax({
method:'get',
url: api + '/api/komuditi/check',
url: api + '/api/shoraka/readiness',
success:function(komoditi){
var check_komuditi = Object.keys(komoditi).length;
if(check_komuditi == 0){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
}else{
if(Number(komoditi['unit_komuditi']) < pinjaman_baru){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
+21 -21
View File
@@ -2264,27 +2264,27 @@
let komuditiblock = false;
$.ajax({
method:'get',
url: api + '/api/komuditi/check',
url: api + '/api/shoraka/readiness',
async:false,
success:function(komoditi){
var check_komuditi = Object.keys(komoditi).length;
if(check_komuditi == 0){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
komuditiblock = true;
event.preventDefault();
return false;
}else{
if(Number(komoditi['unit_komuditi']) < pinjaman_baru){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
komuditiblock = true;
event.preventDefault();
@@ -2646,29 +2646,29 @@
let komuditiblock = false;
$.ajax({
method:'get',
url: api + '/api/komuditi/check',
url: api + '/api/shoraka/readiness',
async:false,
success:function(komoditi){
var check_komuditi = Object.keys(komoditi).length;
if(check_komuditi == 0){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.close();
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
komuditiblock = true;
event.preventDefault();
return false;
}else{
if(Number(komoditi['unit_komuditi']) < pinjaman_baru){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.close();
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
komuditiblock = true;
event.preventDefault();
@@ -3106,25 +3106,25 @@
$.ajax({
method:'get',
url: api + '/api/komuditi/check',
url: api + '/api/shoraka/readiness',
success:function(komoditi){
var check_komuditi = Object.keys(komoditi).length;
if(check_komuditi == 0){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
}else{
if(Number(komoditi['unit_komuditi']) < pinjaman_baru){
if (!komoditi.ready){
$("#terima_transaksi").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
title: 'Shoraka Belum Tersedia',
text: 'Sila hubungi operasi untuk semakan sambungan Shoraka.'
});
event.preventDefault();
return false;
+346
View File
@@ -0,0 +1,346 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BSAS eCert — {{ $ecert_no ?? 'Preview' }}</title>
<style>
:root {
--ink: #1a2332;
--muted: #5a6570;
--line: #c5a572;
--line-soft: #e2d4bc;
--accent: #0f4c5c;
--paper: #fbf8f2;
--panel: #ffffff;
}
* { box-sizing: border-box; }
html, body {
margin: 0;
padding: 0;
background: #d9dde3;
color: var(--ink);
font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
.preview-bar {
position: sticky;
top: 0;
z-index: 20;
display: flex;
gap: 10px;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
background: #0f4c5c;
color: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
.preview-bar .badge {
display: inline-block;
padding: 2px 8px;
border: 1px solid rgba(255,255,255,.55);
border-radius: 3px;
letter-spacing: .08em;
font-size: 11px;
font-weight: 700;
}
.preview-bar button,
.preview-bar a {
border: 0;
background: #c5a572;
color: #1a2332;
font-weight: 700;
padding: 7px 14px;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
.sheet-stack {
padding: 24px 12px 48px;
display: flex;
flex-direction: column;
align-items: center;
gap: 28px;
}
.page {
position: relative;
width: 210mm;
min-height: 297mm;
background: var(--paper);
box-shadow: 0 10px 30px rgba(0,0,0,.18);
overflow: hidden;
padding: 16mm 16mm 18mm;
}
.content {
position: relative;
z-index: 1;
min-height: calc(297mm - 34mm);
display: flex;
flex-direction: column;
}
.page-body {
flex: 1 1 auto;
}
.cert-title {
margin: 0 0 6px;
text-align: center;
font-size: 22px;
letter-spacing: .18em;
text-transform: uppercase;
color: var(--accent);
font-weight: 700;
}
.cert-no {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
margin-bottom: 18px;
}
.cert-no strong {
color: var(--accent);
letter-spacing: .04em;
}
.gold-rule {
height: 1px;
background: linear-gradient(90deg, transparent, var(--line), transparent);
margin: 0 8%;
}
.statement {
margin: 20px auto 24px;
max-width: 92%;
text-align: center;
font-size: 13.5px;
line-height: 1.65;
color: var(--ink);
}
.section-label {
margin: 0 0 10px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
letter-spacing: .16em;
text-transform: uppercase;
color: var(--accent);
font-weight: 700;
border-left: 3px solid var(--line);
padding-left: 8px;
}
.detail-panel {
background: var(--panel);
border: 1px solid var(--line-soft);
border-radius: 2px;
padding: 14px 16px 8px;
}
.detail-grid {
width: 100%;
border-collapse: collapse;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.detail-grid tr td {
padding: 7px 8px;
vertical-align: top;
border-bottom: 1px solid #eee6d8;
}
.detail-grid tr:last-child td {
border-bottom: 0;
}
.detail-grid .label {
width: 38%;
color: var(--muted);
font-weight: 600;
}
.detail-grid .value {
color: var(--ink);
font-weight: 700;
}
.commodity-table {
width: 100%;
border-collapse: collapse;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin-top: 8px;
}
.commodity-table th,
.commodity-table td {
border: 1px solid var(--line-soft);
padding: 10px 12px;
text-align: left;
}
.commodity-table th {
background: #f3eee4;
color: var(--accent);
letter-spacing: .06em;
text-transform: uppercase;
font-size: 11px;
}
.commodity-table td.num {
text-align: right;
font-variant-numeric: tabular-nums;
}
.murabaha-box {
margin-top: 14px;
padding: 10px 12px;
border: 1px dashed var(--line);
background: rgba(197, 165, 114, .08);
font-family: Arial, Helvetica, sans-serif;
display: flex;
justify-content: space-between;
align-items: center;
}
.murabaha-box .k {
font-size: 11px;
letter-spacing: .08em;
text-transform: uppercase;
color: var(--muted);
font-weight: 700;
}
.murabaha-box .v {
font-size: 16px;
font-weight: 700;
color: var(--accent);
}
@media print {
body { background: #fff; }
.preview-bar { display: none !important; }
.sheet-stack { padding: 0; gap: 0; }
.page {
box-shadow: none;
margin: 0;
page-break-after: always;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
.page:last-child { page-break-after: auto; }
}
@page {
size: A4 portrait;
margin: 0;
}
</style>
</head>
<body>
@php
$certificates = $certificates ?? [];
$lines = $lines ?? [];
$ecertNo = $ecert_no ?? 'CPO21OCT26-0000031-000';
$isDummy = $isDummy ?? false;
$pageTotal = count($certificates) + 1;
@endphp
<div class="preview-bar">
<div>
@if($isDummy)
<span class="badge">DUMMY PREVIEW</span>
&nbsp; BSAS e-Certificate layout — {{ $pageTotal }} pages A4
@else
BSAS e-Certificate — {{ $ecertNo }}
@endif
</div>
<div>
<button type="button" onclick="window.print()">Print / PDF</button>
</div>
</div>
<div class="sheet-stack">
@foreach($certificates as $index => $certificate)
<section class="page">
<x-print.bsas.watermark />
<div class="content">
<x-print.bsas.header />
<div class="page-body">
<h1 class="cert-title">{{ $certificate['title'] }}</h1>
<div class="cert-no">Certificate Number: <strong>{{ $certificate['ecert_no'] ?? $ecertNo }}</strong></div>
<div class="gold-rule"></div>
<p class="statement">{!! $certificate['statement'] !!}</p>
<h2 class="section-label">Detail</h2>
<div class="detail-panel">
<table class="detail-grid">
@foreach($certificate['rows'] as $row)
<tr>
<td class="label">{{ $row['label'] }}</td>
<td class="value">{{ $row['value'] }}</td>
</tr>
@endforeach
</table>
@if(!empty($certificate['show_murabaha']))
<div class="murabaha-box">
<span class="k">Murabaha Value</span>
<span class="v">{{ $certificate['currency'] ?? 'MYR' }} {{ $certificate['murabaha'] }}</span>
</div>
@endif
</div>
</div>
<x-print.bsas.footer
:page="$index + 1"
:total="$pageTotal"
/>
</div>
</section>
@endforeach
<section class="page">
<x-print.bsas.watermark />
<div class="content">
<x-print.bsas.header />
<div class="page-body">
<h1 class="cert-title" style="font-size:18px;">Commodity Schedule</h1>
<div class="cert-no">Certificate Number: <strong>{{ $ecertNo }}</strong></div>
<div class="gold-rule"></div>
<h2 class="section-label" style="margin-top:28px;">Commodity Information</h2>
<div class="detail-panel">
<table class="commodity-table">
<thead>
<tr>
<th>Commodity Supplying Participant</th>
<th style="width:28%;text-align:right;">Commodity Volume</th>
</tr>
</thead>
<tbody>
@foreach($lines as $line)
<tr>
<td>{{ $line['supplier'] ?? '-' }}</td>
<td class="num">{{ $line['volume'] ?? '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<x-print.bsas.footer :page="$pageTotal" :total="$pageTotal">
This schedule forms part of Certificate No. {{ $ecertNo }}
</x-print.bsas.footer>
</div>
</section>
</div>
</body>
</html>
+6 -4
View File
@@ -556,9 +556,11 @@
</table>
@php
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/komuditi/check')->json();
$product = Http::withOptions(['verify' => config('app.api_verify')])->get($api_url . '/api/komuditi/description',['kodproduk'=>$komuditi['kodproduct']])->json();
$kuantiti = $gadai_detail['pinjaman']/$komuditi['nilai'];
$commodityPrint = app(\App\Services\CommodityCertificate::class)
->forReference($gadai_detail['norujukan'], $gadai_detail['pinjaman'] ?? 0);
$komuditi = $commodityPrint['komoditi'];
$product = $commodityPrint['product'];
$kuantiti = $commodityPrint['kuantiti'];
@endphp
<table style="margin-bottom:10px;" id="keuntungan">
@@ -576,7 +578,7 @@
<tr>
<td>2</td>
<td>Kod Produk / Diskripsi</td>
<td>{{ $product['kodproduk'] . ' / ' . $product['description'] }}</td>
<td>{{ $product['product_code'] ?? '' }}</td>
<td>5</td>
<td>Nilai</td>
<td>{{ 'RM ' . number_format($gadai_detail['pinjaman'],2) }}</td>
+8 -1
View File
@@ -654,13 +654,20 @@
@php
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])
$shorakaPrint = app(\App\Services\ShorakaFinancingService::class)->printData($gadai_detail['norujukan']);
if ($shorakaPrint) {
$komuditi = $shorakaPrint['komoditi'];
$product = $shorakaPrint['product'];
$kuantiti = $shorakaPrint['kuantiti'];
} else {
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])
->get($api_url . '/api/komuditi/check')
->json();
$product = Http::withOptions(['verify' => config('app.api_verify')])
->get($api_url . '/api/komuditi/description', ['kodproduk' => $komuditi['kodproduct']])
->json();
$kuantiti = $gadai_detail['pinjaman'] / $komuditi['nilai'];
}
@endphp
<table style="margin-bottom:10px;" id="keuntungan">
+8 -1
View File
@@ -713,13 +713,20 @@
</tr>
</table>
@php
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])
$shorakaPrint = app(\App\Services\ShorakaFinancingService::class)->printData($gadai_detail['norujukan']);
if ($shorakaPrint) {
$komuditi = $shorakaPrint['komoditi'];
$product = $shorakaPrint['product'];
$kuantiti = $shorakaPrint['kuantiti'];
} else {
$komuditi = Http::withOptions(['verify' => config('app.api_verify')])
->get($api_url . '/api/komuditi/check')
->json();
$product = Http::withOptions(['verify' => config('app.api_verify')])
->get($api_url . '/api/komuditi/description', ['kodproduk' => $komuditi['kodproduct']])
->json();
$kuantiti = $gadai_detail['pinjaman'] / $komuditi['nilai'];
}
@endphp
<table id="keuntungan" style="margin-bottom:10px;">
+4 -4
View File
@@ -615,12 +615,12 @@
<td>{{ $komoditi['no_sijil'] }}</td>
<td class="text-center">4</td>
<td>Kuantiti (Unit)</td>
<td>{{ number_format($kuantiti, 2) }} TAN</td>
<td>{{ $kuantiti }} TONNES</td>
</tr>
<tr>
<td class="text-center">2</td>
<td>Kod Produk / Deskripsi</td>
<td>{{ $product['kodproduk'] . ' / ' . $product['description'] }}</td>
<td>{{ $product['product_code'] ?? '' }}</td>
<td class="text-center">5</td>
<td>harga kos</td>
<td>{{ 'RM' . number_format($gadai_detail['pinjaman'], 2) }}</td>
@@ -1849,12 +1849,12 @@
<td>{{ $komoditi['no_sijil'] }}</td>
<td class="text-center">4</td>
<td>Kuantiti</td>
<td>{{ number_format($kuantiti, 2) }}</td>
<td>{{ $kuantiti }}</td>
</tr>
<tr>
<td class="text-center">2</td>
<td>Kod Produk / Deskripsi</td>
<td>{{ $product['kodproduk'] . ' / ' . $product['description'] }}</td>
<td>{{ $product['product_code'] ?? '' }}</td>
<td class="text-center">5</td>
<td>Harga Kos</td>
<td>{{ 'RM' . number_format($gadai_detail['pinjaman'], 2) }}</td>
+69
View File
@@ -0,0 +1,69 @@
@extends('layouts.app')
@section('content')
<style>
.shoraka-list-card .table th,
.shoraka-list-card .table td {
vertical-align: middle;
}
.shoraka-list-card .status-badge {
padding: 8px 12px;
font-size: 13px;
font-weight: 500;
white-space: normal;
line-height: 1.5;
}
</style>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb pb-3">
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Komoditi Shoraka</li>
</ol>
</nav>
<div class="card shoraka-list-card">
<div class="card-header bg-secondary d-flex flex-wrap align-items-center justify-content-between">
<h5 class="mb-0 py-2">Komoditi Shoraka</h5>
<a class="btn btn-info btn-sm my-1" href="{{ route('home') }}">
<i class="fas fa-arrow-left mr-1" aria-hidden="true"></i> Kembali ke Paparan Utama
</a>
</div>
<div class="card-body">
<p class="text-muted mb-4">Semak transaksi komoditi Shoraka cawangan ini.</p>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover mb-0">
<thead class="thead-dark">
<tr>
<th scope="col">No. rujukan</th>
<th scope="col">Teller</th>
<th scope="col">Status komoditi</th>
<th scope="col" class="text-center">Tindakan</th>
</tr>
</thead>
<tbody>
@forelse($records as $record)
<tr>
<td class="text-nowrap">{{ $record['norujukan'] }}</td>
<td>{{ $record['teller'] ?: '—' }}</td>
<td>
<span class="badge badge-info status-badge">{{ $record['status'] ?: '—' }}</span>
</td>
<td class="text-center">
<a class="btn btn-info btn-sm" href="{{ route('shoraka.show', $record['norujukan']) }}" aria-label="Buka pembiayaan {{ $record['norujukan'] }}">Buka</a>
</td>
</tr>
@empty
<tr><td colspan="4" class="text-center text-muted py-5">Tiada transaksi.</td></tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -0,0 +1,63 @@
<div id="shoraka-modal" hidden style="position:fixed;inset:0;z-index:20000;background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center;padding:16px">
<div role="dialog" aria-modal="true" aria-labelledby="shoraka-modal-title" tabindex="-1" style="background:#fff;border-radius:5px;padding:24px;max-width:460px;width:100%;text-align:center;box-shadow:0 8px 30px #0003">
<h4 id="shoraka-modal-title">Pembelian Komoditi Shoraka</h4>
<p id="shoraka-modal-message" role="status" aria-live="polite">Sedang memproses pembelian komoditi...</p>
<ol style="text-align:left;padding-left:28px">
<li data-shoraka-step="1">Menyimpan gadaian dan menghantar order</li>
<li data-shoraka-step="2">Menunggu pengesahan Shoraka</li>
<li data-shoraka-step="3">Menyelesaikan pembiayaan</li>
</ol>
<p class="text-muted small">Sila tunggu sehingga proses selesai. Jangan hantar transaksi semula.</p>
<div id="shoraka-modal-spinner" class="spinner-border text-primary" role="status"><span class="sr-only">Sedang memproses</span></div>
</div>
</div>
<script>
window.shorakaProgress = (function () {
var modal = document.getElementById('shoraka-modal');
var previousFocus;
modal.addEventListener('keydown', function (event) {
if (event.key === 'Tab') {
event.preventDefault();
modal.querySelector('[role="dialog"]').focus();
}
});
return function (step, message, stopped) {
if (stopped) {
modal.hidden = true;
modal.style.display = 'none';
if (previousFocus) { previousFocus.focus(); }
return;
}
if (modal.hidden) { previousFocus = document.activeElement; }
modal.hidden = false;
modal.style.display = 'flex';
document.getElementById('shoraka-modal-message').textContent = message || 'Sedang memproses pembelian komoditi...';
modal.querySelectorAll('[data-shoraka-step]').forEach(function (item) {
var number = Number(item.getAttribute('data-shoraka-step'));
item.className = number < step ? 'text-success' : (number === step ? 'text-primary font-weight-bold' : 'text-muted');
if (number === step) { item.setAttribute('aria-current', 'step'); }
else { item.removeAttribute('aria-current'); }
});
modal.querySelector('[role="dialog"]').focus();
};
}());
window.shorakaTrack = function (statusUrl) {
if (window.shorakaTrackTimer) { clearInterval(window.shorakaTrackTimer); }
window.shorakaProgress(1, 'Menyimpan gadaian dan menghantar order...');
window.shorakaTrackTimer = setInterval(function () {
$.get(statusUrl).done(function (body) {
var order = body && body.data && body.data.order;
var status = order && order.status;
if (status === 'Completed') {
clearInterval(window.shorakaTrackTimer);
window.shorakaProgress(3, 'Menyelesaikan pembiayaan...');
} else if (status === 'Cancelled' || status === 'FAILED' || status === 'UNKNOWN') {
clearInterval(window.shorakaTrackTimer);
window.shorakaProgress(2, 'Transaksi Shoraka gagal. Sila tunggu...');
} else if (status) {
window.shorakaProgress(2, 'Menunggu pengesahan Shoraka...');
}
});
}, 1500);
};
</script>
+96
View File
@@ -0,0 +1,96 @@
@extends($isOperasi ? 'layouts.app_operasi' : 'layouts.app')
@section('content')
@php
$listRoute = $isOperasi ? 'operasi.shoraka.index' : 'pc.shoraka.index';
$statusLabels = ['PENDING' => 'PENDING', 'Active' => 'Active', 'Completed' => 'Completed', 'Cancelled' => 'Cancelled', 'UNKNOWN' => 'UNKNOWN', 'FAILED' => 'FAILED'];
@endphp
<div class="container-fluid">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Komoditi Shoraka — {{ $isOperasi ? 'Operasi' : strtoupper(Auth::user()->roles) }}</li>
</ol>
</nav>
<div class="card">
<div class="card-header d-flex flex-wrap justify-content-between align-items-center">
<h5 class="mb-0 py-2">Komoditi Shoraka — {{ $isOperasi ? 'Semua Cawangan' : Auth::user()->cawangan }}</h5>
<a href="{{ route('home') }}" class="btn btn-info btn-sm">Kembali ke Paparan Utama</a>
</div>
<div class="card-body">
<p class="text-muted">Paparan transaksi komoditi Shoraka {{ $isOperasi ? 'semua cawangan' : 'cawangan sendiri' }}.</p>
@if($errors->any())
<div class="alert alert-danger" role="alert">{{ $errors->first() }}</div>
@endif
<form method="get" action="{{ route($listRoute) }}" class="mb-4">
<div class="form-row align-items-end">
@if($isOperasi)
<div class="form-group col-md-3">
<label for="shoraka-branch">Cawangan</label>
<select id="shoraka-branch" name="kodcaw" class="form-control">
<option value="">{{ $isOperasi ? 'Semua cawangan' : Auth::user()->cawangan }}</option>
@foreach($branches as $branch)
<option value="{{ $branch }}" {{ ($filters['kodcaw'] ?? '') === $branch ? 'selected' : '' }}>{{ $branch }}</option>
@endforeach
</select>
</div>
@endif
<div class="form-group col-md-3">
<label for="shoraka-reference">No. rujukan penuh</label>
<input id="shoraka-reference" name="norujukan" class="form-control" maxlength="100" value="{{ $filters['norujukan'] ?? '' }}">
</div>
<div class="form-group col-md-3">
<label for="shoraka-status">Status komoditi</label>
<select id="shoraka-status" name="status" class="form-control">
<option value="">Semua status</option>
@foreach($statusLabels as $status => $label)
<option value="{{ $status }}" {{ ($filters['status'] ?? '') === $status ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
</select>
</div>
<div class="form-group col-md-3">
<label for="shoraka-date-from">Tarikh mula didaftarkan</label>
<input type="date" id="shoraka-date-from" name="date_from" class="form-control" value="{{ $filters['date_from'] ?? '' }}">
</div>
<div class="form-group col-md-3">
<label for="shoraka-date-to">Tarikh akhir didaftarkan</label>
<input type="date" id="shoraka-date-to" name="date_to" class="form-control" value="{{ $filters['date_to'] ?? '' }}">
</div>
<div class="form-group col-md-3">
<button type="submit" class="btn btn-primary">Tapis</button>
<a href="{{ route($listRoute) }}" class="btn btn-secondary">Reset</a>
</div>
</div>
</form>
<p>{{ $records->total() }} rekod</p>
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead class="thead-dark"><tr>
<th scope="col">Cawangan</th>
<th scope="col">No. rujukan</th>
<th scope="col">Teller</th>
<th scope="col">Status komoditi</th>
<th scope="col">Didaftarkan</th>
<th scope="col">Dikemas kini</th>
</tr></thead>
<tbody>
@forelse($records as $record)
<tr>
<td>{{ $record['kodcaw'] }}</td>
<td class="text-nowrap">{{ $record['norujukan'] }}</td>
<td>{{ $record['teller'] ?: '—' }}</td>
<td><span class="badge badge-info p-2">{{ $record['status'] ?: '—' }}</span></td>
<td class="text-nowrap">{{ !empty($record['created_at']) ? \Carbon\Carbon::parse($record['created_at'])->format('d/m/Y H:i') : '—' }}</td>
<td class="text-nowrap">{{ !empty($record['updated_at']) ? \Carbon\Carbon::parse($record['updated_at'])->format('d/m/Y H:i') : '—' }}</td>
</tr>
@empty
<tr><td colspan="6" class="text-center text-muted py-4">Tiada transaksi untuk tapisan ini.</td></tr>
@endforelse
</tbody>
</table>
</div>
{{ $records->links() }}
</div>
</div>
</div>
@endsection
+71
View File
@@ -0,0 +1,71 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb pb-3">
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
<li class="breadcrumb-item"><a href="{{ route('shoraka.index') }}">Komoditi Shoraka</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ $norujukan }}</li>
</ol>
</nav>
<div class="card">
<div class="card-header bg-secondary d-flex flex-wrap align-items-center justify-content-between">
<h5 class="mb-0 py-2">Komoditi Shoraka</h5>
<a class="btn btn-info btn-sm my-1" href="{{ route('shoraka.index') }}">
<i class="fas fa-arrow-left mr-1" aria-hidden="true"></i> Kembali ke senarai
</a>
</div>
<div class="card-body">
@if(!empty($data['simulation']))
<div class="alert alert-warning">SIMULASI LOCAL — tiada transaksi sebenar dihantar ke Shoraka.</div>
@endif
@php
$order = $data['order'] ?? null;
$status = $order['status'] ?? 'Belum dihantar';
$ready = !empty($data['can_complete']);
@endphp
@if($error)<div class="alert alert-danger">{{ $error }}</div>@endif
<p class="text-muted mb-3">No. rujukan: <strong class="text-dark">{{ $norujukan }}</strong></p>
<div class="table-responsive mb-4">
<table class="table table-striped table-bordered mb-0">
<tbody>
<tr>
<th scope="row" class="align-middle">Status komoditi</th>
<td><span class="badge badge-info px-3 py-2">{{ $status }}</span></td>
</tr>
<tr>
<th scope="row">Order ID</th>
<td>{{ $order['order_id'] ?? '—' }}</td>
</tr>
<tr>
<th scope="row">Pembiayaan</th>
<td class="text-nowrap font-weight-bold">RM {{ number_format($data['order_amount'] ?? 0, 2) }}</td>
</tr>
<tr>
<th scope="row">Harga jualan</th>
<td class="text-nowrap font-weight-bold">RM {{ number_format($data['murabaha_amount'] ?? 0, 2) }}</td>
</tr>
</tbody>
</table>
</div>
@if(!$ready)
<div class="alert alert-warning">Bayaran pembiayaan dan SAG ditahan sehingga transaksi komoditi Completed.</div>
@endif
@if(in_array($status, ['UNKNOWN', 'FAILED', 'PENDING']))
<p>Jangan hantar order sekali lagi. Hubungi operasi untuk semakan dengan Shoraka.</p>
@endif
@if($ready)
<div class="d-flex flex-wrap pt-3 mt-4 border-top">
<a class="btn btn-secondary mb-2" href="{{ route('shoraka.certificate', $norujukan) }}">Muat Turun Sijil</a>
</div>
@endif
</div>
</div>
</div>
</div>
</div>
@endsection
+12 -1
View File
@@ -253,6 +253,8 @@ Route::post('/kakitangan/harian',['as'=>'kakitangan.harian','uses'=>'KakitanganC
Route::get('/lelong',['as'=>'lelong','uses'=>'LelongController@lelong']);
Route::get('/khazanah/harga_emas',['as'=>'khazanah.harga_emas','uses'=>'HargaEmasController@index'])->middleware('auth','khazanah');
Route::get('/khazanah/komoditi/bsas',['as'=>'khazanah.bsas','uses'=>'KomuditiController@khazanahBsas'])->middleware('auth','khazanah');
Route::get('/khazanah/komoditi/bsas/ecert/{uuid}',['as'=>'khazanah.bsas.ecert','uses'=>'KomuditiController@showBsasEcert'])->middleware('auth','khazanah');
//Request Teller Batal Route
Route::get('/requestbatal',['as'=>'request.pembatalan','uses'=>'KhazanahController@RequestPembatalan'])->middleware('auth','khazanah');
@@ -422,6 +424,8 @@ Route::group(['middleware' => ['khazanah']], function() {
Route::post('/barcodescanned',['as'=>'barcode.scanned','uses'=>'KhazanahController@barcodescanned'])->middleware('auth','khazanah');
//Operasi
Route::get('/pc/shoraka', 'ShorakaController@pcIndex')->name('pc.shoraka.index')->middleware('auth', 'khazanah');
Route::get('/operasi/shoraka', 'ShorakaController@operasiIndex')->name('operasi.shoraka.index')->middleware('auth', 'operasi');
Route::get('/operasi/kelulusan','OperasiController@kelulusan')->name('operasi.kelulusan')->middleware('auth','operasi');
Route::get('/operasi/kelulusan/anggota','OperasiController@kelulusanAnggota')->name('operasi.kelulusananggota')->middleware('auth','operasi');
Route::post('/operasi/createkelulusan',['as'=>'operasi.createkelulusan','uses'=>'OperasiController@createkelulusan'])->middleware('auth','teller');
@@ -455,6 +459,8 @@ Route::get('/operasi/marginmutu/edit',['as'=>'operasi.marginmutu.edit','uses'=>'
Route::get('/komoditi',['as'=>'komuditi','uses'=>'KomuditiController@index']);
Route::get('/komoditi/rekod',['as'=>'rekod.komoditi','uses'=>'KomuditiController@rekodKomoditi']);
Route::get('/komoditi/rekod/print',['as'=>'komoditi.rekod.print','uses'=>'KomuditiController@printRekodTransaksi']);
Route::get('/komoditi/bsas/ecert/preview',['as'=>'komoditi.bsas.ecert.preview','uses'=>'KomuditiController@previewBsasEcert'])->middleware('auth','operasi');
Route::get('/komoditi/bsas/ecert/{uuid}',['as'=>'komoditi.bsas.ecert','uses'=>'KomuditiController@showBsasEcert'])->middleware('auth','operasi');
Route::post('/khazanah/suratakuangadaian',['as'=>'agh.create','uses'=>'KhazanahController@SuratAkuanGadaian'])->middleware('auth','khazanah');
Route::post('/khazanah/suratakuangadaianedit',['as'=>'agh.update','uses'=>'KhazanahController@SuratAkuanGadaianUpdate'])->middleware('auth','khazanah');
@@ -607,4 +613,9 @@ Route::post('/pampasan/terima',['as' => 'pampasan.terima', 'uses' => 'KhazanahCo
Route::get(('/pampasan/resit'), ['as' => 'pampasan.resit', 'uses' => 'KhazanahController@resitPampasan'])->middleware('auth', 'khazanah');
//Surat Pampasan
Route::get('/pampasan/surat/{norujukan}', ['as' => 'pampasan.surat', 'uses' => 'KhazanahController@suratPampasan'])->middleware('auth', 'role:teller,khazanah');
Route::get('/pampasan/surat/{norujukan}', ['as' => 'pampasan.surat', 'uses' => 'KhazanahController@suratPampasan'])->middleware('auth', 'role:teller,khazanah');
Route::group(['prefix' => 'shoraka', 'middleware' => ['auth', 'role:teller,penilai,khazanah,admin,masteradmin,operasi']], function () {
Route::get('/', 'ShorakaController@index')->name('shoraka.index');
Route::get('/{norujukan}', 'ShorakaController@show')->name('shoraka.show');
Route::get('/{norujukan}/certificate', 'ShorakaController@certificate')->name('shoraka.certificate');
});