sorted buyer types in cart popup highest price first
This commit is contained in:
@@ -7,12 +7,12 @@ import Utils from "./utils";
|
||||
|
||||
export function addItem(inSeatObj: I.JSCSelectedSeat): void {
|
||||
const color: string = `#${XMLHelper.getVenuePricescalePropertyByPricescaleID("color", inSeatObj.data.seatsObj.id[0])}`;
|
||||
const category: string | undefined = Utils.encodeCP850DecodeUTF8( XMLHelper.getVenuePricescalePropertyByPricescaleID("desc", inSeatObj.data.seatsObj.id[0])! );
|
||||
const category: string | undefined = Utils.encodeCP850DecodeUTF8(XMLHelper.getVenuePricescalePropertyByPricescaleID("desc", inSeatObj.data.seatsObj.id[0])!);
|
||||
const seat: string = config.state.layoutRows[inSeatObj.id][5];
|
||||
const row: string = config.state.layoutRows[inSeatObj.id][4];
|
||||
const sectionID: string = config.state.layoutRows[inSeatObj.id][3];
|
||||
const sectionDesc: string | undefined = XMLHelper.getSectionDescBySectionID(sectionID);
|
||||
const seatStr: string | undefined = Utils.encodeCP850DecodeUTF8( `${sectionDesc}<br/>Reihe ${row} Platz ${seat}` );
|
||||
const seatStr: string | undefined = Utils.encodeCP850DecodeUTF8(`${sectionDesc}<br/>Reihe ${row} Platz ${seat}`);
|
||||
const buyerTypes: I.TypeBuyerType = XMLHelper.getBuyerTypesByPricescaleID(inSeatObj.data.seatsObj.id[0]);
|
||||
const cartID: string = `cartItem-${inSeatObj.id}`;
|
||||
const dropdownBuyerTypesSelector: string = `#${cartID} .dropdownBuyerTypes`;
|
||||
@@ -48,7 +48,7 @@ export function changedDropdownBuyerType(inSelect: HTMLSelectElement, inSeatObj:
|
||||
Events.addRedirectCheckout(url);
|
||||
}
|
||||
|
||||
export function calcOverallPrice(): void{
|
||||
export function calcOverallPrice(): void {
|
||||
if (!config.state.selectedSeatsArr.length)
|
||||
config.state.priceOverall = "0";
|
||||
else
|
||||
@@ -113,14 +113,18 @@ function addDropdownBuyerTypeOptions(inBuyerTypes: I.TypeBuyerType, inSelector:
|
||||
if (!inBuyerTypes)
|
||||
return;
|
||||
|
||||
inBuyerTypes.forEach(arr => {
|
||||
console.log(inBuyerTypes);
|
||||
|
||||
inBuyerTypes.sort((a, b) => {
|
||||
return <any>b[1] - <any>a[1];
|
||||
}).forEach(arr => {
|
||||
if (arr[0])
|
||||
appendOption(inSelector, arr)
|
||||
});
|
||||
}
|
||||
|
||||
function appendOption(inSelector: string, inArr: I.TypeBuyerTypeArr): void {
|
||||
const desc: string = Utils.encodeCP850DecodeUTF8( <string>inArr[2] );
|
||||
const desc: string = Utils.encodeCP850DecodeUTF8(<string>inArr[2]);
|
||||
const id: string = <string>inArr[0];
|
||||
const price: string = getPriceInEur(<string>inArr[1]);
|
||||
const dropdownBuyerTypes: HTMLElement = jQuery(inSelector).get(0);
|
||||
@@ -141,17 +145,17 @@ function sumSeatPrices(): string {
|
||||
|
||||
function getSeatPrice(arr: string[]) {
|
||||
const seatID: string = arr[0];
|
||||
const buyertypeID: string = arr[1];
|
||||
const selectedSeat: I.JSCSelectedSeat = config.state.selectedSeatsObj[seatID];
|
||||
const pricescaleID: string = selectedSeat.data.seatsObj.id[0];
|
||||
const pricescaleObj: I.Pricescale5 | undefined = XMLHelper.getVenuePriceStructurePropertyByPricescaleID(pricescaleID);
|
||||
const buyertypeID: string = arr[1];
|
||||
const selectedSeat: I.JSCSelectedSeat = config.state.selectedSeatsObj[seatID];
|
||||
const pricescaleID: string = selectedSeat.data.seatsObj.id[0];
|
||||
const pricescaleObj: I.Pricescale5 | undefined = XMLHelper.getVenuePriceStructurePropertyByPricescaleID(pricescaleID);
|
||||
|
||||
if (pricescaleObj) {
|
||||
const seatPrice: number | undefined = XMLHelper.getPriceByBuyerTypeID(buyertypeID, pricescaleObj);
|
||||
if (pricescaleObj) {
|
||||
const seatPrice: number | undefined = XMLHelper.getPriceByBuyerTypeID(buyertypeID, pricescaleObj);
|
||||
|
||||
if (seatPrice)
|
||||
return seatPrice;
|
||||
}
|
||||
if (seatPrice)
|
||||
return seatPrice;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user