Skip to content

Commit

Permalink
fix(admin-ui): Fix default quantity when adding item to order
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Apr 22, 2024
1 parent 482bca9 commit 277c17e
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,13 @@ export class OrderEditorComponent
const adjustedLine = this.modifyOrderInput.adjustOrderLines?.find(l => l.orderLineId === lineId);
if (adjustedLine) {
return adjustedLine.quantity;
} else {
const line = this.orderSnapshot.lines.find(l => l.id === lineId);
return line ? line.quantity : 0;
}
const addedLine = this.modifyOrderInput.addItems?.find(l => this.getIdForAddedItem(l) === lineId);
if (addedLine) {
return addedLine.quantity ?? 1;
}
const line = this.orderSnapshot.lines.find(l => l.id === lineId);
return line ? line.quantity : 1;
}

updateLineQuantity(line: OrderDetailFragment['lines'][number] | AddedLine, quantity: string) {
Expand Down

0 comments on commit 277c17e

Please sign in to comment.