diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php index 9866e87c9..7d098f491 100644 --- a/app/Http/Controllers/ContactsController.php +++ b/app/Http/Controllers/ContactsController.php @@ -29,6 +29,14 @@ class ContactsController extends Controller $user->updateContactViewPreference($sort); } + $date_flag = false; + + if (str_contains($sort, 'lastactivitydate')) { + $date_sort = str_after($sort, 'lastactivitydate'); + $sort = 'firstnameAZ'; + $date_flag = true; + } + $tags = null; $url = ''; $tagCount = 1; @@ -74,6 +82,18 @@ class ContactsController extends Controller $contacts = $user->account->contacts()->real()->sortedBy($sort)->get(); } + if ($date_flag) { + foreach ($contacts as $contact) { + $contact['sort_date'] = $contact->getLastActivityDate(); + } + + if ($date_sort == 'NewtoOld') { + $contacts = $contacts->sortByDesc('sort_date'); + } elseif ($date_sort == 'OldtoNew') { + $contacts = $contacts->sortBy('sort_date'); + } + } + return view('people.index') ->withContacts($contacts) ->withTags($tags) diff --git a/resources/lang/cz/people.php b/resources/lang/cz/people.php index 0dafcb42f..ce61d8b5f 100644 --- a/resources/lang/cz/people.php +++ b/resources/lang/cz/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Řadit podle jména Z → A', 'people_list_lastnameAZ' => 'Řadit podle příjmení A → Z', 'people_list_lastnameZA' => 'Řadit podle příjmení Z → A', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Zobrazeny všechny kontakty s tagem ', 'people_list_clear_filter' => 'Vyčistit filtr', 'people_list_contacts_per_tags' => '{0} 0 kontaktů|{1,1} 1 kontakt|{2,*} :count kontaktů', diff --git a/resources/lang/de/people.php b/resources/lang/de/people.php index 42a30fb33..75e99929a 100644 --- a/resources/lang/de/people.php +++ b/resources/lang/de/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Nach Vorname sortieren Z → A', 'people_list_lastnameAZ' => 'Nach Nachname sortieren A → Z', 'people_list_lastnameZA' => 'Nach Nachname sortieren Z → A', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Zeige alle Kontakte mit Tag: ', 'people_list_clear_filter' => 'Filter löschen', 'people_list_contacts_per_tags' => '{0} 0 Kontakte|{1,1} 1 Kontakt|{2,*} :count Kontakte', diff --git a/resources/lang/en/people.php b/resources/lang/en/people.php index bc561daa9..abe3656cf 100644 --- a/resources/lang/en/people.php +++ b/resources/lang/en/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Sort by first name Z → A', 'people_list_lastnameAZ' => 'Sort by last name A → Z', 'people_list_lastnameZA' => 'Sort by last name Z → A', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Showing all the contacts tagged with ', 'people_list_clear_filter' => 'Clear filter', 'people_list_contacts_per_tags' => '{0} 0 contact|{1,1} 1 contact|{2,*} :count contacts', diff --git a/resources/lang/fr/people.php b/resources/lang/fr/people.php index 45700d149..68ccb5411 100644 --- a/resources/lang/fr/people.php +++ b/resources/lang/fr/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Tri par prénom Z → A', 'people_list_lastnameAZ' => 'Tri par nom de famille A → Z', 'people_list_lastnameZA' => 'Tri par nom de famille Z → A', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Affichge des contacts avec le tag ', 'people_list_clear_filter' => 'Enlever le filtre', 'people_list_contacts_per_tags' => '{0} 0 contact|{1,1} 1 contact|{2,*} :count contacts', diff --git a/resources/lang/it/people.php b/resources/lang/it/people.php index 913b6c86d..733cf94f9 100644 --- a/resources/lang/it/people.php +++ b/resources/lang/it/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Ordina per nome Z → A', 'people_list_lastnameAZ' => 'Ordina per cognome A → Z', 'people_list_lastnameZA' => 'Ordina per cognome Z → A', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Tutti i contatti etichettati con ', 'people_list_clear_filter' => 'Reimposta filtro', 'people_list_contacts_per_tags' => '{0} 0 contatti|{1,1} 1 contatto|{2,*} :count contatti', diff --git a/resources/lang/pt-br/people.php b/resources/lang/pt-br/people.php index 7f2311818..cd96803dc 100644 --- a/resources/lang/pt-br/people.php +++ b/resources/lang/pt-br/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Classificar por primeiro nome Z → A', 'people_list_lastnameAZ' => 'Classificar por sobrenome A → Z', 'people_list_lastnameZA' => 'Classificar por sobrenome Z → A', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Showing all the contacts tagged with ', 'people_list_clear_filter' => 'Clear filter', 'people_list_contacts_per_tags' => '{0} 0 contact|{1,1} 1 contact|{2,*} :count contacts', diff --git a/resources/lang/ru/people.php b/resources/lang/ru/people.php index 4cea7b439..0fe2fefa5 100644 --- a/resources/lang/ru/people.php +++ b/resources/lang/ru/people.php @@ -14,6 +14,8 @@ return [ 'people_list_firstnameZA' => 'Сортировать по имени Я → А', 'people_list_lastnameAZ' => 'Сортировать по фамилии А → Я', 'people_list_lastnameZA' => 'Сортировать по фамилии Я → А', + 'people_list_lastactivitydateNewtoOld' => 'Sort by last activity date newest to oldest', + 'people_list_lastactivitydateOldtoNew' => 'Sort by last activity date oldest to newest', 'people_list_filter_tag' => 'Показываются все контакты помеченные тэгом ', 'people_list_clear_filter' => 'Очистить фильтр', 'people_list_contacts_per_tags' => ':count контакт|:count контакта|:count контактов', diff --git a/resources/views/people/index.blade.php b/resources/views/people/index.blade.php index b4bd5c9bc..7629efb1b 100644 --- a/resources/views/people/index.blade.php +++ b/resources/views/people/index.blade.php @@ -98,6 +98,14 @@ {{ trans('people.people_list_lastnameZA') }} + + + {{ trans('people.people_list_lastactivitydateNewtoOld') }} + + + + {{ trans('people.people_list_lastactivitydateOldtoNew') }} +