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);
|
appendHTML(cartID, color, category, seatStr);
|
||||||
addDropdownBuyerTypeOptions(buyerTypes, dropdownBuyerTypesSelector);
|
addDropdownBuyerTypeOptions(buyerTypes, dropdownBuyerTypesSelector);
|
||||||
Events.addCartDropdownBuyerTypes(dropdownBuyerTypesSelector, inSeatObj);
|
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 {
|
export function removeCartItems(): void {
|
||||||
@@ -143,7 +143,6 @@ function getSeatPrice(arr: string[]) {
|
|||||||
|
|
||||||
if (pricescaleObj) {
|
if (pricescaleObj) {
|
||||||
const seatPrice: number | undefined = XMLHelper.getPriceByBuyerTypeID(buyertypeID, pricescaleObj);
|
const seatPrice: number | undefined = XMLHelper.getPriceByBuyerTypeID(buyertypeID, pricescaleObj);
|
||||||
|
|
||||||
if (seatPrice)
|
if (seatPrice)
|
||||||
return seatPrice;
|
return seatPrice;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,13 @@ export function addSeatToState(inSelectedSeat: I.JSCSelectedSeat): void {
|
|||||||
const pricescaleObj: I.Pricescale5 | undefined = XMLHelper.getVenuePriceStructurePropertyByPricescaleID(pricescaleID);
|
const pricescaleObj: I.Pricescale5 | undefined = XMLHelper.getVenuePriceStructurePropertyByPricescaleID(pricescaleID);
|
||||||
|
|
||||||
if (pricescaleObj) {
|
if (pricescaleObj) {
|
||||||
const firstBuyerTypeID: string = pricescaleObj.buyer_type[0].id[0];
|
//const firstBuyerTypeID: string = pricescaleObj.buyer_type[0].id[0]; // needs to be highest amount
|
||||||
const buyerTypeCode: string | undefined = XMLHelper.getBuyerTypeCodeByBuyerTypeID(firstBuyerTypeID);
|
const mostExpensiveBuyerTypeID: string = pricescaleObj.buyer_type.reduce((prev, current) => {
|
||||||
const selectedSeatsArrItem: (string | undefined)[] = [inSelectedSeat.id, firstBuyerTypeID, buyerTypeCode];
|
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);
|
addSeatsItemToState(selectedSeatsArrItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user