Merge pull request 'staging' (#16) from staging into master

Reviewed-on: http://localhost:3000/zino/seatmapv2/pulls/16
This commit is contained in:
zino
2021-07-28 16:45:21 +02:00
3 changed files with 10 additions and 16 deletions

View File

@@ -17,12 +17,10 @@ export function addItem(inSeatObj: I.JSCSelectedSeat): void {
const cartID: string = `cartItem-${inSeatObj.id}`;
const dropdownBuyerTypesSelector: string = `#${cartID} .dropdownBuyerTypes`;
console.log(category);
console.log(seatStr);
appendHTML(cartID, color, category, seatStr);
addDropdownBuyerTypeOptions(buyerTypes, dropdownBuyerTypesSelector);
Events.addCartDropdownBuyerTypes(dropdownBuyerTypesSelector, inSeatObj);
//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 {
@@ -32,9 +30,7 @@ export function removeCartItems(): void {
}
export function changedDropdownBuyerType(inSelect: HTMLSelectElement, inSeatObj: I.JSCSelectedSeat): void {
const index: number = config.state.selectedSeatsArr.findIndex(arr =>
arr[0] === inSeatObj.id);
const index: number = config.state.selectedSeatsArr.findIndex(arr => arr[0] === inSeatObj.id);
config.state.selectedSeatsArr[index][1] = inSelect.value;
const buyerTypeCode = XMLHelper.getBuyerTypeCodeByBuyerTypeID(inSelect.value);
@@ -43,7 +39,6 @@ export function changedDropdownBuyerType(inSelect: HTMLSelectElement, inSeatObj:
calcOverallPrice();
CartButtons.setBtnCartText();
const url = generateCheckoutUrl();
Events.addRedirectCheckout(url);
}
@@ -113,8 +108,6 @@ function addDropdownBuyerTypeOptions(inBuyerTypes: I.TypeBuyerType, inSelector:
if (!inBuyerTypes)
return;
console.log(inBuyerTypes);
inBuyerTypes.sort((a, b) => {
return <any>b[1] - <any>a[1];
}).forEach(arr => {
@@ -129,8 +122,6 @@ function appendOption(inSelector: string, inArr: I.TypeBuyerTypeArr): void {
const price: string = getPriceInEur(<string>inArr[1]);
const dropdownBuyerTypes: HTMLElement = jQuery(inSelector).get(0);
console.log(price);
let opt: HTMLOptionElement = document.createElement('option');
opt.value = id;
opt.innerHTML = `${desc} ${price}`;
@@ -152,7 +143,6 @@ function getSeatPrice(arr: string[]) {
if (pricescaleObj) {
const seatPrice: number | undefined = XMLHelper.getPriceByBuyerTypeID(buyertypeID, pricescaleObj);
if (seatPrice)
return seatPrice;
}

View File

@@ -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