Codebase update
- update jomweb/billplz package - refactor controllers, views with means of to simplify data fetch and manipuation
This commit is contained in:
@@ -2,226 +2,147 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use Billplz\Client;
|
||||
use Session;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Adapter\Guzzle6\Client as GuzzleHttpClient;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
use Money\Money;
|
||||
|
||||
use App\Services\BillplzService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Log\Logger;
|
||||
use Illuminate\Http\Client\Pool;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Money\Money;
|
||||
|
||||
class BayaranController extends Controller
|
||||
{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
if(config('app.env') != 'production'){
|
||||
$this->api_key = 'abecfd0c-98d8-4635-abc2-2fcba8c60c11';
|
||||
$this->XSignature_Key = 'S-GWr7z03XjAhqPsFfu_H5nQ';
|
||||
$this->collection_id = '5aosv2dg';
|
||||
}else{
|
||||
$this->api_key = 'f3e82fe1-a422-4660-97f0-65cc59ff6c47';
|
||||
$this->XSignature_Key = 'S-alZUbzmD2_TF3vmrRqgehQ';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function SenaraiPembayaran()
|
||||
{
|
||||
|
||||
$api_url = config('api.url');
|
||||
|
||||
$arraysag = [];
|
||||
|
||||
$auth_user = Auth::user();
|
||||
|
||||
$belum_tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $auth_user['icno'] . '/gadai/' . 'belum_tebus')->json();
|
||||
|
||||
if(is_array($belum_tebus))
|
||||
{
|
||||
if(sizeof($belum_tebus) > 0)
|
||||
{
|
||||
foreach($belum_tebus as $index=>$bt)
|
||||
{
|
||||
foreach($bt as $index1=>$bet)
|
||||
{
|
||||
array_push($arraysag,$bet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$belum_tebus = $arraysag;
|
||||
|
||||
// return view('pembayaran.senaraibayaran', compact('belum_tebus'));
|
||||
return view('includes.bayaran.senaraibayaransag', compact('belum_tebus','api_url'));
|
||||
}
|
||||
|
||||
public function PembayaranAction(Request $request)
|
||||
{
|
||||
|
||||
|
||||
$validated = $request->validate([
|
||||
'chkboxsag' => 'required',
|
||||
]);
|
||||
|
||||
$arraybayar = array();
|
||||
$norujukanList = $request->chkboxsag;
|
||||
|
||||
foreach($request->chkboxsag as $index=>$sag)
|
||||
{
|
||||
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/norujukan/'. $sag)->json();
|
||||
$arraybayar = array_map(fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x)->json()[0][0], $norujukanList);
|
||||
|
||||
$sagonline = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/portal/searchsagonline/',['norujukan' => $sag])->json();
|
||||
$norujukanRecentlyAttemptPayment = array_map(
|
||||
fn($x) => Http::arrahn()->get('/portal/searchsagonline/', ['norujukan' => $x])->json(),
|
||||
$norujukanList
|
||||
);
|
||||
|
||||
if($sagonline == true)
|
||||
return redirect()->route('home')->with('errorsagonline','Sila Tunggu Sebentar!');
|
||||
//$array_lelong = Http::withOptions(['verify' => config('app.api_verify')])->get('https://niklah.arrahn.com.my/api/portalApi',['norujukan' => $sag])->json();
|
||||
//if($array_lelong['lelong'] !== null){
|
||||
// return redirect()->route('home')->with('error','Barangan Sedang Dilelong.');
|
||||
//}
|
||||
$isNorujukanRecentlyAttemptPayment = in_array(true, $norujukanRecentlyAttemptPayment);
|
||||
|
||||
if($gadai[0][0]['tempoh'] >= 12){
|
||||
// return redirect()->route('home')->with('error','SAG Yang Dipilih melebihi tempoh 12 bulan ke atas.');
|
||||
return redirect()->route('home')->with('error','SAG Yang Dipilih Akan/Telah Tamat Kontrak 12 Bulan. Sila Hadir Ke Kaunter Cawangan Untuk Pembayaran/Penebusan.');
|
||||
}
|
||||
|
||||
$arraybayar[] = $gadai[0][0];
|
||||
if ($isNorujukanRecentlyAttemptPayment) {
|
||||
return redirect()->route('home')->with('errorsagonline', 'Sila Tunggu Sebentar!');
|
||||
}
|
||||
|
||||
$gadaiContractExceed12Month = array_filter($arraybayar, fn($x) => $x['tempoh'] >= 12);
|
||||
|
||||
// return view('pembayaran.checkout',compact('arraybayar'));
|
||||
return view('includes.bayaran.pembayaransag',compact('arraybayar'));
|
||||
$isGadaiContractExceed12Month = sizeof($gadaiContractExceed12Month) > 0;
|
||||
|
||||
if ($isGadaiContractExceed12Month) {
|
||||
return redirect()->route('home')->with('error', 'SAG Yang Dipilih Akan/Telah Tamat Kontrak 12 Bulan. Sila Hadir Ke Kaunter Cawangan Untuk Pembayaran/Penebusan.');
|
||||
}
|
||||
|
||||
return view('includes.bayaran.pembayaransag', compact('arraybayar'));
|
||||
}
|
||||
|
||||
public function PembayaranEngine(Request $request)
|
||||
public function PembayaranEngine(Request $request, BillplzService $billplzService)
|
||||
{
|
||||
// $arraybayaran = array();
|
||||
['email' => $customerEmail, 'notel' => $customerPhoneNumber, 'name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray();
|
||||
|
||||
// dd($request);
|
||||
// foreach($request->txtnorujukanhidden as $index1=>$norujukan)
|
||||
// {
|
||||
// // $updategadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/gadai/'. $request->txtkodcawhidden[$index1] .'/norujukan/' . $norujukan,[
|
||||
// // 'bayaran' => $request->txtbayaranhidden[$index1]
|
||||
// // ])->json();
|
||||
$bayaranArrahn = array_filter($request->txtjenisbayaran, fn($x) => $x == 'arrahn');
|
||||
$bayaranOthers = array_filter($request->txtjenisbayaran, fn($x) => $x != 'arrahn');
|
||||
|
||||
$bayaranArrahnArray = array_map(function ($x) use ($customerName, $customerIcno, $request) {
|
||||
return [
|
||||
'customer_name' => $customerName,
|
||||
'nokp' => $customerIcno,
|
||||
'kodcaw' => $request->txtkodcawhidden[$x],
|
||||
'norujukan' => $request->txtnorujukanhidden[$x],
|
||||
'bayaran' => $request->txtbayaranhidden[$x],
|
||||
'txtjbghidden' => $request->txtjbghidden[$x],
|
||||
'txtupahhidden' => $request->txtupahhidden[$x],
|
||||
];
|
||||
}, array_keys($bayaranArrahn));
|
||||
|
||||
// array_push($arraybayaran,['norujukan' => $norujukan, 'kodcaw' => $request->txtkodcawhidden[$index1], 'bayaran' => $request->txtbayaranhidden[$index1]]);
|
||||
// }
|
||||
$bayaranOthersArray = array_map(function ($x) use ($customerName, $customerIcno, $request) {
|
||||
return [
|
||||
'customer_name' => $customerName,
|
||||
'nokp' => $customerIcno,
|
||||
'kodcaw' => $request->txtkodcawhidden[$x],
|
||||
'norujukan' => $request->txtnorujukanhidden[$x],
|
||||
'bayaran' => $request->txtbayaranhidden[$x],
|
||||
];
|
||||
}, array_keys($bayaranOthers));
|
||||
|
||||
// $arraycollection_id = array();
|
||||
$collection_id = '5aosv2dg';
|
||||
$paymentArray = array_merge($bayaranArrahnArray, $bayaranOthersArray);
|
||||
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
$getPaymentSum = function () use ($paymentArray) {
|
||||
$billPlzTransactionFee = Money::MYR(100);
|
||||
$sum = fn() => array_reduce($paymentArray, fn($accumulator, $currentItem) => $accumulator + round($currentItem['bayaran'], 1), 0) * 100;
|
||||
return Money::MYR($sum())->add($billPlzTransactionFee);
|
||||
};
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$bill = $billplzService->createBill([
|
||||
$customerEmail,
|
||||
$customerPhoneNumber,
|
||||
$customerName,
|
||||
$getPaymentSum(),
|
||||
]);
|
||||
|
||||
$billplz->useVersion('v4');
|
||||
$isRecordTransactionSuccess = $this->recordTransaction($paymentArray, $bill);
|
||||
|
||||
$bill = $billplz->bill();
|
||||
if ($isRecordTransactionSuccess) {
|
||||
session([
|
||||
'array_payment' => $paymentArray,
|
||||
'payment_method' => 'login',
|
||||
]);
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
|
||||
$array_payment = [];
|
||||
|
||||
$total_bayaran = 0;
|
||||
|
||||
foreach($request->txtnorujukanhidden as $index1=>$norujukan)
|
||||
{
|
||||
if($request->txtjenisbayaran[$index1] == 'arrahn')
|
||||
{
|
||||
array_push($array_payment,['customer_name' => Auth::user()->name,'kodcaw'=>$request->txtkodcawhidden[$index1],'norujukan'=>$norujukan,'bayaran'=>$request->txtbayaranhidden[$index1],'jbg' => $request->txtjbghidden[$index1],'upah' => $request->txtupahhidden[$index1]]);
|
||||
Session::put('payment_jenis','arrahn');
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($array_payment,['customer_name' => Auth::user()->name,'nokp' => Auth::user()->icno,'kodcaw'=>$request->txtkodcawhidden[$index1],'norujukan'=>$norujukan,'bayaran'=>round($request->txtbayaranhidden[$index1],1)]);
|
||||
}
|
||||
|
||||
//$total_bayaran += $request->txtbayaranhidden[$index1];
|
||||
$total_bayaran += round($request->txtbayaranhidden[$index1],1);
|
||||
return redirect($bill['url'] . '?auto_submit=true');
|
||||
}
|
||||
|
||||
$total_bayaran = ($total_bayaran * 100) + 100;
|
||||
}
|
||||
|
||||
Session::put('array_payment',$array_payment);
|
||||
Session::put('payment_method','login');
|
||||
Session::save();
|
||||
public function recordTransaction($paymentArray, $bill)
|
||||
{
|
||||
|
||||
// foreach($request->txtkodcawhidden as $index2=>$kodcaw)
|
||||
// {
|
||||
// if(config('app.env') != 'production'){
|
||||
// $collection_id = $this->collection_id;
|
||||
// }else{
|
||||
// $collection_id = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url'). '/api/billplz/collectionid',[
|
||||
// 'kodcaw' => $kodcaw
|
||||
// ])->json();
|
||||
// }
|
||||
// array_push($arraycollection_id,$collection_id);
|
||||
// }
|
||||
['name' => $customerName, 'icno' => $customerIcno] = auth()->user()->toArray();
|
||||
|
||||
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
Auth::user()->email,
|
||||
Auth::user()->notel,
|
||||
Auth::user()->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.callback'),
|
||||
'Bayaran Ansuran',
|
||||
['redirect_url' => route('pay.paymentStatus')]
|
||||
);
|
||||
|
||||
$billcode = $response->toArray();
|
||||
|
||||
foreach($array_payment as $index1=>$arraypay)
|
||||
{
|
||||
$previous_siri = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/online/transaction')->json();
|
||||
if($previous_siri){
|
||||
$nosiri = $previous_siri['nosiri'] + 1;
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
$getlatestNoSiri = function () {
|
||||
$previous_siri = Http::arrahn()->get('/api/online/transaction')->json();
|
||||
if ($previous_siri) {
|
||||
return $previous_siri['nosiri'] + 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
$reference_no = 'APKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
$generateTransactionReferenceNumber = function () use ($getlatestNoSiri) {
|
||||
[$day, $month, $year] = [now()->day, now()->month, now()->format('y')];
|
||||
|
||||
$new_transaction = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url') . '/api/online/transaction',[
|
||||
'nokp'=> Auth::user()->icno,
|
||||
'reference_no'=> $reference_no,
|
||||
'nosiri'=> $nosiri,
|
||||
'billplz_id' => $billcode['id'],
|
||||
'norujukan' => $arraypay['norujukan'],
|
||||
'kodcaw' => $arraypay['kodcaw'],
|
||||
'total_payment'=> $arraypay['bayaran'],
|
||||
'customer_name' => Auth::user()->name,
|
||||
])->json();
|
||||
return 'APKB' . $day . $month . $year . sprintf("%08d", $getlatestNoSiri());
|
||||
};
|
||||
|
||||
}
|
||||
Http::pool(fn(Pool $pool) =>
|
||||
collect($paymentArray)->map(fn($payment) =>
|
||||
$pool->arrahn()->post('/api/online/transaction', [
|
||||
'nokp' => $customerIcno,
|
||||
'reference_no' => $generateTransactionReferenceNumber(),
|
||||
'nosiri' => $getlatestNoSiri(),
|
||||
'billplz_id' => $bill['id'],
|
||||
'norujukan' => $payment['norujukan'],
|
||||
'kodcaw' => $payment['kodcaw'],
|
||||
'total_payment' => $payment['bayaran'],
|
||||
'customer_name' => $customerName,
|
||||
])
|
||||
)
|
||||
);
|
||||
|
||||
$tagportal = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/transaction/online/tagportal',[
|
||||
'billplz_id'=> $billcode['id']
|
||||
])->json();
|
||||
Http::arrahn()->put('/api/transaction/online/tagportal', [
|
||||
'billplz_id' => $bill['id'],
|
||||
])->json();
|
||||
|
||||
return redirect($billcode['url'] . '?auto_submit=true');
|
||||
|
||||
// return view('pembayaran.result.berjaya',compact('arraybayaran'));
|
||||
return true;
|
||||
}
|
||||
|
||||
public function ResitBayaran(Request $request)
|
||||
@@ -230,160 +151,134 @@ class BayaranController extends Controller
|
||||
|
||||
$kpbaru = Auth::User()->icno;
|
||||
|
||||
$customer = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/customers/'.$kpbaru)->json();
|
||||
$customer = Http::arrahn()->get('/api/customers/' . $kpbaru)->json();
|
||||
$customer_details = $customer;
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$date = $current->toDateTimeString();
|
||||
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $payment_details['kodcaw'])->json();
|
||||
$cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/'. $payment_details['kodcaw'])->json();
|
||||
$cawangan_detail = $cawangan[0];
|
||||
$nama_cawangan = $cawangan_info['details_caw'];
|
||||
$cawangan_info = Http::arrahn()->get('/api/cawangan/' . $payment_details['kodcaw'])->json();
|
||||
$cawangan = Http::arrahn()->get('/api/cawangan/detail/' . $payment_details['kodcaw'])->json();
|
||||
$cawangan_detail = $cawangan[0];
|
||||
$nama_cawangan = $cawangan_info['details_caw'];
|
||||
|
||||
$gadai_details = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/gadai/norujukan/'.$payment_details['norujukan'])->json();
|
||||
$gadai = $gadai_details[0][0];
|
||||
// if($gadai_details[0][0]['hargajualan'] > 0)
|
||||
// {
|
||||
// $baki_harga_jualan_sebelum = $gadai_details[0][0]['bakihargajualan'] + $payment_details['total_payment'];
|
||||
// $baki_harga_jualan_semasa = $gadai_details[0][0]['bakihargajualan'];
|
||||
$gadai_details = Http::arrahn()->get('/api/gadai/norujukan/' . $payment_details['norujukan'])->json();
|
||||
$gadai = $gadai_details[0][0];
|
||||
|
||||
return view('pembayaran.resit.resitportal',compact('customer_details','payment_details','cawangan_detail','nama_cawangan','gadai'));
|
||||
// }else{
|
||||
|
||||
// $gadai_details = $gadai_details[0][0];
|
||||
|
||||
// $koskeuntungan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahbukantawarruq/' . $payment_details['kodcaw'] . '/' . $payment_details['norujukan'])->json();
|
||||
|
||||
// $jbg = $gadai_details['jbg'];
|
||||
|
||||
// return view('pembayaran.resit.resit_baru_sebelum',compact('customer_details','payment_details','date','koskeuntungan','jbg'));
|
||||
// }
|
||||
return view('pembayaran.resit.resitportal', compact('customer_details', 'payment_details', 'cawangan_detail', 'nama_cawangan', 'gadai'));
|
||||
|
||||
}
|
||||
|
||||
public function callback(Request $request, BillplzService $billplzService)
|
||||
{
|
||||
$data = $billplzService->webhook($request->toArray());
|
||||
|
||||
public function callback(Request $request){
|
||||
logger('REQUEST');
|
||||
logger($request);
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
$isBillUnpaid = $data['paid'] !== true;
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$billplz->useVersion('v4');
|
||||
if ($isBillUnpaid) {
|
||||
Http::arrahn()->put('/api/online/transaction', [
|
||||
'billplz_id' => $data['id'],
|
||||
'status' => 'UNSUCCESSFUL',
|
||||
'paid_at' => null,
|
||||
]);
|
||||
|
||||
$bill = $billplz->bill();
|
||||
return response(200);
|
||||
|
||||
$data = $bill->webhook($request->toArray());
|
||||
}
|
||||
|
||||
if($data['billplz']['paid'] == 'true'){
|
||||
Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/online/transaction',[
|
||||
'billplz_id' => $data['billplz']['id'],
|
||||
'status' => 'PAID',
|
||||
'paid_at' => $data['billplz']['paid_at']
|
||||
]);
|
||||
Http::arrahn()->put('/api/online/transaction', [
|
||||
'billplz_id' => $data['id'],
|
||||
'status' => 'PAID',
|
||||
'paid_at' => $data['paid_at']->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
$transactionOnline = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/transaction/online/express',[
|
||||
'billplz_id' => $data['billplz']['id']
|
||||
])->json();
|
||||
return response(200);
|
||||
}
|
||||
|
||||
// \Mail::to(Auth::user()->email)->send(new \App\Mail\BayaranMail($array_payment));
|
||||
public function response(Request $request, BillplzService $billplzService)
|
||||
{
|
||||
|
||||
// return redirect()->route('pay.success',[
|
||||
// 'transactionOnline' => $transactionOnline
|
||||
// ]);
|
||||
return response(200);
|
||||
$data = $billplzService->redirect($request->toArray());
|
||||
|
||||
}else{
|
||||
Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/online/transaction',[
|
||||
'billplz_id' => $data['billplz']['id'],
|
||||
'status' => 'UNSUCCESSFUL',
|
||||
'paid_at' => null
|
||||
]);
|
||||
$isBillUnpaid = $data['paid'] !== true;
|
||||
|
||||
// return redirect()->route('pay.failed');
|
||||
return response(500);
|
||||
}
|
||||
}
|
||||
if ($isBillUnpaid) {
|
||||
Http::arrahn()->put('/api/online/transaction', [
|
||||
'billplz_id' => $data['id'],
|
||||
'status' => 'UNSUCCESSFUL',
|
||||
'paid_at' => null,
|
||||
]);
|
||||
|
||||
public function response(Request $request){
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
);
|
||||
$transactionOnline = Http::arrahn()->get('/api/transaction/online/login', [
|
||||
'billplz_id' => $data['id'],
|
||||
])->json();
|
||||
|
||||
$billplz = new Client($http, $this->api_key);
|
||||
if(config('app.env') != 'production'){
|
||||
$billplz->useSandbox();
|
||||
}
|
||||
$billplz->useVersion('v4');
|
||||
return redirect()->route('pay.failed');
|
||||
|
||||
$bill = $billplz->bill();
|
||||
}
|
||||
|
||||
$data = $bill->webhook($request->toArray());
|
||||
if($data['billplz']['paid'] == 'true'){
|
||||
Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/online/transaction',[
|
||||
'billplz_id' => $data['billplz']['id'],
|
||||
'status' => 'PAID',
|
||||
'paid_at' => $data['billplz']['paid_at']
|
||||
]);
|
||||
Http::arrahn()->put('/api/online/transaction', [
|
||||
'billplz_id' => $data['id'],
|
||||
'status' => 'PAID',
|
||||
'paid_at' => $data['paid_at']->format('Y-m-d H:i:s'),
|
||||
]);
|
||||
|
||||
$transactionOnline = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/transaction/online/login',[
|
||||
'billplz_id' => $data['billplz']['id']
|
||||
])->json();
|
||||
$transactionOnline = Http::arrahn()->get('/api/transaction/online/login', [
|
||||
'billplz_id' => $data['id'],
|
||||
])->json();
|
||||
|
||||
return redirect()->route('pay.success',[
|
||||
'transactionOnline' => $transactionOnline
|
||||
]);
|
||||
return redirect()->route('pay.success', [
|
||||
'transactionOnline' => $transactionOnline,
|
||||
]);
|
||||
|
||||
}else{
|
||||
Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url') . '/api/online/transaction',[
|
||||
'billplz_id' => $data['billplz']['id'],
|
||||
'status' => 'UNSUCCESSFUL',
|
||||
'paid_at' => null
|
||||
]);
|
||||
return redirect()->route('pay.failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function successPayment(Request $request){
|
||||
$transactionOnline = $request->transactionOnline;
|
||||
public function successPayment(Request $request)
|
||||
{
|
||||
$transactionOnline = $request->transactionOnline;
|
||||
|
||||
// dd($transactionOnline);
|
||||
$arraygadai = array_map(
|
||||
fn($x) => Http::arrahn()->get('/api/gadai/norujukan/' . $x['norujukan'])->json()[0][0],
|
||||
$transactionOnline
|
||||
);
|
||||
|
||||
$arraygadai = array();
|
||||
$arraycawangan = array();
|
||||
// dd($transactionOnline);
|
||||
foreach($transactionOnline as $index1=>$trans)
|
||||
{
|
||||
$cawangan_info = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/'. $trans['kodcaw'])->json();
|
||||
$cawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/'. $trans['kodcaw'])->json();
|
||||
$cawangan_detail = $cawangan[0];
|
||||
$nama_cawangan = $cawangan_info['details_caw'];
|
||||
$gadai = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/gadai/norujukan/'.$trans['norujukan'])->json();
|
||||
$gadai = $gadai[0][0];
|
||||
$arraycawangan = array_map(
|
||||
fn($x) => Http::arrahn()->get('/api/cawangan/detail/' . $x['kodcaw'])->json()[0],
|
||||
$transactionOnline
|
||||
);
|
||||
|
||||
array_push($arraygadai,$gadai);
|
||||
array_push($arraycawangan,$cawangan_detail);
|
||||
return view('pembayaran.result.berjayaportal', compact('transactionOnline', 'arraycawangan', 'arraygadai'));
|
||||
}
|
||||
|
||||
public function failedPayment()
|
||||
{
|
||||
return view('pembayaran.result.gagalportal');
|
||||
}
|
||||
|
||||
}
|
||||
public function SenaraiPembayaran()
|
||||
{
|
||||
|
||||
// dd($arraygadai,$arraycawangan);
|
||||
$api_url = config('api.url');
|
||||
|
||||
// return view('pembayaran.result.berjaya',compact('transactionOnline','arraycawangan','arraygadai'));
|
||||
return view('pembayaran.result.berjayaportal',compact('transactionOnline','arraycawangan','arraygadai'));
|
||||
}
|
||||
$arraysag = [];
|
||||
|
||||
public function failedPayment(){
|
||||
// return view('pembayaran.result.gagal');
|
||||
return view('pembayaran.result.gagalportal');
|
||||
}
|
||||
$auth_user = Auth::user();
|
||||
|
||||
$belum_tebus = Http::arrahn()->get('/api/customers/' . $auth_user['icno'] . '/gadai/' . 'belum_tebus')->json();
|
||||
|
||||
if (is_array($belum_tebus)) {
|
||||
if (sizeof($belum_tebus) > 0) {
|
||||
foreach ($belum_tebus as $index => $bt) {
|
||||
foreach ($bt as $index1 => $bet) {
|
||||
array_push($arraysag, $bet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$belum_tebus = $arraysag;
|
||||
|
||||
return view('includes.bayaran.senaraibayaransag', compact('belum_tebus', 'api_url'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\BillplzService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BillplzTransactionReviewController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, BillplzService $billplzService)
|
||||
{
|
||||
$date = $request->date ?? Carbon::now()->toDateString();
|
||||
|
||||
$billplzTransactionReview = $billplzService->getBillplzTransactionReview($date);
|
||||
|
||||
return response()->json($billplzTransactionReview, 200);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
use App\Services\PembiayaanService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
private $pembiayaanService;
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(PembiayaanService $pembiayaanService)
|
||||
{
|
||||
$this->middleware(['auth','verified']);
|
||||
$this->pembiayaanService = $pembiayaanService;
|
||||
$this->middleware(['auth', 'verified']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,67 +26,27 @@ class HomeController extends Controller
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
// $harga_emas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/harga_emas/')->json();
|
||||
$pembiayaan = $this->pembiayaanService->getPembiayaan($request->filter);
|
||||
|
||||
// $hargaemasterdahulu = array();
|
||||
$authUser = Auth::user();
|
||||
$customerInfo = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get(config('api.url') . '/portal/customer/info', ['ic' => $authUser['icno']])
|
||||
->json();
|
||||
|
||||
// foreach($harga_emas as $index=>$harga)
|
||||
// {
|
||||
// $hargaemassandaran = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/harga_emas/rekod/sandaran',['karat' => $harga['karat']])->json();
|
||||
['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo;
|
||||
|
||||
// $percentnaik = (floatval($harga['harga']) - floatval($hargaemassandaran[1]['harga'])) / ($hargaemassandaran[1]['harga']) * 100;
|
||||
$formatMoney = fn($x) => number_format($x, 2);
|
||||
$getTotal = fn($x) => array_reduce($x, fn($accumulator, $current_item) => $accumulator + $current_item['bakipjm'], 0);
|
||||
$total = $formatMoney($getTotal($customer_gadai));
|
||||
|
||||
// array_push($hargaemasterdahulu,['karat' => $harga['karat'],'hargasemasa' => $harga['harga'], 'hargadahulu' => $hargaemassandaran[1]['harga'],'percent' => $percentnaik]);
|
||||
$sixMonths = sizeOf(array_filter($customer_gadai, fn($x) => $x['tempoh'] >= 6));
|
||||
|
||||
// }
|
||||
$bilanganLelong = sizeOf($customer_lelong);
|
||||
|
||||
$CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']]);
|
||||
//dd($CustomerInfo)
|
||||
$bilangan = sizeof($customer_gadai) + sizeOf($customer_lelong);
|
||||
|
||||
$total = 0.00;
|
||||
$sixmonths = 0;
|
||||
$bilangan = 0;
|
||||
foreach($CustomerInfo['gadai'] as $index=>$gadai)
|
||||
{
|
||||
$bilangan++;
|
||||
$total += $gadai['bakipjm'];
|
||||
|
||||
if($gadai['tempoh'] >= 6)
|
||||
{
|
||||
$sixmonths++;
|
||||
}
|
||||
}
|
||||
|
||||
$bilanganlelong = 0;
|
||||
foreach($CustomerInfo['lelong'] as $index1=>$lelong)
|
||||
{
|
||||
$bilangan++;
|
||||
$bilanganlelong += 1;
|
||||
}
|
||||
|
||||
// $arraysag = [];
|
||||
// $belum_tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $auth_user['icno'] . '/gadai/' . 'belum_tebus')->json();
|
||||
|
||||
// if(is_array($belum_tebus))
|
||||
// {
|
||||
// if(sizeof($belum_tebus) > 0)
|
||||
// {
|
||||
// foreach($belum_tebus as $index=>$bt)
|
||||
// {
|
||||
// foreach($bt as $index1=>$bet)
|
||||
// {
|
||||
// array_push($arraysag,$bet);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// $belum_tebus = $arraysag;
|
||||
$api_url = config('api.url');
|
||||
|
||||
return view('includes.home',compact('api_url','bilangan','sixmonths','total','bilanganlelong'));
|
||||
return view('includes.home', compact('bilangan', 'sixMonths', 'total', 'bilanganLelong', 'pembiayaan'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
@@ -23,6 +25,14 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
Http::macro('arrahn', function () {
|
||||
return Http::withOptions(['verify' => config('app.api_verify')])->baseUrl(config('api.url'));
|
||||
});
|
||||
|
||||
PendingRequest::macro('arrahn', function () {
|
||||
$this->options['verify'] = config('app.api_verify');
|
||||
$this->baseUrl(config('api.url'));
|
||||
return $this;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Http\Client\Pool;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class BayaranHistoryService
|
||||
{
|
||||
public $norujukanList;
|
||||
|
||||
public function __construct($norujukanList) {
|
||||
$this->norujukanList = $norujukanList;
|
||||
}
|
||||
|
||||
public function getBayaranHistory()
|
||||
{
|
||||
$getBayaranHistory = function () {
|
||||
return Http::pool(function (Pool $pool){
|
||||
foreach ($this->norujukanList as $norujukan) {
|
||||
$pool->get(config('api.url') . '/api/transaction/' . $norujukan);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$bayaranHistoryResponse = array_map(fn($x) => $x->json(), $getBayaranHistory());
|
||||
|
||||
$formatBayaranHistoryData = function ($x) {
|
||||
if (sizeof($x) === 0) {
|
||||
return $x;
|
||||
}
|
||||
|
||||
$formatDate = fn($x) => Carbon::parse($x)->format('d/m/Y');
|
||||
$setResitAnsuranLink = fn($x) => route("resit.ansuran", $x);
|
||||
|
||||
return array_map(function ($y) use ($formatDate, $setResitAnsuranLink) {
|
||||
$y['created_at'] = $formatDate($y['created_at']);
|
||||
$y['resit_ansuran_link'] = $setResitAnsuranLink($y['id']);
|
||||
return $y;
|
||||
}, $x);
|
||||
};
|
||||
|
||||
return array_map($formatBayaranHistoryData, $bayaranHistoryResponse);
|
||||
}
|
||||
|
||||
public static function from($norujukanList)
|
||||
{
|
||||
return new static($norujukanList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Billplz\Client;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class BillplzService
|
||||
{
|
||||
public $client;
|
||||
public $config;
|
||||
public $callbackUrl;
|
||||
public $paymentTitle;
|
||||
public $redirectUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$appEnvironment = config('app.env');
|
||||
$billplzConfig = $appEnvironment == 'production' ? config('services.billplz.production') : config('services.billplz.sandbox');
|
||||
|
||||
$client = Client::make($billplzConfig['api_key'], $billplzConfig['x_signature']);
|
||||
$client->useVersion('v4');
|
||||
|
||||
if ($appEnvironment != 'production') {
|
||||
$client->useSandbox();
|
||||
}
|
||||
|
||||
$this->callbackUrl = route('pay.callback');
|
||||
$this->redirectUrl = ['redirect_url' => route('pay.paymentStatus')];
|
||||
$this->paymentTitle = "Pembayaran Ansuran";
|
||||
$this->config = $billplzConfig;
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function getCollections()
|
||||
{
|
||||
return $this->client->collection()->all()->toArray();
|
||||
}
|
||||
|
||||
public function createBill(array $data)
|
||||
{
|
||||
$composed_data = [
|
||||
$this->config['collection_id'],
|
||||
...$data,
|
||||
$this->callbackUrl,
|
||||
$this->paymentTitle,
|
||||
$this->redirectUrl,
|
||||
];
|
||||
|
||||
return $this->client->bill()->create(...$composed_data)->toArray();
|
||||
}
|
||||
|
||||
public function redirect($request)
|
||||
{
|
||||
return $this->client->bill()->redirect($request);
|
||||
}
|
||||
|
||||
public function webhook($request)
|
||||
{
|
||||
return $this->client->webhook($request);
|
||||
}
|
||||
|
||||
public function getTransactions($date)
|
||||
{
|
||||
$arrahnTransactions = $this->getArrahnTransactions($date);
|
||||
$billplzID = collect($arrahnTransactions)->pluck('billplz_id')->unique()->values();
|
||||
|
||||
$billplzTransactions = collect($billplzID)->map(function ($billId) {
|
||||
return $this->client->transaction()->get($billId)->toArray();
|
||||
})
|
||||
->map(function ($data) {
|
||||
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);
|
||||
$billId = ['bill_id' => $data['bill_id']];
|
||||
return array_merge($billId, $latestTransaction);
|
||||
})
|
||||
->keyBy('bill_id');
|
||||
|
||||
return $billplzTransactions;
|
||||
}
|
||||
|
||||
public function getArrahnTransactions($date)
|
||||
{
|
||||
return Http::arrahn()->get('/api/transaction/online/query', ['date' => $date])->json();
|
||||
}
|
||||
|
||||
public function getBillplzTransactionReview($date)
|
||||
{
|
||||
$arrahnTransactions = $this->getArrahnTransactions($date);
|
||||
$arrahnTransactionsGroupedByBill = collect($arrahnTransactions)->groupBy('billplz_id');
|
||||
$billplzID = $arrahnTransactionsGroupedByBill->keys();
|
||||
$billplzTransactions = $this->getTransactions($date);
|
||||
|
||||
$merged = $billplzID->map(function ($billId) use ($arrahnTransactionsGroupedByBill, $billplzTransactions) {
|
||||
return [
|
||||
'bill_id' => $billId,
|
||||
'arrahn_transactions' => $arrahnTransactionsGroupedByBill->get($billId)->toArray(),
|
||||
'billplz_latest_transaction' => $billplzTransactions->get($billId),
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
$summarizedBillplzTransactions = collect($merged)->map(function ($data) {
|
||||
$data['arrahn_transactions'] = collect($data['arrahn_transactions'])->map(function ($transaction) {
|
||||
return[
|
||||
'nokp' => $transaction['nokp'],
|
||||
'norujukan' => $transaction['norujukan'],
|
||||
'kodcaw' => $transaction['kodcaw'],
|
||||
'total_payment' => $transaction['total_payment'],
|
||||
'customer_name' => $transaction['customer_name'],
|
||||
'status' => $transaction['status'],
|
||||
'paid_at' => $transaction['paid_at'],
|
||||
'portal' => $transaction['tagportal'] == 1 ? 'Arrahn Pay' : 'SPARE',
|
||||
];
|
||||
});
|
||||
|
||||
return $data;
|
||||
});
|
||||
|
||||
return $summarizedBillplzTransactions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Http\Client\Pool;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class MarhunService
|
||||
{
|
||||
public $norujukanList;
|
||||
|
||||
public function __construct($norujukanList) {
|
||||
$this->norujukanList = $norujukanList;
|
||||
}
|
||||
|
||||
public function getMarhunDetails()
|
||||
{
|
||||
$getMarhunDetails = function () {
|
||||
return Http::pool(function (Pool $pool) {
|
||||
foreach ($this->norujukanList as $norujukan) {
|
||||
$pool->get(config('api.url') . '/api/marhun/' . $norujukan);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$marhunDetailsResponse = array_map(fn($x) => array_merge([], ...$x->json()), $getMarhunDetails());
|
||||
|
||||
$formatMarhunDetailData = function ($x) {
|
||||
$getMarhunTypeFullName = function ($code) {
|
||||
|
||||
$marhun = Http::get(config('api.url') . '/api/jemas/nama_marhun', ['marhun' => $code])->json()['descpt'];
|
||||
return $marhun;
|
||||
};
|
||||
|
||||
return array_map(function ($y) use ($getMarhunTypeFullName) {
|
||||
$y['marhun'] = $getMarhunTypeFullName($y['marhun']);
|
||||
return $y;
|
||||
}, $x);
|
||||
};
|
||||
|
||||
return array_map($formatMarhunDetailData, $marhunDetailsResponse);
|
||||
}
|
||||
|
||||
public static function from($norujukanList)
|
||||
{
|
||||
return new static($norujukanList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Http\Controllers\InformationController;
|
||||
use Illuminate\Http\Client\Pool;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class PembiayaanService
|
||||
{
|
||||
|
||||
public function getPembiayaan($filter)
|
||||
{
|
||||
$getPembiayaan = fn() => (new InformationController())->pembiayaanaktif()->getData();
|
||||
|
||||
if ($filter === 'pembiayaan-6-bulan') {
|
||||
$getPembiayaan = fn() => (new InformationController())->pembiayaanmelebihi6bulan()->getData();
|
||||
}
|
||||
|
||||
if ($filter === 'pembiayaan-akan-dilelong') {
|
||||
$getPembiayaan = fn() => (new InformationController())->pembiayaanakandilelong()->getData();
|
||||
}
|
||||
|
||||
$pembiayaan = $this->formatPembiayaanData($getPembiayaan());
|
||||
$pembiayaan = $this->attachMarhunModalData($pembiayaan);
|
||||
$pembiayaan = $this->checkPembiayaanPaymentDisabled($pembiayaan);
|
||||
|
||||
return $pembiayaan;
|
||||
|
||||
}
|
||||
|
||||
private function formatPembiayaanData($pembiayaan)
|
||||
{
|
||||
$allCawangan = Http::withOptions(['verify' => config('app.api_verify')])
|
||||
->get(config('api.url') . '/api/cawangan')
|
||||
->json();
|
||||
|
||||
$setCawanganFullName = function ($pembiayaan) use ($allCawangan) {
|
||||
$cawangan = array_filter($allCawangan, fn($x) => $x['kodcaw'] === $pembiayaan->kodcaw);
|
||||
$pembiayaan->cawangan_name = array_pop($cawangan)['details_caw'];
|
||||
return $pembiayaan;
|
||||
};
|
||||
|
||||
$setKeuntunganFormatted = function ($pembiayaan) {
|
||||
$pembiayaan->keuntungan_formatted = number_format((float) $pembiayaan->keuntungan, 2, '.', '');
|
||||
return $pembiayaan;
|
||||
};
|
||||
|
||||
$setTarikhAkhir = function ($pembiayaan) {
|
||||
$pembiayaan->tarikh_akhir = $pembiayaan->lelong_tawarruq != 0 ? '-' : Carbon::parse($pembiayaan->t_matang1)->format('d/m/Y');
|
||||
return $pembiayaan;
|
||||
};
|
||||
|
||||
$setTLelongFormatted = function ($pembiayaan) {
|
||||
$t_lelong = $pembiayaan->t_lelong;
|
||||
$isTLelongNotAvailable = $t_lelong == 0 || $t_lelong == '';
|
||||
|
||||
$pembiayaan->t_lelong_formatted = $isTLelongNotAvailable ? '-' : Carbon::parse($pembiayaan->t_lelong)->format('d/m/Y');
|
||||
|
||||
return $pembiayaan;
|
||||
};
|
||||
|
||||
$formatted = array_map(function ($x) use ($setCawanganFullName, $setKeuntunganFormatted, $setTarikhAkhir, $setTLelongFormatted) {
|
||||
$x = $setCawanganFullName($x);
|
||||
$x = $setKeuntunganFormatted($x);
|
||||
$x = $setTarikhAkhir($x);
|
||||
$x = $setTLelongFormatted($x);
|
||||
return $x;
|
||||
}, $pembiayaan);
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
private function attachMarhunModalData($pembiayaan)
|
||||
{
|
||||
$marhunModalData = $this->getMarhunModalData($pembiayaan);
|
||||
|
||||
return array_map(
|
||||
function ($x, $y) {
|
||||
$x->marhunModalData = $y;
|
||||
return $x;
|
||||
},
|
||||
$pembiayaan,
|
||||
$marhunModalData,
|
||||
);
|
||||
}
|
||||
|
||||
public function getMarhunModalData($pembiayaan)
|
||||
{
|
||||
$norujukanList = array_map(fn($x) => $x->norujukan, $pembiayaan);
|
||||
|
||||
$marhunDetails = MarhunService::from($norujukanList)->getMarhunDetails();
|
||||
|
||||
$bayaranHistoryDetails = BayaranHistoryService::from($norujukanList)->getBayaranHistory();
|
||||
|
||||
return array_map(
|
||||
fn($x, $y, $z) => [
|
||||
'nilaimarhun' => $x->nilaimarhun,
|
||||
'berat' => $x->berat,
|
||||
'bakiupah' => $x->bakiupah,
|
||||
'pinjaman' => $x->pinjaman,
|
||||
'bakipjm' => $x->bakipjm,
|
||||
'taglel' => $x->taglel,
|
||||
'marhun' => $x->marhun,
|
||||
'pinjaman' => $x->pinjaman,
|
||||
'norujukan' => $x->norujukan,
|
||||
'hargajualan' => $x->hargajualan,
|
||||
'kodcaw' => $x->kodcaw,
|
||||
'tempoh' => $x->tempoh,
|
||||
'cawangan_name' => $x->cawangan_name,
|
||||
'marhun_details' => $y,
|
||||
'bayaran_history' => $z,
|
||||
],
|
||||
$pembiayaan,
|
||||
$marhunDetails,
|
||||
$bayaranHistoryDetails,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private function getNorujukanRecentlyAttemptPayment($norujukanList)
|
||||
{
|
||||
$getRecentlyAttemptPayment = function () use ($norujukanList) {
|
||||
return Http::pool(function (Pool $pool) use ($norujukanList) {
|
||||
foreach ($norujukanList as $norujukan) {
|
||||
$pool->get(config('api.url') . '/portal/searchsagonline/', ['norujukan' => $norujukan]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$recentlyAttemptPaymentResponse = array_map(
|
||||
fn($x, $y) => ['norujukan' => $x, 'isRecentlyAttemptPayment' => $y->json()],
|
||||
$norujukanList,
|
||||
$getRecentlyAttemptPayment()
|
||||
);
|
||||
|
||||
$filterRecentlyAttemptPayment = array_filter(
|
||||
$recentlyAttemptPaymentResponse,
|
||||
fn($x) => $x['isRecentlyAttemptPayment'] === true
|
||||
);
|
||||
|
||||
return array_map(fn($x) => $x['norujukan'], $filterRecentlyAttemptPayment);
|
||||
|
||||
}
|
||||
|
||||
private function checkPembiayaanPaymentDisabled($pembiayaan)
|
||||
{
|
||||
$norujukanList = array_map(fn($x) => $x->norujukan, $pembiayaan);
|
||||
|
||||
$norujukanRecentlyAttemptPayment = $this->getNorujukanRecentlyAttemptPayment($norujukanList);
|
||||
|
||||
$getPembiayaanAkanDilelong = fn() => (new InformationController())->pembiayaanakandilelong()->getData();
|
||||
|
||||
$isCurrentDateGreaterThanEqual3DaysBeforeLelong = function ($x) {
|
||||
$tarikhLelong = Carbon::parse($x->t_lelong);
|
||||
$currentDate = Carbon::now();
|
||||
|
||||
if ($currentDate->gte($tarikhLelong->subDays(3))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
$pembiayaanAkanDilelong = array_filter($getPembiayaanAkanDilelong(), $isCurrentDateGreaterThanEqual3DaysBeforeLelong);
|
||||
$norujukanAkanDilelong = array_map(fn($x) => $x->norujukan, $pembiayaanAkanDilelong);
|
||||
|
||||
$pembiayaanInFasa2 = array_filter($getPembiayaanAkanDilelong(), fn($x) => $x->fasa == 2);
|
||||
$norujukanInFasa2 = array_map(fn($x) => $x->norujukan, $pembiayaanInFasa2);
|
||||
|
||||
$getPayableUjrahBranches = fn() => Http::arrahn()->get('/api/payable-ujrah-branches')->json();
|
||||
$branchesNotPermitPaymentUjrah = array_filter($getPayableUjrahBranches(), fn($x) => $x['gadaian_ujrah_payable'] == 0);
|
||||
$kodCawanganBranchesNotPermitPaymentUjrah = array_map(fn($x) => $x['kodcaw'], $branchesNotPermitPaymentUjrah);
|
||||
|
||||
|
||||
$isNorujukanPaymentRecentlyAttempted = function ($x) use ($norujukanRecentlyAttemptPayment) {
|
||||
return in_array($x->norujukan, $norujukanRecentlyAttemptPayment);
|
||||
};
|
||||
|
||||
$isNorujukanAkanDilelong = function ($x) use ($norujukanAkanDilelong) {
|
||||
return in_array($x->norujukan, $norujukanAkanDilelong);
|
||||
};
|
||||
|
||||
$isNorujukanUjrah = function ($x) {
|
||||
return $x->tagbaru === 1 ? true : false;
|
||||
};
|
||||
|
||||
$isNorujukanIsInFasa2 = function ($x) use ($norujukanInFasa2) {
|
||||
return in_array($x->norujukan, $norujukanInFasa2);
|
||||
};
|
||||
|
||||
$isCawanganNotPermitUjrahPayment = function ($x) use ($kodCawanganBranchesNotPermitPaymentUjrah, $isNorujukanUjrah) {
|
||||
|
||||
if($isNorujukanUjrah($x)){
|
||||
return in_array($x->kodcaw, $kodCawanganBranchesNotPermitPaymentUjrah);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
return array_map(function ($x) use ($isNorujukanPaymentRecentlyAttempted, $isNorujukanAkanDilelong, $isNorujukanIsInFasa2, $isCawanganNotPermitUjrahPayment) {
|
||||
|
||||
$x->disabled_payment = false;
|
||||
|
||||
if (
|
||||
$isNorujukanAkanDilelong($x)
|
||||
|| $isNorujukanIsInFasa2($x)
|
||||
|| $isNorujukanPaymentRecentlyAttempted($x)
|
||||
|| $isCawanganNotPermitUjrahPayment($x)
|
||||
) {
|
||||
$x->disabled_payment = true;
|
||||
}
|
||||
|
||||
return $x;
|
||||
|
||||
}, $pembiayaan);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+11
-4
@@ -8,13 +8,17 @@
|
||||
"php": "^7.3|^8.0",
|
||||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"jomweb/billplz": "^1.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"guzzlehttp/psr7": "^2.6",
|
||||
"jomweb/billplz": "^4.3.1",
|
||||
"laravel-frontend-presets/argon": "^1.1",
|
||||
"laravel/framework": "^8.40",
|
||||
"laravel/tinker": "^2.5",
|
||||
"laravel/ui": "^3.3",
|
||||
"php-http/guzzle6-adapter": "^1.1",
|
||||
"php-http/discovery": "^1.19",
|
||||
"php-http/guzzle7-adapter": "^1.0",
|
||||
"php-http/message": "^1.16",
|
||||
"php-http/message-factory": "^1.1",
|
||||
"rap2hpoutre/laravel-log-viewer": "^2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -58,7 +62,10 @@
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
|
||||
Generated
+1188
-747
File diff suppressed because it is too large
Load Diff
+14
-1
@@ -12,7 +12,7 @@ return [
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
@@ -30,4 +30,17 @@ return [
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'billplz' => [
|
||||
'production' => [
|
||||
'api_key' => env('BILLPLZ_PRODUCTION_API_KEY', 'f3e82fe1-a422-4660-97f0-65cc59ff6c47'),
|
||||
'x_signature' => env('BILLPLZ_PRODUCTION_X_SIGNATURE', 'S-alZUbzmD2_TF3vmrRqgehQ'),
|
||||
'collection_id' => env('BILLPLZ_PRODUCTION_COLLECTION_ID', 'z0r4kjhi'),
|
||||
],
|
||||
'sandbox' => [
|
||||
'api_key' => env('BILLPLZ_SANDBOX_API_KEY', 'abecfd0c-98d8-4635-abc2-2fcba8c60c11'),
|
||||
'x_signature' => env('BILLPLZ_SANDBOX_X_SIGNATURE', 'S-GWr7z03XjAhqPsFfu_H5nQ'),
|
||||
'collection_id' => env('BILLPLZ_SANDBOX_COLLECTION_ID', '5aosv2dg'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
@props([
|
||||
'title' => '',
|
||||
'subtitle' => '',
|
||||
'icon' => '',
|
||||
'iconState' => 'info',
|
||||
'cardBackgroundState' => 'white',
|
||||
'link' => '#',
|
||||
])
|
||||
|
||||
<div class="col-xl-3 col-lg-6" >
|
||||
<div class="card card-stats mb-4 mb-xl-0 {{ 'bg-'.$cardBackgroundState}}">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="card-title text-uppercase mb-0 {{ $cardBackgroundState == 'white' ? 'text-muted' : 'text-white' }}">{{ $title }}</h6>
|
||||
<span class="h5 font-weight-bold mb-0 {{ $cardBackgroundState == 'white' ? 'text-black' : 'text-white' }}">{{ $subtitle }}</span>
|
||||
</div>
|
||||
<div class="col-auto text-center">
|
||||
<a href="{{ $link }}">
|
||||
<div class="icon icon-shape bg-{{ $iconState }} rounded-circle shadow text-center">
|
||||
<i class="{{ $icon }}"></i>
|
||||
</div>
|
||||
</a>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div style="margin-bottom: 15px;" class="">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
@props([
|
||||
'content' => '',
|
||||
])
|
||||
|
||||
<div>
|
||||
<i class="text-danger" style="font-size:12px;">{{ $content }}</i><br>
|
||||
</div>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,10 @@
|
||||
<!-- <link href="{{ asset('css/loader.css') }}" rel="stylesheet"> -->
|
||||
|
||||
<style>
|
||||
.bg-crimson {
|
||||
background-color: crimson;
|
||||
}
|
||||
|
||||
.portalloader {
|
||||
/* display: none;
|
||||
position: fixed;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<div class="table-responsive table-bordered table-hover">
|
||||
<table class="table align-items-center table-flush border" id="main-table" style="text-align: center; width: 100%">
|
||||
<thead class="thead-light bg-dark text-white text-center">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>T Lelong</th>
|
||||
<th class="hide-xs">Cawangan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="list">
|
||||
@foreach ($pembiayaan as $data)
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" onclick="tickfunc(this)" name="chkboxsag[]" value="{{ $data->norujukan }}"
|
||||
id="sag-{{ $loop->iteration }}" data-norujukan="{{ $data->norujukan }}"
|
||||
{{ $data->disabled_payment ? 'disabled' : '' }} />
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" class="marhun-detail-link">
|
||||
<span class="text-sm text-info"
|
||||
data-marhun-modal="{{ json_encode($data->marhunModalData) }}">{{ $data->norujukan }}</span>
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ $data->t_lelong_formatted }}</td>
|
||||
<td class="hide-xs">{{ $data->cawangan_name }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<i class="hide-xs text-success" style="font-size:12px;">"Swipe" ke kiri</i>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
<div class="table-responsive table-bordered table-hover">
|
||||
<table class="table align-items-center table-flush border" id="main-table" style="text-align: center; width: 100%">
|
||||
<thead class="thead-light bg-dark text-white text-center">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>No Rujukan</th>
|
||||
<th class="hide-xs">Tempoh</th>
|
||||
<th>T Akhir</th>
|
||||
<th>Keuntungan</th>
|
||||
<th class="hide-xs">Cawangan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="list">
|
||||
@foreach ($pembiayaan as $data)
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" onclick="tickfunc(this)" name="chkboxsag[]" value="{{ $data->norujukan }}"
|
||||
id="sag-{{ $loop->iteration }}" data-norujukan="{{ $data->norujukan }}"
|
||||
{{ $data->disabled_payment ? 'disabled' : '' }} />
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" class="marhun-detail-link">
|
||||
<span class="text-sm text-info"
|
||||
data-marhun-modal="{{ json_encode($data->marhunModalData) }}">{{ $data->norujukan }}</span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="hide-xs">{{ $data->tempoh }}</td>
|
||||
<td>{{ $data->tarikh_akhir }}</td>
|
||||
<td>{{ $data->keuntungan_formatted }}</td>
|
||||
<td class="hide-xs">{{ $data->cawangan_name }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<i class="hide-xs text-success" style="font-size:12px;">"Swipe" ke kiri</i>
|
||||
</div>
|
||||
@@ -20,6 +20,7 @@
|
||||
</section>
|
||||
</div>
|
||||
@include('includes.main.footerwhite')
|
||||
@stack('additional_js_scripts')
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
{{-- <h5 class="modal-title">Senarai Marhun</h5> --}}
|
||||
<ul class="nav nav-tabs nav-fill">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#home" role="tab" aria-controls="pills-marhun" aria-selected="true">Marhun</a>
|
||||
<a class="nav-link active" data-toggle="pill" href="#home" role="tab" aria-controls="pills-marhun" aria-selected="true">Marhun</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#rekod" role="tab" aria-controls="pills-rekod" aria-selected="false">Rekod Bayaran</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#rekod" role="tab" aria-controls="pills-rekod" aria-selected="false">Rekod Bayaran</a>
|
||||
</li>
|
||||
<li class="show-xs nav-item test">
|
||||
<a class="show-xs nav-link" data-toggle="pill" href="#detail" role="tab" aria-controls="pills-detail" aria-selected="false">Detail SAG</a>
|
||||
<a class="show-xs nav-link" data-toggle="pill" href="#detail" role="tab" aria-controls="pills-detail" aria-selected="false">Detail SAG</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- <button type="button" class="close" data-dismiss="modal">×</button> -->
|
||||
</div>
|
||||
|
||||
@@ -75,15 +75,21 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>Pembiayaan Asal: <span id="pembiayaan"></span></b></div></div>
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>Pembiayaan Asal: <span id="pembiayaan"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>Baki Pembiayaan: <span id="bpembiayaan"></span></b></div></div>
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>Baki Pembiayaan: <span id="bpembiayaan"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>Nilai Marhun: <span id="nm"></span></b></div></div>
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>Nilai Marhun: <span id="nm"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-4">
|
||||
@@ -93,47 +99,59 @@
|
||||
</div> --}}
|
||||
|
||||
<div class="col-6">
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>Keuntungan 6 bulan: <span id="koskeun"></span></b></div></div>
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>Keuntungan 6 bulan: <span id="koskeun"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-4">
|
||||
<div class="p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>T.Lanjut: <span id="berat"></span></b></div></div>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="overflow-x: auto;">
|
||||
<div style="overflow-x: auto;">
|
||||
<table id="tablehistorybayaran" class="table table-striped table-bordered text-center">
|
||||
<thead class="bg-dark text-white">
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>Tarikh</th>
|
||||
<th>Bayaran</th>
|
||||
<!-- <th>Tindakan</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<thead class="bg-dark text-white">
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>Tarikh</th>
|
||||
<th>Bayaran</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <p style="font-size: 12px;"><i>*Dengan bayaran serendah jumlah keuntungan <span class="text-danger font-weight-bold">6 bulan</span>, anda layak mendapat lanjutan tempoh selama <span class="text-danger font-weight-bold">6 bulan</span> lagi.</i></p> -->
|
||||
</div>
|
||||
<!-- <p style="font-size: 12px;"><i>*Dengan bayaran serendah jumlah keuntungan <span class="text-danger font-weight-bold">6 bulan</span>, anda layak mendapat lanjutan tempoh selama <span class="text-danger font-weight-bold">6 bulan</span> lagi.</i></p> -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="show-xs tab-pane fade " id="detail" role="tabpanel" aria-labelledby="detail-tab">
|
||||
|
||||
<div class="row show-xs">
|
||||
<div class="row show-xs">
|
||||
<div class="col-6">
|
||||
<div class="show-xs p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>No Rujukan: <span id="norujukan"></span></b></div></div>
|
||||
<div class="show-xs p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>No Rujukan: <span id="norujukan"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="show-xs p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>Tempoh: <span id="tempoh"></span></b></div></div>
|
||||
<div class="show-xs p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>Tempoh: <span id="tempoh"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="show-xs p-2 rounded bg-warning text-center text-dark mb-2"><div class="inner"><b>Cawangan: <span id="namacaw"></span></b></div></div>
|
||||
<div class="show-xs p-2 rounded bg-warning text-center text-dark mb-2">
|
||||
<div class="inner"><b>Cawangan: <span id="namacaw"></span></b></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -142,9 +160,82 @@
|
||||
|
||||
<!-- Modal footer -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
|
||||
<button type="button" class="btn btn-secondary">Tutup</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('additional_js_scripts')
|
||||
<script>
|
||||
const showMarhunDetailModal = function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
|
||||
let data = JSON.parse(event.target.dataset.marhunModal);
|
||||
|
||||
$('#pembiayaan').text('RM' + formatter.format(data.pinjaman));
|
||||
$('#bpembiayaan').text('RM' + formatter.format(data.bakipjm));
|
||||
$('#nm').text('RM' + formatter.format(data.nilaimarhun));
|
||||
$('#berat').text(data.berat + 'g');
|
||||
$('#koskeun').text('RM' + formatter.format(data.bakiupah));
|
||||
$('#norujukan').text(data.norujukan);
|
||||
$('#tempoh').text(data.tempoh);
|
||||
$('#namacaw').text(data.cawangan_name);
|
||||
$('#pemb').text('RM ' + data.pinjaman);
|
||||
$('#bpemb').text('RM ' + data.bakipjm);
|
||||
$('#statuslelong').text(data.taglel === 1 ? 'Akan Dilelong' : '-');
|
||||
$('#norujukan_modal').val(data.norujukan);
|
||||
$('#pinjaman_modal').val(data.pinjaman);
|
||||
$('#marhunModal').modal('show');
|
||||
|
||||
$('#tablehistorybayaran').DataTable().clear().destroy();
|
||||
let table_bayaran_history = $('#tablehistorybayaran').DataTable();
|
||||
|
||||
$('#biasa').DataTable().clear().destroy();
|
||||
let table_marhun = $('#biasa').DataTable();
|
||||
|
||||
data.bayaran_history.forEach((x, index) => {
|
||||
table_bayaran_history.row.add([
|
||||
index + 1,
|
||||
x.created_at,
|
||||
`RM ${x.duit_masuk} <a target='_blank' href="${x.resit_ansuran_link}" class='btn btn-info btn-sm'><span class='fas fa-print'></span></a>`,
|
||||
]).draw(false)
|
||||
});
|
||||
|
||||
data.marhun_details.forEach((x, index) => {
|
||||
table_marhun.row.add([
|
||||
index + 1,
|
||||
x.marhun,
|
||||
x.berat,
|
||||
x.karat,
|
||||
`RM ${formatter.format(x.n_marhun)}`,
|
||||
x.nota
|
||||
]).draw(false)
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
document.querySelectorAll('a.marhun-detail-link').forEach(x => x.addEventListener('click', showMarhunDetailModal))
|
||||
|
||||
});
|
||||
|
||||
document.querySelector('#marhunModal .modal-footer button').addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#marhunModal').modal('hide');
|
||||
});
|
||||
|
||||
document.querySelector('#marhunModal').addEventListener('hidden.bs.modal', function(e) {
|
||||
document.querySelector('#marhunModal .modal-header a[aria-controls="pills-marhun"]').click();
|
||||
});
|
||||
|
||||
|
||||
</script>')
|
||||
@endpush
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\BillplzTransactionReviewController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
@@ -17,3 +18,5 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
Route::get('/billplz-transaction-review', BillplzTransactionReviewController::class)->name('billplz-transaction-review');
|
||||
|
||||
Reference in New Issue
Block a user