"; if(images.length > 0){ MagicZoom.stop('MagicZoomPlus-'+inputId); MagicScroll.stop('MagicScroll-'+inputId); images.each(function(i){ if(i===0) { // create Main image for MagicZoom image_clone = jQuery(this).clone(true,true); jQuery(this).removeAttr('style'); var magic_zoom_tag = ""; jQuery(this).parent('#MagicZoomGallery').append(magic_zoom_tag); jQuery(this).attr('src', jQuery(this).attr('data-src')).appendTo('#MagicZoomPlus-'+inputId); jQuery('#MagicZoomGallery').append(magic_scroll_tag); jQuery(this).attr('width', 450); jQuery(this).attr('height', 450); jQuery(this).attr('alt', jQuery('#componentInfoModal').find('h4').text()); } else { // create Thumbs for MagicScroll jQuery(this).removeAttr('style'); jQuery(this).attr('src', jQuery(this).attr('data-src')).appendTo('#MagicScroll-'+inputId); jQuery(this).css('box-shadow', 'none'); jQuery(this).wrap(''); jQuery(this).attr('width', 69); jQuery(this).attr('height', 75); if(i===1) { // create Thumbs with clone for MagicScroll jQuery(image_clone).removeAttr('style'); jQuery(image_clone).attr('src', jQuery(image_clone).attr('data-src')).appendTo('#MagicScroll-'+inputId); jQuery(image_clone).css('box-shadow','none'); jQuery(image_clone).wrap(''); } } }); window.setTimeout(function() { MagicZoom.start(); }, 500); window.setTimeout(function() { MagicScroll.start(); }, 500);// // change selected thumb in magicscroll to index 0 window.setTimeout(function() { jQuery('#MagicScroll-'+inputId).find('.mcs-items-container').find('.mcs-item > a').removeClass('mz-thumb-selected'); jQuery(jQuery('#MagicScroll-'+inputId).find('.mcs-items-container').find('.mcs-item > a')[0]).addClass('mz-thumb-selected'); }, 800); } jQuery('#componentInfoModal button.btn-primary').unbind('click'); jQuery('#componentInfoModal button.btn-primary').on('click', function(e) { // Select input element inputEl = inputSearch[0]; boxId = inputEl.getAttribute('data-box-id'); jQuery('input#'+inputId).prop('checked', true); inputSearch.change(); // Execute process of changed selection if(boxId !== 'undefined'){ konfigurator.changeSelection(inputEl, boxId); } else { konfigurator.changeSelection(inputEl, ''); } jQuery('#componentInfoModal .modal-header').find('button').click(); }); // init youtube videos in modal views init_youtube_video('#componentInfoModal'); }, openInfoModalOfSelected: function(e) { var elSection = jQuery(e).parent().parent().parent().parent().parent().parent().children('section'); var section = 0; if(elSection.length>0) { section = elSection.attr('id').split('-')[1]; } else { section = jQuery(e).data('info-id').split('-')[1]; } var upgradeId = 'undefined'; // check if more than one checkbox checked and select last checked checkbox if(jQuery('input[id^=upgrade-option-' + section + '-]:checked').length > 1) { jQuery('input[id^=upgrade-option-' + section + '-]:checked').each(function() { if(jQuery(this).attr('data-last-input')) { upgradeId = jQuery(this).attr('id'); } }); } else { upgradeId = jQuery('input[id^=upgrade-option-' + section + '-]:checked').attr('id'); } if(upgradeId !== 'undefined' && upgradeId){ this.openInfoModal('product-' + upgradeId); } }, openInfoModalOfSelectedCases: function(upgradeId) { this.openInfoModal('product-' + upgradeId); }, openIncompatibleModal: function(incompatible_notice, event, boxId, is_qty_button, affected_lists) { var modal = jQuery('#incompatibleModal'); var arrNotices = incompatible_notice.split(';'); var strURL = "https://www.csl-computer.com/bundlerule/ajax/isrestriction"; var notice_data = []; var validation_url = ""; var is_restriction = false; var BreakException = {}; var strNotice = ""; var arrAffectedLists = []; var is_enumeration = false; if(affected_lists.indexOf(';') > -1){ arrAffectedLists = affected_lists.split(';'); is_enumeration = true; } else { arrAffectedLists = affected_lists; } var ajaxQueue = []; jQuery('#incompatibleModal button.btn-primary').text('Trotzdem fortfahren'); jQuery('#incompatibleModal button.btn-primary').show(); jQuery.each(arrNotices, function(i, notice){ notice_data = notice.split('='); if(arrAffectedLists.indexOf(notice_data[0].toString()) > -1){ validation_url = strURL + "/id/" + notice_data[0]; ajaxCheckIsRestricted(validation_url); } }); var cnt = 1; arrNotices.each(function(notice){ notice_data = notice.split('='); if(arrAffectedLists.indexOf(notice_data[0].toString()) > -1){ if(is_enumeration){ strNotice = strNotice + cnt + ". " + notice_data[1] + " "; cnt = cnt + 1; } else { strNotice = notice_data[1]; } } }); modal.find('.modal-title').text('Hinweis zur gewählten Aufrüstung'); modal.find('.modal-body').html(strNotice); jQuery('#incompatibleModal').modal('show'); jQuery('#incompatibleModal button.btn-primary').unbind('click'); jQuery('#incompatibleModal button.btn-primary').bind('click', function() { jQuery('#incompatibleModal').modal('hide'); jQuery('#incompatibleModal').removeClass('fade'); if(!is_qty_button){ konfigurator.changeSelection(event,boxId); } else { konfigurator.validateSelections(event); } }); jQuery('#incompatibleModal button.btn-default').text('Aufrüstung verwerfen'); jQuery('#incompatibleModal button.btn-default').attr('data-prevent-enable', 'false'); jQuery('#incompatibleModal button.btn-default').show(); jQuery('#incompatibleModal button.btn-default').attr('data-prevent-enable', 'true'); jQuery('#incompatibleModal button.btn-default, [data-dismiss=modal]').unbind('click'); jQuery('#incompatibleModal button.btn-default, [data-dismiss=modal]').bind('click', function(e) { jQuery('#incompatibleModal').modal('hide'); jQuery('#incompatibleModal').removeClass('fade'); var options = new Object(null); konfigurator.discardSelection(event, options); }); return true; }, openErrorModal: function(options, next) { objSliderPro = false; var modal = jQuery('#componentErrorModal'); let modal_body = ''; let modal_body_counter = 1; let upgrade_price_sum = numeral(0); switch(options.solution_type) { case "additions": var modal_title = "Hinweis zu Aufrüstungen"; var modal_footer = "
Sie können diese Vorschläge direkt übernehmen oder die benötigten Aufrüstungen selbst vornehmen."; let upgrade_recommendation = "Aufrüstungsvorschlag:"; var sum_extra_charge = "Gesamtpreis der Aufrüstung beträgt:"; var extra_charge = " Aufpreis"; modal.find('.modal-title').text(modal_title); let last_update = jQuery(next).parents('.panel-body').find('input[data-last-input]'); let chosen_comp = jQuery(next).parent().parent().find('label').text(); let last_update_price = 0; if(last_update.length !== 0) { last_update_price = parseFloat(last_update.attr('data-price')); } let raw_comp_price = parseFloat(jQuery(next).attr('data-price')) - last_update_price; let chosen_comp_price = numeral(raw_comp_price).format(); modal_body += '
Wenn Sie Hilfe bei der Konfiguration Ihres Wunsch-PC's benötigen, nehmen Sie gerne mit uns über die Service-Hotline +49 511 / 76 900 100 Kontakt auf."; // var upgrade_recommendation = ""; var sum_extra_charge = "Gesamtpreis der Aufrüstung beträgt:"; var extra_charge = " Aufpreis"; modal.find('.modal-title').text(modal_title); modal.find('.btn-default').text("Ok"); for (let item in options.items) { modal_body += ' ' + options.items[item].label + ' '; modal_body += '' + options.items[item].upgrade.name + '
'; modal_body_counter++; upgrade_price_sum = upgrade_price_sum.add(options.items[item].upgrade.price); } modal.find('.modal-body').html(modal_body); modal.find('.modal-body').append(modal_footer); jQuery('#componentErrorModal').modal('show'); jQuery('#componentErrorModal button.btn-default').show(); jQuery('#componentErrorModal button.btn-primary').hide(); jQuery('#componentErrorModal button.btn-default').attr('data-prevent-enable', 'true'); jQuery('#componentErrorModal button.btn-default, [data-dismiss=modal]').unbind('click'); jQuery('#componentErrorModal button.btn-default, [data-dismiss=modal]').bind('click', function() {konfigurator.discardSelection(next, options);}); toggleShortUrlButton(); break; case 'valid': toggleShortUrlButton(); break; } }, applyUpgrade: function(options,next) { for (var item in options.items) { var upgrade_id = options.items[item].upgrade_id; var upgrade_option_input = jQuery('.componentsInput[value="'+upgrade_id+'"]'); var section_id = upgrade_option_input.attr('data-section_id'); if(options.items[item].upgrade.mode === 'select'){ upgrade_option_input.prop('checked', true); var btn_box_attr = upgrade_option_input.attr('onclick'); var reg = /(\'(.*)\')/; var btn_box = btn_box_attr.match(reg); konfigurator.changeSelection(upgrade_option_input.get()[0], btn_box[2], true); toggleShortUrlButton(); } else if(options.items[item].upgrade.mode === 'deselect'){ if(upgrade_option_input.attr('type') === 'radio') { var no_selection_option = jQuery('#no-selection-' + section_id); no_selection_option.prop('checked',true); upgrade_option_input.prop('checked',false); konfigurator.changeSelection(no_selection_option[0], '', true); toggleShortUrlButton(); } else if(upgrade_option_input.attr('type') === 'checkbox') { if(options.items[item].upgrade.amount > 0) { var qtyField = jQuery('#' + jQuery('#' + jQuery(upgrade_option_input).attr('id')).attr('data-box-id')).children().find("input[name$='"+ jQuery('#' + jQuery(upgrade_option_input).attr('id'))[0].name.substring(jQuery('#' + jQuery(upgrade_option_input).attr('id'))[0].name.indexOf('[')) +"']"); qtyField.text(options.items[item].upgrade.amount); qtyfield.val(options.items[item].upgrade.amount); jQuery(upgrade_option_input).attr('data-amount', options.items[item].upgrade.amount); } else { // Deselect checkbox upgrade_option_input.prop('checked', false); konfigurator.updateSectionSelection(section_id); konfigurator.toggleQtySelect(upgrade_option_input.attr('data-box-id')); toggleShortUrlButton(); } konfigurator.activateDisabledBy(upgrade_id); } } var gallery = jQuery('#collapse'+section_id).find('.upgrade_gallery'); if(gallery.length){ var selectedItem = gallery.find('.componentsInput:checked').parents('.mcs-item').data('item'); if(typeof selectedItem != 'undefined'){ var gId = gallery.attr('id'); MagicScroll.jump(gId,selectedItem); } loadPanelInformation("section-" + section_id, 'upgrade-option-'+section_id+'-'+upgrade_id); } } var selected = [], inputs = $$(".product-view .componentsInput:checked[value!='']"); for (j=0; j< inputs.length; j++) { amount = 1; if(inputs[j].type === 'checkbox') { // Type of input element is checkbox // Determine the DOM element for the qty qtyfield = jQuery('#' + jQuery('#' + inputs[j].id).attr('data-box-id')).children().find("input[name$='"+ inputs[j].name.substring(inputs[j].name.indexOf('[')) +"']"); if(qtyfield !== 'undefined'){ // Qty element is found if(qtyfield.text() >= 1){ // Text is greater or equals 1 amount = qtyfield.text(); // Fetch the input amount } else if(qtyfield.val() >= 1) { // Val is greater or equals 1 amount = qtyfield.val(); // Fetch the input amount } } // Add ID of upgrade and its amount to array 'selected' (
x) selected.push(inputs[j].value + 'x' + amount); } else { // Type of input element is not equals checkbox // Add ID of upgrade to array 'selected' selected.push(inputs[j].value); } } konfigurator.storeSelections("7690", selected.join(',')); if(jQuery(next).attr('type') === 'checkbox'){ var qtyfield = jQuery('#' + jQuery('#' + next.id).attr('data-box-id')).children().find("input[name$='"+ next.name.substring(next.name.indexOf('[')) +"']"); jQuery(qtyfield).attr('data-last-valid-qty', jQuery(next).attr('data-amount')); } else { jQuery(next).parents('.panel-body').find('input').removeAttr('data-last-input'); jQuery(next).attr('data-last-input', 'true'); } jQuery('#componentErrorModal').modal('hide'); jQuery('#componentErrorModal').removeClass('fade'); }, discardSelection: function(next, options) { // On click on 'Discard upgrade' // Search for previous Upgrade of the same section var nextID = jQuery(next).attr('id').split('-'); var section = nextID[2]; var lastSelectedInput = jQuery('input[id^=upgrade-option-'+section+'][data-last-input=true]'); var qtyfield = 'undefined'; var amount = null; // If upgrade could be found in DOM if(lastSelectedInput.length){ if(lastSelectedInput.attr('type') === 'radio'){ // Input has type radio // Select upgrade lastSelectedInput.prop('checked', true); konfigurator.updateSectionSelection(section); this.updateDisplayPrices(lastSelectedInput[0],false); konfigurator.activateDisabledBy(nextID[3]); } else if(lastSelectedInput.attr('type') === 'checkbox') { // Input has type checkbox // Determine the DOM element for the qty qtyfield = jQuery(next).parent().find('input.qty'); amount = jQuery(qtyfield).attr('data-last-valid-qty'); // Check wheather the selected amount has to be decremented or the checkbox has to be deselected if(amount > 0 && qtyfield.is(':visible')) { // Decrement amount qtyfield.val(amount); qtyfield.text(amount); qtyfield.trigger('qtyChange') jQuery(next).attr('data-amount', amount); } else{ // Deselect checkbox lastSelectedInput.prop('checked', false); konfigurator.updateSectionSelection(section); if(qtyfield.is(':visible')){ konfigurator.toggleQtySelect(lastSelectedInput.attr('data-box-id')); } } konfigurator.activateDisabledBy(nextID[3]);// console.log(nextID); this.validateSelections(jQuery(next)[0]); } } else { // Select default upgrade var lastSelectedInput = jQuery('input[id^=upgrade-option-' + section + '][data-is-default=true]'); if(lastSelectedInput.length) { lastSelectedInput.prop('checked', true); } else { var lastSelectedInput = jQuery('#no-selection-' + section); if(lastSelectedInput.length) { lastSelectedInput.prop('checked', true); } else if(jQuery(next).attr('type') === 'checkbox'){ jQuery(next).prop('checked', false); } } konfigurator.activateDisabledBy(nextID[3]); } //update gallery psoition if necessary var gallery = jQuery('#collapse'+section).find('.upgrade_gallery'); if(gallery.length){ var selectedItem = gallery.find('.componentsInput:checked').parents('.mcs-item').data('item'); var gId = gallery.attr('id'); MagicScroll.jump(gId,selectedItem); } // Update Affix konfigurator.updateAffixPrice(); // Deactivate input fields, if solution type additions if(jQuery('#componentInfoModal button.btn-default').attr('data-prevent-enable') === 'true' && next.value !== 'undefined'){ konfigurator.deactivateInputFields(options, next.value); } // load panel-informations when upgrade option discard - BB-229 loadPanelInformation("section-" + section, lastSelectedInput.attr('id')); this.highlightSelectedInput(); toggleShortUrlButton(); }, storeSelections: function(id, selString) { var raw = sessionStorage.getItem('productConfig'); var storedSelections = {}; if(typeof raw === 'string'){ storedSelections = JSON.parse(raw); } storedSelections[id] = selString; sessionStorage.setItem('productConfig', JSON.stringify(storedSelections)); }, loadDefaultSelection: function(){ jQuery('.componentsInput:checked').each(function(){ konfigurator.toggleQtySelect(jQuery(this).attr('data-box-id')); jQuery(this).prop("checked",false); }); this.updateSectionSelection(); this.loadSelections(this.stdInput); toggleShortUrlButton(); //objAffix.checkAffixLegend(); //obsolete konfigurator.validateSelections({value:'',type:'init',id:'none'}); }, loadStoredSelections: function(id) { var raw = sessionStorage.getItem('productConfig'); if(customerSelection.length > 0){ //Cart configure // deactivate every checkox jQuery('.componentsInput.input-checkbox').prop('checked',false); var input = customerSelection.split(','); this.loadSelections(input); toggleShortUrlButton(); //objAffix.checkAffixLegend(); //obsolete // validate loaded selection konfigurator.validateSelections({value:'',type:'init',id:'none'}); } else if(typeof raw === 'string' || typeof customerSelection === 'string') { var storedSelections = JSON.parse(raw); if(storedSelections != null && typeof storedSelections[id] != 'undefined'){ // deactivate every checkox jQuery('.componentsInput.input-checkbox').prop('checked',false); var input = storedSelections[id].split(','); this.loadSelections(input); toggleShortUrlButton(); //objAffix.checkAffixLegend(); //obsolete // validate loaded selection konfigurator.validateSelections({value:'',type:'init',id:'none'}); } } }, activateDisabledBy: function(upgradeid) { jQuery('input[data-disabled-by="' + upgradeid + '"]').each(function(){ var input_id = jQuery(this).attr('id'); var label = jQuery('label[for="'+input_id+'"]'); resetTitle(label); changeTitle(jQuery(this),label.attr('title')); jQuery(this).attr('disabled', false); jQuery(this).parents('.comnponent').removeClass('disabled'); jQuery(this).removeAttr('data-disabled-by'); }); }, activateInputFields: function(selector) { jQuery(selector).each(function(){ if(jQuery(this).attr('disabled') == 'disabled') { var input_id = jQuery(this).attr('id'); var label = jQuery('label[for="'+input_id+'"]'); resetTitle(label); changeTitle(jQuery(this),label.attr('title')); jQuery(this).attr('disabled', false); } }); jQuery('.component.disabled').removeClass('disabled'); }, deactivateInputFieldsOld: function(options, input, next) { var selection = null; for (selection in options.selections) { jQuery(input).each(function () { if(this.value === selection) { var input_id = jQuery(this).attr('id'); var label = jQuery('label[for="'+input_id+'"]');// if(options.solution_type !== 'valid') { if(options.selections[selection].solution_type !== 'valid') { jQuery(this).attr('disabled', true); jQuery(this).parents('.component').addClass('disabled'); if (jQuery(this)[0].hasAttribute('data-disabled-by') !== true) { jQuery(this).attr('data-disabled-by', next); } var upgrade = null; for (upgrade in options.selections[selection].error.upgrades) { var error_label = options.selections[selection].error.upgrades[upgrade].label; changeTitle(label,error_label); changeTitle(jQuery(this),error_label); } }// if(options.solution_type === 'valid') { if(options.selections[selection].solution_type === 'valid') { resetTitle(label); resetTitle(jQuery(this)); jQuery(this).attr('disabled', false); jQuery(this).parents('.component').removeClass('disabled'); } } }); } }, deactivateInputFields: function(options, next) { var selection = null; for (selection in options.selections) { var element = jQuery('.componentsInput[value="'+selection+'"]'); if(element.length == 1){ var input_id = element.attr('id'); var label = jQuery('label[for="'+input_id+'"]'); if(options.selections[selection].solution_type !== 'valid') { element.attr('disabled', true); element.parents('.component').addClass('disabled'); if (element[0].hasAttribute('data-disabled-by') !== true) { element.attr('data-disabled-by', next); } var upgrade = null; for (upgrade in options.selections[selection].error.upgrades) { var error_label = options.selections[selection].error.upgrades[upgrade].label; changeTitle(label,error_label); changeTitle(element,error_label); } } } } }, removeSectionQtySelect: function(section) { var selector = "." + "btn-QtySelectBox-" + section; jQuery(selector).hide(); }, highlightSelectedInput: function() { jQuery('input[class*="componentsInput"]').each(function() { if(jQuery(this).prop('checked')) { //console.log(jQuery(this).prop('checked'), jQuery(this).prop('id')); jQuery(this).parents('.component').addClass('selection'); } else { jQuery(this).parents('.component').removeClass('selection'); } }); }, toggleQtySelect: function (boxId) { var parentType = jQuery("#"+boxId); if (parentType[0]) { var buttonType = jQuery(parentType).parent().find('input').prop('type'); if (buttonType === "checkbox" ) { jQuery('#'+boxId).fadeToggle('slow'); jQuery('#'+boxId).css('display','block'); } if (buttonType === "radio" ) { var selector = boxId.split("-"); var amountSelectorClass = "." + selector[0] +"-"+ selector[1] +"-"+ selector[2]; jQuery(amountSelectorClass).hide(); jQuery("#"+boxId).show(); } } // todo: Wenn Checkbox deaktiviert wird, Einzelpreis wieder zuruecksetzen }, qtyDown: function(elDown, count_clicks, min, id, data_label) { var qtyBase = elDown.parent().parent().find('.input-text.qty'); // disable info buttons jQuery('i.componentInfo').css('display', 'none'); if(count_clicks <= min) { qtyBase.val(min); qtyBase.addClass('error'); if(qtyBase.val() === 0) { qtyBase.val(1); } // enable info buttons jQuery('i.componentInfo').css('display', 'unset'); return qty; }else{ qtyBase.removeClass('error'); } var data_price = jQuery('#'+id).attr('data-price'); var qty = parseFloat(qtyBase.val()) - 1; jQuery('li#'+id).html(qty + 'x ' + data_label); jQuery('#'+id).attr('data-amount',qty); var affix_price = numeral().unformat(jQuery('.affixPriceAsConfigured').text()); affix_price = Math.abs(affix_price) - parseFloat(data_price); try{ jQuery('.affixPriceAsConfigured').text(this.formatPrice(affix_price, '')).effect("highlight", {color: "#db950b"}, 1000); }catch(e){} qtyBase.val(qty); qtyBase.text(qty); qtyBase.trigger('qtyChange'); this.validateIncompatible(elDown[0], jQuery('#'+id).attr('data-box-id')); return qty; }, qtyUp: function(elUp, count_clicks, max, id, data_label) { var qtyBase = elUp.parent().parent().find('.input-text.qty'); // disable info buttons jQuery('i.componentInfo').css('display', 'none'); if(count_clicks >= max) { qtyBase.val(max); qtyBase.addClass('error'); jQuery('i.componentInfo').css('display', 'unset'); return qty ; }else{ qtyBase.removeClass('error'); } var data_price = jQuery('#'+id).attr('data-price'); var qty = parseFloat(qtyBase.val()) + 1; jQuery('li#'+id).html(qty + 'x ' + data_label); jQuery('#'+id).attr('data-amount',qty); var affix_price = numeral().unformat(jQuery('.affixPriceAsConfigured').text()); affix_price = Math.abs(affix_price) + parseFloat(data_price); try{ jQuery('.affixPriceAsConfigured').text(this.formatPrice(affix_price, '')).effect("highlight", {color: "#db950b"}, 1000); }catch(e){} qtyBase.val(qty); qtyBase.text(qty); qtyBase.trigger('qtyChange'); this.validateIncompatible(elUp[0], jQuery('#'+id).attr('data-box-id')); return qty; }, qtyHandleTextInput: function(elQty, qty, min, max, id, data_label, data_price){ var last_valid_qty = jQuery('#'+id).parent().find('.qty-block input').attr('data-last-valid-qty'); if(last_valid_qty < min){ last_valid_qty = min; } if(elQty.val() > max || elQty.val() < min) { elQty.val(last_valid_qty); elQty.addClass('error'); return last_valid_qty; } data_price = jQuery('#'+id).attr('data-price'); qty = parseFloat(elQty.val()); jQuery('li#'+id).html(qty + 'x ' + data_label); jQuery('#'+id).attr('data-amount',qty); var affix_price = numeral().unformat(jQuery('.affixPriceAsConfigured').text()); affix_price = Math.abs(affix_price) + (parseFloat(data_price) * (qty - last_valid_qty)); try{ jQuery('.affixPriceAsConfigured').text(this.formatPrice(affix_price, '')).effect("highlight", {color: "#db950b"}, 1000); }catch(e){} elQty.val(qty); elQty.text(qty); elQty.trigger('qtyChange'); this.validateSelections(jQuery('#'+id)[0]); return qty; }, qtyResetProcessStates: function(id) { var qtyField = jQuery("#id-"+id); qtyField.parent().find('.up,.dn').show(); }, updateSectionSelection: function (section) { var selector = '.product-collateral .panel-heading'; // per default process all pannels if(typeof section != 'undefined'){ if(section.indexOf("-") > 0){ section = section.substring(0,section.indexOf("-")); } selector = '.panel-heading[data-target="#collapse'+section+'"]'; } jQuery(selector).each(function(){ var heading = jQuery(this); var content = jQuery(heading.data('target')); var checked = content.find('.componentsInput:checked'); switch (checked.length){ case 0: heading.find('.selectedComponent').html("Keine Auswahl"); break; case 1: var text= jQuery("label[for='"+checked.attr('id')+"']").html(); heading.find('.selectedComponent').html(text); break; default: heading.find('.selectedComponent').html("Mehrere Ausgewählt"); break; } }); }, // load price and show arrows for configured product from cart loadConfiguredProduct: function (section, event) { var price_raw = 0; // load configured product price from cart if (jQuery('#hidden_cart_price').attr('data-hidden-cart-price') > 0) { price_raw = jQuery('#hidden_cart_price').attr('data-hidden-cart-price'); } else { price_raw = jQuery('.startpricePrice').attr('data-priceraw'); } jQuery('.affixPriceAsConfigured').text(this.formatPrice(numeral().unformat(price_raw), '')); if(MAGE_CART_EDIT) { loadPanelInformation('section-'+section,event.id); } }, /** * * @returns {selectedComponents} */ initSelectedComponents: function(){ var inputs = $$(".product-view .componentsInput:checked"); for (var i=0; i 0) { if(jQuery(event).is(':checked')){ exclusion_lists.each(function(exlusions){ // Fetch Exclusion List Data incompatible_matches = exlusions.split(';'); list_info = incompatible_matches[0].split('x'); incompatible_matches.splice(0, 1); exclusion_list_id = list_info[0].match(patt); valid_qty = list_info[1]; curr_qty = 1; // check incompatible product-ids and maybe revert the selection if(event.type === 'checkbox' && jQuery(event).is(':checked')){ // Checkbox clicked curr_qty = jQuery(event).parent().find('input.qty').val(); var other_upgrades = jQuery('input[type=radio][data-upgrade_id='+jQuery(event).attr('data-upgrade_id')+']:checked'); curr_qty = parseInt(curr_qty) + other_upgrades.length if(curr_qty !== "undefined"){ if(parseInt(valid_qty) <= parseInt(curr_qty)){ jQuery('.product-view .componentsInput:checked').each(function() { if(typeof (jQuery(this).attr('data-upgrade_id')) !== "undefined" && typeof (jQuery(this).attr('data-incompatible')) !== "undefined") { var upgrade_id = jQuery(this).attr('data-upgrade_id'); incompatible_matches.forEach(function(value) { if(value === upgrade_id && is_incompatible === false) { is_incompatible = true; jQuery('#up-'+event.id).parent().removeAttr('style'); jQuery('#up-'+event.id).parent().prev().removeAttr('disabled'); jQuery('#up-'+event.id).removeAttr('style'); jQuery('#dn-'+event.id).removeAttr('style'); jQuery('i.fa.fa-spinner').remove(); //there should not be a spinnter in to info icon... ??? jQuery('i.componentInfo').css('display', 'inherit'); } }); } }); } } } else { // Radio-Input clicked var other_upgrades = jQuery('input[type=checkbox][data-upgrade_id='+jQuery(event).attr('data-upgrade_id')+']:checked'); if(other_upgrades.length > 0){ other_upgrades.each(function(){ curr_qty = parseInt(curr_qty) + parseInt(jQuery(this).parent().find('input.qty').val()); }); } if(parseInt(valid_qty) <= parseInt(curr_qty)){ var selected_incompatible = ''; var incompatible_upgrade; var selected_upgrades_cnt; var BreakException = {}; try{ incompatible_matches.each(function(value){ curr_qty = 0; incompatible_upgrade = jQuery('input[data-upgrade_id='+value+']:checked'); selected_upgrades_cnt = incompatible_upgrade.length; if(incompatible_upgrade.length === 0){ is_incompatible = false; throw BreakException; } incompatible_upgrade.each(function(){ var selected_upgrade = jQuery(this); selected_incompatible = selected_upgrade.attr('data-incompatible').split(';'); list_info = selected_incompatible[0].split('x'); valid_qty = list_info[1]; if(valid_qty > 1 && selected_upgrades_cnt > 1){ var is_checkbox = (selected_upgrade.attr('type') === 'checkbox'); if(is_checkbox){ curr_qty = parseInt(curr_qty) + parseInt(selected_upgrade.parent().find('input.qty').val()); if(parseInt(valid_qty) <= parseInt(curr_qty)){ is_incompatible = true; } } else { curr_qty = parseInt(curr_qty) + 1; if(parseInt(valid_qty) <= parseInt(curr_qty)){ is_incompatible = true; } } } else { is_incompatible = true; } }); if(valid_qty > 0 && is_incompatible === false){ throw BreakException; } }); } catch (e){ if (e !== BreakException) throw e; } } } if(is_incompatible){ if(affected_lists.length === 0){ affected_lists = exclusion_list_id; } else { affected_lists = affected_lists + ";" + exclusion_list_id; } } }); } else { is_incompatible = false; } } if(affected_lists.length > 0){ konfigurator.openIncompatibleModal(jQuery(event).attr('data-incompatible_notice'), event, boxId, is_qty_button, affected_lists); } if(affected_lists.length === 0 && !is_qty_button) { konfigurator.changeSelection(event, boxId); } else if(affected_lists.length === 0 && is_qty_button) { this.validateSelections(event); } }, validateSelections: function (event) { var nextID = event.value; if(!jQuery(event).prop('checked')) { // exit if checkbox will be unchecked! No ajax request necessary! nextID = ''; } var qtyfield = 'undefined'; var amount; var selected = [], inputs = $$(".product-view .componentsInput:checked[value!='']"); for (j=0; j< inputs.length; j++) { amount = 1; if(inputs[j].type === 'checkbox') { // Type of input element is checkbox // Determine the DOM element for the qty qtyfield = jQuery('#' + jQuery('#' + inputs[j].id).attr('data-box-id')).children().find("input[name$='"+ inputs[j].name.substring(inputs[j].name.indexOf('[')) +"']"); if(qtyfield !== 'undefined'){ // Qty element is found if(qtyfield.text() >= 1){ // Text is greater or equals 1 amount = qtyfield.text(); // Fetch the input amount } else if(qtyfield.val() >= 1) { // Val is greater or equals 1 amount = qtyfield.val(); // Fetch the input amount } } // Add ID of upgrade and its amount to array 'selected' (x) selected.push(inputs[j].value + 'x' + amount); } else { // Type of input element is not equals checkbox // Add ID of upgrade to array 'selected' selected.push(inputs[j].value); } } var lastValidQty = null; if(event.type === 'checkbox') { qtyfield = jQuery('#' + jQuery('#' + event.id).attr('data-box-id')).children().find("input[name$='"+ event.name.substring(event.name.indexOf('[')) +"']"); var lastValidQty = jQuery(qtyfield).attr('data-last-valid-qty'); } var validationURL = "https://www.csl-computer.com/bundlerule/ajax/requirements"; validationURL += "/id/" + "7690" + "/selections/" + selected.join(','); if(nextID !== ''){ validationURL += "/next/" + nextID; if(lastValidQty !== null){ validationURL += "/validqty/" + lastValidQty; } } jQuery('.btn-cart').attr('disabled', true); // manage overlay lockout jQuery('body').append(''); setTimeout(function(){ jQuery('#css_loader').addClass('active'); },500); jQuery.ajax({ url: validationURL, data: { format: 'json' }, error: function(dataObj) { konfigurator.qtyResetProcessStates(event.id); jQuery('i.componentInfo').css('display', 'inherit'); cart_validator.openServerErrorModal(dataObj); try { let options = new Object(null); konfigurator.discardSelection(event, options); }catch(e){ console.warn(e); } }, dataType: 'json', success: function(data) { konfigurator.qtyResetProcessStates(event.id); jQuery('i.componentInfo').css('display', 'inherit'); jQuery('.btn-cart').attr('disabled', false); konfigurator.activateInputFields('[class*=\'componentList\'] input'); let nextID = event.id; let arrNextID = nextID.split('-'); let section = arrNextID[2]; let fnReturn = false; if(data.solution_type !== 'valid') { // check on upgrade.mode if(data['forced']){ konfigurator.applyUpgrade(data,event); } else { konfigurator.openErrorModal(data, event); } // Unselections deaktivieren konfigurator.deactivateInputFields(data, event.value); if(event.type === 'checkbox') { jQuery('input[data-last-input][id^=upgrade-option-'+section+']').removeAttr('data-last-input'); jQuery(event).attr('data-last-input', 'true'); } } else { jQuery('input[data-last-input][id^=upgrade-option-'+section+']').removeAttr('data-last-input'); jQuery(event).attr('data-last-input', 'true'); if(event.type === 'checkbox' && jQuery(event).is(':checked')) { if(qtyfield.text() != '') { jQuery(qtyfield).attr('data-last-valid-qty', qtyfield.text()); } else { jQuery(qtyfield).attr('data-last-valid-qty', qtyfield.val()); } } konfigurator.openErrorModal(data, event); // Unselections deaktivieren konfigurator.deactivateInputFields(data, event.value); konfigurator.storeSelections("7690", selected.join(',')); fnReturn = true; } if(data.debugging){ if(data.debugging.length > 0) { jQuery('#debugging-monitor-other').show(); jQuery('#debugging-monitor-other').html(data.debugging); jQuery('#debugging-area a.btn-remove-monitor').show(); } } //objAffix.checkAffixLegend(); //obsolete return fnReturn; }, complete: function(){ jQuery('#css_loader').addClass('fadeOut').removeClass('fadeIn').removeClass('active'); setTimeout(function(){ jQuery('#css_loader').remove(); },400); }, type: 'GET' }); return true; }, formatPrice: function(price, pattern){ var returnVal = ''; if (Math.ceil(price) != price) { if(pattern.length > 0){ returnVal = numeral(price).format(pattern); } else { returnVal = numeral(price).format(); } } else { returnVal = price + ',- €'; } return returnVal; } }); // Eo class Create Konfigurator
Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.
We notice you're using an ad blocker
Without advertising income, we can't keep making this site awesome for you.