fix: selected sort not updated first time selected (#6709)

Co-authored-by: Alexis Saettler <alexis@saettler.org>
This commit is contained in:
Ismail A. Amassi
2023-11-01 14:29:34 +02:00
committed by GitHub
parent 4612bb1de3
commit a24704d6ab
3 changed files with 11 additions and 10 deletions
@@ -133,6 +133,7 @@ class ContactsController extends Controller
->withHasArchived($nbArchived > 0)
->withArchivedContacts($nbArchived)
->withTags($tags)
->withSort($sort)
->withTagsCount($tagsCount)
->withUrl($url)
->withTagCount($count)
+4 -4
View File
@@ -496,13 +496,13 @@ class Contact extends Model
{
switch ($criteria) {
case 'firstnameAZ':
return $builder->orderBy('first_name', 'asc');
return $builder->orderBy('first_name');
case 'firstnameZA':
return $builder->orderBy('first_name', 'desc');
return $builder->orderByDesc('first_name');
case 'lastnameAZ':
return $builder->orderBy('last_name', 'asc');
return $builder->orderBy('last_name');
case 'lastnameZA':
return $builder->orderBy('last_name', 'desc');
return $builder->orderByDesc('last_name');
case 'lastactivitydateNewtoOld':
return $this->sortedByLastActivity($builder, 'desc');
case 'lastactivitydateOldtoNew':
+6 -6
View File
@@ -76,27 +76,27 @@
<div class="options-dropdowns dropdown">
<a href="" class="dropdown-btn" data-toggle="dropdown" id="dropdownSort">{{ trans('people.people_list_sort') }}</a>
<div class="dropdown-menu" aria-labelledby="dropdownSort">
<a class="dropdown-item {{ (auth()->user()->contacts_sort_order == 'firstnameAZ')?'selected':'' }}" href="{{ route('people.index') }}?sort=firstnameAZ">
<a class="dropdown-item {{ ($sort == 'firstnameAZ')?'selected':'' }}" href="{{ route('people.index') }}?sort=firstnameAZ">
{{ trans('people.people_list_firstnameAZ') }}
</a>
<a class="dropdown-item {{ (auth()->user()->contacts_sort_order == 'firstnameZA')?'selected':'' }}" href="{{ route('people.index') }}?sort=firstnameZA">
<a class="dropdown-item {{ ($sort == 'firstnameZA')?'selected':'' }}" href="{{ route('people.index') }}?sort=firstnameZA">
{{ trans('people.people_list_firstnameZA') }}
</a>
<a class="dropdown-item {{ (auth()->user()->contacts_sort_order == 'lastnameAZ')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastnameAZ">
<a class="dropdown-item {{ ($sort == 'lastnameAZ')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastnameAZ">
{{ trans('people.people_list_lastnameAZ') }}
</a>
<a class="dropdown-item {{ (auth()->user()->contacts_sort_order == 'lastnameZA')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastnameZA">
<a class="dropdown-item {{ ($sort == 'lastnameZA')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastnameZA">
{{ trans('people.people_list_lastnameZA') }}
</a>
<a class="dropdown-item {{ (auth()->user()->contacts_sort_order == 'lastactivitydateNewtoOld')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastactivitydateNewtoOld">
<a class="dropdown-item {{ ($sort == 'lastactivitydateNewtoOld')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastactivitydateNewtoOld">
{{ trans('people.people_list_lastactivitydateNewtoOld') }}
</a>
<a class="dropdown-item {{ (auth()->user()->contacts_sort_order == 'lastactivitydateOldtoNew')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastactivitydateOldtoNew">
<a class="dropdown-item {{ ($sort == 'lastactivitydateOldtoNew')?'selected':'' }}" href="{{ route('people.index') }}?sort=lastactivitydateOldtoNew">
{{ trans('people.people_list_lastactivitydateOldtoNew') }}
</a>
</div>