Merge pull request #6161 from beganovich/v5-2906-tasks-controlled-by-setting

(v5) Show tasks based on setting in the client portal
This commit is contained in:
Benjamin Beganović 2021-06-30 02:01:06 +02:00 committed by GitHub
commit 1c05d51c7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,17 +26,26 @@ class TasksTable extends Component
public $per_page = 10; public $per_page = 10;
public $company; public $company;
public function mount() public function mount()
{ {
MultiDB::setDb($this->company->db); MultiDB::setDb($this->company->db);
} }
public function render() public function render()
{ {
$query = Task::query() $query = Task::query()
->where('client_id', auth('contact')->user()->client->id) ->where('client_id', auth('contact')->user()->client->id);
->whereNotNull('invoice_id')
if ($this->company->getSetting('show_all_tasks_client_portal') === 'invoiced') {
$query = $query->whereNotNull('invoice_id');
}
if ($this->company->getSetting('show_all_tasks_client_portal') === 'uninvoiced') {
$query = $query->whereNull('invoice_id');
}
$query = $query
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->paginate($this->per_page); ->paginate($this->per_page);