From 52985cd5a0b8570099355c6ad60321a15a90d105 Mon Sep 17 00:00:00 2001 From: Antoine Le Gonidec Date: Mon, 8 Jul 2024 17:46:48 +0200 Subject: [PATCH] Add the ability to set the Mailbox when editing a Customer --- resources/views/customers/update.blade.php | 23 ++++++++++++++++++++ src/Http/Controllers/CustomersController.php | 11 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 resources/views/customers/update.blade.php diff --git a/resources/views/customers/update.blade.php b/resources/views/customers/update.blade.php new file mode 100644 index 0000000..6055bd1 --- /dev/null +++ b/resources/views/customers/update.blade.php @@ -0,0 +1,23 @@ +@extends('layouts.app') + +@section('title_full', $customer->getFullName(true).' - '.__('Customer Profile')) +@section('body_class', 'sidebar-no-height') + +@section('body_attrs')@parent data-customer_id="{{ $customer->id }}"@endsection + +@section('sidebar') +
+ @include('customers/profile_menu') + @include('customers/profile_snippet') +
+@endsection + +@section('content') + @include('customers/profile_tabs') + @include('freescout-restricted-customers::customers/partials/edit_form') +@endsection + +@section('javascript') + @parent + multiInputInit(); +@endsection diff --git a/src/Http/Controllers/CustomersController.php b/src/Http/Controllers/CustomersController.php index 8a59737..eb1bd11 100644 --- a/src/Http/Controllers/CustomersController.php +++ b/src/Http/Controllers/CustomersController.php @@ -22,6 +22,11 @@ class CustomersController extends BaseCustomersController { // instead of overriding the whole method here. $customer = Customer::findOrFail($id); + // Get the list of Mailboxes the current User has access to. + $mailboxes = auth() + ->user() + ->mailboxesCanView(); + $customer_emails = $customer->emails; if (count($customer_emails)) { foreach ($customer_emails as $row) { @@ -31,7 +36,11 @@ class CustomersController extends BaseCustomersController { $emails = ['']; } - return view('customers/update', ['customer' => $customer, 'emails' => $emails]); + return view('freescout-restricted-customers::customers/update', [ + 'customer' => $customer, + 'mailboxes' => $mailboxes, + 'emails' => $emails, + ]); } /**