add record password di web n customer contr
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Audit;
|
||||||
use App\Marhun;
|
use App\Marhun;
|
||||||
use App\BankMaster;
|
use App\BankMaster;
|
||||||
use App\Customer;
|
use App\Customer;
|
||||||
@@ -49,7 +50,7 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function showOneCustomerByICAdmin(Request $request){
|
public function showOneCustomerByICAdmin(Request $request){
|
||||||
|
|
||||||
$customer = Customer::on('mysql7')
|
$customer = Customer::on('mysql7')
|
||||||
->where('kplama','=',$request->ic)
|
->where('kplama','=',$request->ic)
|
||||||
->orWhere('kpbaru','=',$request->ic)
|
->orWhere('kpbaru','=',$request->ic)
|
||||||
@@ -111,7 +112,7 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($gadai_all);
|
return response()->json($gadai_all);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||||
|
|
||||||
if($status == 'belum_tebus'){
|
if($status == 'belum_tebus'){
|
||||||
$gadai = Gadai::on($cawangan['mysql'])
|
$gadai = Gadai::on($cawangan['mysql'])
|
||||||
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
|
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
|
||||||
@@ -165,7 +166,7 @@ class CustomerController extends Controller
|
|||||||
$gadai[0]['datatuntut'] = $tuntutbaki;
|
$gadai[0]['datatuntut'] = $tuntutbaki;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response()->json($gadai);
|
return response()->json($gadai);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +203,7 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($gadai_all);
|
return response()->json($gadai_all);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +228,7 @@ class CustomerController extends Controller
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $barang;
|
return $barang;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,10 +260,10 @@ class CustomerController extends Controller
|
|||||||
'tarikhgadai' => $gd->t_gadai,
|
'tarikhgadai' => $gd->t_gadai,
|
||||||
'hargajualan' => $gd->hargajualan,
|
'hargajualan' => $gd->hargajualan,
|
||||||
'bakihargajualan' => $gd->bakihargajualan,
|
'bakihargajualan' => $gd->bakihargajualan,
|
||||||
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
|
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif($gd->sttebus == 'T')
|
elseif($gd->sttebus == 'T')
|
||||||
{
|
{
|
||||||
array_push($sttebus_T, array(
|
array_push($sttebus_T, array(
|
||||||
@@ -270,22 +271,22 @@ class CustomerController extends Controller
|
|||||||
'pembiayaan' => number_format($gd->pinjaman,2),
|
'pembiayaan' => number_format($gd->pinjaman,2),
|
||||||
'tarikhgadai' => $gd->t_gadai,
|
'tarikhgadai' => $gd->t_gadai,
|
||||||
'hargajualan' => $gd->hargajualan,
|
'hargajualan' => $gd->hargajualan,
|
||||||
'bakihargajualan' => $gd->bakihargajualan,
|
'bakihargajualan' => $gd->bakihargajualan,
|
||||||
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
|
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
elseif($gd->sttebus == 'L')
|
elseif($gd->sttebus == 'L')
|
||||||
{
|
{
|
||||||
array_push($sttebus_L, array(
|
array_push($sttebus_L, array(
|
||||||
'norujukan' => $gd->norujukan,
|
'norujukan' => $gd->norujukan,
|
||||||
'pembiayaan' => number_format($gd->pinjaman,2),
|
'pembiayaan' => number_format($gd->pinjaman,2),
|
||||||
'tarikhgadai' => $gd->t_gadai,
|
'tarikhgadai' => $gd->t_gadai,
|
||||||
'hargajualan' => $gd->hargajualan,
|
'hargajualan' => $gd->hargajualan,
|
||||||
'bakihargajualan' => $gd->bakihargajualan,
|
'bakihargajualan' => $gd->bakihargajualan,
|
||||||
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
|
'barang' => $this->marhun($cawangan, $gd->norujukan) ?? ' tiada data',
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -308,7 +309,7 @@ class CustomerController extends Controller
|
|||||||
->where([['tarikhdaftar','=',$tarikh],['kodcaw',$kodcaw]])
|
->where([['tarikhdaftar','=',$tarikh],['kodcaw',$kodcaw]])
|
||||||
->orderBy('tarikhdaftar', 'desc')
|
->orderBy('tarikhdaftar', 'desc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return response()->json($gadai);
|
return response()->json($gadai);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +365,7 @@ class CustomerController extends Controller
|
|||||||
'telefon' => $request->telefon1,
|
'telefon' => $request->telefon1,
|
||||||
'telefon2' => $request->telefon2
|
'telefon2' => $request->telefon2
|
||||||
));
|
));
|
||||||
|
|
||||||
return response()->json($customer_update, 200);
|
return response()->json($customer_update, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +409,7 @@ class CustomerController extends Controller
|
|||||||
->get()->toArray();
|
->get()->toArray();
|
||||||
|
|
||||||
$new_data = json_encode($customer_info_new);
|
$new_data = json_encode($customer_info_new);
|
||||||
|
|
||||||
$audit_customer = DB::connection('mysql7')
|
$audit_customer = DB::connection('mysql7')
|
||||||
->table('audit_customer')
|
->table('audit_customer')
|
||||||
->insert([
|
->insert([
|
||||||
@@ -431,11 +432,11 @@ class CustomerController extends Controller
|
|||||||
DB::connection('mysql7')->rollback();
|
DB::connection('mysql7')->rollback();
|
||||||
return response()->json($e->getMessage(),400);
|
return response()->json($e->getMessage(),400);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function customerUpdateKhazanah($nokp,Request $request){
|
public function customerUpdateKhazanah($nokp,Request $request){
|
||||||
|
|
||||||
DB::connection('mysql7')->beginTransaction();
|
DB::connection('mysql7')->beginTransaction();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
@@ -476,7 +477,7 @@ class CustomerController extends Controller
|
|||||||
->get()->toArray();
|
->get()->toArray();
|
||||||
|
|
||||||
$new_data = json_encode($customer_info_new);
|
$new_data = json_encode($customer_info_new);
|
||||||
|
|
||||||
$audit_customer = DB::connection('mysql7')
|
$audit_customer = DB::connection('mysql7')
|
||||||
->table('audit_customer')
|
->table('audit_customer')
|
||||||
->insert([
|
->insert([
|
||||||
@@ -490,7 +491,7 @@ class CustomerController extends Controller
|
|||||||
'customer_nokp' => $nokp,
|
'customer_nokp' => $nokp,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DB::connection('mysql7')->commit();
|
DB::connection('mysql7')->commit();
|
||||||
|
|
||||||
@@ -500,8 +501,8 @@ class CustomerController extends Controller
|
|||||||
DB::connection('mysql7')->rollback();
|
DB::connection('mysql7')->rollback();
|
||||||
return response()->json($e->getMessage(),400);
|
return response()->json($e->getMessage(),400);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function customerUpdateAdmin(Request $request){
|
public function customerUpdateAdmin(Request $request){
|
||||||
@@ -521,12 +522,12 @@ class CustomerController extends Controller
|
|||||||
'nokp'=>$request->icno
|
'nokp'=>$request->icno
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_asal = $customer_update = Customer::on('mysql7')
|
$data_asal = $customer_update = Customer::on('mysql7')
|
||||||
->where('kplama','=',$request->ic_asal)
|
->where('kplama','=',$request->ic_asal)
|
||||||
->orWhere('kpbaru','=',$request->ic_asal)
|
->orWhere('kpbaru','=',$request->ic_asal)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if($data_asal['kpbaru'] != null){
|
if($data_asal['kpbaru'] != null){
|
||||||
$customer_update = Customer::on('mysql7')
|
$customer_update = Customer::on('mysql7')
|
||||||
->where('kplama','=',$request->ic_asal)
|
->where('kplama','=',$request->ic_asal)
|
||||||
@@ -601,7 +602,7 @@ class CustomerController extends Controller
|
|||||||
return response()->json($array_norujukan);
|
return response()->json($array_norujukan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function countNorujukanMobile($nokp){
|
public function countNorujukanMobile($nokp){
|
||||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||||
$bilangan_sag = 0;
|
$bilangan_sag = 0;
|
||||||
@@ -615,7 +616,7 @@ class CustomerController extends Controller
|
|||||||
|
|
||||||
public function getGadaiDetailMobile(Request $request)
|
public function getGadaiDetailMobile(Request $request)
|
||||||
{
|
{
|
||||||
$array_norujukan = $request->norujukan;
|
$array_norujukan = $request->norujukan;
|
||||||
$array_kodcaw = $request->kodcaw;
|
$array_kodcaw = $request->kodcaw;
|
||||||
$array_gadai = [];
|
$array_gadai = [];
|
||||||
$gadai_payment = [];
|
$gadai_payment = [];
|
||||||
@@ -660,7 +661,7 @@ class CustomerController extends Controller
|
|||||||
|
|
||||||
return response('Deleted Successfully', 200);
|
return response('Deleted Successfully', 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function akaunBankMobile($nokp)
|
public function akaunBankMobile($nokp)
|
||||||
{
|
{
|
||||||
$customer_detail = [];
|
$customer_detail = [];
|
||||||
@@ -672,7 +673,7 @@ class CustomerController extends Controller
|
|||||||
->where('kplama','=',$nokp)
|
->where('kplama','=',$nokp)
|
||||||
->orWhere('kpbaru','=',$nokp)
|
->orWhere('kpbaru','=',$nokp)
|
||||||
->rightJoin('online_arrahn.bank', 'bank.id', '=', 'customer.kodbank')
|
->rightJoin('online_arrahn.bank', 'bank.id', '=', 'customer.kodbank')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!empty($customer))
|
if(!empty($customer))
|
||||||
{
|
{
|
||||||
@@ -680,14 +681,14 @@ class CustomerController extends Controller
|
|||||||
$customer_detail['namabank'] = $customer['name'];
|
$customer_detail['namabank'] = $customer['name'];
|
||||||
$customer_detail['kodbank'] = $customer['id'];
|
$customer_detail['kodbank'] = $customer['id'];
|
||||||
return response()->json($customer_detail);
|
return response()->json($customer_detail);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $customer_detail;
|
return $customer_detail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bankListMobile()
|
public function bankListMobile()
|
||||||
{
|
{
|
||||||
$bank_array = [];
|
$bank_array = [];
|
||||||
@@ -702,32 +703,32 @@ class CustomerController extends Controller
|
|||||||
{
|
{
|
||||||
array_push($bank_array, array(
|
array_push($bank_array, array(
|
||||||
'kodbank' => $banklist->id,
|
'kodbank' => $banklist->id,
|
||||||
'namabank' => $banklist->name,
|
'namabank' => $banklist->name,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return response()->json($bank_array);
|
return response()->json($bank_array);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return response()->json('Data Not Found');
|
return response()->json('Data Not Found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertAkaunBankMobile(Request $request)
|
public function insertAkaunBankMobile(Request $request)
|
||||||
{
|
{
|
||||||
$customer = Customer::on('mysql7')
|
$customer = Customer::on('mysql7')
|
||||||
->where('kplama','=',$request->nokp)
|
->where('kplama','=',$request->nokp)
|
||||||
->orWhere('kpbaru','=',$request->nokp)
|
->orWhere('kpbaru','=',$request->nokp)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!empty($customer))
|
if(!empty($customer))
|
||||||
{
|
{
|
||||||
$customer->kodbank = $request->kodbank;
|
$customer->kodbank = $request->kodbank;
|
||||||
$customer->noakaun = $request->noakaun;
|
$customer->noakaun = $request->noakaun;
|
||||||
$customer->save();
|
$customer->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($customer, 200);
|
return response()->json($customer, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +762,7 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function blacklistCustomer(Request $request){
|
public function blacklistCustomer(Request $request){
|
||||||
|
|
||||||
$blacklist = Blacklist::where('nokp',$request->nokp)->first();
|
$blacklist = Blacklist::where('nokp',$request->nokp)->first();
|
||||||
|
|
||||||
return response()->json($blacklist);
|
return response()->json($blacklist);
|
||||||
@@ -778,8 +779,8 @@ class CustomerController extends Controller
|
|||||||
->select('kodcaw')
|
->select('kodcaw')
|
||||||
->where('nokp', '=', $ic)
|
->where('nokp', '=', $ic)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if($customer)
|
if($customer)
|
||||||
array_push($custcawangan,['kodcaw' => $customer['kodcaw'], 'namacawangan' => $cawangan['details_caw']]);
|
array_push($custcawangan,['kodcaw' => $customer['kodcaw'], 'namacawangan' => $cawangan['details_caw']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,9 +806,9 @@ class CustomerController extends Controller
|
|||||||
return response()->json($dataCustomer);
|
return response()->json($dataCustomer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function AdminsearchCustomerByName(Request $request)
|
public function AdminsearchCustomerByName(Request $request)
|
||||||
{
|
{
|
||||||
$nama = strtoupper($request->nama);
|
$nama = strtoupper($request->nama);
|
||||||
|
|
||||||
if(empty($nama))
|
if(empty($nama))
|
||||||
@@ -821,12 +822,12 @@ class CustomerController extends Controller
|
|||||||
->take(3)
|
->take(3)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($customer);
|
return response()->json($customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function AdminsearchCustomerByIC(Request $request)
|
public function AdminsearchCustomerByIC(Request $request)
|
||||||
{
|
{
|
||||||
if(isset($request->kodcaw))
|
if(isset($request->kodcaw))
|
||||||
{
|
{
|
||||||
$customer = Customer::on('mysql7')
|
$customer = Customer::on('mysql7')
|
||||||
@@ -841,8 +842,22 @@ class CustomerController extends Controller
|
|||||||
->take(3)
|
->take(3)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return response()->json($customer);
|
return response()->json($customer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changepassword(Request $request, $kodcaw, $id) {
|
||||||
|
|
||||||
|
$current = Carbon::now();
|
||||||
|
// log::info ($request->name);
|
||||||
|
$audit = new Audit();
|
||||||
|
$audit->users = $request->nama;
|
||||||
|
$audit->actions = "Tukar Kata Laluan";
|
||||||
|
// $audit->new_data = json_encode($request->new_password);
|
||||||
|
$audit->kodcaw = $kodcaw;
|
||||||
|
$audit->created_at = $current;
|
||||||
|
$audit->updated_at = $current;
|
||||||
|
$audit->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -41,7 +41,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
|||||||
$router->get('/', 'PayableUjrahBranchController@index');
|
$router->get('/', 'PayableUjrahBranchController@index');
|
||||||
$router->post('/', 'PayableUjrahBranchController@create');
|
$router->post('/', 'PayableUjrahBranchController@create');
|
||||||
$router->post('/sync-status', 'PayableUjrahBranchController@syncStatus');
|
$router->post('/sync-status', 'PayableUjrahBranchController@syncStatus');
|
||||||
});
|
});
|
||||||
|
|
||||||
//Customer API
|
//Customer API
|
||||||
$router->get('customers',['uses'=>'CustomerController@showAllCustomers']);
|
$router->get('customers',['uses'=>'CustomerController@showAllCustomers']);
|
||||||
@@ -61,6 +61,9 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
|||||||
$router->get('customer/blacklist',['uses'=>'CustomerController@blacklistCustomer']);
|
$router->get('customer/blacklist',['uses'=>'CustomerController@blacklistCustomer']);
|
||||||
$router->get('customer/eachcawangan/{ic}',['uses'=>'CustomerController@showCustomerByEachCawangan']);
|
$router->get('customer/eachcawangan/{ic}',['uses'=>'CustomerController@showCustomerByEachCawangan']);
|
||||||
|
|
||||||
|
//Change Password
|
||||||
|
$router->post('changepassword/{kodcaw}/{id}',['uses'=>'CustomerController@changepassword']);
|
||||||
|
|
||||||
//Gadai API
|
//Gadai API
|
||||||
$router->get('gadai',['uses'=>'GadaiController@showAllGadais']);
|
$router->get('gadai',['uses'=>'GadaiController@showAllGadais']);
|
||||||
$router->get('gadai/{noic}',['uses'=>'GadaiController@showOneGadai']);
|
$router->get('gadai/{noic}',['uses'=>'GadaiController@showOneGadai']);
|
||||||
|
|||||||
Reference in New Issue
Block a user