private function getStatusLabel($model)
{
$entityType = $this->entityType;
// check if invoice is overdue
if (Utils::parseFloat($model->balance) && $model->due_date && $model->due_date != '0000-00-00') {
if (\DateTime::createFromFormat('Y-m-d', $model->due_date) < new \DateTime('now')) {
$label = $entityType == ENTITY_INVOICE ? trans('texts.overdue') : trans('texts.expired');
return '<h4><div class="label label-danger">' . $label . '</div></h4>';
}
}
$label = trans('texts.status_' . strtolower($model->invoice_status_name));
$class = 'default';
switch ($model->invoice_status_id) {
case INVOICE_STATUS_SENT:
$class = 'info';
break;
case INVOICE_STATUS_VIEWED:
$class = 'warning';
break;
case INVOICE_STATUS_APPROVED:
$class = 'success';
break;
case INVOICE_STATUS_PARTIAL:
$class = 'primary';
break;
case INVOICE_STATUS_PAID:
$class = 'success';
break;
}
return "<h4><div class=\"label label-{$class}\">{$label}</div></h4>";
}