Merge remote-tracking branch 'origin/rebate-anggota' into rebate-anggota

This commit is contained in:
nurafrinaalimi16
2026-06-14 15:58:31 +08:00
2 changed files with 77 additions and 0 deletions
@@ -396,6 +396,7 @@ class CustomerController extends Controller
// 'nota_arcc'=>$request->nota_arcc,
'telefon' => $request->telefon1,
'telefon2' => $request->telefon2,
'telefon2' => $request->telefon2,
));
return response()->json($customer_update, 200);
@@ -420,6 +421,33 @@ class CustomerController extends Controller
$customer->tag_anggota = 1;
$customer->save();
return response()->json([
'success' => true,
'message' => 'Tag anggota berjaya dikemaskini.',
'data' => $customer
], 200);
}
}
public function assignAnggota($noic, Request $request)
{
// Semak sama ada pelanggan wujud
$customer = Customer::on('mysql7')
->where('kpbaru', $noic)
->orWhere('kplama', $noic)
->first();
if (!$customer) {
return response()->json([
'success' => false,
'message' => 'Pelanggan tidak dijumpai.'
], 404);
}
// Kemaskini tag_anggota
$customer->tag_anggota = 1;
$customer->save();
return response()->json([
'success' => true,
'message' => 'Tag anggota berjaya dikemaskini.',
@@ -861,6 +889,14 @@ class CustomerController extends Controller
}
public function anggotaKoperasi(Request $request){
$anggota = Anggota::where('noic',$request->noic)->first();
return response()->json($anggota);
}
public function showCustomerByEachCawangan($ic)
{
$cawangan_all = Cawangan::on('mysql7')->get();
@@ -1102,6 +1138,27 @@ public function AdminsearchCustomerBySAG(Request $request)
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();