fixed otp email settings
This commit is contained in:
@@ -830,6 +830,64 @@ class ClientsController extends Controller
|
||||
|
||||
return response()->json(['message' => 'Note added successfully!']);
|
||||
}
|
||||
public function update_notes(Request $request, $id)
|
||||
{
|
||||
$note = ClientNote::findOrFail($id);
|
||||
|
||||
// Optional: Double-check the 2-day rule on the backend for security
|
||||
if ($note->created_at->diffInDays(now()) > 2) {
|
||||
return response()->json(['errors' => ['Cannot edit notes older than 2 days.']], 403);
|
||||
}
|
||||
|
||||
$note->update([
|
||||
'notes_body' => $request->notes_body,
|
||||
]);
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Note updated successfully!']);
|
||||
}
|
||||
|
||||
public function update_short_code(Request $request, $id)
|
||||
{
|
||||
// Validate the inputs based on the fields in your edit modal
|
||||
$validated = $request->validate([
|
||||
'code_type' => 'required|string',
|
||||
'shortcode' => 'required|string',
|
||||
'network' => 'required|string',
|
||||
'status' => 'required|string',
|
||||
'expiry_date' => 'nullable|date',
|
||||
'remarks' => 'nullable|string',
|
||||
]);
|
||||
|
||||
// Find the record and update it
|
||||
$shortcode = ShortCode::findOrFail($id); // Adjust 'ShortCode' to your actual model name
|
||||
$shortcode->update($validated);
|
||||
|
||||
// Return the JSON response for SweetAlert
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Short code updated successfully!'
|
||||
]);
|
||||
}
|
||||
public function update_payment(Request $request, $id)
|
||||
{
|
||||
// Validate the inputs based on the fields in your edit modal
|
||||
$validated = $request->validate([
|
||||
'invoice_number' => 'required|string',
|
||||
'invoice_amount' => 'required|numeric',
|
||||
'invoice_date' => 'required|date',
|
||||
'invoice_status' => 'required|string',
|
||||
]);
|
||||
|
||||
// Find the record and update it
|
||||
$payment = ClientPayment::findOrFail($id); // Adjust 'ClientPayment' to your actual model name
|
||||
$payment->update($validated);
|
||||
|
||||
// Return the JSON response for SweetAlert
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Payment record updated successfully!'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user