fixed the repeated notes on edit
This commit is contained in:
@@ -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'];
|
||||
|
||||
8
mphatso-notes.md
Normal file
8
mphatso-notes.md
Normal file
@@ -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');
|
||||
Reference in New Issue
Block a user