|
|
|
@ -150,8 +150,12 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement |
|
|
|
|
this.initializeCalendar(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public calendarEventsFunction(fetchInfo:{ start:Date, end:Date, timeZone:string }, |
|
|
|
|
successCallback:(events:EventInput[]) => void):void|PromiseLike<EventInput[]> { |
|
|
|
|
public async calendarEventsFunction( |
|
|
|
|
fetchInfo:{ start:Date, end:Date, timeZone:string }, |
|
|
|
|
successCallback:(events:EventInput[]) => void, |
|
|
|
|
):Promise<void> { |
|
|
|
|
await this.workPackagesCalendar.updateTimeframe(fetchInfo, this.currentProject.identifier || undefined); |
|
|
|
|
|
|
|
|
|
if (this.alreadyLoaded) { |
|
|
|
|
this.alreadyLoaded = false; |
|
|
|
|
const events = this.updateResults(this.querySpace.results.value!); |
|
|
|
@ -165,8 +169,6 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement |
|
|
|
|
successCallback(events); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void this.workPackagesCalendar.updateTimeframe(fetchInfo, this.currentProject.identifier || undefined); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line @angular-eslint/use-lifecycle-interface
|
|
|
|
@ -215,8 +217,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement |
|
|
|
|
const due = moment(resizeInfo.event.endStr).subtract(1, 'day').toDate(); |
|
|
|
|
const start = moment(resizeInfo.event.startStr).toDate(); |
|
|
|
|
const wp = resizeInfo.event.extendedProps.workPackage as WorkPackageResource; |
|
|
|
|
if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due) |
|
|
|
|
|| this.dayService.isNonWorkingDay(start) || this.dayService.isNonWorkingDay(due))) { |
|
|
|
|
if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) { |
|
|
|
|
this.toastService.addError(this.text.cannot_drag_to_non_working_day); |
|
|
|
|
resizeInfo?.revert(); |
|
|
|
|
return; |
|
|
|
@ -226,7 +227,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement |
|
|
|
|
eventDrop: (dropInfo:EventDropArg) => { |
|
|
|
|
const start = moment(dropInfo.event.startStr).toDate(); |
|
|
|
|
const wp = dropInfo.event.extendedProps.workPackage as WorkPackageResource; |
|
|
|
|
if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.dayService.isNonWorkingDay(start))) { |
|
|
|
|
if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start))) { |
|
|
|
|
this.toastService.addError(this.text.cannot_drag_to_non_working_day); |
|
|
|
|
dropInfo?.revert(); |
|
|
|
|
return; |
|
|
|
@ -347,8 +348,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement |
|
|
|
|
|
|
|
|
|
private handleDateClicked(info:DateSelectArg) { |
|
|
|
|
const due = moment(info.endStr).subtract(1, 'day').toDate(); |
|
|
|
|
const nonWorkingDays = this.weekdayService.isNonWorkingDay(info.start) || this.weekdayService.isNonWorkingDay(due) |
|
|
|
|
|| this.dayService.isNonWorkingDay(info.start) || this.dayService.isNonWorkingDay(due); |
|
|
|
|
const nonWorkingDays = this.weekdayService.isNonWorkingDay(info.start) || this.weekdayService.isNonWorkingDay(due); |
|
|
|
|
|
|
|
|
|
const defaults = { |
|
|
|
|
startDate: info.startStr, |
|
|
|
@ -381,7 +381,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement |
|
|
|
|
const nonWorkingDays = new Array<{ start:Date|string, end:Date|string }>(); |
|
|
|
|
|
|
|
|
|
while (currentStartDate.toString() !== currentEndDate.toString()) { |
|
|
|
|
if (this.weekdayService.isNonWorkingDay(currentStartDate) || this.dayService.isNonWorkingDay(currentStartDate)) { |
|
|
|
|
if (this.weekdayService.isNonWorkingDay(currentStartDate)) { |
|
|
|
|
nonWorkingDays.push({ |
|
|
|
|
start: moment(currentStartDate).format('YYYY-MM-DD'), |
|
|
|
|
end: moment(currentStartDate).add('1', 'day').format('YYYY-MM-DD'), |
|
|
|
|