mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#15 PopUp Vorabinfo
This commit is contained in:
@@ -232,7 +232,7 @@ export class DomainAvailabilityService {
|
||||
}
|
||||
|
||||
isAvailable({ availability }: { availability: AvailabilityDTO }) {
|
||||
return [2, 32, 256, 1024, 2048, 4096].some((code) => availability?.availabilityType === code);
|
||||
return [1, 2, 32, 256, 1024, 2048, 4096, 8192].some((code) => availability?.availabilityType === code);
|
||||
}
|
||||
|
||||
mapToOlaAvailability({
|
||||
|
||||
@@ -216,11 +216,17 @@ export class DomainTaskCalendarService {
|
||||
hasTask,
|
||||
publicationDate,
|
||||
announcementDate,
|
||||
taskDate,
|
||||
}: {
|
||||
publicationDate?: string;
|
||||
announcementDate?: string;
|
||||
hasTask?: boolean;
|
||||
taskDate?: string;
|
||||
}): InfoType {
|
||||
if (this.dateAdapter.isGreaterEqual(this.dateAdapter.today(), new Date(publicationDate)) && hasTask) {
|
||||
return 'PreInfo';
|
||||
}
|
||||
|
||||
if (hasTask) {
|
||||
return 'Task';
|
||||
}
|
||||
@@ -230,14 +236,22 @@ export class DomainTaskCalendarService {
|
||||
}
|
||||
|
||||
const _publicationDate = new Date(publicationDate);
|
||||
const _announcmentDate = new Date(announcementDate);
|
||||
const _taskDate = new Date(taskDate);
|
||||
|
||||
return this.dateAdapter.compareDate(_announcmentDate, _publicationDate) > 0 ? 'PreInfo' : 'Info';
|
||||
return this.dateAdapter.compareDate(_taskDate, _publicationDate) > 0 &&
|
||||
this.dateAdapter.isGreaterEqual(_publicationDate, this.dateAdapter.today())
|
||||
? 'PreInfo'
|
||||
: 'Info';
|
||||
}
|
||||
|
||||
getDisplayInfoDate(source: { taskDate?: string; publicationDate?: string; announcementDate?: string }) {
|
||||
// Wenn announcementDate abgelaufen ist wird der taskDate/publicationDate genommen
|
||||
let displayDate = new Date(source.taskDate || source.publicationDate);
|
||||
|
||||
let displayDate = this.dateAdapter.isGreaterEqual(this.dateAdapter.today(), new Date(source.publicationDate))
|
||||
? new Date(source.publicationDate)
|
||||
: new Date(source.taskDate || source.publicationDate);
|
||||
|
||||
// let displayDate = new Date(source.publicationDate || source.taskDate);
|
||||
if (source.announcementDate && new Date(source.announcementDate) >= this.dateAdapter.today()) {
|
||||
displayDate = new Date(source.announcementDate);
|
||||
}
|
||||
|
||||
@@ -59,11 +59,7 @@ export class TaskListComponent {
|
||||
);
|
||||
|
||||
selectedItems$ = combineLatest([this.items$, this.selected$]).pipe(
|
||||
map(([items, date]) =>
|
||||
items.filter(
|
||||
(item) => (item.taskDate || item.publicationDate) && this.dateAdapter.equals(new Date(item.taskDate || item.publicationDate), date)
|
||||
)
|
||||
),
|
||||
map(([items, date]) => items.filter((item) => this.dateAdapter.equals(this.domainTaskCalendarService.getDisplayInfoDate(item), date))),
|
||||
// Sortierung der aufgaben nach Rot => Gelb => Grau => Grün
|
||||
map((list) => this.sort(list, ['Overdue', 'InProcess', 'Approved', 'Completed']))
|
||||
);
|
||||
|
||||
@@ -55,21 +55,22 @@ export class TaskCalendarStore extends ComponentStore<TaskCalendarState> {
|
||||
|
||||
if (mode === 'week') {
|
||||
const fdow = this.dateAdapter.getFirstDateOfWeek(displayedDate);
|
||||
const withOffset = this.dateAdapter.addCalendarDays(fdow, -7);
|
||||
const fdowWithOffset = this.dateAdapter.addCalendarDays(fdow, -7);
|
||||
const ldow = this.dateAdapter.getLastDateOfWeek(displayedDate);
|
||||
const ldowWithOffset = this.dateAdapter.addCalendarDays(ldow, 7);
|
||||
|
||||
return {
|
||||
start: withOffset,
|
||||
stop: ldow,
|
||||
start: fdowWithOffset,
|
||||
stop: ldowWithOffset,
|
||||
};
|
||||
} else {
|
||||
const fdom = this.dateAdapter.getFirstDateOfMonth(displayedDate);
|
||||
const withOffset = this.dateAdapter.addCalendarDays(fdom, -7);
|
||||
const fdomWithOffset = this.dateAdapter.addCalendarDays(fdom, -7);
|
||||
const ldom = this.dateAdapter.getLastDateOfMonth(displayedDate);
|
||||
|
||||
const ldomWithOffset = this.dateAdapter.addCalendarDays(ldom, 7);
|
||||
return {
|
||||
start: withOffset,
|
||||
stop: ldom,
|
||||
start: fdomWithOffset,
|
||||
stop: ldomWithOffset,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -54,6 +54,14 @@ export abstract class DateAdapter<TDate = Date> {
|
||||
);
|
||||
}
|
||||
|
||||
isLessEqual(first: TDate, second: TDate): boolean {
|
||||
return (
|
||||
this.getYear(first) >= this.getYear(second) &&
|
||||
this.getMonth(first) >= this.getMonth(second) &&
|
||||
this.getDate(first) >= this.getDate(second)
|
||||
);
|
||||
}
|
||||
|
||||
isGreaterThan(first: TDate, second: TDate): boolean {
|
||||
return (
|
||||
this.getYear(first) <= this.getYear(second) &&
|
||||
@@ -62,6 +70,14 @@ export abstract class DateAdapter<TDate = Date> {
|
||||
);
|
||||
}
|
||||
|
||||
isGreaterEqual(first: TDate, second: TDate): boolean {
|
||||
return (
|
||||
this.getYear(first) <= this.getYear(second) &&
|
||||
this.getMonth(first) <= this.getMonth(second) &&
|
||||
this.getDate(first) <= this.getDate(second)
|
||||
);
|
||||
}
|
||||
|
||||
equals(date1: TDate, date2: TDate): boolean {
|
||||
return (
|
||||
this.getYear(date1) === this.getYear(date2) &&
|
||||
|
||||
Reference in New Issue
Block a user