Fixes for default sort order in Client Portal
This commit is contained in:
parent
7fa7d5349a
commit
2d562b0d6e
|
|
@ -34,6 +34,12 @@ class CreditsTable extends Component
|
|||
{
|
||||
MultiDB::setDb($this->db);
|
||||
|
||||
|
||||
$this->sort_asc = false;
|
||||
|
||||
$this->sort_field = 'date';
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class InvoicesTable extends Component
|
|||
$q->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . ($this->sort_asc ? 'desc' : 'asc'));
|
||||
})
|
||||
->when($this->sort_field != 'number', function ($q){
|
||||
$q->orderBy($this->sort_field, ($this->sort_asc ? 'desc' : 'asc'));
|
||||
$q->orderBy($this->sort_field, ($this->sort_asc ? 'asc' : 'desc'));
|
||||
});
|
||||
// ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ class PaymentsTable extends Component
|
|||
public function mount()
|
||||
{
|
||||
MultiDB::setDb($this->db);
|
||||
|
||||
$this->sort_asc = false;
|
||||
|
||||
$this->sort_field = 'date';
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ class QuotesTable extends Component
|
|||
public function mount()
|
||||
{
|
||||
MultiDB::setDb($this->db);
|
||||
|
||||
$this->sort_asc = false;
|
||||
|
||||
$this->sort_field = 'date';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -55,10 +59,10 @@ class QuotesTable extends Component
|
|||
->with('client.contacts', 'company')
|
||||
// ->orderBy($this->sort, $this->sort_asc ? 'asc' : 'desc');
|
||||
->when($this->sort == 'number', function ($q){
|
||||
$q->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . ($this->sort_asc ? 'desc' : 'asc'));
|
||||
$q->orderByRaw("REGEXP_REPLACE(number,'[^0-9]+','')+0 " . ($this->sort_asc ? 'asc' : 'desc'));
|
||||
})
|
||||
->when($this->sort != 'number', function ($q){
|
||||
$q->orderBy($this->sort, ($this->sort_asc ? 'desc' : 'asc'));
|
||||
$q->orderBy($this->sort, ($this->sort_asc ? 'asc' : 'desc'));
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class TasksTable extends Component
|
|||
public function mount()
|
||||
{
|
||||
MultiDB::setDb($this->db);
|
||||
|
||||
$this->sort_asc = false;
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
|||
Loading…
Reference in New Issue