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 gantt chart
bsatarnejad60733364c49f
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.tsindex 4b1b6b17ef1..ca040d10e03 100644--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/cells/timeline-cell-renderer.ts@@ -21,6 +21,7 @@ import {timelineMarkerSelectionStartClass,} from '../wp-timeline';import Moment = moment.Moment;+import { DayResourceService } from 'core-app/core/state/days/day.service';export interface CellDateMovement {// Target values to move work package to@@ -51,6 +52,8 @@ export class TimelineCellRenderer {@InjectField() weekdayService:WeekdayService;+ @InjectField() dayService:DayResourceService;+@InjectField() schemaCache:SchemaCacheService;@InjectField() I18n!:I18nService;@@ -321,7 +324,7 @@ export class TimelineCellRenderer {break;}// Extend the duration if the currentDate is non-working- if (this.weekdayService.isNonWorkingDay(currentDate.toDate())) {+ if (this.weekdayService.isNonWorkingDay(currentDate.toDate()) || this.dayService.isNonWorkingDay(currentDate.toDate())) {duration += 1;}}@@ -472,10 +475,11 @@ export class TimelineCellRenderer {const dates = (evOrDates instanceof MouseEvent)? [this.cursorDateAndDayOffset(evOrDates, renderInfo)[0]]: evOrDates;- if (!renderInfo.workPackage.ignoreNonWorkingDays && direction === 'both' && this.weekdayService.isNonWorkingDay(dates[dates.length - 1].toDate())) {+ if (!renderInfo.workPackage.ignoreNonWorkingDays && direction === 'both'+ && (this.weekdayService.isNonWorkingDay(dates[dates.length - 1].toDate()) || this.dayService.isNonWorkingDay(dates[dates.length - 1].toDate()))) {return false;}- return dates.some((date) => this.weekdayService.isNonWorkingDay(date.toDate()));+ return dates.some((date) => (this.weekdayService.isNonWorkingDay(date.toDate()) || this.dayService.isNonWorkingDay(date.toDate())));}/**diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.tsindex 70540d35324..73daac5ceef 100644--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts@@ -42,6 +42,7 @@ import {} from '../wp-timeline';import { WeekdayService } from 'core-app/core/days/weekday.service';import Moment = moment.Moment;+import { DayResourceService } from 'core-app/core/state/days/day.service';@Component({selector: 'wp-timeline-grid',@@ -56,6 +57,7 @@ export class WorkPackageTableTimelineGrid implements AfterViewInit {private elementRef:ElementRef,public wpTimeline:WorkPackageTimelineTableController,private weekdaysService:WeekdayService,+ private daysService:DayResourceService,) {}ngAfterViewInit():void {@@ -188,7 +190,7 @@ export class WorkPackageTableTimelineGrid implements AfterViewInit {private checkForNonWorkingDayHighlight(date:Moment, cell:HTMLElement) {const day = date.toDate();- if (this.weekdaysService.isNonWorkingDay(day)) {+ if (this.weekdaysService.isNonWorkingDay(day) || this.daysService.isNonWorkingDay(day)) {cell.classList.add('wp-timeline--non-working-day');cell.dataset.qaSelector = `wp-timeline--non-working-day_${day.getDate()}-${day.getMonth() + 1}-${day.getFullYear()}`;}