freescout-customers-groups/Resources/views/groups/partials/edit_form.blade.php

138 lines
4 KiB
PHP

<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
?>
@include('partials/flash_messages')
<div class="container form-container">
<div class="row">
<div class="col-xs-12">
<form class="form-horizontal margin-top" method="POST" action="" enctype="multipart/form-data">
{{ csrf_field() }}
<!-- Hidden field: The id of the Customers Group that is currently being edited -->
<input
id="customer_id"
type="hidden"
name="customer_id"
value="{{ $group->id }}"
/>
<!-- Mandatory field: The Mailbox this Customers Group is linked to -->
<div class="form-group{{ $errors->has('mailbox') ? ' has-error' : '' }} margin-bottom-0">
<label
for="mailbox"
class="col-sm-2 control-label"
>
{{ __('Mailbox') }}
</label>
<div class="col-sm-6">
<div class="multi-container">
<div class="multi-item">
<div>
<div class="input-group input-group-flex input-sized-lg">
<select class="form-control" name="mailbox" required>
@if($group->mailbox == null)
<option value="" disabled selected>---</option>
@endif
@foreach($mailboxes as $mailbox)
<option
value="{{ $mailbox->id }}"
@if($group->mailbox && $mailbox->id == $group->mailbox->id)
selected
@endif
>
{{ $mailbox->name }}
</option>
@endforeach
</select>
</div>
</div>
</div>
</div>
@include('partials/field_error', ['field'=>'mailbox'])
</div>
</div>
<!-- Mandatory field: The name of this Customers Group -->
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label
for="name"
class="col-sm-2 control-label"
>
{{ __('Name') }}
</label>
<div class="col-sm-6">
<input
id="name"
type="text"
class="form-control input-sized-lg"
name="name"
value="{{ old('name', $group->name) }}"
maxlength="255"
/>
@include('partials/field_error', ['field'=>'name'])
</div>
</div>
<!-- Mandatory field: The list of Emails included in this Customer Group -->
<div class="form-group margin-bottom-0">
<label
for="emails"
class="col-sm-2 control-label"
>
{{ __('Emails') }}
</label>
<div class="col-sm-6">
<div class="multi-container">
@foreach ( $emails as $first_character => $emails_group )
<details>
<summary
style="display: list-item; counter-increment: list-item 0; list-style: disclosure-closed inside; cursor: pointer;"
>
{{ $first_character }}…
</summary>
@foreach ( $emails_group as $email )
<div class="control-group">
<div class="controls">
<label
class="control-label checkbox"
for="email-{{ $email->id }}"
style="text-align: left;"
>
<input
type="checkbox"
name="emails[]"
id="email-{{ $email->id }}"
value="{{ $email->id }}"
@if ( $group->emails()->contains($email) )
checked="checked"
@endif
>
{{ $email->customer->last_name }}
{{ $email->customer->first_name }}
&lt;{{ $email->email }}&gt;
</label>
</div>
</div>
@endforeach
</details>
@endforeach
</div>
{{-- @include('partials/field_error', ['field'=>'emails.*']) --}}
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<button type="submit" class="btn btn-primary">
@if (!empty($save_button_title))
{{ $save_button_title }}
@else
{{ __('Save Group') }}
@endif
</button>
</div>
</div>
</form>
</div>
</div>
</div>