💄 on attachment delete: refresh items
This commit is contained in:
parent
310b4db455
commit
a7adec2675
@ -2026,10 +2026,15 @@ export class TripComponent implements AfterViewInit {
|
|||||||
.subscribe({
|
.subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.trip!.attachments = this.trip?.attachments?.filter((att) => att.id != attachmentId);
|
this.trip!.attachments = this.trip?.attachments?.filter((att) => att.id != attachmentId);
|
||||||
if (this.selectedItem?.attachments?.length) {
|
let modifiedItem = false;
|
||||||
if (this.selectedItem.attachments.some((a) => a.id == attachmentId))
|
this.trip?.days.forEach(d => d.items.forEach(i => {
|
||||||
this.selectedItem.attachments = this.selectedItem.attachments.filter((a) => a.id != attachmentId);
|
if (i.attachments?.length) {
|
||||||
|
i.attachments = i.attachments.filter(attachment => attachment.id != attachmentId);
|
||||||
|
modifiedItem = true;
|
||||||
}
|
}
|
||||||
|
}))
|
||||||
|
if (this.selectedItem?.attachments?.length) this.selectedItem.attachments = this.selectedItem.attachments.filter((a) => a.id != attachmentId);
|
||||||
|
if (modifiedItem) this.flattenTripDayItems();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user