Working on the calendar

This commit is contained in:
Hillel Coren 2017-09-12 23:25:41 +03:00
parent a7dcc30711
commit 9b370a3e8d
4 changed files with 29 additions and 18 deletions

View File

@ -75,6 +75,8 @@ class TaskPresenter extends EntityPresenter
{
$data = parent::calendarEvent();
$task = $this->entity;
$account = $task->account;
$date = $account->getDateTime();
$data->title = trans('texts.task');
if ($project = $this->project()) {
@ -89,11 +91,13 @@ class TaskPresenter extends EntityPresenter
if (count($parts)) {
$first = $parts[0];
$start = $first[0];
$data->start = date('Y-m-d H:i:m', $start);
$date->setTimestamp($start);
$data->start = $date->format('Y-m-d H:i:m');
$last = $parts[count($parts) - 1];
$end = count($last) == 2 ? $last[1] : $last[0];
$data->end = date('Y-m-d H:i:m', $end);
$date->setTimestamp($end);
$data->end = $date->format('Y-m-d H:i:m');
}
return $data;

View File

@ -39,26 +39,25 @@
$(function() {
var lastFilter = false;
if (isStorageSupported()) {
lastFilter = JSON.parse(localStorage.getItem('last:calendar_filter'));
}
// Setup state/status filter
$('#entityTypeFilter').select2({
placeholder: "{{ trans('texts.filter') }}",
/*
templateSelection: function(data, container) {
if (data.id == 'archived') {
$(container).css('color', '#fff');
$(container).css('background-color', '#f0ad4e');
$(container).css('border-color', '#eea236');
}
return data.text;
}
*/
}).on('change', function() {
}).val(lastFilter).trigger('change').on('change', function() {
$('#calendar').fullCalendar('refetchEvents');
if (isStorageSupported()) {
var filter = JSON.stringify($('#entityTypeFilter').val());
localStorage.setItem('last:calendar_filter', filter);
}
}).maximizeSelect2Height();
$('#calendar').fullCalendar({
locale: '{{ App::getLocale() }}',
//timezone: 'America/Chicago',
header: {
left: 'prev,next today',
center: 'title',

View File

@ -1,19 +1,20 @@
<li class="nav-{{ $option }} {{ Request::is("{$option}*") ? 'active' : '' }}">
@if ($option == 'settings')
<a type="button" class="btn btn-default btn-sm pull-right" title="{{ Utils::getReadableUrl(request()->path()) }}"
href="{{ Utils::getDocsUrl(request()->path()) }}" target="_blank">
<i class="fa fa-info-circle" style="width:20px"></i>
</a>
@elseif ($option == 'reports')
<a type="button" class="btn btn-default btn-sm pull-right" title="{{ trans('texts.calendar') }}"
href="{{ url('/calendar') }}">
<i class="fa fa-calendar" style="width:20px"></i>
</a>
@elseif (Auth::user()->can('create', $option) || Auth::user()->can('create', substr($option, 0, -1)))
<a type="button" class="btn btn-primary btn-sm pull-right"
href="{{ url("/{$option}/create") }}">
<i class="fa fa-plus-circle" style="width:20px" title="{{ trans('texts.create_new') }}"></i>
</a>
@endif
<a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}"

View File

@ -19,6 +19,13 @@
@stop
@section('top-right')
{!! Button::normal(trans('texts.calendar'))
->asLinkTo(url('/calendar'))
->appendIcon(Icon::create('calendar')) !!}
@stop
@section('content')
@if (!Utils::isPro())