fixed not refreshing checkouturl on highest buyer type sort

This commit is contained in:
zino
2021-07-28 15:16:12 +02:00
parent 28554886ff
commit 269b982575
2 changed files with 3 additions and 10 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
}
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 => {

View File

@@ -44,7 +44,7 @@ export function addModalCart(): void {
export function addRedirectCheckout(inUrl: string | undefined): void {
if (!inUrl)
return;
const btnCheckout = jQuery("#modalCart-overlay #checkout .fl-button").get(0);
if (btnCheckout) {
btnCheckout.addEventListener("click", () => {