1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/resources/views/calendar.blade.php

106 lines
2.8 KiB
PHP
Raw Normal View History

2017-09-12 12:43:59 +02:00
@extends('header')
@section('head')
@parent
<script src="{{ asset('js/select2.min.js') }}" type="text/javascript"></script>
<link href="{{ asset('css/select2.css') }}" rel="stylesheet" type="text/css"/>
<script src="{{ asset('js/fullcalendar.min.js') }}" type="text/javascript"></script>
<link href="{{ asset('css/fullcalendar.css') }}" rel="stylesheet" type="text/css"/>
@stop
2017-09-12 16:16:18 +02:00
@section('head_css')
@parent
<style type="text/css">
.fc-day,
.fc-list-item {
background-color: white;
}
</style>
@stop
2017-09-12 12:43:59 +02:00
@section('top-right')
2017-09-13 13:40:07 +02:00
<div id="entityTypeFilterWrapper" style="display:none">
<select class="form-control" style="width: 220px;" id="entityTypeFilter" multiple="true">
2017-12-24 17:56:01 +01:00
@foreach ([ENTITY_INVOICE, ENTITY_PAYMENT, ENTITY_QUOTE, ENTITY_PROJECT, ENTITY_TASK, ENTITY_EXPENSE] as $value)
2017-09-13 13:40:07 +02:00
<option value="{{ $value }}">{{ trans("texts.{$value}") }}</option>
@endforeach
</select>
</div>
2017-09-12 12:43:59 +02:00
@stop
@section('content')
2017-09-13 10:56:26 +02:00
@if (!Utils::isPro())
<div class="alert alert-warning" style="font-size:larger">
<center>
{!! trans('texts.pro_plan_calendar', ['link'=>'<a href="javascript:showUpgradeModal()">' . trans('texts.pro_plan_remove_logo_link') . '</a>']) !!}
</center>
</div>
@endif
2017-09-12 12:43:59 +02:00
<div id='calendar'></div>
<script type="text/javascript">
2017-09-14 10:38:30 +02:00
$(function() {
2017-09-12 12:43:59 +02:00
2017-09-12 22:25:41 +02:00
var lastFilter = false;
2017-09-13 15:45:20 +02:00
var lastView = 'month';
2017-09-12 22:25:41 +02:00
if (isStorageSupported()) {
lastFilter = JSON.parse(localStorage.getItem('last:calendar_filter'));
2017-09-14 10:38:30 +02:00
lastView = localStorage.getItem('last:calendar_view') || lastView;
2017-09-12 22:25:41 +02:00
}
2017-09-14 10:38:30 +02:00
// Setup state/status filter
$('#entityTypeFilter').select2({
placeholder: "{{ trans('texts.filter') }}",
}).val(lastFilter).trigger('change').on('change', function() {
2017-09-12 16:16:18 +02:00
$('#calendar').fullCalendar('refetchEvents');
2017-09-12 22:25:41 +02:00
if (isStorageSupported()) {
var filter = JSON.stringify($('#entityTypeFilter').val());
localStorage.setItem('last:calendar_filter', filter);
}
2017-09-14 10:38:30 +02:00
}).maximizeSelect2Height();
2017-09-13 13:40:07 +02:00
$('#entityTypeFilterWrapper').show();
2017-09-12 12:43:59 +02:00
2017-09-14 10:38:30 +02:00
$('#calendar').fullCalendar({
2017-09-12 16:16:18 +02:00
locale: '{{ App::getLocale() }}',
2017-09-13 10:56:26 +02:00
firstDay: {{ $account->start_of_week ?: '0' }},
2017-09-13 15:45:20 +02:00
defaultView: lastView,
viewRender: function(view, element) {
if (isStorageSupported()) {
localStorage.setItem('last:calendar_view', view.name);
}
},
2017-09-14 10:38:30 +02:00
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay,listWeek'
},
defaultDate: '{{ date('Y-m-d') }}',
eventLimit: true,
events: {
2018-02-25 22:03:29 +01:00
url: '{{ url('/reports/calendar_events') }}',
2017-09-14 10:38:30 +02:00
type: 'GET',
2017-09-12 16:16:18 +02:00
data: function() {
2017-09-14 10:38:30 +02:00
return {
filter: $('#entityTypeFilter').val()
};
},
error: function() {
alert("{{ trans('texts.error_refresh_page') }}");
},
}
});
});
2017-09-12 12:43:59 +02:00
</script>
@stop