Refactor to use ClientSchedule on client
Use the ClientSchedule data structure for deserialising and tracking edit state on the client instead of trying to directly deal with the ApiSchedule type which is not build for ease of edits or rendering.
This commit is contained in:
parent
ce9f758f84
commit
bb450fd583
15 changed files with 488 additions and 1297 deletions
|
@ -457,6 +457,7 @@ export class ClientSchedule extends ClientEntity {
|
|||
shiftSlots: Map<Id, ClientScheduleShiftSlot>;
|
||||
eventSlots: Map<Id, ClientScheduleEventSlot>;
|
||||
modified: boolean;
|
||||
nextClientId = -1;
|
||||
|
||||
constructor(
|
||||
id: 111,
|
||||
|
@ -478,6 +479,14 @@ export class ClientSchedule extends ClientEntity {
|
|||
this.shiftSlots = idMap([...shifts.values()].flatMap(shift => [...shift.slots.values()]));
|
||||
this.originalShiftSlots = new Map(this.shiftSlots);
|
||||
this.modified = false;
|
||||
// XXX For now the prototype server is assigning client ids instead of remapping them.
|
||||
this.nextClientId = Math.min(
|
||||
0,
|
||||
...locations.keys(),
|
||||
...events.keys(),
|
||||
...roles.keys(),
|
||||
...shifts.keys(),
|
||||
) - 1;
|
||||
}
|
||||
|
||||
equals(other: ClientSchedule): boolean {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue