Add the ability to set the Mailbox when editing a Customer

This commit is contained in:
Antoine Le Gonidec 2024-07-08 17:46:48 +02:00
parent 6fbaf4bfc3
commit 52985cd5a0
Signed by: vv221
GPG key ID: 636B78F91CEB80D8
2 changed files with 33 additions and 1 deletions

View file

@ -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')
<div class="profile-preview">
@include('customers/profile_menu')
@include('customers/profile_snippet')
</div>
@endsection
@section('content')
@include('customers/profile_tabs')
@include('freescout-restricted-customers::customers/partials/edit_form')
@endsection
@section('javascript')
@parent
multiInputInit();
@endsection

View file

@ -22,6 +22,11 @@ class CustomersController extends BaseCustomersController {
// instead of overriding the whole method here. // instead of overriding the whole method here.
$customer = Customer::findOrFail($id); $customer = Customer::findOrFail($id);
// Get the list of Mailboxes the current User has access to.
$mailboxes = auth()
->user()
->mailboxesCanView();
$customer_emails = $customer->emails; $customer_emails = $customer->emails;
if (count($customer_emails)) { if (count($customer_emails)) {
foreach ($customer_emails as $row) { foreach ($customer_emails as $row) {
@ -31,7 +36,11 @@ class CustomersController extends BaseCustomersController {
$emails = ['']; $emails = [''];
} }
return view('customers/update', ['customer' => $customer, 'emails' => $emails]); return view('freescout-restricted-customers::customers/update', [
'customer' => $customer,
'mailboxes' => $mailboxes,
'emails' => $emails,
]);
} }
/** /**