|
|
|
@ -63,7 +63,6 @@ import { |
|
|
|
|
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service'; |
|
|
|
|
import { FormResource } from 'core-app/features/hal/resources/form-resource'; |
|
|
|
|
import { DateModalRelationsService } from 'core-app/shared/components/datepicker/services/date-modal-relations.service'; |
|
|
|
|
import { DateModalSchedulingService } from 'core-app/shared/components/datepicker/services/date-modal-scheduling.service'; |
|
|
|
|
import { |
|
|
|
|
mappedDate, |
|
|
|
|
onDayCreate, |
|
|
|
@ -79,7 +78,6 @@ import { DeviceService } from 'core-app/core/browser/device.service'; |
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
|
|
encapsulation: ViewEncapsulation.None, |
|
|
|
|
providers: [ |
|
|
|
|
DateModalSchedulingService, |
|
|
|
|
DateModalRelationsService, |
|
|
|
|
], |
|
|
|
|
}) |
|
|
|
@ -90,8 +88,6 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV |
|
|
|
|
|
|
|
|
|
@InjectField() halEditing:HalResourceEditingService; |
|
|
|
|
|
|
|
|
|
@InjectField() dateModalScheduling:DateModalSchedulingService; |
|
|
|
|
|
|
|
|
|
@InjectField() dateModalRelations:DateModalRelationsService; |
|
|
|
|
|
|
|
|
|
@InjectField() deviceService:DeviceService; |
|
|
|
@ -196,6 +192,17 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV |
|
|
|
|
this.cdRef.detectChanges(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns whether the user can alter the dates of the work package. |
|
|
|
|
*/ |
|
|
|
|
get isSchedulable():boolean { |
|
|
|
|
return this.scheduleManually || !this.dateModalRelations.isParent; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isDayDisabled(dayElement:DayElement, minimalDate?:Date|null):boolean { |
|
|
|
|
return !this.isSchedulable || (!this.scheduleManually && !!minimalDate && dayElement.dateObj <= minimalDate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
changeNonWorkingDays():void { |
|
|
|
|
this.initializeDatepicker(); |
|
|
|
|
|
|
|
|
@ -217,7 +224,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV |
|
|
|
|
this.changeset.setValue('ignoreNonWorkingDays', this.ignoreNonWorkingDays); |
|
|
|
|
|
|
|
|
|
// Apply the dates if they could be changed
|
|
|
|
|
if (this.dateModalScheduling.isSchedulable) { |
|
|
|
|
if (this.isSchedulable) { |
|
|
|
|
this.changeset.setValue('date', mappedDate(this.date)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -288,7 +295,7 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV |
|
|
|
|
this.ignoreNonWorkingDays, |
|
|
|
|
await this.datePickerInstance?.isNonWorkingDay(dayElem.dateObj), |
|
|
|
|
minimalDate, |
|
|
|
|
this.dateModalScheduling.isDayDisabled(dayElem, minimalDate), |
|
|
|
|
this.isDayDisabled(dayElem, minimalDate), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|