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 {
|
export function addItem(inSeatObj: I.JSCSelectedSeat): void {
|
||||||
const color: string = `#${XMLHelper.getVenuePricescalePropertyByPricescaleID("color", inSeatObj.data.seatsObj.id[0])}`;
|
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 seat: string = config.state.layoutRows[inSeatObj.id][5];
|
||||||
const row: string = config.state.layoutRows[inSeatObj.id][4];
|
const row: string = config.state.layoutRows[inSeatObj.id][4];
|
||||||
const sectionID: string = config.state.layoutRows[inSeatObj.id][3];
|
const sectionID: string = config.state.layoutRows[inSeatObj.id][3];
|
||||||
const sectionDesc: string | undefined = XMLHelper.getSectionDescBySectionID(sectionID);
|
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 buyerTypes: I.TypeBuyerType = XMLHelper.getBuyerTypesByPricescaleID(inSeatObj.data.seatsObj.id[0]);
|
||||||
const cartID: string = `cartItem-${inSeatObj.id}`;
|
const cartID: string = `cartItem-${inSeatObj.id}`;
|
||||||
const dropdownBuyerTypesSelector: string = `#${cartID} .dropdownBuyerTypes`;
|
const dropdownBuyerTypesSelector: string = `#${cartID} .dropdownBuyerTypes`;
|
||||||
@@ -48,7 +48,7 @@ export function changedDropdownBuyerType(inSelect: HTMLSelectElement, inSeatObj:
|
|||||||
Events.addRedirectCheckout(url);
|
Events.addRedirectCheckout(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calcOverallPrice(): void{
|
export function calcOverallPrice(): void {
|
||||||
if (!config.state.selectedSeatsArr.length)
|
if (!config.state.selectedSeatsArr.length)
|
||||||
config.state.priceOverall = "0";
|
config.state.priceOverall = "0";
|
||||||
else
|
else
|
||||||
@@ -113,14 +113,18 @@ function addDropdownBuyerTypeOptions(inBuyerTypes: I.TypeBuyerType, inSelector:
|
|||||||
if (!inBuyerTypes)
|
if (!inBuyerTypes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inBuyerTypes.forEach(arr => {
|
console.log(inBuyerTypes);
|
||||||
|
|
||||||
|
inBuyerTypes.sort((a, b) => {
|
||||||
|
return <any>b[1] - <any>a[1];
|
||||||
|
}).forEach(arr => {
|
||||||
if (arr[0])
|
if (arr[0])
|
||||||
appendOption(inSelector, arr)
|
appendOption(inSelector, arr)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendOption(inSelector: string, inArr: I.TypeBuyerTypeArr): void {
|
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 id: string = <string>inArr[0];
|
||||||
const price: string = getPriceInEur(<string>inArr[1]);
|
const price: string = getPriceInEur(<string>inArr[1]);
|
||||||
const dropdownBuyerTypes: HTMLElement = jQuery(inSelector).get(0);
|
const dropdownBuyerTypes: HTMLElement = jQuery(inSelector).get(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user