Merge branch 'new-super' of https://gitlab.com/online-sistem1/kaunter into lapfix
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class updateGadai extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'update:lelongtawarruq';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update gadai for every active gadai';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$updategadai = Http::get(config('api.url') . '/api/check/lelong/tawarruq')->json();
|
||||
$this->info('sucess');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class updateGadai extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'update:gadai';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update gadai for every active gadai';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$updategadai = Http::get(config('api.url') . '/api/update/sttebus/gadaian')->json();
|
||||
$this->info('sucess');
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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([
|
||||
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="belum"/>',
|
||||
'<a href="#" onclick="checkserah(this)" data-norujukan='+ gadai_detail['norujukan'] +' data-url=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
||||
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") + '%',
|
||||
|
||||
@@ -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([
|
||||
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="belum"/>',
|
||||
'<a href="#" onclick="checkserah(this)" data-norujukan='+ gadai_detail['norujukan'] +' data-url=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
||||
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") + '%',
|
||||
|
||||
Reference in New Issue
Block a user