Compare commits

..

2 commits

Author SHA1 Message Date
63097ea17e
0.2.0 release
* Group e-mails by first character in the group creation/edition form.
2024-07-20 18:47:53 +02:00
53cb37897a
Group e-mails by first character in the group creation/edition form 2024-07-20 18:36:58 +02:00
5 changed files with 41 additions and 23 deletions

3
CHANGELOG Normal file
View file

@ -0,0 +1,3 @@
0.2.0
* Group e-mails by first character in the group creation/edition form.

View file

@ -53,6 +53,12 @@ class CustomersGroupsController extends Controller {
->pluck('emails') ->pluck('emails')
->flatten() ->flatten()
->sortBy('email'); ->sortBy('email');
// Group Emails by their first character.
// This is used to display them in collapsible groups.
$emails = $emails->mapToGroups(function ($email) {
$first_character = substr($email->email, $offset = 0, $length = 1);
return [ $first_character => $email ];
});
return view('mmfcustomersgroups::groups/edit', [ return view('mmfcustomersgroups::groups/edit', [
'mailboxes' => $mailboxes, 'mailboxes' => $mailboxes,

View file

@ -84,27 +84,36 @@
</label> </label>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="multi-container"> <div class="multi-container">
@foreach ( $emails as $email ) @foreach ( $emails as $first_character => $emails_group )
<div class="control-group"> <details>
<div class="controls"> <summary
<label style="display: list-item; counter-increment: list-item 0; list-style: disclosure-closed inside; cursor: pointer;"
class="control-label checkbox" >
for="email-{{ $email->id }}" {{ $first_character }}
style="text-align: left;" </summary>
> @foreach ( $emails_group as $email )
<input <div class="control-group">
type="checkbox" <div class="controls">
name="emails[]" <label
id="email-{{ $email->id }}" class="control-label checkbox"
value="{{ $email->id }}" for="email-{{ $email->id }}"
@if ( $group->emails()->contains($email) ) style="text-align: left;"
checked="checked" >
@endif <input
> type="checkbox"
{{ $email->email }} name="emails[]"
</label> id="email-{{ $email->id }}"
</div> value="{{ $email->id }}"
</div> @if ( $group->emails()->contains($email) )
checked="checked"
@endif
>
{{ $email->email }}
</label>
</div>
</div>
@endforeach
</details>
@endforeach @endforeach
</div> </div>
{{-- @include('partials/field_error', ['field'=>'emails.*']) --}} {{-- @include('partials/field_error', ['field'=>'emails.*']) --}}

View file

@ -1,7 +1,7 @@
{ {
"name": "millions-missing-france/freescout-customers-groups", "name": "millions-missing-france/freescout-customers-groups",
"description": "Freescout customers groups - Set groups of Freescout Customers for easier group emailing", "description": "Freescout customers groups - Set groups of Freescout Customers for easier group emailing",
"version": "0.1.0", "version": "0.2.0",
"type": "library", "type": "library",
"license": ["AGPL-3.0-only"], "license": ["AGPL-3.0-only"],
"authors": [ "authors": [

View file

@ -2,7 +2,7 @@
"name": "MMFCustomersGroups", "name": "MMFCustomersGroups",
"alias": "mmfcustomersgroups", "alias": "mmfcustomersgroups",
"description": "Freescout customers groups - Set groups of Freescout Customers for easier group emailing", "description": "Freescout customers groups - Set groups of Freescout Customers for easier group emailing",
"version": "0.1.0", "version": "0.2.0",
"detailsUrl": "", "detailsUrl": "",
"author": "Millions Missing FRANCE", "author": "Millions Missing FRANCE",
"authorUrl": "info@millionsmissing.fr", "authorUrl": "info@millionsmissing.fr",