configure first day of week for calendar and date-picker (#1952)

This commit is contained in:
Kevin Papst
2020-09-05 18:31:37 +02:00
committed by GitHub
parent ed528eb19a
commit 217960de60
30 changed files with 195 additions and 71 deletions

View File

@@ -57,12 +57,45 @@
};
document.addEventListener('kimai.initialized', function(event) {
var API = event.detail.kimai.getPlugin('api');
var kimai = event.detail.kimai;
var API = kimai.getPlugin('api');
$('#timesheet_calendar').fullCalendar({
defaultView: '{{ app.user.getPreferenceValue('calendar.initial_view') }}',
{% if not google.apiKey is null %}
googleCalendarApiKey: '{{ google.apiKey }}',
{% endif %}
header : {
left : 'prev,next today',
center: 'title',
right : 'month,agendaWeek,agendaDay'
},
eventLimit: {{ config.dayLimit }},
weekNumbers: {% if config.showWeekNumbers %}true{% else %}false{% endif %},
allDaySlot: false,
navLinks: true,
locale: kimai.getConfiguration().get('locale').replace('_', '-').toLowerCase(),
firstDay: kimai.getConfiguration().get('first_dow_iso'),
/*
// TODO calculate height properly instead of relying on the default aspectRatio
height: function() {
return 'parent';
},
*/
height: 'auto',
nowIndicator: true,
now: '{{ now|date_format('c') }}',
timezone: '{{ app.user.preferenceValue("timezone") }}',
weekends: {% if config.showWeekends %}true{% else %}false{% endif %},
businessHours: {
dow: [{{ config.businessDays|join(',') }}],
start: '{{ config.businessTimeBegin }}',
end: '{{ config.businessTimeEnd }}'
},
slotDuration: '{{ config.slotDuration }}',
slotLabelInterval: '{{ config.slotDuration }}',
minTime: '{{ config.timeframeBegin }}',
maxTime: '{{ config.timeframeEnd }}',
defaultTimedEventDuration: '00:30',
eventSources: [
{
events: function(start, end, timezone, callback) {
@@ -107,32 +140,6 @@
}
{% endfor %}
],
header : {
left : 'prev,next today',
center: 'title',
right : 'month,agendaWeek,agendaDay'
},
eventLimit: {{ config.dayLimit }},
weekNumbers: {% if config.showWeekNumbers %}true{% else %}false{% endif %},
allDaySlot: false,
navLinks: true,
locale: '{{ app.request.locale|replace({'_': '-'})|lower }}',
/*
// TODO calculate height properly instead of relying on the default aspectRatio
height: function() {
return 'parent';
},
*/
height: 'auto',
nowIndicator: true,
now: '{{ now|date_format('c') }}',
timezone: '{{ app.user.preferenceValue("timezone") }}',
weekends: {% if config.showWeekends %}true{% else %}false{% endif %},
businessHours: {
dow: [{{ config.businessDays|join(',') }}],
start: '{{ config.businessTimeBegin }}',
end: '{{ config.businessTimeEnd }}'
},
eventRender: function(eventObj, $el) {
// don't show popover for google calendar
if (eventObj.source.ajaxSettings !== undefined) {
@@ -214,11 +221,6 @@
eventResize: changeHandler,
{% endif %}
{% endif %}
slotDuration: '{{ config.slotDuration }}',
slotLabelInterval: '{{ config.slotDuration }}',
minTime: '{{ config.timeframeBegin }}',
maxTime: '{{ config.timeframeEnd }}',
defaultTimedEventDuration: '00:30'
})
});
</script>