OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
check if a date is non-working with weekayService and dayService on calendar
bsatarnejad5653902361a3
diff --git a/frontend/src/app/features/calendar/op-calendar.service.ts b/frontend/src/app/features/calendar/op-calendar.service.tsindex 08bee9c349a..b9781ad1e19 100644--- a/frontend/src/app/features/calendar/op-calendar.service.ts+++ b/frontend/src/app/features/calendar/op-calendar.service.ts@@ -5,6 +5,7 @@ import {import { Subject } from 'rxjs';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { WeekdayService } from 'core-app/core/days/weekday.service';+import { DayResourceService } from 'core-app/core/state/days/day.service';@Injectable()export class OpCalendarService extends UntilDestroyedMixin {@@ -14,6 +15,7 @@ export class OpCalendarService extends UntilDestroyedMixin {constructor(readonly weekdayService:WeekdayService,+ readonly dayService:DayResourceService,) {super();}@@ -31,7 +33,7 @@ export class OpCalendarService extends UntilDestroyedMixin {}applyNonWorkingDay({ date }:{ date?:Date }):string[] {- if (date && this.weekdayService.isNonWorkingDay(date)) {+ if (date && (this.weekdayService.isNonWorkingDay(date) || this.dayService.isNonWorkingDay(date))) {return ['fc-non-working-day'];}diff --git a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.tsindex 63c78a59e5c..eae8209aa49 100644--- a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts+++ b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts@@ -76,6 +76,7 @@ import {} from 'core-app/features/calendar/op-work-packages-calendar.service';import { OpCalendarService } from 'core-app/features/calendar/op-calendar.service';import { WeekdayService } from 'core-app/core/days/weekday.service';+import { DayResourceService } from 'core-app/core/state/days/day.service';@Component({templateUrl: './wp-calendar.template.html',@@ -124,6 +125,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementreadonly halEditing:HalResourceEditingService,readonly halNotification:HalResourceNotificationService,readonly weekdayService:WeekdayService,+ readonly dayService:DayResourceService,) {super();}@@ -213,7 +215,8 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementconst 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))) {+ if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due)+ || this.dayService.isNonWorkingDay(start) || this.dayService.isNonWorkingDay(due))) {this.toastService.addError(this.text.cannot_drag_to_non_working_day);resizeInfo?.revert();return;@@ -223,7 +226,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementeventDrop: (dropInfo:EventDropArg) => {const start = moment(dropInfo.event.startStr).toDate();const wp = dropInfo.event.extendedProps.workPackage as WorkPackageResource;- if (!wp.ignoreNonWorkingDays && this.weekdayService.isNonWorkingDay(start)) {+ if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.dayService.isNonWorkingDay(start))) {this.toastService.addError(this.text.cannot_drag_to_non_working_day);dropInfo?.revert();return;@@ -344,7 +347,8 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementprivate handleDateClicked(info:DateSelectArg) {const due = moment(info.endStr).subtract(1, 'day').toDate();- const nonWorkingDays = this.weekdayService.isNonWorkingDay(info.start) || this.weekdayService.isNonWorkingDay(due);+ const nonWorkingDays = this.weekdayService.isNonWorkingDay(info.start) || this.weekdayService.isNonWorkingDay(due)+ || this.dayService.isNonWorkingDay(info.start) || this.dayService.isNonWorkingDay(due);const defaults = {startDate: info.startStr,@@ -377,7 +381,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementconst nonWorkingDays = new Array<{ start:Date|string, end:Date|string }>();while (currentStartDate.toString() !== currentEndDate.toString()) {- if (this.weekdayService.isNonWorkingDay(currentStartDate)) {+ if (this.weekdayService.isNonWorkingDay(currentStartDate) || this.dayService.isNonWorkingDay(currentStartDate)) {nonWorkingDays.push({start: moment(currentStartDate).format('YYYY-MM-DD'),end: moment(currentStartDate).add('1', 'day').format('YYYY-MM-DD'),