diff --git a/app/Http/Controllers/ClientsController.php b/app/Http/Controllers/ClientsController.php index eb0f569..87423dc 100755 --- a/app/Http/Controllers/ClientsController.php +++ b/app/Http/Controllers/ClientsController.php @@ -15,7 +15,7 @@ use Carbon\Carbon; class ClientsController extends Controller -{ +{ /** * Display a listing of the resource. * @@ -313,27 +313,21 @@ class ClientsController extends Controller 'notes_body' => 'required' ]); $auth_user = session('current_user'); - $notes_arr = [ - 'notes_body' => $request->notes_body, - 'services' => implode(',', $request->services), - 'auth_user_id' => $auth_user['id'], - 'client_id' => $request->client_id - ]; + $note = Models\ClientNote::find($request->note_id); + $note->notes_body = $request->notes_body; + $note->services = implode(',', $request->services); + if ($request->has('highlight')) { - $notes_arr['highlight'] = 'YES'; + $note->highlight = 'YES'; } + $result = $note->save(); - - //dd($notes_arr); - // change this to update - $result = Models\ClientNote::create($notes_arr); - - $notes = Models\ClientNote::with('client_info', 'created_by_info')->find($result->id); - //todo : send emails + $notes = Models\ClientNote::with('client_info', 'created_by_info')->find($request->note_id); + //dispatch(new SendNewNotesEmailAlert($notes)); if ($result) { - $data = ['code' => 1, 'msg' => 'Notes successfully added']; + $data = ['code' => 1, 'msg' => 'Notes successfully updated']; } else{ $data = ['code' => 3, 'msg' => 'Your request could not be handled at this time']; diff --git a/mphatso-notes.md b/mphatso-notes.md new file mode 100644 index 0000000..145830d --- /dev/null +++ b/mphatso-notes.md @@ -0,0 +1,8 @@ +INSERT INTO `client_notes` (`id`, `client_id`, `services`, `auth_user_id`, `notes_body`, `highlight`, `created_at`, `updated_at`) +VALUES + (955, '229', 'A2P', 15, 'A bilateral prepaid agreement has been signed by both Click Mobile and Telxio Networks.\r\nThe next step is to exchange tech forms for the interconnection.', 'NO', '2024-03-11 11:34:14', '2024-03-11 11:34:14'); + + +INSERT INTO `client_notes` (`id`, `client_id`, `services`, `auth_user_id`, `notes_body`, `highlight`, `created_at`, `updated_at`) +VALUES + (954, '229', 'A2P', 15, 'A bilateral prepaid agreement has been signed by both Click Mobile and Telxio.\r\nThe next stepp is to excahnge tech forms for the interconnection.', 'NO', '2024-03-11 08:00:02', '2024-03-11 08:00:02');