Skip to content

Commit 15babcc

Browse files
committed
calendar not showing fixed; ui issues fixed
1 parent 8211206 commit 15babcc

File tree

2 files changed

+115
-109
lines changed

2 files changed

+115
-109
lines changed

app/Domain/Calendar/Js/calendarController.mjs

+15-3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ export const initTicketsCalendar = function (
144144
dayHeaderFormat: getFormatFromSettings("dateformat", "luxon"),
145145
eventTimeFormat: getFormatFromSettings("timeformat", "luxon"),
146146
slotLabelFormat: getFormatFromSettings("timeformat", "luxon"),
147+
views: {
148+
timeGridDay: {},
149+
timeGridWeek: {},
150+
dayGridMonth: {
151+
dayHeaderFormat: { weekday: 'short' },
152+
},
153+
multiMonthYear: {
154+
showNonCurrentDates: true,
155+
multiMonthTitleFormat: { month: 'long', year: 'numeric' },
156+
dayHeaderFormat: { weekday: 'short' },
157+
}
158+
},
147159
nowIndicator: true,
148160
bootstrapFontAwesome: {
149161
close: 'fa-times',
@@ -155,7 +167,7 @@ export const initTicketsCalendar = function (
155167
eventDrop: function (event) {
156168
jQuery.ajax({
157169
type : 'PATCH',
158-
url : appUrl + '/api/tickets',
170+
url : leantime.appUrl + '/api/tickets',
159171
data : {
160172
id: event.event.extendedProps.entityId,
161173
editFrom: event.event.startStr,
@@ -166,7 +178,7 @@ export const initTicketsCalendar = function (
166178
eventResize: function (event) {
167179
jQuery.ajax({
168180
type : 'PATCH',
169-
url : appUrl + '/api/tickets',
181+
url : lentime.appUrl + '/api/tickets',
170182
data : {
171183
id: event.event.extendedProps.entityId,
172184
editFrom: event.event.startStr,
@@ -178,7 +190,7 @@ export const initTicketsCalendar = function (
178190
});
179191
calendar.setOption('locale', leantime.i18n.__("language.code"));
180192
calendar.render();
181-
calendar.scrollToTime( 100 );
193+
calendar.scrollToTime( Date.now() );
182194
jQuery("#calendarTitle h2").text(calendar.getCurrentData().viewTitle);
183195
jQuery('.fc-prev-button').click(function() {
184196
calendar.prev();

app/Domain/Tickets/Templates/calendar.blade.php

+100-106
Original file line numberDiff line numberDiff line change
@@ -31,65 +31,66 @@
3131
$tpl->dispatchTplEvent('filters.beforeLefthandSectionClose');
3232
?>
3333
</div>
34-
<div class="col-md-4">
34+
<div class="col-md-4 p-2">
3535
<div class="fc-center center" id="calendarTitle" style="padding-top:5px;">
3636
<h2>..</h2>
3737
</div>
3838
</div>
39-
<div class="col-md-4">
39+
<div class="col-md-4 p-2">
4040

41-
<x-global::forms.button
42-
type="button"
43-
class="right"
44-
style="margin-right:5px;"
45-
content-role='secondary'
41+
<x-global::forms.button
42+
type="button"
43+
class="fc-next-button right"
44+
style="margin-right:5px;"
45+
content-role='secondary'
4646
>
47-
<span class="fc-icon fc-icon-chevron-right"></span>
48-
</x-global::forms.button>
49-
50-
<x-global::forms.button
51-
type="button"
52-
class="right"
53-
style="margin-right:5px;"
54-
content-role='secondary'
55-
47+
<span class="fc-icon fc-icon-chevron-right"></span>
48+
</x-global::forms.button>
49+
50+
<x-global::forms.button
51+
type="button"
52+
class="fc-prev-button right"
53+
style="margin-right:5px;"
54+
content-role='secondary'
5655
>
57-
<span class="fc-icon fc-icon-chevron-left"></span>
58-
</x-global::forms.button>
59-
60-
<x-global::forms.button
61-
type="button"
62-
class="fc-today-button btn btn-default right"
63-
style="margin-right:5px;">
64-
today
65-
</x-global::forms.button>
66-
67-
68-
<x-global::forms.select class="right" id="my-select">
69-
<x-global::forms.select.select-option
70-
value="timeGridDay"
71-
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'timeGridDay'">
72-
Day
73-
</x-global::forms.select.select-option>
74-
75-
<x-global::forms.select.select-option
76-
value="timeGridWeek"
77-
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'timeGridWeek'">
78-
Week
79-
</x-global::forms.select.select-option>
80-
81-
<x-global::forms.select.select-option
82-
value="dayGridMonth"
83-
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'dayGridMonth'">
84-
Month
85-
</x-global::forms.select.select-option>
86-
87-
<x-global::forms.select.select-option
88-
value="multiMonthYear"
89-
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'multiMonthYear'">
90-
Year
91-
</x-global::forms.select.select-option>
92-
</x-global::forms.select>
56+
<span class="fc-icon fc-icon-chevron-left"></span>
57+
</x-global::forms.button>
58+
59+
<x-global::forms.button
60+
type="button"
61+
class="fc-today-button right"
62+
style="margin-right:5px;"
63+
content-role='secondary'
64+
>
65+
today
66+
</x-global::forms.button>
67+
68+
69+
<x-global::forms.select class="right" id="my-select" style="margin-right:5px;">
70+
<x-global::forms.select.select-option
71+
value="timeGridDay"
72+
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'timeGridDay'">
73+
Day
74+
</x-global::forms.select.select-option>
75+
76+
<x-global::forms.select.select-option
77+
value="timeGridWeek"
78+
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'timeGridWeek'">
79+
Week
80+
</x-global::forms.select.select-option>
81+
82+
<x-global::forms.select.select-option
83+
value="dayGridMonth"
84+
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'dayGridMonth'">
85+
Month
86+
</x-global::forms.select.select-option>
87+
88+
<x-global::forms.select.select-option
89+
value="multiMonthYear"
90+
:selected="session('usersettings.submenuToggle.myProjectCalendarView') == 'multiMonthYear'">
91+
Year
92+
</x-global::forms.select.select-option>
93+
</x-global::forms.select>
9394

9495

9596
</div>
@@ -122,78 +123,71 @@ class="fc-today-button btn btn-default right"
122123
<?php } ?>
123124
124125
125-
});
126+
var events = [
127+
<?php foreach ($milestones as $mlst) :
128+
$headline = $tpl->__('label.' . strtolower($mlst->type)) . ": " . $mlst->headline;
129+
if ($mlst->type == "milestone") {
130+
$headline .= " (" . $mlst->percentDone . "% Done)";
131+
}
126132
133+
$color = "#8D99A6";
134+
if ($mlst->type == "milestone") {
135+
$color = $mlst->tags;
136+
}
127137
128-
var events = [
129-
<?php foreach ($milestones as $mlst) :
130-
$headline = $tpl->__('label.' . strtolower($mlst->type)) . ": " . $mlst->headline;
131-
if ($mlst->type == "milestone") {
132-
$headline .= " (" . $mlst->percentDone . "% Done)";
133-
}
138+
$sortIndex = 0;
139+
if ($mlst->sortIndex != '' && is_numeric($mlst->sortIndex)) {
140+
$sortIndex = $mlst->sortIndex;
141+
}
134142
135-
$color = "#8D99A6";
136-
if ($mlst->type == "milestone") {
137-
$color = $mlst->tags;
138-
}
143+
$dependencyList = array();
144+
if ($mlst->milestoneid != 0) {
145+
$dependencyList[] = $mlst->milestoneid;
146+
}
139147
140-
$sortIndex = 0;
141-
if ($mlst->sortIndex != '' && is_numeric($mlst->sortIndex)) {
142-
$sortIndex = $mlst->sortIndex;
143-
}
144-
145-
$dependencyList = array();
146-
if ($mlst->milestoneid != 0) {
147-
$dependencyList[] = $mlst->milestoneid;
148-
}
149-
150-
if ($mlst->dependingTicketId != 0) {
151-
$dependencyList[] = $mlst->dependingTicketId;
152-
}
148+
if ($mlst->dependingTicketId != 0) {
149+
$dependencyList[] = $mlst->dependingTicketId;
150+
}
153151
154152
155-
?>
156-
157-
{
158-
159-
title: <?php echo json_encode($headline); ?>,
153+
?>
160154
161-
<?php if(dtHelper()->isValidDateString($mlst->dateToFinish)){ ?>
162-
start: new Date(<?php echo format($mlst->dateToFinish)->jsTimestamp() ?>),
163-
end: new Date(<?php echo format(dtHelper()->parseDbDateTime($mlst->dateToFinish)->addHour(1))->jsTimestamp() ?>),
164-
<?php } elseif(dtHelper()->isValidDateString($mlst->editFrom)){ ?>
165-
start: new Date(<?php echo format($mlst->editFrom)->jsTimestamp() ?>),
166-
end: new Date(<?php echo format($mlst->editTo)->jsTimestamp() ?>),
167-
<?php } ?>
155+
{
168156
157+
title: <?php echo json_encode($headline); ?>,
169158
170-
enitityId: <?php echo $mlst->id ?>,
171-
<?php if ($mlst->type == "milestone") { ?>
172-
url: '#/tickets/editMilestone/<?php echo $mlst->id ?>',
173-
color: '<?=$color?>',
174-
enitityType: "milestone",
175-
allDay: true,
176-
<?php } else { ?>
177-
url: '#/tickets/showTicket/<?php echo $mlst->id ?>',
178-
color: '<?=$color?>',
179-
enitityType: "ticket",
180-
allDay: false,
181-
<?php } ?>
159+
<?php if(dtHelper()->isValidDateString($mlst->dateToFinish)){ ?>
160+
start: new Date(<?php echo format($mlst->dateToFinish)->jsTimestamp() ?>),
161+
end: new Date(<?php echo format(dtHelper()->parseDbDateTime($mlst->dateToFinish)->addHour(1))->jsTimestamp() ?>),
162+
<?php } elseif(dtHelper()->isValidDateString($mlst->editFrom)){ ?>
163+
start: new Date(<?php echo format($mlst->editFrom)->jsTimestamp() ?>),
164+
end: new Date(<?php echo format($mlst->editTo)->jsTimestamp() ?>),
165+
<?php } ?>
182166
183-
},
184-
<?php endforeach; ?>
185-
];
186167
168+
enitityId: <?php echo $mlst->id ?>,
169+
<?php if ($mlst->type == "milestone") { ?>
170+
url: '#/tickets/editMilestone/<?php echo $mlst->id ?>',
171+
color: '<?=$color?>',
172+
enitityType: "milestone",
173+
allDay: true,
174+
<?php } else { ?>
175+
url: '#/tickets/showTicket/<?php echo $mlst->id ?>',
176+
color: '<?=$color?>',
177+
enitityType: "ticket",
178+
allDay: false,
179+
<?php } ?>
187180
181+
},
182+
<?php endforeach; ?>
183+
];
188184
189-
document.addEventListener('DOMContentLoaded', function () {
190185
calendarController.initTicketsCalendar(
191186
document.getElementById('calendar'),
192187
'<?=session("usersettings.submenuToggle.myProjectCalendarView") ?>',
193-
events,
188+
events
194189
);
195190
});
196191
197-
198192
</script>
199193
@endsection

0 commit comments

Comments
 (0)