Working on the calendar

This commit is contained in:
Hillel Coren 2017-09-13 14:40:07 +03:00
parent ff034b08c0
commit e0bcd698ac
4 changed files with 40 additions and 9 deletions

View File

@ -50,6 +50,24 @@ class EntityPresenter extends Presenter
return "<span style=\"font-size:13px\" class=\"label label-{$class}\">{$label}</span>"; return "<span style=\"font-size:13px\" class=\"label label-{$class}\">{$label}</span>";
} }
public function statusColor()
{
$class = $this->entity->statusClass();
switch ($class) {
case 'success':
return '#5cb85c';
case 'warning':
return '#f0ad4e';
case 'primary':
return '#337ab7';
case 'info':
return '#5bc0de';
default:
return '#777';
}
}
/** /**
* @return mixed * @return mixed
*/ */

View File

@ -331,8 +331,13 @@ class InvoicePresenter extends EntityPresenter
$entityType = $invoice->getEntityType(); $entityType = $invoice->getEntityType();
$data->title = trans("texts.{$entityType}") . ' ' . $invoice->invoice_number . ' | ' . $this->amount() . ' | ' . $this->client(); $data->title = trans("texts.{$entityType}") . ' ' . $invoice->invoice_number . ' | ' . $this->amount() . ' | ' . $this->client();
$data->start = $invoice->invoice_date; $data->start = $invoice->due_date ?: $invoice->invoice_date;
$data->borderColor = $data->backgroundColor = $invoice->isQuote() ? '#984ea3' : '#377eb8';
if ($subColors) {
$data->borderColor = $data->backgroundColor = $invoice->present()->statusColor();
} else {
$data->borderColor = $data->backgroundColor = $invoice->isQuote() ? '#984ea3' : '#377eb8';
}
return $data; return $data;
} }

View File

@ -52,9 +52,14 @@ class PaymentPresenter extends EntityPresenter
$payment = $this->entity; $payment = $this->entity;
$invoice = $payment->invoice; $invoice = $payment->invoice;
$data->title = trans('texts.payment') . ' ' . $invoice->invoice_number . ' | ' . $this->amount() . ' | ' . $this->client(); $data->title = trans('texts.payment') . ' ' . $invoice->invoice_number . ' | ' . $this->completedAmount() . ' | ' . $this->client();
$data->start = $payment->payment_date; $data->start = $payment->payment_date;
$data->borderColor = $data->backgroundColor = '#4daf4a';
if ($subColors) {
$data->borderColor = $data->backgroundColor = Utils::brewerColor($payment->payment_status_id);
} else {
$data->borderColor = $data->backgroundColor = '#4daf4a';
}
return $data; return $data;
} }

View File

@ -24,11 +24,13 @@
@section('top-right') @section('top-right')
<select class="form-control" style="width: 220px" id="entityTypeFilter" multiple="true"> <div id="entityTypeFilterWrapper" style="display:none">
@foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, ENTITY_TASK, ENTITY_EXPENSE] as $value) <select class="form-control" style="width: 220px;" id="entityTypeFilter" multiple="true">
<option value="{{ $value }}">{{ trans("texts.{$value}") }}</option> @foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, ENTITY_TASK, ENTITY_EXPENSE] as $value)
@endforeach <option value="{{ $value }}">{{ trans("texts.{$value}") }}</option>
</select> @endforeach
</select>
</div>
@stop @stop
@section('content') @section('content')
@ -62,6 +64,7 @@
localStorage.setItem('last:calendar_filter', filter); localStorage.setItem('last:calendar_filter', filter);
} }
}).maximizeSelect2Height(); }).maximizeSelect2Height();
$('#entityTypeFilterWrapper').show();
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
locale: '{{ App::getLocale() }}', locale: '{{ App::getLocale() }}',