From e1878e31e416a2a5689459dc73cab80aa86adfed Mon Sep 17 00:00:00 2001 From: nurafrinaalimi16 Date: Sun, 14 Jun 2026 15:02:45 +0800 Subject: [PATCH] pdpa for koperasi --- app/Http/Controllers/CustomerController.php | 21 +++++++++++++++++++++ routes/web.php | 1 + 2 files changed, 22 insertions(+) diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 5b93b81..18d25a2 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -1038,6 +1038,27 @@ class CustomerController extends Controller return response()->json($results); } + public function updateTagPdpa(Request $request) + { + $tarikh_cetak_pdpa = Carbon::now()->toDateString(); + + $no_ic = $request->input('no_ic'); + + $customer = Customer::where('kplama', $no_ic) + ->orWhere('kpbaru', $no_ic) + ->first(); + + if (!$customer) { + return response()->json(['error' => 'Customer not found.'], 404); + } + + $customer->tag_pdpa = $request->input('tag_pdpa'); + $customer->tarikh_cetak_pdpa = $tarikh_cetak_pdpa; + $customer->save(); + + return response()->json(['message' => 'Customer PDPA updated successfully.'], 200); + } + // public function createNotaArcc($kodcaw, Request $request) // { // $current = Carbon::now(); diff --git a/routes/web.php b/routes/web.php index 008c397..fdcefdd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -62,6 +62,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('customer/anggota',['uses'=>'CustomerController@anggotaKoperasi']); $router->get('customer/eachcawangan/{ic}',['uses'=>'CustomerController@showCustomerByEachCawangan']); $router->put('customers/{noic}/assign-anggota', ['uses' => 'CustomerController@assignAnggota']); + $router->post('/customers/update-tag-pdpa', ['uses' => 'CustomerController@updateTagPdpa']); //arcc $router->get('customer/searchbyname',['uses'=>'CustomerController@searchByName']);