<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var customer_address_id;
function customer_address_delete_overlay(id) {
    customer_address_id = id;

    $("#overlay_customer_address_delete").overlay().load();
}
function customer_address_delete(id) {
    $.ajax({
        type: "POST",
        url: UNAS.shop.base_url+"/shop_ajax/ajax_customer_addresses.php",
        dataType: "JSON",
        data: {
            action: "delete",
            id: id,
            get_ajax:1
        },
        success: function () {
            if ($("body").attr('id') === "ud_shop_customer_addresses_det") {
                location.href=UNAS.shop.base_url+"/shop_customer_addresses.php";
            } else {
                $("#customer-address__card-" + id).remove();
                $("#overlay_customer_address_delete").overlay().close();
            }
        }
    });
}

$(document).ready(function () {
    //VĂĄsĂĄrlĂł cĂ­mei - adĂłszĂĄm megjelenĂ­tĂŠs / elrejtĂŠs
    $(".js-customer-type-radio").on("click", function () {
        let _this = $(this);
        let customer_type = $(_this).data("customer-type");

        if (customer_type === 0 || customer_type === 2) {
            $(".tax-number").val("").hide();
            return;
        }

        if (! UNAS.shop["only_private_customer_can_purchase"]) {
            $(".tax-number").show();
        }
    });
});

$(document).on("click", ".js-customer-default-address-radio:not(.is-checked):not(.is-disabled)", function () {
    let _this = $(this);
    let address_type = $(_this).data("address-type");

    let previous_checked_address = $(".js-customer-default-" +address_type + "-address-radio.is-checked");
    let clicked_address = $(_this).closest(".customer-address__default-" + address_type + "-address");

    previous_checked_address.removeClass("is-checked");
    $(_this).closest(".customer-address__default-" + address_type + "-address").addClass("is-checked").addClass("loading");

    let address_ids = [];
    $(".js-customer-default-address-radio.is-checked").each(function (index, el) {
        address_ids.push($(el).data("address-id") + "Â¤" + $(el).data("address-type"));
    });

    $.ajax({
        type: "POST",
        dataType: "JSON",
        url: UNAS.shop.base_url + "/shop_ajax/ajax_customer_addresses.php",
        data: {
            get_ajax: 1,
            action: "set_default_address",
            address_ids: JSON.stringify(address_ids)
        },
        success: function (response) {
            if (response.success) {
                $(document).trigger("addressChangeSuccess");
                clicked_address.removeClass("loading");

                //TĂśrĂśl gombot eltĹąntetjĂźk arrĂłl a kĂĄrtyĂĄrĂłl, amelyik egy alapĂŠrtelmezett cĂ­m
                clicked_address.closest(".js-customer-address-card").addClass("js-customer-address-delete-hidden");

                //A korĂĄbban alapĂŠrtelmezett cĂ­m kĂĄrtyĂĄjĂĄrĂłl eldĂśntjĂźk, hogy alapĂŠrtelmezett-e mĂŠg, ha nem az megjelenĂ­tjĂźk a tĂśrlĂŠs ikont
                if (previous_checked_address.closest(".js-customer-address-card").find(".js-customer-default-address-radio.is-checked").length &lt; 1) {
                    previous_checked_address.closest(".js-customer-address-card").removeClass("js-customer-address-delete-hidden");

                    let previous_address = previous_checked_address.closest(".js-customer-address-card");
                    let delete_icon = previous_address.find(".customer-address__delete-button");
                    let address_id = previous_address.attr("id").replace("customer-address__card-", "");

                    delete_icon.attr("onclick", "customer_address_delete_overlay(" + address_id + "); return false;")
                }
            }
        }
    });
});</pre></body></html>