ro

Abonamente știri

    Prețul total: 0 MDL
    Treci la achitare
    `); section.find(".category-checkbox, .months-select").on("change", function() { updateTotalPrice($(this)); }); $("#packages-container").append(section); } function updateTotalPrice(element) { let total = 0; $(".category-section").each(function() { const checkbox = $(this).find(".category-checkbox"); const isChecked = checkbox.is(":checked"); const months = parseInt($(this).find(".months-select").val()); const price = parseInt(checkbox.data("price")); const categoryPrice = months * price; $(this).find(".category-price").text(` Prețul : ${categoryPrice} MDL`); if (isChecked) { total += categoryPrice; } }); $("#total").text(total); } $(document).ready(function() { Object.keys(abonamente).forEach((abonament) => { createCategorySection(abonament, abonamente[abonament]); }); $(".hidden-info .icon").each(function() { $(this).on("mouseenter", function() { $(this).parent().find(".modal").removeClass("hidden"); }); $(this).on("mouseleave", function() { $(this).parent().find(".modal").addClass("hidden"); }); }) $.ajax('https://www.moldpres.md/users/data', { success: function(data) { let email = data.match(/type="email" value="([^"]*)"/)[1]; let name = data.match(/type="text" value="([^"]*)"/)[1]; let phone = data.match(/type="phone" value="([^"]*)"/)[1]; $("#name").val(name); $("#email").val(email); $("#phone").val(phone); }, error: function() { return; } }); $('input[name="person-type"]').change(function() { if ($(this).val() === 'juridica') { $('.company-name').removeClass('hidden'); } else { $('.company-name').addClass('hidden'); } }); });