💄 Trip: null paid_by on member deletion
This commit is contained in:
parent
5e7d6e6c4a
commit
a77421bc26
@ -1726,6 +1726,21 @@ export class TripComponent implements AfterViewInit {
|
|||||||
next: () => {
|
next: () => {
|
||||||
const index = this.tripMembers.findIndex((p) => p.user == username);
|
const index = this.tripMembers.findIndex((p) => p.user == username);
|
||||||
if (index > -1) this.tripMembers.splice(index, 1);
|
if (index > -1) this.tripMembers.splice(index, 1);
|
||||||
|
|
||||||
|
let updated_paidby = false;
|
||||||
|
this.trip?.days.forEach((d) =>
|
||||||
|
d.items.forEach((item) => {
|
||||||
|
if (item.paid_by === username) {
|
||||||
|
item.paid_by = undefined;
|
||||||
|
updated_paidby = true;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (updated_paidby) {
|
||||||
|
this.flattenTripDayItems();
|
||||||
|
if (this.selectedItem && this.selectedItem.paid_by === username) this.selectedItem.paid_by = undefined;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user