diff --git a/app/Console/Commands/checkLelongTawarruq.php b/app/Console/Commands/checkLelongTawarruq.php
new file mode 100644
index 0000000..69b56bf
--- /dev/null
+++ b/app/Console/Commands/checkLelongTawarruq.php
@@ -0,0 +1,44 @@
+json();
+ $this->info('sucess');
+ }
+}
diff --git a/app/Console/Commands/updateGadai.php b/app/Console/Commands/updateGadai.php
new file mode 100644
index 0000000..f41bbdf
--- /dev/null
+++ b/app/Console/Commands/updateGadai.php
@@ -0,0 +1,44 @@
+json();
+ $this->info('sucess');
+ }
+}
diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php
index e10d27a..63c3f63 100644
--- a/app/Http/Controllers/CustomersController.php
+++ b/app/Http/Controllers/CustomersController.php
@@ -209,60 +209,20 @@ class CustomersController extends Controller
return redirect()->route('customer_info')->with( ['customer_info' => $customer_info] );
}
- /**
- * Display the specified resource.
- *
- * @param \App\Customer $customer
- * @return \Illuminate\Http\Response
- */
- public function show(Customer $customer)
- {
- //
- }
-
- /**
- * Show the form for editing the specified resource.
- *
- * @param \App\Customer $customer
- * @return \Illuminate\Http\Response
- */
- public function edit(Customer $customer)
- {
- //
- }
-
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param \App\Customer $customer
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, Customer $customer)
- {
- //
- }
-
- /**
- * Remove the specified resource from storage.
- *
- * @param \App\Customer $customer
- * @return \Illuminate\Http\Response
- */
- public function destroy(Customer $customer)
- {
- //
- }
-
public function getOTP(Request $request){
$auth_user = Auth::user();
$expired = Carbon::now();
$expired = new Carbon();
- $expired = $expired->addHours(24);
+ $expired = $expired->addHours(24);
+ $currentDateTime = Carbon::now();
+
+ $cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
+ $nama_cawangan = $cawangan_info["details_caw"];
$nokp = $request->noic_otp;
$customer = Http::get(config('api.url'). '/api/customers/'.$nokp)->json();
- $recipient = '+6'.$customer['telefon'];
+ $recipient = '6'.$customer['telefon'];
+ // $recipient = '60189025461';
//pembinaan token
function token($length) {
$characters = array(
@@ -294,7 +254,8 @@ class CustomersController extends Controller
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
]);
- $message = "Your TAC code is " . $random;
+ // $message = "Your OTP code is " . $random;
+ $message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
$this->sendWhatsAppMessage($message, $recipient);
return response()->json(['otp'=>$random]);
}
@@ -306,7 +267,8 @@ class CustomersController extends Controller
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
]);
- $message = "Your TAC code is " . $random;
+ // $message = "Your OTP code is " . $random;
+ $message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
$this->sendWhatsAppMessage($message, $recipient);
return response()->json(['otp'=>$random]);
}
@@ -323,7 +285,8 @@ class CustomersController extends Controller
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
]);
- $message = "Your TAC code is " . $random;
+ // $message = "Your OTP code is " . $random;
+ $message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
$this->sendWhatsAppMessage($message, $recipient);
return response()->json(['otp'=>$random]);
}
@@ -335,34 +298,26 @@ class CustomersController extends Controller
'expired' => $expired,
'kodcaw' => $auth_user['cawangan']
]);
- $message = "Your TAC code is " . $random;
+ // $message = "Your OTP code is " . $random;
+ $message = 'AR-RAHN PKB ' . $nama_cawangan . ' : OTP: ' . $random . ' ' . $currentDateTime . '. AR-RAHN CARELINE CENTRE 1300-22-4343';
$this->sendWhatsAppMessage($message, $recipient);
return response()->json(['otp'=>$random]);
}
}
}
- public function listenToReplies(Request $request)
- {
- $from = $request->input('From');
-
- $message = "Someone send you a message on whatsapp";
-
- $this->sendWhatsAppMessage($message, $from);
-
- return;
- }
-
public function sendWhatsAppMessage(string $message, string $recipient)
{
- $twilio_whatsapp_number = getenv('TWILIO_WHATSAPP_NUMBER');
- $account_sid = getenv("TWILIO_SID");
- $auth_token = getenv("TWILIO_AUTH_TOKEN");
- $from = "whatsapp:".$twilio_whatsapp_number;
- $to = "whatsapp:".$recipient;
+ $status = Http::get('http://gateway.onewaysms.com.my:10001/api.aspx',[
+ 'apiusername' => 'APIUK330HDAFO',
+ 'apipassword' => 'APIUK330HDAFOUK330',
+ 'senderid' => 'INFO',
+ 'mobileno' => $recipient,
+ 'message'=> $message,
+ 'languagetype'=> 1
+ ]);
- $client = new Client($account_sid, $auth_token);
- return $client->messages->create($to, array('from' => $from, 'body' => $message));
+ return ($status);
}
}
diff --git a/resources/views/customers/info.blade.php b/resources/views/customers/info.blade.php
index 96e350d..96a5ef2 100644
--- a/resources/views/customers/info.blade.php
+++ b/resources/views/customers/info.blade.php
@@ -745,11 +745,16 @@
taglel,
]).draw();
}else{
+ if(gadai_detail['lelong_tawarruq'] == 0){
+ var tarikh_matang = gadai_detail['t_matang1'];
+ }else{
+ var tarikh_matang = gadai_detail['t_matang'];
+ }
tablegadai.row.add([
'',
'' + gadai_detail['norujukan'] + '',
gadai_detail['t_gadai'],
- gadai_detail['t_matang'],
+ tarikh_matang,
'RM '+ formatter.format(gadai_detail['bakihargajualan']),
'RM '+formatter.format(gadai_detail['bakipjm']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
diff --git a/resources/views/khazanah/info.blade.php b/resources/views/khazanah/info.blade.php
index 9b5b81d..8371047 100644
--- a/resources/views/khazanah/info.blade.php
+++ b/resources/views/khazanah/info.blade.php
@@ -518,11 +518,16 @@
gadai_detail['tempoh']
]).draw();
}else{
+ if(gadai_detail['lelong_tawarruq'] == 0){
+ var tarikh_matang = gadai_detail['t_matang1'];
+ }else{
+ var tarikh_matang = gadai_detail['t_matang'];
+ }
tablegadai.row.add([
'',
'' + gadai_detail['norujukan'] + '',
gadai_detail['t_gadai'],
- gadai_detail['t_matang1'],
+ tarikh_matang,
'RM '+ formatter.format(gadai_detail['bakihargajualan']),
'RM '+formatter.format(gadai_detail['bakipjm']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',