fixed otp email settings and added edit/delete to show tabs
This commit is contained in:
@@ -832,7 +832,7 @@ class ClientsController extends Controller
|
||||
}
|
||||
public function update_notes(Request $request, $id)
|
||||
{
|
||||
$note = ClientNote::findOrFail($id);
|
||||
$note = Models\ClientNote::findOrFail($id);
|
||||
|
||||
// Optional: Double-check the 2-day rule on the backend for security
|
||||
if ($note->created_at->diffInDays(now()) > 2) {
|
||||
@@ -859,7 +859,7 @@ class ClientsController extends Controller
|
||||
]);
|
||||
|
||||
// Find the record and update it
|
||||
$shortcode = ShortCode::findOrFail($id); // Adjust 'ShortCode' to your actual model name
|
||||
$shortcode = Models\ShortCode::findOrFail($id); // Adjust 'ShortCode' to your actual model name
|
||||
$shortcode->update($validated);
|
||||
|
||||
// Return the JSON response for SweetAlert
|
||||
@@ -879,7 +879,7 @@ class ClientsController extends Controller
|
||||
]);
|
||||
|
||||
// Find the record and update it
|
||||
$payment = ClientPayment::findOrFail($id); // Adjust 'ClientPayment' to your actual model name
|
||||
$payment = Models\ClientPayment::findOrFail($id); // Adjust 'ClientPayment' to your actual model name
|
||||
$payment->update($validated);
|
||||
|
||||
// Return the JSON response for SweetAlert
|
||||
@@ -889,6 +889,44 @@ class ClientsController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy_note($id)
|
||||
{
|
||||
$note = Models\ClientNote::findOrFail($id);
|
||||
|
||||
// Enforce the 2-day restriction on the backend for security
|
||||
if ($note->created_at->diffInDays(now()) > 2) {
|
||||
return response()->json(['message' => 'Cannot delete notes older than 2 days.'], 403);
|
||||
}
|
||||
|
||||
$note->delete();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Note deleted successfully.'
|
||||
]);
|
||||
}
|
||||
public function destroy_short_code($id)
|
||||
{
|
||||
$shortcode = Models\ShortCode::findOrFail($id); // Adjust model name if needed
|
||||
$shortcode->delete();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Short code deleted successfully.'
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy_payment($id)
|
||||
{
|
||||
$payment = Models\ClientPayment::findOrFail($id); // Adjust model name if needed
|
||||
$payment->delete();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Payment record deleted successfully.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user