close #1053 Added: Dashboard date filter

This commit is contained in:
Cüneyt Şentürk
2019-12-30 12:30:30 +03:00
parent 237b161fe0
commit bd0598b4d4
14 changed files with 152 additions and 56 deletions

View File

@ -29,6 +29,18 @@ abstract class Widget extends AbstractWidget
return $this->show();
}
public function applyFilters($model, $args = ['date_field' => 'paid_at'])
{
if (empty(request()->get('start_date', null))) {
return $model;
}
$start_date = request()->get('start_date') . ' 00:00:00';
$end_date = request()->get('end_date') . ' 23:59:59';
return $model->whereBetween($args['date_field'], [$start_date, $end_date]);
}
public function calculateDocumentTotals($model)
{
$open = $overdue = 0;