fixed highest price by adding most expensive buyertypeid to state on seat select
This commit is contained in:
@@ -20,7 +20,7 @@ export function addItem(inSeatObj: I.JSCSelectedSeat): void {
|
||||
appendHTML(cartID, color, category, seatStr);
|
||||
addDropdownBuyerTypeOptions(buyerTypes, dropdownBuyerTypesSelector);
|
||||
Events.addCartDropdownBuyerTypes(dropdownBuyerTypesSelector, inSeatObj);
|
||||
jQuery(".dropdownBuyerTypes").trigger("change"); // refresh cart because of highest buyer type sort
|
||||
//jQuery(".dropdownBuyerTypes").trigger("change"); // refresh cart because of highest buyer type sort => we dont need this because we add mostExpensiveBuyerTypeID now
|
||||
}
|
||||
|
||||
export function removeCartItems(): void {
|
||||
@@ -143,7 +143,6 @@ function getSeatPrice(arr: string[]) {
|
||||
|
||||
if (pricescaleObj) {
|
||||
const seatPrice: number | undefined = XMLHelper.getPriceByBuyerTypeID(buyertypeID, pricescaleObj);
|
||||
|
||||
if (seatPrice)
|
||||
return seatPrice;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,13 @@ export function addSeatToState(inSelectedSeat: I.JSCSelectedSeat): void {
|
||||
const pricescaleObj: I.Pricescale5 | undefined = XMLHelper.getVenuePriceStructurePropertyByPricescaleID(pricescaleID);
|
||||
|
||||
if (pricescaleObj) {
|
||||
const firstBuyerTypeID: string = pricescaleObj.buyer_type[0].id[0];
|
||||
const buyerTypeCode: string | undefined = XMLHelper.getBuyerTypeCodeByBuyerTypeID(firstBuyerTypeID);
|
||||
const selectedSeatsArrItem: (string | undefined)[] = [inSelectedSeat.id, firstBuyerTypeID, buyerTypeCode];
|
||||
//const firstBuyerTypeID: string = pricescaleObj.buyer_type[0].id[0]; // needs to be highest amount
|
||||
const mostExpensiveBuyerTypeID: string = pricescaleObj.buyer_type.reduce((prev, current) => {
|
||||
return (prev.price[0] > current.price[0]) ? prev : current
|
||||
}).id[0]
|
||||
|
||||
const buyerTypeCode: string | undefined = XMLHelper.getBuyerTypeCodeByBuyerTypeID(mostExpensiveBuyerTypeID);
|
||||
const selectedSeatsArrItem: (string | undefined)[] = [inSelectedSeat.id, mostExpensiveBuyerTypeID, buyerTypeCode];
|
||||
addSeatsItemToState(selectedSeatsArrItem);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user