Skip to content

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

add background to non-working days while dragging the wp that does not include non-working days and its datese will be updated to a non-working day

bsatarnejad66eda60e58cd
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.ts
index f070de853bb..a3b0bf52534 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
@@ -898,7 +898,24 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
)
.subscribe(([assignable, principals]) => {
const api = this.ucCalendar.getApi();
-
+ if (!wp.ignoreNonWorkingDays) {
+ let currentStartDate = this.ucCalendar.getApi().view.currentStart;
+ const currentEndDate = moment(this.ucCalendar.getApi().view.currentEnd).add('1', 'day').toDate();
+ const nonWorkingDays = new Array<{ start:Date, end:Date }>();
+
+ while (currentStartDate.toString() !== currentEndDate.toString()) {
+ if (this.weekdayService.isNonWorkingDay(currentStartDate)) {
+ nonWorkingDays.push({
+ start: currentStartDate,
+ end: currentStartDate,
+ });
+ }
+ currentStartDate = moment(currentStartDate).add('1', 'day').toDate();
+ }
+ nonWorkingDays.forEach((day) => {
+ api.addEvent({ ...day }, 'background');
+ });
+ }
const eventBase = {
start: moment().subtract('1', 'month').toDate(),
end: moment().add('1', 'month').toDate(),