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 the selected start and end date is non working days only while resizing on team planner
bsatarnejad6308f2eb7255
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.tsindex d8f38f9b4d5..2de413cc0fb 100644--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts@@ -497,7 +497,17 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,// DnD configurationeditable: true,droppable: true,- eventResize: (resizeInfo:EventResizeDoneArg) => this.updateEvent(resizeInfo),+ eventResize: (resizeInfo:EventResizeDoneArg) => {+ 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.toastService.addError(this.text.cannot_drag_to_non_working_day);+ resizeInfo?.revert();+ return;+ }+ void this.updateEvent(resizeInfo);+ },eventResizeStart: (resizeInfo:EventResizeDoneArg) => {const wp = resizeInfo.event.extendedProps.workPackage as WorkPackageResource;if (!wp.ignoreNonWorkingDays) {@@ -521,10 +531,26 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,this.draggingItem$.next(undefined);this.removeBackGroundEvents();},- eventDrop: (dropInfo:EventDropArg) => this.updateEvent(dropInfo),+ 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.toastService.addError(this.text.cannot_drag_to_non_working_day);+ dropInfo?.revert();+ return;+ }+ void this.updateEvent(dropInfo);+ },eventReceive: async (dropInfo:EventReceiveArg) => {- await this.updateEvent(dropInfo);+ const due = moment(dropInfo.event.endStr).subtract(1, 'day').toDate();+ const start = moment(dropInfo.event.startStr).toDate();const wp = dropInfo.event.extendedProps.workPackage as WorkPackageResource;+ if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) {+ this.toastService.addError(this.text.cannot_drag_to_non_working_day);+ dropInfo?.revert();+ return;+ }+ await this.updateEvent(dropInfo);this.actions$.dispatch(teamPlannerEventAdded({ workPackage: wp.id as string }));},// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access@@ -813,13 +839,6 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,private async updateEvent(info:EventResizeDoneArg|EventDropArg|EventReceiveArg):Promise<void> {const changeset = this.workPackagesCalendar.updateDates(info);- const due = moment(info.event.endStr).subtract(1, 'day').toDate();- const start = moment(info.event.startStr).toDate();- if (!changeset.projectedResource.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) {- this.toastService.addError(this.text.cannot_drag_to_non_working_day);- info?.revert();- return;- }const resource = info.event.getResources()[0];if (resource) {changeset.setValue('assignee', { href: resource.id });