Fondale telescopico

Da 115,00 + IVA

Espositore telescopico

- +   - +   cm
Larghezza: min 180 - max 250
Altezza: min 180 - max 200
Invalid value
{{nbd_fields['f1611572892955'].invalidOption}} is not available
{{nbd_fields['f1611572023238'].invalidOption}} is not available
Min size: 0 MB Max size: 1000 MB Invalid value, min: 1 Invalid value, max: 100

Please check invalid fields and quantity input or choose a different combination!

Riepilogo opzioni

{{field.title}} : {{field.value_name}}
( cart fee )
( for all items )
Prezzo con le opzioni / 1 item
Sconto quantità / 1 item
Prezzo finale / 1 item
Cart item fee / all items
Subtotal price / {{_qty}} items

Tabella prezzi

Quantità prezzo CAD Prezzo totale Risparmio
{{pt.qty}} (+) {{pt.saving}}
(+x) x: Cart item fee
'); var tiptip_content = $('
'); var tiptip_arrow = $('
'); $("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('
'))); } else { var tiptip_holder = $("#tiptip_holder"); var tiptip_content = $("#tiptip_content"); var tiptip_arrow = $("#tiptip_arrow"); } return this.each(function(){ var org_elem = $(this); if(opts.content){ var org_title = opts.content; } else { var org_title = org_elem.attr(opts.attribute); } if(org_title != ""){ if(!opts.content){ org_elem.removeAttr(opts.attribute); //remove original Attribute } var timeout = false; if(opts.activation == "hover"){ org_elem.hover(function(){ active_tiptip(); }, function(){ if(!opts.keepAlive){ deactive_tiptip(); } }); if(opts.keepAlive){ tiptip_holder.hover(function(){}, function(){ deactive_tiptip(); }); } } else if(opts.activation == "focus"){ org_elem.focus(function(){ active_tiptip(); }).blur(function(){ deactive_tiptip(); }); } else if(opts.activation == "click"){ org_elem.click(function(){ active_tiptip(); return false; }).hover(function(){},function(){ if(!opts.keepAlive){ deactive_tiptip(); } }); if(opts.keepAlive){ tiptip_holder.hover(function(){}, function(){ deactive_tiptip(); }); } } function active_tiptip(){ opts.enter.call(this); tiptip_content.html(org_title); tiptip_holder.hide().removeAttr("class").css("margin","0"); tiptip_arrow.removeAttr("style"); var top = parseInt(org_elem.offset()['top']); var left = parseInt(org_elem.offset()['left']); var org_width = parseInt(org_elem.outerWidth()); var org_height = parseInt(org_elem.outerHeight()); var tip_w = tiptip_holder.outerWidth(); var tip_h = tiptip_holder.outerHeight(); var w_compare = Math.round((org_width - tip_w) / 2); var h_compare = Math.round((org_height - tip_h) / 2); var marg_left = Math.round(left + w_compare); var marg_top = Math.round(top + org_height + opts.edgeOffset); var t_class = ""; var arrow_top = ""; var arrow_left = Math.round(tip_w - 12) / 2; if(opts.defaultPosition == "bottom"){ t_class = "_bottom"; } else if(opts.defaultPosition == "top"){ t_class = "_top"; } else if(opts.defaultPosition == "left"){ t_class = "_left"; } else if(opts.defaultPosition == "right"){ t_class = "_right"; } var right_compare = (w_compare + left) parseInt($(window).width()); if((right_compare && w_compare parseInt($(window).height() + $(window).scrollTop()); var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) "+b.value+""+e[f].show+""+a.value+"",type:10}):d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+""+a.value+"",type:1})):2===e[f].type||9===e[f].type?(a=d.pop(),b=d.pop(),d.push({value:(1!=b.type?"(":"")+b.value+(1!=b.type?")":"")+e[f].show+(1!=a.type?"(":"")+a.value+(1!=a.type?")":""),type:e[f].type})):12===e[f].type&&(a=d.pop(),b=d.pop(),c=d.pop(),d.push({value:e[f].show+"("+c.value+","+b.value+","+a.value+")",type:12}));return d[0].value},b.exports=d},{"./postfix_evaluator.js":5}],2:[function(a,b,c){function d(a,b){for(var c=0;cr.length-2?r.length-1:A.length-s;t>0;t--)for(u=0;uc)h.push(a);else{for(;c>=e&&!k||k&&e1)throw new d.exception("Uncaught Syntax error");return f[0].value>1e15?"Infinity":parseFloat(f[0].value.toFixed(15))},d.eval=function(a,b,c){return"undefined"==typeof b?this.lex(a).toPostfix().postfixEval():"undefined"==typeof c?"undefined"!=typeof b.length?this.lex(a,b).toPostfix().postfixEval():this.lex(a).toPostfix().postfixEval(b):this.lex(a,b).toPostfix().postfixEval(c)},b.exports=d},{"./postfix.js":4}]},{},[1])(1)}); !function(e){if("function"==typeof define&&define.amd)define(["jquery"],e);else if("object"==typeof exports){var n=require("jquery");module.exports=e(n)}else e(window.jQuery||window.Zepto||window.$)}(function(e){"use strict";e.fn.serializeJSON=function(n){var r,s,t,i,a,u,l,o,p,c,d,f,y;return r=e.serializeJSON,s=this,t=r.setupOpts(n),i=s.serializeArray(),r.readCheckboxUncheckedValues(i,t,s),a={},e.each(i,function(e,n){u=n.name,l=n.value,p=r.extractTypeAndNameWithNoType(u),c=p.nameWithNoType,(d=p.type)||(d=r.attrFromInputWithName(s,u,"data-value-type")),r.validateType(u,d,t),"skip"!==d&&(f=r.splitInputNameIntoKeysArray(c),o=r.parseValue(l,u,d,t),(y=!o&&r.shouldSkipFalsy(s,u,c,d,t))||r.deepSet(a,f,o,t))}),a},e.serializeJSON={defaultOptions:{checkboxUncheckedValue:void 0,parseNumbers:!1,parseBooleans:!1,parseNulls:!1,parseAll:!1,parseWithFunction:null,skipFalsyValuesForTypes:[],skipFalsyValuesForFields:[],customTypes:{},defaultTypes:{string:function(e){return String(e)},number:function(e){return Number(e)},boolean:function(e){return-1===["false","null","undefined","","0"].indexOf(e)},null:function(e){return-1===["false","null","undefined","","0"].indexOf(e)?e:null},array:function(e){return JSON.parse(e)},object:function(e){return JSON.parse(e)},auto:function(n){return e.serializeJSON.parseValue(n,null,null,{parseNumbers:!0,parseBooleans:!0,parseNulls:!0})},skip:null},useIntKeysAsArrayIndex:!1},setupOpts:function(n){var r,s,t,i,a,u;u=e.serializeJSON,null==n&&(n={}),t=u.defaultOptions||{},s=["checkboxUncheckedValue","parseNumbers","parseBooleans","parseNulls","parseAll","parseWithFunction","skipFalsyValuesForTypes","skipFalsyValuesForFields","customTypes","defaultTypes","useIntKeysAsArrayIndex"];for(r in n)if(-1===s.indexOf(r))throw new Error("serializeJSON ERROR: invalid option '"+r+"'. Please use one of "+s.join(", "));return i=function(e){return!1!==n[e]&&""!==n[e]&&(n[e]||t[e])},a=i("parseAll"),{checkboxUncheckedValue:i("checkboxUncheckedValue"),parseNumbers:a||i("parseNumbers"),parseBooleans:a||i("parseBooleans"),parseNulls:a||i("parseNulls"),parseWithFunction:i("parseWithFunction"),skipFalsyValuesForTypes:i("skipFalsyValuesForTypes"),skipFalsyValuesForFields:i("skipFalsyValuesForFields"),typeFunctions:e.extend({},i("defaultTypes"),i("customTypes")),useIntKeysAsArrayIndex:i("useIntKeysAsArrayIndex")}},parseValue:function(n,r,s,t){var i,a;return i=e.serializeJSON,a=n,t.typeFunctions&&s&&t.typeFunctions[s]?a=t.typeFunctions[s](n):t.parseNumbers&&i.isNumeric(n)?a=Number(n):!t.parseBooleans||"true"!==n&&"false"!==n?t.parseNulls&&"null"==n?a=null:t.typeFunctions&&t.typeFunctions.string&&(a=t.typeFunctions.string(n)):a="true"===n,t.parseWithFunction&&!s&&(a=t.parseWithFunction(a,r)),a},isObject:function(e){return e===Object(e)},isUndefined:function(e){return void 0===e},isValidArrayIndex:function(e){return/^[0-9]+$/.test(String(e))},isNumeric:function(e){return e-parseFloat(e)>=0},optionKeys:function(e){if(Object.keys)return Object.keys(e);var n,r=[];for(n in e)r.push(n);return r},readCheckboxUncheckedValues:function(n,r,s){var t,i,a;null==r&&(r={}),e.serializeJSON,t="input[type=checkbox][name]:not(:checked):not([disabled])",s.find(t).add(s.filter(t)).each(function(s,t){if(i=e(t),null==(a=i.attr("data-unchecked-value"))&&(a=r.checkboxUncheckedValue),null!=a){if(t.name&&-1!==t.name.indexOf("[]["))throw new Error("serializeJSON ERROR: checkbox unchecked values are not supported on nested arrays of objects like '"+t.name+"'. See https://github.com/marioizquierdo/jquery.serializeJSON/issues/67");n.push({name:t.name,value:a})}})},extractTypeAndNameWithNoType:function(e){var n;return(n=e.match(/(.*):([^:]+)$/))?{nameWithNoType:n[1],type:n[2]}:{nameWithNoType:e,type:null}},shouldSkipFalsy:function(n,r,s,t,i){var a=e.serializeJSON.attrFromInputWithName(n,r,"data-skip-falsy");if(null!=a)return"false"!==a;var u=i.skipFalsyValuesForFields;if(u&&(-1!==u.indexOf(s)||-1!==u.indexOf(r)))return!0;var l=i.skipFalsyValuesForTypes;return null==t&&(t="string"),!(!l||-1===l.indexOf(t))},attrFromInputWithName:function(e,n,r){var s,t;return s=n.replace(/(:|\.|\[|\]|\s)/g,"\\$1"),t='[name="'+s+'"]',e.find(t).add(e.filter(t)).attr(r)},validateType:function(n,r,s){var t,i;if(i=e.serializeJSON,t=i.optionKeys(s?s.typeFunctions:i.defaultOptions.defaultTypes),r&&-1===t.indexOf(r))throw new Error("serializeJSON ERROR: Invalid type "+r+" found in input name '"+n+"', please use one of "+t.join(", "));return!0},splitInputNameIntoKeysArray:function(n){var r;return e.serializeJSON,r=n.split("["),""===(r=e.map(r,function(e){return e.replace(/\]/g,"")}))[0]&&r.shift(),r},deepSet:function(n,r,s,t){var i,a,u,l,o,p;if(null==t&&(t={}),(p=e.serializeJSON).isUndefined(n))throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined");if(!r||0===r.length)throw new Error("ArgumentError: param 'keys' expected to be an array with least one element");i=r[0],1===r.length?""===i?n.push(s):n[i]=s:(a=r[1],""===i&&(o=n[l=n.length-1],i=p.isObject(o)&&(p.isUndefined(o[a])||r.length>2)?l:l+1),""===a?!p.isUndefined(n[i])&&e.isArray(n[i])||(n[i]=[]):t.useIntKeysAsArrayIndex&&p.isValidArrayIndex(a)?!p.isUndefined(n[i])&&e.isArray(n[i])||(n[i]=[]):!p.isUndefined(n[i])&&p.isObject(n[i])||(n[i]={}),u=r.slice(1),p.deepSet(n[i],u,s,t))}}}); var in_quick_view = 0; var nbOption = { status: false, initialed: false, options: {"version":"274","quantity_enable":"n","quantity_type":"r","quantity_min":"1","quantity_max":"100","quantity_step":"1","quantity_discount_type":"f","quantity_breaks":[{"val":"1","dis":""},{"val":"2","dis":"1"},{"val":"5","dis":"10"},{"val":"9","dis":"16"}],"fields":[{"id":"f1611572257802","general":{"title":"DIMENSIONI PERSONALIZZATE","description":"Option description","data_type":"i","input_type":"t","input_option":{"min":"1","max":"100","step":"1","default":"1"},"text_option":{"min":"0","max":"999"},"placeholder":"","upload_option":{"min_size":"0","max_size":"128","allow_type":"png,jpg,jpeg"},"enabled":"y","published":"y","required":"n","price_type":"f","depend_qty":"y","depend_quantity":"n","price":"","price_breaks":[],"attributes":{"options":[{"preview_type":"i","image":"0","color":"#ffffff","name":"Attribute name","des":"","price":[""],"implicit_value":""}]},"min_width":"180","max_width":"250","step_width":"1","default_width":"250","min_height":"180","max_height":"200","step_height":"1","default_height":"200","mesure":"n"},"conditional":{"enable":"n"},"appearance":{"display_type":"r","change_image_product":"n","show_in_archives":"n","css_class":""},"nbd_type":"dimension","template":"\/home\/rionghsz\/domains\/print-station.it\/private_html\/wp-content\/plugins\/web-to-print-online-designer\/templates\/single-product\/options-builder\/input.php","need_show":true,"class":" "},{"id":"f1611572892955","general":{"title":"ORIENTAMENTO","description":"Option description","data_type":"m","input_type":"t","input_option":{"min":"1","max":"100","step":"1","default":"1"},"text_option":{"min":"0","max":"999"},"placeholder":"","upload_option":{"min_size":"0","max_size":"128","allow_type":"png,jpg,jpeg"},"enabled":"y","published":"y","required":"n","price_type":"f","depend_qty":"y","depend_quantity":"n","price":"","price_breaks":[],"attributes":{"options":[{"preview_type":"i","image":"0","color":"#ffffff","name":"VERTICALE","des":"","price":[""],"implicit_value":""},{"preview_type":"i","image":"0","color":"#ffffff","name":"ORIZZONTALE","des":"","price":[""],"implicit_value":""}]}},"conditional":{"enable":"n"},"appearance":{"display_type":"r","change_image_product":"n","show_in_archives":"n","css_class":""},"nbd_type":"orientation","template":"\/home\/rionghsz\/domains\/print-station.it\/private_html\/wp-content\/plugins\/web-to-print-online-designer\/templates\/single-product\/options-builder\/radio.php","need_show":true,"class":" "},{"id":"f1611572023238","general":{"title":"OPZIONE STRUTTURA","description":"Option description","data_type":"m","input_type":"t","input_option":{"min":"1","max":"100","step":"1","default":"1"},"text_option":{"min":"0","max":"999"},"placeholder":"","upload_option":{"min_size":"0","max_size":"128","allow_type":"png,jpg,jpeg"},"enabled":"y","published":"y","required":"n","price_type":"f","depend_qty":"y","depend_quantity":"y","price":"","price_breaks":[],"attributes":{"options":[{"preview_type":"i","image":"0","color":"#ffffff","name":"STRUTTURA COMPLETA","des":"","price":["129","126","130","116"],"implicit_value":""},{"preview_type":"i","image":"0","color":"#ffffff","name":"CAMBIO STAMPA","des":"","price":["","","",""],"implicit_value":""}]}},"conditional":{"enable":"n"},"appearance":{"display_type":"r","change_image_product":"n","show_in_archives":"n","css_class":""},"template":"\/home\/rionghsz\/domains\/print-station.it\/private_html\/wp-content\/plugins\/web-to-print-online-designer\/templates\/single-product\/options-builder\/radio.php","need_show":true,"class":" "},{"id":"f1614954534142","general":{"title":"CARICA IL TUO FILE","description":"Se hai gi\u00e0 un file pronto caricalo qui, scegli le quantit\u00e0 e completa l'ordine aggiungendo al carrello.","data_type":"i","input_type":"u","input_option":{"min":"1","max":"100","step":"1","default":"1"},"text_option":{"min":"0","max":"999"},"placeholder":"","upload_option":{"min_size":"0","max_size":"1000","allow_type":"png,jpg,jpeg"},"enabled":"y","published":"y","required":"n","price_type":"f","depend_qty":"y","depend_quantity":"n","price":"","price_breaks":[],"attributes":{"options":[{"preview_type":"i","image":"0","color":"#ffffff","name":"Attribute name","des":"","price":[""],"implicit_value":""}]},"nbpb_image_configs":{"views":[]}},"conditional":{"enable":"n"},"appearance":{"display_type":"d","change_image_product":"n","show_in_archives":"n","css_class":""},"nbpb_type":"nbpb_image","template":"\/home\/rionghsz\/domains\/print-station.it\/private_html\/wp-content\/plugins\/web-to-print-online-designer\/templates\/single-product\/options-builder\/input.php","need_show":true,"class":" "}],"views":[{"name":"View name","base":"0","base_width":"","base_height":"","base_url":"https:\/\/print-station.it\/wp-content\/plugins\/web-to-print-online-designer\/assets\/images\/placeholder.png"}],"display_type":"1","popup_trigger_field":"","matrix_type":1}, bulk_fields: [], nbd_fields: {}, odOption: {}, extraOdOption: {}, lastOdOption: {}, lastExtraOdOption: {}, crtlId: 'nbo-ctrl-nbo-app-1630316606714', updateVariations: function(){ var scope = angular.element(document.getElementById(nbOption.crtlId)).scope(); scope.updateVariations(); }, updateBulkPrice: function(){ var scope = angular.element(document.getElementById(nbOption.crtlId)).scope(); scope.calculate_bulk_total_price(); }, enable_gallery_api: 0, template_folder: "", options_str: '', prev_options_str: '', gallery: {}, gallery_url: "https://print-station.it/wp-content/uploads/nbdesigner/gallery", design_stored: 0, has_delivery: 0, delivery_field_id: '', delivery_count: parseInt(0) }; jQuery('.variations_form').on('woocommerce_variation_has_changed wc_variation_form', function(){ startApp(); }); jQuery('.variations_form').on('found_variation', function(){ setTimeout(function(){ startApp(); }, 100); }); function _debounce(func, wait, immediate) { var timeout; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; }; jQuery(document).ready(function(){ var changeQtyFn = function(event){ if( event.namespace == 'nbo' ){ startApp(); }else{ startApp( true ); } }; jQuery('input[name="quantity"]').on('input change change.nbo', changeQtyFn); jQuery('#nbd-trigger-nbo-popup').on('click', function(){ jQuery('#nbo-detail-popup-wrap').showNBDPopup(); }); jQuery('#nbo-sumit-popup-action').on('click', function(){ jQuery('.single_add_to_cart_button').trigger('click'); jQuery('#nbo-detail-popup-wrap .popup-inner').trigger('click'); }); }); function startApp( updateQty ){ if( nbOption.status ){ var scope = angular.element(document.getElementById("nbo-ctrl-nbo-app-1630316606714")).scope(); scope.mapOptions(); if( angular.isDefined(updateQty) ){ if( nbOption.has_delivery ){ scope.update_delivery_date(); } } scope.check_valid(); scope.update_app(); } }; var option_selector = ""; var quantity_selector = '.quantity:not(.buttons_added) .minus, .quantity:not(.buttons_added) .plus, .quantity-plus, .quantity-minus'; var qty_selector = option_selector != '' ? quantity_selector + ', ' + option_selector : quantity_selector; jQuery(document).off('click.nbo', qty_selector) .on('click.nbo', qty_selector, function(){ jQuery('input[name="quantity"]').trigger( 'change.nbo' ); }); var nboApp = angular.module('nboApp', []); function nbo_variation_calculator(variation_attributes, product_variations, all_set_callback, not_all_set_callback) { this.recalc_needed = true; this.all_set_callback = all_set_callback; this.not_all_set_callback = not_all_set_callback; this.variation_attributes = variation_attributes; this.variations_available = product_variations; this.variations_current = {}; this.variations_selected = {}; this.reset_current = function () { for (var attribute in this.variation_attributes) { this.variations_current[attribute] = {}; for (var av = 0; av max ) check[field_id] = false; } } } } field.value_name = ''; if( angular.isDefined(field.value) ){ if( origin_field.general.input_type != 'u' ){ field.value_name = field.value; }else if( angular.isDefined(field.value.name) ){ field.value_name = field.value.name; } } }else{ if( angular.isDefined(field.values) ){ field.value_name = ''; angular.forEach(field.values, function(val, index){ field.value_name += (index == 0 ? '' : ', ') + origin_field.general.attributes.options[val].name; }); if( origin_field.nbd_type == "page" || origin_field.nbd_type == "page2" ){ $scope.can_start_design = field.values.length == 0 ? false: true; } }else{ var selected_option = origin_field.general.attributes.options[field.value]; field.value_name = selected_option.name; if( angular.isDefined($scope.nbd_fields[field_id]) ){ $scope.nbd_fields[field_id].form_name = ''; if( angular.isDefined(selected_option.enable_subattr) && selected_option.enable_subattr == 'on' ){ if( angular.isDefined(selected_option.sub_attributes) && selected_option.sub_attributes.length > 0 ){ $scope.nbd_fields[field_id].form_name = selected_option.form_name; if( angular.isUndefined( selected_option.sub_attributes[$scope.nbd_fields[field_id].sub_value] ) ){ $scope.nbd_fields[field_id].sub_value = '0'; } field.value_name += ' - ' + selected_option.sub_attributes[$scope.nbd_fields[field_id].sub_value].name; } } if( origin_field.appearance.display_type == 'ad' ){ $scope.nbd_fields[field_id].form_name = '[value]'; } } if( origin_field.nbe_type == 'actions' ){ var action = selected_option.action; if( !( action == 'u' || action == 'c' ) ){ jQuery('#triggerDesign, #startDesign, #startUpload, #useTemplate').hide(); if( jQuery('.nbd-force-ignore-design').length == 0 ){ jQuery('form.cart').append(''); } if( ( jQuery('#triggerDesign').length > 0 || jQuery('#startDesign').length > 0 || jQuery('#startUpload').length > 0 ) && angular.isDefined( nbds_frontend ) && nbds_frontend.hide_cart_button == 'yes'){ jQuery('button[type="submit"].single_add_to_cart_button').show(); }; }else{ jQuery('#triggerDesign, #startDesign, #startUpload, #useTemplate').show(); if( action == 'u' ){ jQuery('#startDesign, #useTemplate').hide(); }else{ jQuery('#startUpload').hide(); } jQuery('form.cart').find('.nbd-force-ignore-design').remove(); if( ( jQuery('#triggerDesign').length > 0 || jQuery('#startDesign').length > 0 || jQuery('#startUpload').length > 0 ) && angular.isDefined( nbds_frontend ) && nbds_frontend.hide_cart_button == 'yes'){ jQuery('button[type="submit"].single_add_to_cart_button').hide(); }; } } if( origin_field.general.attributes.options.length ){ origin_field.general.attributes.options.forEach(function(op, opIndex){ $scope.checkAttributeStatus( field_id, opIndex ); if( angular.isDefined( op.enable_subattr ) && op.enable_subattr == 'on' && op.sub_attributes.length > 0 ){ op.sub_attributes.forEach(function(sop, sopIndex){ $scope.checkAttributeStatus( field_id, opIndex, sopIndex ); }); } }); if( !$scope.status_fields[field_id][field.value].enable ){ check[field_id] = false; field.valid = false; field.invalidOption = selected_option.name; } if( angular.isDefined( field.sub_value ) ){ if( angular.isDefined( selected_option.enable_subattr ) && selected_option.enable_subattr == 'on' && selected_option.sub_attributes.length > 0 ){ var selected_sub_option = selected_option.sub_attributes[field.sub_value]; if( !$scope.status_fields[field_id][field.value].sub_attributes[field.sub_value] ){ check[field_id] = false; field.valid = false; field.invalidOption = selected_sub_option.name; } } } } if( angular.isDefined( origin_field.nbd_type ) && origin_field.nbd_type == 'shape' ){ field.shape = selected_option.shape; } } } if( !field.enable ) check[field_id] = true; if( $scope.options.display_type == 6 ){ if( field_id == $scope.options.popup_trigger_field && field.value == $scope.options.popup_trigger_value ){ show_popup_trigger = true; } } }); if( show_popup_trigger ){ jQuery('#nbd-trigger-nbo-popup').css('display', 'inline-block'); jQuery('.single_add_to_cart_button').addClass('nbop-hidden'); }else{ jQuery('#nbd-trigger-nbo-popup').css('display', 'none'); jQuery('.single_add_to_cart_button').removeClass('nbop-hidden'); } angular.forEach(check, function(c){ total_check = total_check && c; }); /*if( $scope.options.display_type == 3 ){ var check_bulk_quantity = false; if( jQuery('.nbb-qty-field').length == 0 ) check_bulk_quantity = true; jQuery.each(jQuery('.nbb-qty-field'), function(key, el){ if(jQuery(el).val() != '') check_bulk_quantity = true; }); total_check = total_check && check_bulk_quantity; }*/ if( total_check ){ $scope.postOptionsToEditor(); $scope.calculate_price(); $scope.calculate_price_table2(); if( nbOption.has_delivery ){ $scope.calc_turnaround_matrix(); } $scope.valid_form = true; jQuery('.single_add_to_cart_button').removeClass( "nbo-disabled nbo-hidden"); jQuery('.variations_form, form.cart').find('[name="nbo-ignore-design"]').remove(); if($scope.can_start_design){ if( $scope.type == 'variable' ){ var variation_id = jQuery('input[name="variation_id"], input.variation_id').val(); if( variation_id != '' && variation_id != 0 ){ jQuery('#triggerDesign').removeClass('nbdesigner_disable'); } }else{ jQuery('#triggerDesign').removeClass('nbdesigner_disable'); } }else{ jQuery('.variations_form, form.cart').append(''); jQuery('#triggerDesign').addClass('nbdesigner_disable'); }; jQuery(document).triggerHandler( 'nbo_valid_form' ); }else{ jQuery(document).triggerHandler( 'invalid_nbo_options' ); jQuery('.single_add_to_cart_button').addClass( "nbo-disabled"); if( nbds_frontend.nbdesigner_hide_add_cart_until_form_filled == 'yes' ){ jQuery('.single_add_to_cart_button').addClass( "nbo-hidden"); } $scope.valid_form = false; jQuery('#triggerDesign').addClass('nbdesigner_disable'); jQuery(document).triggerHandler( 'nbo_invalid_form' ); } $scope.may_be_change_product_image(); if( $scope.has_price_matrix && ( angular.isUndefined( calculate_pm ) || calculate_pm ) ){ $scope.calculate_price_matrix(); } angular.copy($scope.nbd_fields, nbOption.nbd_fields); if( !nbOption.initialed ){ jQuery(document).triggerHandler( 'initialed_nbo_options' ); nbOption.initialed = true; function inIframe() { try { return window.self !== window.top; } catch (e) { return true; } } if( inIframe() ){ window.parent.postMessage('initialed_nbo_options', window.location.origin); } }else{ jQuery(document).triggerHandler( 'update_nbo_options', { pro: pro } ); }; var preventEnter = function(event){ if( event.keyCode == 13 ) { event.preventDefault(); return false; } }; jQuery('.variations_form input, form.cart input').off('keydown', preventEnter).on('keydown', preventEnter); if( nbOption.delivery_count > 1 && !$scope.nbd_fields[nbOption.delivery_field_id].enable ){ var first = true, delivery_field_id; angular.forEach($scope.nbd_fields, function(field, field_id){ var origin_field = $scope.get_field(field_id); if( origin_field.general.enabled == 'y' && origin_field.general.published == 'y' && angular.isDefined( origin_field.nbe_type ) && origin_field.nbe_type == 'delivery' & angular.isDefined( origin_field.general.attributes ) && angular.isDefined( origin_field.general.attributes.options ) && origin_field.general.attributes.options.length > 0 && first && $scope.nbd_fields[field_id].enable ){ delivery_field_id = origin_field.id; first = false; } }); if( delivery_field_id ){ nbOption.delivery_field_id = delivery_field_id; $scope.init_turnaround_matrix(); $scope.calc_turnaround_matrix(); } } if( angular.isDefined( $scope.no_of_group ) && $scope.no_of_group != 0 ){ $scope.changeGroupPanel( null, -1 ); } $scope.update_app(); }); }; $scope.postOptionsToEditor = function(){ angular.copy( nbOption.odOption, nbOption.lastOdOption ); angular.copy( nbOption.extraOdOption, nbOption.lastExtraOdOption ); nbOption.odOption = {}; nbOption.extraOdOption = {}; var options_str = ''; angular.forEach($scope.nbd_fields, function(field, field_id){ if(field.enable){ var origin_field = $scope.get_field(field_id); if( angular.isDefined(origin_field.nbd_type) ){ switch(origin_field.nbd_type){ case 'dpi': nbOption.odOption.dpi = $scope.validate_int( field.value ); break; case 'color': var option_color = origin_field.general.attributes.options[field.value]; nbOption.odOption.color = { bg_type: origin_field.general.attributes.bg_type, bg_color: option_color.bg_color, bg_image: option_color.bg_image_url }; if( origin_field.general.attributes.bg_type == 'i' ){ options_str += ( ( options_str == '' ) ? '' : '|' ) + 'color,' + field_id + ',' + field.value; } if( !!origin_field.general.attributes.show_as_pt && !! option_color.pattern ){ nbOption.extraOdOption.pattern = option_color.pattern; nbOption.extraOdOption.pattern.color = option_color.bg_color; nbOption.extraOdOption.pattern.type = origin_field.general.attributes.bg_type; delete nbOption.odOption.color; } break; case 'page': case 'page1': case 'page2': var number_page = $scope.validate_int( field.value ); nbOption.odOption.page = { number: number_page, page_display: origin_field.general.page_display, exclude_page: origin_field.general.exclude_page, field_id: field_id }; if( origin_field.general.data_type == 'm' ){ nbOption.odOption.page.list_page = field.values; } break; case 'page3': var list_page = [0, 1]; if( field.value == 0 ){ list_page = [0]; } else if ( field.value == 1 ){ list_page = [1]; } nbOption.odOption.page = { list_page: list_page, field_id: field_id }; break; case 'size': /*var currentFieldIndex = $scope.getFieldIndexById(field_id) + ''; if( $scope.options.bulk_fields.includes(currentFieldIndex) ){ nbOption.variations = []; var bulkForm = jQuery('.nbo-bulk-variation input, .nbo-bulk-variation select').serializeJSON(); angular.forEach(bulkForm['nbb-qty-fields'], function(bf_field, bf_index){ var option_size = origin_field.general.attributes.options[bulkForm['nbb-fields'][field_id][bf_index]]; var first = true, name = ''; angular.forEach(bulkForm['nbb-fields'], function(_bff_field, _bff_id){ var _origin_field = $scope.get_field(_bff_id); var _option = _origin_field.general.attributes.options[bulkForm['nbb-fields'][_bff_id][bf_index]]; var separate = first ? '' : ', '; name += separate + _option.name; first = false; }); var size = { product_width: $scope.validate_float( option_size.product_width ), product_height: $scope.validate_float( option_size.product_height ), real_width: $scope.validate_float( option_size.real_width ), real_height: $scope.validate_float( option_size.real_height ), real_top: $scope.validate_float( option_size.real_top ), real_left: $scope.validate_float( option_size.real_left ) }; nbOption.variations.push({index: bf_index, qty: $scope.validate_int(bf_field), size: size, name: name}); }); }else{*/ if(origin_field.general.attributes.same_size == 'n'){ var option_size = origin_field.general.attributes.options[field.value]; nbOption.odOption.size = { product_width: $scope.validate_float( option_size.product_width ), product_height: $scope.validate_float( option_size.product_height ), real_width: $scope.validate_float( option_size.real_width ), real_height: $scope.validate_float( option_size.real_height ), real_top: $scope.validate_float( option_size.real_top ), real_left: $scope.validate_float( option_size.real_left ) }; } /*}*/ break; case 'dimension': nbOption.odOption.dimension = { width: field.width, height: field.height }; break; case 'orientation': nbOption.odOption.orientation = $scope.validate_int( field.value ); break; case 'area': nbOption.odOption.area = $scope.validate_int( parseInt(field.value) + 1 ); break; case 'padding': var option = origin_field.general.attributes.options[field.value]; nbOption.odOption.padding = parseFloat(option.padding); break; case 'rounded_corner': var option = origin_field.general.attributes.options[field.value]; nbOption.extraOdOption.rounded_corner = parseFloat(option.radius); break; case 'overlay': var option = origin_field.general.attributes.options[field.value]; nbOption.extraOdOption.overlay = option.overlay_image_url; break; case 'fold': var option = origin_field.general.attributes.options[field.value]; nbOption.extraOdOption.fold = option.fold; break; case 'shape': var option = origin_field.general.attributes.options[field.value]; nbOption.extraOdOption.shape = option.shape; break; } } } }); if( nbOption.enable_gallery_api == '1' && options_str != '' ){ nbOption.prev_options_str = nbOption.options_str; nbOption.options_str = options_str; var _options_folder = 'product_id,' + $scope.product_id + '|' + 'template,' + nbOption.template_folder + '|' + nbOption.options_str; _options_folder = window.btoa( _options_folder ); $timeout(function(){ if( nbOption.prev_options_str != nbOption.options_str ) $scope.get_gallery( _options_folder ); }); } /* send option to editor */ if( angular.equals( nbOption.odOption, nbOption.lastOdOption ) ){ jQuery(document).triggerHandler( 'change_nbo_options_without_od_option' ); }else{ jQuery(document).triggerHandler( 'change_nbo_options_with_od_option' ); }; if( !angular.equals( nbOption.extraOdOption, nbOption.lastExtraOdOption ) ){ jQuery(document).triggerHandler( 'change_nbo_extra_od_options' ); } jQuery(document).triggerHandler( 'change_nbo_options' ); }; $scope.getFieldIndexById = function(field_id){ var currentFieldIndex = 0; angular.forEach($scope.options.fields, function(__field, __index){ if(__field.id == field_id) currentFieldIndex = __index; }); return currentFieldIndex; }; $scope.updateVariations = function(){ nbOption.variations = []; var bulkForm = jQuery('.nbo-bulk-variation input, .nbo-bulk-variation select').serializeJSON(); angular.forEach(bulkForm['nbb-qty-fields'], function(bf_field, bf_index){ angular.forEach(bulkForm['nbb-fields'], function(bff_field, bff_id){ var origin_field = $scope.get_field(bff_id); if( origin_field.nbd_type == 'size' ){ var first = true, name = ''; angular.forEach(bulkForm['nbb-fields'], function(_bff_field, _bff_id){ var _origin_field = $scope.get_field(_bff_id); var _option = _origin_field.general.attributes.options[bulkForm['nbb-fields'][_bff_id][bf_index]]; var separate = first ? '' : ', '; name += separate + _option.name; first = false; }); var option_size = origin_field.general.attributes.options[bulkForm['nbb-fields'][bff_id][bf_index]]; var size = { product_width: $scope.validate_float( option_size.product_width ), product_height: $scope.validate_float( option_size.product_height ), real_width: $scope.validate_float( option_size.real_width ), real_height: $scope.validate_float( option_size.real_height ), real_top: $scope.validate_float( option_size.real_top ), real_left: $scope.validate_float( option_size.real_left ) }; nbOption.variations.push({index: bf_index, qty: $scope.validate_int(bf_field), size: size, name: name}); } }); }); if(nbOption.variations.length){ jQuery(document).triggerHandler( 'change_nbo_size_variations' ); } }; $scope.updateMultiselectValue = function(field_id){ $scope.nbd_fields[field_id].values = []; angular.forEach($scope.nbd_fields[field_id]._values, function(val, index){ if(val){ $scope.nbd_fields[field_id].values.push(index); } }); $scope.nbd_fields[field_id].value = $scope.nbd_fields[field_id].values[0]; $scope.check_valid(); }; $scope.update_dimensionvalue = function(field_id, dir){ var origin_field = $scope.get_field(field_id), current_val = $scope.validate_float( $scope.nbd_fields[field_id][dir] ), min_val = $scope.validate_float( origin_field.general['min_' + dir] ), max_val = $scope.validate_float( origin_field.general['max_' + dir] ); current_val = ( current_val max_val ) ? max_val : current_val; $scope.nbd_fields[field_id][dir] = current_val; $scope.current_dimensions[dir] = current_val; $scope.nbd_fields[field_id].value = $scope.nbd_fields[field_id].width + 'x' + $scope.nbd_fields[field_id].height; $scope.check_valid(); }; $scope.update_dimension = function(field_id, dir, operator){ var origin_field = $scope.get_field(field_id), current_val = $scope.validate_float( $scope.nbd_fields[field_id][dir] ), min_val = $scope.validate_float( origin_field.general['min_' + dir] ), max_val = $scope.validate_float( origin_field.general['max_' + dir] ), step_val = $scope.validate_float( origin_field.general['step_' + dir] ); step_val = ( step_val == 0 ) ? 1 : step_val; if( operator == 'minus' ){ current_val = (current_val - step_val) >= min_val ? $scope.shorten(current_val - step_val) : min_val; }else{ if( max_val != 0 ){ current_val = (current_val + step_val) = 500){ $scope.check_valid(); }; }, 500); }; $scope.set_product_image_attr = function(ele, attr, value, id){ if( angular.isUndefined($scope.product_image[id]) || angular.isUndefined($scope.product_image[id][attr]) ){ if( angular.isUndefined($scope.product_image[id]) ) $scope.product_image[id] = {}; $scope.product_image[id][attr] = ele.attr( attr ); } if ( false === value ) { ele.removeAttr( attr ); }else{ ele.attr( attr, value ); } }; $scope.reset_product_image_attr = function(ele, attr, id){ ele.attr( attr, $scope.product_image[id][attr] ); delete $scope.product_image[id][attr]; }; $scope.may_be_change_product_image = function(){ $scope.product_img = []; angular.forEach($scope.nbd_fields, function(_field, field_id){ var field = $scope.get_field(field_id); if( field.general.data_type == 'm' && field.appearance.change_image_product == 'y' && field.general.attributes.options[_field.value].imagep == 'y' && _field.enable ){ $scope.product_img.field_id = field_id; $scope.product_img.option_index = _field.value; } }); if( angular.isDefined($scope.product_img.field_id) && angular.isDefined($scope.product_img.option_index) ){ $scope.change_product_image($scope.product_img.field_id, $scope.product_img.option_index); } }; $scope.change_product_image = function( field_id, option_index ){ var field = $scope.get_field(field_id); if( field.appearance.change_image_product == 'y' && field.general.attributes.options[option_index].imagep == 'y' ){ var product_element = jQuery( '#product-'+ $scope.product_id ); var product_image = product_element.find( '.woocommerce-product-gallery__image:not(.clone), .woocommerce-product-gallery__image--placeholder:not(.clone)' ).eq( 0 ).find( '.wp-post-image' ).first(); if ( product_image.length === 0 ) { product_image = product_element.find( "a.woocommerce-main-image img, img.woocommerce-main-image" ).not( '.thumbnails img,.product_list_widget img' ).first(); } if ( jQuery( product_image ).length > 1 ) { product_image = jQuery( product_image ).first(); } var gallery_image = product_element.find( '.flex-control-nav li:eq(0) img' ), gallery_wrapper = product_element.find( '.woocommerce-product-gallery__wrapper ' ), product_image_wrap = gallery_wrapper.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ), product_link = product_image.closest( 'a' ); var option_data = field.general.attributes.options[option_index]; if( !option_data.full_src ) option_data.full_src = option_data.image_link; if (product_image.length){ if( !option_data.full_src_w ) option_data.full_src = product_image.attr('data-large_image_width'); if( !option_data.full_src_h ) option_data.full_src_h = product_image.attr('data-large_image_height'); $scope.set_product_image_attr(product_image, 'src', option_data.image_link, 0); $scope.set_product_image_attr(product_image, 'srcset', option_data.image_srcset, 0); $scope.set_product_image_attr(product_image, 'sizes', option_data.image_sizes, 0); $scope.set_product_image_attr(product_image, 'title', option_data.image_title, 0); $scope.set_product_image_attr(product_image, 'alt', option_data.image_alt, 0); $scope.set_product_image_attr(product_image, 'data-src', option_data.full_src, 0); $scope.set_product_image_attr(product_image, 'data-large_image', option_data.full_src, 0); $scope.set_product_image_attr(product_image, 'data-large_image_width', option_data.full_src_w, 0); $scope.set_product_image_attr(product_image, 'data-large_image_height', option_data.full_src_h, 0); $scope.set_product_image_attr(product_image, 'alt', option_data.alt, 0); $scope.set_product_image_attr(product_image_wrap, 'data-thumb', option_data.image_link, 1); } if (gallery_image.length){ $scope.set_product_image_attr(gallery_image, 'src', option_data.image_link, 2); } if (product_link.length){ $scope.set_product_image_attr(product_link, 'href', option_data.full_src, 3); $scope.set_product_image_attr(product_link, 'title', option_data.image_caption, 3); } $scope.init_product_gallery_and_zoom(); } }; $scope.change_gallery_image = function( gallery_images, folder ){ if( angular.isDefined( folder ) ){ nbOption.template_folder = folder; nbOption.gallery = {}; nbOption.design_stored = 1; } var _options_folder = 'product_id,' + $scope.product_id + '|' + 'template,' + nbOption.template_folder + '|' + nbOption.options_str; _options_folder = window.btoa( _options_folder ); nbOption.gallery[_options_folder] = gallery_images; var product_element = jQuery( '#product-'+ $scope.product_id ), product_images = product_element.find( '.woocommerce-product-gallery__image:not(.clone), .woocommerce-product-gallery__image--placeholder:not(.clone)' ), thumbnail_images = product_element.find( '.flex-control-nav li' ); if(product_images.length > 1 && gallery_images.length > 0 ){ jQuery.each( product_images, function( index, el ){ if( index > 0 && index 1 ) { product_image = jQuery( product_image ).first(); } var gallery_image = product_element.find( '.flex-control-nav li:eq(0) img' ), gallery_wrapper = product_element.find( '.woocommerce-product-gallery__wrapper ' ), product_image_wrap = gallery_wrapper.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ), product_link = product_image.closest( 'a' ); if (product_image.length){ $scope.set_product_image_attr(product_image, 'src', option.image_link, 0); $scope.set_product_image_attr(product_image, 'srcset', option.image_srcset, 0); $scope.set_product_image_attr(product_image, 'sizes', option.image_sizes, 0); $scope.set_product_image_attr(product_image, 'title', option.image_title, 0); $scope.set_product_image_attr(product_image, 'alt', option.image_alt, 0); $scope.set_product_image_attr(product_image, 'data-src', option.full_src, 0); $scope.set_product_image_attr(product_image, 'data-large_image', option.full_src, 0); $scope.set_product_image_attr(product_image, 'data-large_image_width', option.full_src_w, 0); $scope.set_product_image_attr(product_image, 'data-large_image_height', option.full_src_h, 0); $scope.set_product_image_attr(product_image, 'alt', option.alt, 0); $scope.set_product_image_attr(product_image_wrap, 'data-thumb', option.image_link, 1); } if (gallery_image.length){ $scope.set_product_image_attr(gallery_image, 'src', option.image_link, 2); } if (product_link.length){ $scope.set_product_image_attr(product_link, 'href', option.full_src, 3); $scope.set_product_image_attr(product_link, 'title', option.image_caption, 3); } $scope.init_product_gallery_and_zoom(); }; $scope.init_product_gallery_and_zoom = function(){ var product_element = jQuery( '#product-'+ $scope.product_id ); var gallery_element = product_element.find( '.woocommerce-product-gallery' ); if( gallery_element.length && gallery_element.data( 'flexslider' ) ){ $timeout(function(){ gallery_element.flexslider( 0 ); }, 100); window.setTimeout( function () { gallery_element.trigger( 'woocommerce_gallery_init_zoom' ); jQuery( window ).trigger( 'resize' ); }, 10 ); } var zoom_images = product_element.find( '.woocommerce-product-gallery__image' ), galleryWidth = product_element.find( '.woocommerce-product-gallery--with-images' ).width(), zoomEnabled = false; jQuery( zoom_images ).each( function( index, target ) { var image = jQuery( target ).find( 'img.wp-post-image' ); if ( image.attr( 'data-large_image_width' ) > galleryWidth ) { zoomEnabled = true; return false; } } ); if ( zoomEnabled ){ var zoom_options = { touch: false }; if ( 'ontouchstart' in window ) { zoom_options.on = 'click'; } zoom_images.trigger( 'zoom.destroy' ); if( typeof zoom_images.zoom == 'function' ) zoom_images.zoom( zoom_options ); }else{ zoom_images.trigger( 'zoom.destroy' ); } }; $scope.debug = function(){ jQuery('input[name="quantity"]').val( 100 ); jQuery('input[name="quantity"]').trigger( 'change.nbo' ); }; $scope.get_field = function( field_id ){ var _field = null; angular.forEach( $scope.fields, function( field ){ if( field.id == field_id ) _field = field; }); return _field; }; $scope.get_field_index = function( field_id ){ var _index = null; angular.forEach( $scope.fields, function( field, index ){ if( field.id == field_id ) _index = index; }); return _index; }; $scope.check_depend = function( field_id ){ if( angular.isUndefined($scope.nbd_fields[field_id]) ) return; var field = $scope.get_field(field_id), check = []; $scope.nbd_fields[field_id].enable = true; if( field.conditional.enable == 'n' ) return true; if( angular.isUndefined(field.conditional.depend) ) return true; if( field.conditional.depend.length == 0 ) return true; var show = field.conditional.show, logic = field.conditional.logic, total_check = logic == 'a' ? true : false; angular.forEach(field.conditional.depend, function(con, key){ if( con.id != '' ){ if( con.id != 'qty' && ( angular.isUndefined($scope.nbd_fields[con.id]) || !$scope.nbd_fields[con.id].enable ) ){ check[key] = false; }else{ if( con.id == 'qty' ){ var qty = $scope.validate_int( jQuery('input[name="quantity"]').val() ); if( $scope.is_sold_individually == 1 ){ qty = 1; } con.val = con.val * 1; } switch(con.operator){ case 'i': check[key] = $scope.nbd_fields[con.id].value == con.val ? true : false; break; case 'n': check[key] = $scope.nbd_fields[con.id].value != con.val ? true : false; break; case 'e': check[key] = $scope.nbd_fields[con.id].value == '' ? true : false; break; case 'ne': check[key] = $scope.nbd_fields[con.id].value != '' ? true : false; break; case 'eq': check[key] = qty == con.val ? true : false; break; case 'gt': check[key] = qty > con.val ? true : false; break; case 'lt': check[key] = qty 0 ){ var show = option.con_show, logic = option.con_logic, total_check = logic == 'a' ? true : false; angular.forEach(option.depend, function(con, key){ if( con.id != '' ){ if( con.id != 'qty' && ( angular.isUndefined($scope.nbd_fields[con.id]) || !$scope.nbd_fields[con.id].enable ) ){ checks[key] = false; }else{ if( con.id == 'qty' ){ var qty = $scope.validate_int( jQuery('input[name="quantity"]').val() ); if( $scope.is_sold_individually == 1 ){ qty = 1; } con.val = con.val * 1; } switch(con.operator){ case 'i': checks[key] = $scope.nbd_fields[con.id].value == con.val ? true : false; break; case 'n': checks[key] = $scope.nbd_fields[con.id].value != con.val ? true : false; break; case 'e': checks[key] = $scope.nbd_fields[con.id].value == '' ? true : false; break; case 'ne': checks[key] = $scope.nbd_fields[con.id].value != '' ? true : false; break; case 'eq': checks[key] = qty == con.val ? true : false; break; case 'gt': checks[key] = qty > con.val ? true : false; break; case 'lt': checks[key] = qty 0 ) op.form_name = '[value]'; } } $scope.status_fields[field.id][k] = {enable: true}; }); if( !selectedOp ){ selectedOp = field.general.attributes.options[0]; } if( selectedOp ){ if( angular.isDefined(selectedOp.enable_subattr) && selectedOp.enable_subattr == 'on' ){ if(angular.isDefined(selectedOp.sub_attributes)){ $scope.nbd_fields[field.id].sub_value = '0'; angular.forEach(selectedOp.sub_attributes, function(sop, sk){ if( sop.selected == 'on' ) $scope.nbd_fields[field.id].sub_value = '' + sk; }); } } } if( $scope.isMultipleSelectPage( field ) ){ if( angular.isDefined( $scope.form_values[field.id] ) ){ $scope.nbd_fields[field.id].values = [parseInt($scope.nbd_fields[field.id].value)]; }else{ $scope.nbd_fields[field.id].values = []; } $scope.nbd_fields[field.id]._values = []; angular.forEach(field.general.attributes.options, function(op, k){ if( angular.isDefined( $scope.form_values[field.id] ) ){ $scope.nbd_fields[field.id]._values[k] = false; }else{ if( angular.isDefined( field.general.auto_select_page ) && field.general.auto_select_page == 'n' ){ if( op.selected == 'on' ){ $scope.nbd_fields[field.id]._values[k] = true; $scope.nbd_fields[field.id].values.push(k); } }else{ $scope.nbd_fields[field.id]._values[k] = true; $scope.nbd_fields[field.id].values.push(k); } } //$scope.nbd_fields[field.id]._values[k] = k == 0 ? true : false; }); if( $scope.nbd_fields[field.id]._values.length == 0 ){ $scope.nbd_fields[field.id]._values[0] = true; $scope.nbd_fields[field.id].values.push(0); } } if( $scope.artwork_action != '' ){ if( angular.isDefined( field.nbe_type ) && field.nbe_type == 'actions' ){ $scope.nbd_fields[field.id].value = $scope.artwork_action; } } } } } }); angular.forEach($scope.form_values, function(value, field_id){ if(field_id){ if( angular.isDefined(value['sub_value']) ){ $scope.nbd_fields[field_id].value = value['value']; $scope.nbd_fields[field_id].sub_value = value['sub_value']; } else if( angular.isDefined(value['value']) ){ $scope.nbd_fields[field_id].value = value['value']; }else{ $scope.nbd_fields[field_id].value = value; } } var origin_field = $scope.get_field(field_id); if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' ){ var dimension = value.split("x"); $scope.nbd_fields[field_id].width = parseFloat(dimension[0]); $scope.nbd_fields[field_id].height = parseFloat(dimension[1]); } if( $scope.isMultipleSelectPage( origin_field ) ){ $scope.nbd_fields[field_id].value = value[0]; $scope.nbd_fields[field_id].values = value; angular.forEach(value, function(val){ $scope.nbd_fields[origin_field.id]._values[val] = true; }); } }); angular.forEach($scope.fields, function(field){ $scope.check_depend(field.id); }); if( $scope.options.display_type == 2 && ( ( $scope.options.pm_hoz.length > 0 || $scope.options.pm_ver.length > 0 ) || ( $scope.options.mpm_hoz.length > 0 && $scope.options.mpm_ver.length > 0 ) ) ){ $scope.init_price_matrix(); $scope.has_price_matrix = true; } if( nbOption.has_delivery ) $scope.init_turnaround_matrix(); $scope.check_valid(); $timeout(function(){ jQuery('.nbd-option-field:first').removeClass('nbo-collapse'); if( angular.isDefined( $scope.no_of_group ) && $scope.no_of_group != 0 ){ $scope.changeGroupPanel( null, 0 ); $scope.initGroupTimeline(); } }); jQuery(document).on( 'change_nbo_variations', function(){ $scope.upDateVaritionQty(NBDESIGNERPRODUCT.variations); }); }; $scope.mapOptions = function(){ if( !$scope.variations_form ){ $scope.variations_form = jQuery('.variations_form'); $scope.variations_form_obj = { calculator: null, use_ajax: false, swatches_xhr: null, checked: false, first: true }; if( $scope.variations_form.length && $scope.variations_form.find('select.nbo-mapping-select').length ){ var getSelector = function( field_id ){ var field = $scope.get_field(field_id), type = field.appearance.display_type, selector = ''; if( angular.isDefined( field.nbd_type ) && field.nbd_type == 'shape' ){ type = 'ad'; } switch( type ){ case 's': selector = '> .nbd-swatch-wrap input[type="radio"]'; break; case 'r': selector = '> .__nbd-radio-wrap input[type="radio"]'; break; case 'xl': selector = '> .nbd-xlabel-wrapper input[type="radio"]'; break; case 'ad': selector = '> div > select option'; break; case 'l': selector = '> .nbd-label-wrap input[type="radio"]'; break; default: selector = '> .__nbd-dropdown-wrap select option'; break; } return selector; }; var updateFieldStatus = function( current_options ){ var mustCheckValid = false; $scope.variations_form.find('.variations select.nbo-mapping-select').each(function () { var classList = jQuery(this).attr('class').split(/\s+/), field_id, optionWrap; jQuery.each(classList, function(index, _class) { if ( _class.indexOf("nbo_field_id-") > -1 ) { var arr = _class.split("-"); field_id = arr[1]; } }); optionWrap = jQuery('.nbd-option-field[data-id="' + field_id + '"]'); var selector = getSelector( field_id ); var attribute_name = jQuery(this).data('attribute_name') || jQuery(this).attr('name'), avaiable_options = current_options[attribute_name]; jQuery(this).find('option').each(function(index, el){ var val = jQuery(el).val(); if( index > 0 ){ var option = optionWrap.find('.nbd-field-content ' + selector).eq( index - 1); if ( !avaiable_options[val] ) { option.addClass('nbo_map_disable').attr('disabled', 'disabled'); }else{ option.removeClass('nbo_map_disable').removeAttr('disabled'); } } }); }); if( mustCheckValid ){ //$scope.check_valid(); } }; var init = function(){ $scope.variations_form.find('.variations select.nbo-mapping-select').each(function () { var classList = jQuery(this).attr('class').split(/\s+/), val = jQuery(this).val(), field_id, optionWrap; jQuery.each(classList, function(index, _class) { if ( _class.indexOf("nbo_field_id-") > -1 ) { var arr = _class.split("-"); field_id = arr[1]; } }); optionWrap = jQuery('.nbd-option-field[data-id="' + field_id + '"]'); var selector = getSelector( field_id ); if( optionWrap.length ){ jQuery(this).parents('tr').hide(); if( val != '' ){ var index = jQuery(this).find("[value='" + val + "']").index(); var option = optionWrap.find('.nbd-field-content ' + selector).eq( index - 1); }else{ option = optionWrap.find('.nbd-field-content ' + selector).eq(0); } if( option.attr('disabled') == 'disabled'){ var enabledOption = optionWrap.find('.nbd-field-content ' + selector +':enabled').eq(0); if( enabledOption.length ){ enabledIndex = enabledOption.val(); $scope.nbd_fields[field_id].value = enabledIndex; $scope.updateMapOptions(field_id); } } }else{ jQuery(this).show(); } }); $scope.check_valid(); $scope.variations_form_obj.first = false; }; $scope.variations_form.on('bind_calculator', function(){ var $product_variations = $scope.variations_form.data('product_variations'); $scope.variations_form_obj.use_ajax = $product_variations === false; if ( $scope.variations_form_obj.use_ajax && jQuery.fn.block ) { $scope.variations_form.block({message: null, overlayCSS: {background: '#fff', opacity: 0.6}}); } var attribute_keys = {}; $scope.variations_form.find('.variations select').each(function (index, el) { var $current_attr_select = jQuery(el); var current_attribute_name = $current_attr_select.data('attribute_name') || $current_attr_select.attr('name'); attribute_keys[current_attribute_name] = []; var current_options = ''; current_options = $current_attr_select.find('option:gt(0)').get(); if (current_options.length) { for (var i = 0; i 1 ) jQuery(this).parents('tr').remove(); }); el.parents('table.nbo-bulk-variation').find('input.nbo-bulk-checkbox').prop('checked', false); $scope.calculate_bulk_total_price(); }; $scope.init_price_matrix = function(){ $scope.options.pm_num_col = 1; $scope.options.pm_num_row = 1; $scope.options.pm_hoz_field = []; $scope.options.pm_ver_field = []; $scope.options.pm_hoz.forEach(function(field, index){ var field_index = $scope.options.matrix_type == 1 ? field : $scope.get_field_index( field ); $scope.options.pm_num_col *= $scope.fields[field_index].general.attributes.options.length; var colspan = 1; $scope.options.pm_hoz.forEach(function(field, _index){ var field_index = $scope.options.matrix_type == 1 ? field : $scope.get_field_index( field ); if(_index > index) colspan *= $scope.fields[field_index].general.attributes.options.length; }); $scope.options.pm_hoz_field.push({field_id: $scope.fields[field_index].id, colspan: colspan}); }); $scope.options.pm_ver.forEach(function(field, index){ var field_index = $scope.options.matrix_type == 1 ? field : $scope.get_field_index( field ); $scope.options.pm_num_row *= $scope.fields[field_index].general.attributes.options.length; var rowspan = 1; $scope.options.pm_ver.forEach(function(field, _index){ var field_index = $scope.options.matrix_type == 1 ? field : $scope.get_field_index( field ); if(_index > index) rowspan *= $scope.fields[field_index].general.attributes.options.length; }); $scope.options.pm_ver_field.push({field_id: $scope.fields[field_index].id, rowspan: rowspan}); }); var i, j; $scope.options.price_matrix = []; for( i = 0; i -1 || $scope.options.pm_ver.indexOf( field_id ) > -1 ) return; } var origin_field = $scope.get_field(field_id); var factor = null; if( origin_field.general.data_type == 'i' ){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price, origin_field, qty, nbd_fields ); }else{ factor = origin_field.general.price; } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price_breaks[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor = origin_field.general.price_breaks[quantity_break.index]; } } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ factor = $scope.calculate_price_base_measurement(origin_field, field.width, field.height, qty); if( (origin_field.general.price_type == 'f' || origin_field.general.price_type == 'c') && origin_field.general.mesure_base_pages == 'y' ){ if( angular.isDefined(nbOption.odOption.page) ){ var _origin_field = $scope.get_field(nbOption.odOption.page.field_id); if( _origin_field.general.data_type == 'i' ){ factor *= Math.floor( (nbOption.odOption.page.number + 1) / 2 ); } } } } if( origin_field.general.input_type == 'u' && ( angular.isUndefined(field.value) || field.value == "" ) ){ factor = 0; } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' && angular.isDefined(origin_field.general.price_depend_no) && origin_field.general.price_depend_no == 'y' && angular.isDefined(origin_field.general.price_no_range) && origin_field.general.price_no_range.length > 0 ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var current_value = $scope.validate_int( field.value ), default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value = qty ){ factor = range[1]; } }); } }else{ var option = origin_field.general.attributes.options[field.value]; if(option){ var option_price = option.price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[0], origin_field, qty, nbd_fields ); }else{ factor = $scope.validate_float( option_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor = $scope.validate_float( option_price[quantity_break.index] ); } } if( angular.isDefined(option.enable_subattr) && option.enable_subattr == 'on' ){ if(angular.isDefined(option.sub_attributes) && option.sub_attributes.length > 0){ soption_price = option.sub_attributes[field.sub_value].price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[0], origin_field, qty, nbd_fields ); }else{ factor += $scope.validate_float( soption_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor += $scope.validate_float( soption_price[quantity_break.index] ); } } } } } } if( $scope.isMultipleSelectPage( origin_field ) ){ factor = []; angular.forEach(field.values, function(val, v_index){ var option = origin_field.general.attributes.options[val]; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[0], origin_field, qty, nbd_fields ); }else{ factor[v_index] = option.price[0]; } }else{ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor[v_index] = option.price[quantity_break.index]; } } }); field.price = 0; var xfac = 0, _xfac = 0; angular.forEach(factor, function(fac){ fac = $scope.validate_float(fac); var _fac = fac; if( $scope.is_independent_qty( origin_field ) ){ fac = 0; field.ind_qty = true; } if( $scope.is_fixed_amount( origin_field ) ){ fac /= qty; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price += _fac; total_price += fac; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _fac; } break; case 'p': field.price += basePrice * _fac / 100; total_price += basePrice * fac / 100; if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _fac; } break; case 'p+': field.price += fac / 100; field._price += _fac / 100; xfac += fac / 100; _xfac += _fac / 100; field.is_pp = 1; break; } }); if( $scope.is_fixed_amount( origin_field ) ){ field.fixed_amount = true; } field.price_val = field.price * 1; field.price = $scope.convert_to_wc_price( field.price ); if(origin_field.general.price_type == 'p+'){ xfactor *= (1 + xfac / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _xfac / 100); } } }else{ factor = $scope.validate_float(factor) ; field.is_pp = 0; if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.price_type == 'c' ){ origin_field.general.price_type = 'f'; } var _factor = factor; if( $scope.is_independent_qty( origin_field ) ){ factor = 0; field.ind_qty = true; } if( $scope.is_fixed_amount( origin_field ) ){ factor /= qty; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price_val = _factor; field.price = $scope.convert_to_wc_price( _factor ); total_price += factor; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _factor; } break; case 'p': field.price_val = basePrice * _factor / 100; field.price = $scope.convert_to_wc_price( basePrice * _factor / 100 ); total_price += (basePrice * factor / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _factor; } break; case 'p+': field.price = factor / 100; field._price = _factor / 100; xfactor *= (1 + factor / 100); field.is_pp = 1; if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _factor / 100); } break; case 'c': var current_value = $scope.validate_int( field.value ); if( ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page' && origin_field.general.data_type == 'i' ) || ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' ) || ( angular.isDefined(origin_field.nbe_type) && origin_field.nbe_type == 'number_file' ) ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value 0 ? final_price : 0; total_cart_price = final_price * qty; var _total_cart_price = total_cart_price; if( line_price.fixed != 0 || line_price.xfactor != 1 || line_price.percent != 0 ){ if( line_price.fixed != 0 ){ total_cart_price += line_price.fixed; } if( line_price.percent != 0 ){ total_cart_price += (basePrice * line_price.percent / 100); } if( line_price.xfactor != 1 ){ total_cart_price += ( total_cart_price * ( line_price.xfactor - 1 ) ); angular.forEach(nbd_fields, function(field){ if( field.is_pp == 1 && field.ind_qty ){ field.price = $scope.convert_to_wc_price( field._price * total_cart_price / ( field._price + 1 ) ); } }); } cart_item_fee.value = total_cart_price - _total_cart_price; if( cart_item_fee.value > 0 ){ cart_item_fee.enable = true; } cart_item_fee.value = $scope.convert_to_wc_price( cart_item_fee.value ); } if( angular.isUndefined( $scope.turnaround_matrix[key] ) ) $scope.turnaround_matrix[key] = []; var max_qty = $scope.validate_int( op['max_qty'] ), show = false; if( op['max_qty'] == '' || max_qty >= qty ) show = true; $scope.turnaround_matrix[key][okey].show = show; $scope.turnaround_matrix[key][okey].total_cart_price = $scope.convert_to_wc_price( total_cart_price ); $scope.turnaround_matrix[key][okey].final_price = $scope.convert_to_wc_price( final_price, true ); }); }); }; $scope.calculate_price_matrix = function(){ var i, j; var basePrice = $scope.price; if($scope.type == 'variable'){ var variation_id = jQuery('input[name="variation_id"], input.variation_id').val(); basePrice = (variation_id != '' && variation_id != 0 ) ? $scope.variations[variation_id] : basePrice; } basePrice = $scope.convert_wc_price_to_float( basePrice ); var calculate_price = function( _fields, basePrice ){ var total_price = 0, discount_by_qty = 0, qty = 0, cart_item_fee = 0; if( $scope.is_sold_individually == 1 ){ qty = 1; }else{ qty = $scope.validate_int(jQuery('input[name="quantity"]').val()); } var quantity_break = $scope.get_quantity_break(qty); var xfactor = 1, line_price = { fixed: 0, percent: 0, xfactor: 1 }, fixed_amount = 0; angular.forEach(_fields, function(field, field_id){ if( $scope.has_price_matrix && $scope.options.matrix_type == 2 ){ if( $scope.options.pm_hoz.indexOf( field_id ) > -1 || $scope.options.pm_ver.indexOf( field_id ) > -1 ) return; } if( field.enable ){ var origin_field = $scope.get_field( field_id ); var factor = null; if( origin_field.general.data_type == 'i' ){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price, origin_field, qty, _fields ); }else{ factor = origin_field.general.price; } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price_breaks[quantity_break.index], origin_field, qty, _fields ); }else{ factor = origin_field.general.price_breaks[quantity_break.index]; } } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ factor = $scope.calculate_price_base_measurement(origin_field, field.width, field.height, qty); if( (origin_field.general.price_type == 'f' || origin_field.general.price_type == 'c') && origin_field.general.mesure_base_pages == 'y' ){ if( angular.isDefined(nbOption.odOption.page) ){ var _origin_field = $scope.get_field(nbOption.odOption.page.field_id); if( _origin_field.general.data_type == 'i' ){ factor *= Math.floor( (nbOption.odOption.page.number + 1) / 2 ); } } } } if( origin_field.general.input_type == 'u' && ( angular.isUndefined(field.value) || field.value == "" ) ){ factor = 0; } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' && angular.isDefined(origin_field.general.price_depend_no) && origin_field.general.price_depend_no == 'y' && angular.isDefined(origin_field.general.price_no_range) && origin_field.general.price_no_range.length > 0 ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var current_value = $scope.validate_int( field.value ), default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value = qty ){ factor = range[1]; } }); } }else{ var option = origin_field.general.attributes.options[field.value]; if(option){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option.price[0], origin_field, qty, _fields ); }else{ factor = $scope.validate_float( option.price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option.price[quantity_break.index], origin_field, qty, _fields ); }else{ factor = $scope.validate_float( option.price[quantity_break.index] ); } } if( angular.isDefined(option.enable_subattr) && option.enable_subattr == 'on' ){ if(angular.isDefined(option.sub_attributes) && option.sub_attributes.length > 0){ soption_price = option.sub_attributes[field.sub_value].price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[0], origin_field, qty, _fields ); }else{ factor += $scope.validate_float( soption_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[quantity_break.index], origin_field, qty, _fields ); }else{ factor += $scope.validate_float( soption_price[quantity_break.index] ); } } } } } } if( $scope.isMultipleSelectPage( origin_field ) ){ factor = []; angular.forEach(field.values, function(val, v_index){ var option = origin_field.general.attributes.options[val]; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[0], origin_field, qty, _fields ); }else{ factor[v_index] = option.price[0]; } }else{ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[quantity_break.index], origin_field, qty, _fields ); }else{ factor[v_index] = option.price[quantity_break.index]; } } }); field.price = 0; var xfac = 0, _xfac = 0; angular.forEach(factor, function(fac){ fac = $scope.validate_float(fac); var _fac = fac; if( $scope.is_independent_qty( origin_field ) ){ fac = 0; field.ind_qty = true; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price += _fac; if( ! $scope.is_fixed_amount( origin_field ) ) total_price += fac; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _fac; } break; case 'p': field.price += $scope.basePrice * _fac / 100; total_price += $scope.basePrice * fac / 100; if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _fac; } break; case 'p+': field.price += fac / 100; field._price += _fac / 100; xfac += fac / 100; _xfac += _fac / 100; field.is_pp = 1; break; } }); if( $scope.is_fixed_amount( origin_field ) ){ fixed_amount += field.price; field.fixed_amount = true; } field.price_val = field.price * 1; field.price = $scope.convert_to_wc_price( field.price ); if(origin_field.general.price_type == 'p+'){ xfactor *= (1 + xfac / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _xfac / 100); } } }else{ factor = $scope.validate_float(factor); field.is_pp = 0; var _factor = factor; if( $scope.is_independent_qty( origin_field ) ){ factor = 0; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price_val = _factor; field.price = $scope.convert_to_wc_price( _factor ); if( ! $scope.is_fixed_amount( origin_field ) ) total_price += factor; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _factor; } break; case 'p': field.price_val = basePrice * _factor / 100; field.price = $scope.convert_to_wc_price( field.price_val ); total_price += ($scope.basePrice * factor / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _factor; } break; case 'p+': field.price = factor / 100; field._price = _factor / 100; xfactor *= (1 + factor / 100); field.is_pp = 1; if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _factor / 100); } break; case 'c': var current_value = $scope.validate_int( field.value ); if( ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page' && origin_field.general.data_type == 'i' ) || ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' ) || ( angular.isDefined(origin_field.nbe_type) && origin_field.nbe_type == 'number_file' ) ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value 0 ? final_price : 0; var total_cart_price = final_price * qty; if( $scope.options.quantity_discount_type == 'f' ){ total_cart_price += fixed_amount; }else{ total_cart_price += fixed_amount * ( 100 - qty_factor ) / 100; } if( line_price.fixed != 0 || line_price.xfactor != 1 || line_price.percent != 0 ){ var _total_cart_price = total_cart_price; if( line_price.fixed != 0 ){ total_cart_price += line_price.fixed; } if( line_price.percent != 0 ){ total_cart_price += (basePrice * line_price.percent / 100); } if( line_price.xfactor != 1 ){ total_cart_price += ( total_cart_price * ( line_price.xfactor - 1 ) ); } cart_item_fee = total_cart_price - _total_cart_price; return final_price + cart_item_fee; } return final_price; }; var check_depend = function( field_id, pm_fields ){ var field = $scope.get_field(field_id), check = []; pm_fields[field_id].enable = true; if( field.conditional.enable == 'n' ) return true; if( angular.isUndefined(field.conditional.depend) ) return true; if( field.conditional.depend.length == 0 ) return true; var show = field.conditional.show, logic = field.conditional.logic, total_check = logic == 'a' ? true : false; angular.forEach(field.conditional.depend, function(con, key){ if( con.id != '' ){ if( con.id == 'qty' ){ var qty = $scope.validate_int( jQuery('input[name="quantity"]').val() ); if( $scope.is_sold_individually == 1 ){ qty = 1; } con.val = con.val * 1; } switch(con.operator){ case 'i': check[key] = pm_fields[con.id].value == con.val ? true : false; break; case 'n': check[key] = pm_fields[con.id].value != con.val ? true : false; break; case 'e': check[key] = pm_fields[con.id].value == '' ? true : false; break; case 'ne': check[key] = pm_fields[con.id].value != '' ? true : false; break; case 'eq': check[key] = qty == con.val ? true : false; break; case 'gt': check[key] = qty > con.val ? true : false; break; case 'lt': check[key] = qty 0 ){ var new_decimals = decimals * 1; new_decimals += 1; tem = tem.replace(/(\d+\.)(\d+)/, '$1' + new_decimals); } else if( (/\d+\.$/).test( tem ) ) { tem = ( tem.replace("\.", "") * 1 ) + 1; } return tem.replace(/(\.\d*?)0{5,}\d+$/, '$1') * 1; } return num * 1; }; $scope.validate_float = function(input){ var output = parseFloat(input); if( isNaN(output) ) output = 0; return output; }; $scope.get_quantity_break = function( qty ){ var quantity_break = {index: 0, oparator: 'gt'}; var quantity_breaks = []; angular.forEach($scope.options.quantity_breaks, function(_break, key){ quantity_breaks[key] = $scope.validate_int(_break.val); }); angular.forEach(quantity_breaks, function(_break, key){ if( key == 0 && qty = _break && key = _break){ quantity_break = {index: key, oparator: 'gt'}; } }); return quantity_break; }; $scope.calculate_price = function(){ $scope.basePrice = $scope.price; if(this.type == 'variable'){ var variation_id = jQuery('input[name="variation_id"], input.variation_id').val(); $scope.basePrice = (variation_id != '' && variation_id != 0 ) ? $scope.variations[variation_id] : $scope.basePrice; } $scope.basePrice = $scope.convert_wc_price_to_float( $scope.basePrice ); if( $scope.has_price_matrix && $scope.options.matrix_type == 2 ){ var pmi = angular.isDefined( $scope.options.pm_selected ) ? $scope.options.pm_selected[0] : 0, pmj = angular.isDefined( $scope.options.pm_selected ) ? $scope.options.pm_selected[1] : 0; $scope.basePrice = $scope.get_mpm_base_price( pmi, pmj ); } $scope.total_price = 0; $scope.discount_by_qty = 0; $scope.cart_item_fee = { enable: false, value: 0 }; var qty = 0; if( $scope.is_sold_individually == 1 ){ qty = 1; }else{ qty = $scope.validate_int(jQuery('input[name="quantity"]').val()); } $scope._qty = qty; var quantity_break = $scope.get_quantity_break(qty); var xfactor = 1, line_price = { fixed: 0, percent: 0, xfactor: 1 }, fixed_amount = 0; angular.forEach($scope.nbd_fields, function(field, field_id){ if( field.enable ){ if( $scope.has_price_matrix && $scope.options.matrix_type == 2 ){ if( $scope.options.pm_hoz.indexOf( field_id ) > -1 || $scope.options.pm_ver.indexOf( field_id ) > -1 ) return; } var origin_field = $scope.get_field(field_id); var factor = null; if( origin_field.general.data_type == 'i' ){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price, origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor = origin_field.general.price; } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price_breaks[quantity_break.index], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor = origin_field.general.price_breaks[quantity_break.index]; } } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ factor = $scope.calculate_price_base_measurement(origin_field, field.width, field.height, $scope._qty); if( (origin_field.general.price_type == 'f' || origin_field.general.price_type == 'c') && origin_field.general.mesure_base_pages == 'y' ){ if( angular.isDefined(nbOption.odOption.page) ){ var _origin_field = $scope.get_field(nbOption.odOption.page.field_id); if( _origin_field.general.data_type == 'i' ){ factor *= Math.floor( (nbOption.odOption.page.number + 1) / 2 ); }else{ /* factor *= Math.floor( (nbOption.odOption.page.list_page.length + 1) / 2 ); */ } } } } if( origin_field.general.input_type == 'u' && ( angular.isUndefined(field.value) || field.value == "" ) ){ factor = 0; } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' && angular.isDefined(origin_field.general.price_depend_no) && origin_field.general.price_depend_no == 'y' && angular.isDefined(origin_field.general.price_no_range) && origin_field.general.price_no_range.length > 0 ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var current_value = $scope.validate_int( field.value ), default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value = qty ){ factor = range[1]; } }); } }else{ var option = origin_field.general.attributes.options[field.value]; if( option ){ var option_price = option.price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[0], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor = $scope.validate_float( option_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[quantity_break.index], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor = $scope.validate_float( option_price[quantity_break.index] ); } } if( angular.isDefined(option.enable_subattr) && option.enable_subattr == 'on' ){ if(angular.isDefined(option.sub_attributes) && option.sub_attributes.length > 0){ soption_price = option.sub_attributes[field.sub_value].price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[0], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor += $scope.validate_float( soption_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[quantity_break.index], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor += $scope.validate_float( soption_price[quantity_break.index] ); } } } } } } if( $scope.isMultipleSelectPage( origin_field ) ){ factor = []; angular.forEach(field.values, function(val, v_index){ var option = origin_field.general.attributes.options[val]; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[0], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor[v_index] = option.price[0]; } }else{ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[quantity_break.index], origin_field, $scope._qty, $scope.nbd_fields ); }else{ factor[v_index] = option.price[quantity_break.index]; } } }); field.price = 0; var xfac = 0, _xfac = 0; angular.forEach(factor, function(fac){ fac = $scope.validate_float(fac); var _fac = fac; if( $scope.is_independent_qty( origin_field ) ){ fac = 0; field.ind_qty = true; } if( $scope.is_fixed_amount( origin_field ) ){ fac /= qty; } switch(origin_field.general.price_type){ case 'f': field.price += _fac; $scope.total_price += fac; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _fac; } break; case 'p': field.price += $scope.basePrice * _fac / 100; $scope.total_price += $scope.basePrice * fac / 100; if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _fac; } break; case 'p+': field.price += fac / 100; field._price += _fac / 100; xfac += fac / 100; _xfac += _fac / 100; field.is_pp = 1; break; case 'mf': field.price += _fac; $scope.total_price += fac; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _fac; } break; } }); if( $scope.is_fixed_amount( origin_field ) ){ field.fixed_amount = true; } field.price_val = field.price * 1; field.price = $scope.convert_to_wc_price( field.price ); if(origin_field.general.price_type == 'p+'){ xfactor *= (1 + xfac / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _xfac / 100); } } }else{ factor = $scope.validate_float(factor) ; field.is_pp = 0; if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.price_type == 'c' ){ origin_field.general.price_type = 'f'; } var _factor = factor; if( $scope.is_independent_qty( origin_field ) ){ factor = 0; field.ind_qty = true; } if( $scope.is_fixed_amount( origin_field ) ){ factor /= qty; } switch(origin_field.general.price_type){ case 'f': field.price_val = _factor; field.price = $scope.convert_to_wc_price( _factor ); $scope.total_price += factor; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _factor; } break; case 'p': field.price_val = $scope.basePrice * _factor / 100; field.price = $scope.convert_to_wc_price( field.price_val ); $scope.total_price += ($scope.basePrice * factor / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _factor; } break; case 'p+': field.price = factor / 100; field._price = _factor / 100; xfactor *= (1 + factor / 100); field.is_pp = 1; if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _factor / 100); } break; case 'c': var current_value = $scope.validate_int( field.value ); if( ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page' && origin_field.general.data_type == 'i' ) || ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' ) || ( angular.isDefined(origin_field.nbe_type) && origin_field.nbe_type == 'number_file' ) ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value 0 ? $scope.final_price : 0; $scope.total_cart_price = $scope.final_price * qty; if( line_price.fixed != 0 || line_price.xfactor != 1 || line_price.percent != 0 ){ $scope.cart_item_fee.enable = true; var _total_cart_price = $scope.total_cart_price; if( line_price.fixed != 0 ){ $scope.total_cart_price += line_price.fixed; } if( line_price.percent != 0 ){ $scope.total_cart_price += ($scope.basePrice * line_price.percent / 100); } if( line_price.xfactor != 1 ){ $scope.total_cart_price += ( $scope.total_cart_price * ( line_price.xfactor - 1 ) ); angular.forEach($scope.nbd_fields, function(field){ if( field.is_pp == 1 && field.ind_qty ){ field.price = $scope.convert_to_wc_price( field._price * $scope.total_cart_price / ( field._price + 1 ) ); } }); } $scope.cart_item_fee.value = $scope.total_cart_price - _total_cart_price; $scope.cart_item_fee.value = $scope.convert_to_wc_price( $scope.cart_item_fee.value ); } $scope.total_cart_item_price_num = $scope.total_cart_price; $scope.total_cart_price = $scope.convert_to_wc_price( $scope.total_cart_price ); var wrapEl = '#product-' + $scope.product_id + ' .summary'; jQuery(wrapEl + ' .price .amount').html($scope.total_cart_price); jQuery(wrapEl + ' .nbo-base-price-html').html(nbds_frontend.total); jQuery(wrapEl + ' .nbo-base-price-html-var').html(nbds_frontend.total); jQuery('#product-' + $scope.product_id + ' .nbd-design-action-info .price .amount').html($scope.total_cart_price); jQuery('#product-' + $scope.product_id + ' .nbd-design-action-info .nbo-base-price-html').html(nbds_frontend.total); $scope.final_price = $scope.convert_to_wc_price( $scope.final_price, true ); $scope.total_price = $scope.convert_to_wc_price( $scope.total_price, true ); $scope.discount_by_qty = $scope.convert_to_wc_price( $scope.discount_by_qty, true ); }; $scope.calculate_bulk_total_price = function(){ var nbb_fields_arr = [], bulk_total_price = 0; var basePrice = $scope.price; if(this.type == 'variable'){ var variation_id = jQuery('input[name="variation_id"], input.variation_id').val(); basePrice = (variation_id != '' && variation_id != 0 ) ? $scope.variations[variation_id] : basePrice; } basePrice = $scope.convert_wc_price_to_float( basePrice ); var bulk_fields = {}; angular.forEach($scope.bulk_fields, function(field, index){ var elements = jQuery('[name="nbb-fields[' + field.id + '][]"]'); bulk_fields[field.id] = []; jQuery.each( elements, function(_index, el){ var val = jQuery(el).val(); bulk_fields[field.id].push({ value: val, value_name: field.general.attributes.options[val].name, enable: true }); }); }); jQuery.each( jQuery('[name="nbb-qty-fields[]"]'), function( index, qtyEl ){ var nbb_fields = {}; angular.copy($scope.nbd_fields, nbb_fields); angular.forEach(bulk_fields, function(field, field_id){ nbb_fields[field_id] = field[index]; }); nbb_fields_arr.push( nbb_fields ); }); jQuery.each( jQuery('[name="nbb-qty-fields[]"]'), function( index, qtyEl ){ var qty = $scope.validate_int( jQuery(qtyEl).val() ); if( qty > 0 ){ var total_price = 0, discount_by_qty = 0, xfactor = 1, quantity_break = $scope.get_quantity_break( qty ), cart_item_fee = {enable: false}, line_price = { fixed: 0, percent: 0, xfactor: 1 }, fixed_amount = 0; angular.forEach(nbb_fields_arr[index], function(field, field_id){ if(field.enable){ var origin_field = $scope.get_field(field_id); var factor = null; if( origin_field.general.data_type == 'i' ){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price, origin_field, qty, nbb_fields_arr[index] ); }else{ factor = origin_field.general.price; } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price_breaks[quantity_break.index], origin_field, qty, nbb_fields_arr[index] ); }else{ factor = origin_field.general.price_breaks[quantity_break.index]; } } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ factor = $scope.calculate_price_base_measurement(origin_field, field.width, field.height, qty); if( (origin_field.general.price_type == 'f' || origin_field.general.price_type == 'c') && origin_field.general.mesure_base_pages == 'y' ){ if( angular.isDefined(nbOption.odOption.page) ){ var _origin_field = $scope.get_field(nbOption.odOption.page.field_id); if( _origin_field.general.data_type == 'i' ){ factor *= Math.floor( (nbOption.odOption.page.number + 1) / 2 ); } } } } if( origin_field.general.input_type == 'u' && ( angular.isUndefined(field.value) || field.value == "" ) ){ factor = 0; } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' && angular.isDefined(origin_field.general.price_depend_no) && origin_field.general.price_depend_no == 'y' && angular.isDefined(origin_field.general.price_no_range) && origin_field.general.price_no_range.length > 0 ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var current_value = $scope.validate_int( field.value ), default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value = qty ){ factor = range[1]; } }); } }else{ var option = origin_field.general.attributes.options[field.value]; if(option){ var option_price = option.price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[0], origin_field, qty, nbb_fields_arr[index] ); }else{ factor = $scope.validate_float( option_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[quantity_break.index], origin_field, qty, nbb_fields_arr[index] ); }else{ factor = $scope.validate_float( option_price[quantity_break.index] ); } } if( angular.isDefined(option.enable_subattr) && option.enable_subattr == 'on' ){ if(angular.isDefined(option.sub_attributes) && option.sub_attributes.length > 0){ soption_price = option.sub_attributes[field.sub_value].price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[0], origin_field, qty, nbb_fields_arr[index] ); }else{ factor += $scope.validate_float( soption_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[quantity_break.index], origin_field, qty, nbb_fields_arr[index] ); }else{ factor += $scope.validate_float( soption_price[quantity_break.index] ); } } } } } } if( $scope.isMultipleSelectPage( origin_field ) ){ factor = []; angular.forEach(field.values, function(val, v_index){ var option = origin_field.general.attributes.options[val]; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[0], origin_field, qty, nbb_fields_arr[index] ); }else{ factor[v_index] = option.price[0]; } }else{ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[quantity_break.index], origin_field, qty, nbb_fields_arr[index] ); }else{ factor[v_index] = option.price[quantity_break.index]; } } }); field.price = 0; var xfac = 0, _xfac = 0; angular.forEach(factor, function(fac){ fac = $scope.validate_float(fac); var _fac = fac; if( $scope.is_independent_qty( origin_field ) ){ fac = 0; field.ind_qty = true; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price += _fac; if( ! $scope.is_fixed_amount( origin_field ) ) total_price += fac; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _fac; } break; case 'p': field.price += basePrice * _fac / 100; total_price += basePrice * fac / 100; if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _fac; } break; case 'p+': field.price += fac / 100; field._price += _fac / 100; xfac += fac / 100; _xfac += _fac / 100; field.is_pp = 1; break; } }); if( $scope.is_fixed_amount( origin_field ) ){ fixed_amount += field.price; field.fixed_amount = true; } field.price_val = field.price * 1; field.price = $scope.convert_to_wc_price( field.price ); if(origin_field.general.price_type == 'p+'){ xfactor *= (1 + xfac / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _xfac / 100); } } }else{ factor = $scope.validate_float(factor) ; field.is_pp = 0; if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.price_type == 'c' ){ origin_field.general.price_type = 'f'; } var _factor = factor; if( $scope.is_independent_qty( origin_field ) ){ factor = 0; field.ind_qty = true; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price_val = _factor; field.price = $scope.convert_to_wc_price( _factor ); if( ! $scope.is_fixed_amount( origin_field ) ) total_price += factor; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _factor; } break; case 'p': field.price_val = basePrice * _factor / 100; field.price = $scope.convert_to_wc_price( field.price_val ); total_price += (basePrice * factor / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _factor; } break; case 'p+': field.price = factor / 100; field._price = _factor / 100; xfactor *= (1 + factor / 100); field.is_pp = 1; if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _factor / 100); } break; case 'c': var current_value = $scope.validate_int( field.value ); if( ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page' && origin_field.general.data_type == 'i' ) || ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' ) || ( angular.isDefined(origin_field.nbe_type) && origin_field.nbe_type == 'number_file' ) ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value 0 ? final_price : 0; total_cart_price = final_price * qty; var _total_cart_price = total_cart_price; if( line_price.fixed != 0 || line_price.xfactor != 1 || line_price.percent != 0 || fixed_amount > 0 ){ if( line_price.fixed != 0 ){ total_cart_price += line_price.fixed; } if( line_price.percent != 0 ){ total_cart_price += (basePrice * line_price.percent / 100); } if( line_price.xfactor != 1 ){ total_cart_price += ( total_cart_price * ( line_price.xfactor - 1 ) ); angular.forEach(nbb_fields_arr[index], function(field){ if( field.is_pp == 1 && field.ind_qty ){ field.price = $scope.convert_to_wc_price( field._price * total_cart_price / ( field._price + 1 ) ); } }); } cart_item_fee.value = total_cart_price - _total_cart_price; if( cart_item_fee.value > 0 ){ cart_item_fee.enable = true; } cart_item_fee.value = $scope.convert_to_wc_price( cart_item_fee.value ); } if( $scope.options.quantity_discount_type == 'f' ){ total_cart_price += fixed_amount; }else{ total_cart_price += fixed_amount * ( 100 - qty_factor ) / 100; } bulk_total_price += total_cart_price; } }); bulk_total_price = bulk_total_price > 0 ? bulk_total_price : 0; $scope.total_cart_item_price_num = bulk_total_price; var bulk_total_price_html = $scope.convert_to_wc_price( bulk_total_price ); var wrapEl = '#product-' + $scope.product_id + ' .summary'; jQuery(wrapEl + ' .price .amount').html(bulk_total_price_html); jQuery(wrapEl + ' .nbo-base-price-html').html(nbds_frontend.total); jQuery('#product-' + $scope.product_id + ' .nbd-design-action-info .price .amount').html(bulk_total_price_html); jQuery('#product-' + $scope.product_id + ' .nbd-design-action-info .nbo-base-price-html').html(nbds_frontend.total); }; $scope.calculate_price_table2 = function(){ $scope.price_table = []; var basePrice = $scope.price; if(this.type == 'variable'){ var variation_id = jQuery('input[name="variation_id"], input.variation_id').val(); basePrice = (variation_id != '' && variation_id != 0 ) ? $scope.variations[variation_id] : basePrice; } basePrice = $scope.convert_wc_price_to_float( basePrice ); if( $scope.has_price_matrix && $scope.options.matrix_type == 2 ){ var pmi = angular.isDefined( $scope.options.pm_selected ) ? $scope.options.pm_selected[0] : 0, pmj = angular.isDefined( $scope.options.pm_selected ) ? $scope.options.pm_selected[1] : 0; basePrice = $scope.get_mpm_base_price( pmi, pmj ); } var missing_one = true; angular.forEach($scope.options.quantity_breaks, function(_break, key){ if( _break.val == '1' ) missing_one = false; }); var quantity_breaks = []; angular.copy($scope.options.quantity_breaks, quantity_breaks); if( missing_one ){ quantity_breaks.unshift({val: 1, dis: 0}); } angular.forEach(quantity_breaks, function(_break, key){ var qty = $scope.validate_int(_break.val), nbd_fields = {}, total_price = 0, discount_by_qty = 0, xfactor = 1, quantity_break = $scope.get_quantity_break( qty ), cart_item_fee = {enable: false}, line_price = { fixed: 0, percent: 0, xfactor: 1 }, fixed_amount = 0; angular.copy($scope.nbd_fields, nbd_fields); angular.forEach(nbd_fields, function(field, field_id){ if( field.enable ){ if( $scope.has_price_matrix && $scope.options.matrix_type == 2 ){ if( $scope.options.pm_hoz.indexOf( field_id ) > -1 || $scope.options.pm_ver.indexOf( field_id ) > -1 ) return; } var origin_field = $scope.get_field(field_id); var factor = null; if( origin_field.general.data_type == 'i' ){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price, origin_field, qty, nbd_fields ); }else{ factor = origin_field.general.price; } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price_breaks[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor = origin_field.general.price_breaks[quantity_break.index]; } } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ factor = $scope.calculate_price_base_measurement(origin_field, field.width, field.height, qty); if( (origin_field.general.price_type == 'f' || origin_field.general.price_type == 'c') && origin_field.general.mesure_base_pages == 'y' ){ if( angular.isDefined(nbOption.odOption.page) ){ var _origin_field = $scope.get_field(nbOption.odOption.page.field_id); if( _origin_field.general.data_type == 'i' ){ factor *= Math.floor( (nbOption.odOption.page.number + 1) / 2 ); }else{ /* factor *= Math.floor( (nbOption.odOption.page.list_page.length + 1) / 2 ); */ } } } } if( origin_field.general.input_type == 'u' && ( angular.isUndefined(field.value) || field.value == "" ) ){ factor = 0; } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' && angular.isDefined(origin_field.general.price_depend_no) && origin_field.general.price_depend_no == 'y' && angular.isDefined(origin_field.general.price_no_range) && origin_field.general.price_no_range.length > 0 ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var current_value = $scope.validate_int( field.value ), default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value = qty ){ factor = range[1]; } }); } }else{ var option = origin_field.general.attributes.options[field.value]; if(option){ var option_price = option.price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[0], origin_field, qty, nbd_fields ); }else{ factor = $scope.validate_float( option_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option_price[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor = $scope.validate_float( option_price[quantity_break.index] ); } } if( angular.isDefined(option.enable_subattr) && option.enable_subattr == 'on' ){ if(angular.isDefined(option.sub_attributes) && option.sub_attributes.length > 0){ soption_price = option.sub_attributes[field.sub_value].price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[0], origin_field, qty, nbd_fields ); }else{ factor += $scope.validate_float( soption_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor += $scope.validate_float( soption_price[quantity_break.index] ); } } } } } } if( $scope.isMultipleSelectPage( origin_field ) ){ factor = []; angular.forEach(field.values, function(val, v_index){ var option = origin_field.general.attributes.options[val]; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[0], origin_field, qty, nbd_fields ); }else{ factor[v_index] = option.price[0]; } }else{ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[quantity_break.index], origin_field, qty, nbd_fields ); }else{ factor[v_index] = option.price[quantity_break.index]; } } }); field.price = 0; var xfac = 0, _xfac = 0; angular.forEach(factor, function(fac){ fac = $scope.validate_float(fac); var _fac = fac; if( $scope.is_independent_qty( origin_field ) ){ fac = 0; field.ind_qty = true; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price += _fac; if( ! $scope.is_fixed_amount( origin_field ) ) total_price += fac; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _fac; } break; case 'p': field.price += basePrice * _fac / 100; total_price += basePrice * fac / 100; if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _fac; } break; case 'p+': field.price += fac / 100; field._price += _fac / 100; xfac += fac / 100; _xfac += _fac / 100; field.is_pp = 1; break; } }); if( $scope.is_fixed_amount( origin_field ) ){ fixed_amount += field.price; field.fixed_amount = true; } field.price_val = field.price * 1; field.price = $scope.convert_to_wc_price( field.price ); if(origin_field.general.price_type == 'p+'){ xfactor *= (1 + xfac / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _xfac / 100); } } }else{ factor = $scope.validate_float(factor) ; field.is_pp = 0; if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.price_type == 'c' ){ origin_field.general.price_type = 'f'; } var _factor = factor; if( $scope.is_independent_qty( origin_field ) ){ factor = 0; field.ind_qty = true; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price_val = _factor; field.price = $scope.convert_to_wc_price( _factor ); if( ! $scope.is_fixed_amount( origin_field ) ) total_price += factor; if( $scope.is_independent_qty( origin_field ) ){ line_price.fixed += _factor; } break; case 'p': field.price_val = basePrice * _factor / 100; field.price = $scope.convert_to_wc_price( basePrice * _factor / 100 ); total_price += (basePrice * factor / 100); if( $scope.is_independent_qty( origin_field ) ){ line_price.percent += _factor; } break; case 'p+': field.price = factor / 100; field._price = _factor / 100; xfactor *= (1 + factor / 100); field.is_pp = 1; if( $scope.is_independent_qty( origin_field ) ){ line_price.xfactor *= (1 + _factor / 100); } break; case 'c': var current_value = $scope.validate_int( field.value ); if( ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page' && origin_field.general.data_type == 'i' ) || ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' ) || ( angular.isDefined(origin_field.nbe_type) && origin_field.nbe_type == 'number_file' ) ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value 0 ? final_price : 0; total_cart_price = final_price * qty; var _total_cart_price = total_cart_price; if( line_price.fixed != 0 || line_price.xfactor != 1 || line_price.percent != 0 || fixed_amount > 0 ){ if( line_price.fixed != 0 ){ total_cart_price += line_price.fixed; } if( line_price.percent != 0 ){ total_cart_price += (basePrice * line_price.percent / 100); } if( line_price.xfactor != 1 ){ total_cart_price += ( total_cart_price * ( line_price.xfactor - 1 ) ); angular.forEach(nbd_fields, function(field){ if( field.is_pp == 1 && field.ind_qty ){ field.price = $scope.convert_to_wc_price( field._price * total_cart_price / ( field._price + 1 ) ); } }); } cart_item_fee.value = total_cart_price - _total_cart_price + fixed_amount; if( cart_item_fee.value > 0 ){ cart_item_fee.enable = true; } cart_item_fee.value = $scope.convert_to_wc_price( cart_item_fee.value ); } if( $scope.options.quantity_discount_type == 'f' ){ total_cart_price += fixed_amount; }else{ total_cart_price += fixed_amount * ( 100 - qty_factor ) / 100; } $scope.price_table[key] = { qty: qty, cart_item_fee: cart_item_fee, total_cart_price: $scope.convert_to_wc_price( total_cart_price ), _total_cart_price: $scope.convert_to_wc_price( _total_cart_price ), final_price_val: final_price, final_price: $scope.convert_to_wc_price( final_price, true ) }; }); $scope.price_table_cart_fee = false; var _first = $scope.price_table[0]; angular.forEach($scope.price_table, function(pt, key){ if( angular.isDefined( pt.cart_item_fee.enable ) && pt.cart_item_fee.enable ){ $scope.price_table_cart_fee = true; } if( pt.final_price_val.toFixed != 0 ){ pt.klass = ((pt.final_price_val - _first.final_price_val) > 0 ) ? 'nbo-inc' : ( ((pt.final_price_val - _first.final_price_val) 1 ) { pt = {}; pt.from = 1; pt.up = _break - 1; pt.quantity_break = {index: 0, oparator: 'lt'}; $scope.price_table.push(pt); } if( key > 0 && key = pt.from && ( _qty -1 || $scope.options.pm_ver.indexOf( field_id ) > -1 ) return; } var origin_field = $scope.get_field(field_id); var factor = null; if( origin_field.general.data_type == 'i' ){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price, origin_field, pt.from, pt.nbd_fields ); }else{ factor = origin_field.general.price; } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( origin_field.general.price_breaks[pt.quantity_break.index], origin_field, pt.from, pt.nbd_fields ); }else{ factor = origin_field.general.price_breaks[pt.quantity_break.index]; } } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ factor = $scope.calculate_price_base_measurement(origin_field, field.width, field.height, pt.from); if( (origin_field.general.price_type == 'f' || origin_field.general.price_type == 'c') && origin_field.general.mesure_base_pages == 'y' ){ if( angular.isDefined(nbOption.odOption.page) ){ factor *= Math.floor( (nbOption.odOption.page.number + 1) / 2 ); } } } if( origin_field.general.input_type == 'u' && ( angular.isUndefined(field.value) || field.value == "" ) ){ factor = 0; } if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' && angular.isDefined(origin_field.general.price_depend_no) && origin_field.general.price_depend_no == 'y' && angular.isDefined(origin_field.general.price_no_range) && origin_field.general.price_no_range.length > 0 ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var current_value = $scope.validate_int( field.value ), default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value = qty ){ factor = range[1]; } }); } }else{ var option = origin_field.general.attributes.options[field.value]; if(option){ if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option.price[0], origin_field, pt.from, pt.nbd_fields ); }else{ factor = $scope.validate_float( option.price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor = $scope.eval_price( option.price[pt.quantity_break.index], origin_field, pt.from, pt.nbd_fields ); }else{ factor = $scope.validate_float( option.price[pt.quantity_break.index] ); } } if( angular.isDefined(option.enable_subattr) && option.enable_subattr == 'on' ){ if(angular.isDefined(option.sub_attributes) && option.sub_attributes.length > 0){ soption_price = option.sub_attributes[field.sub_value].price; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[0], origin_field, pt.from, pt.nbd_fields ); }else{ factor += $scope.validate_float( soption_price[0] ); } }else{ if( origin_field.general.price_type == 'mf' ){ factor += $scope.eval_price( soption_price[pt.quantity_break.index], origin_field, pt.from, pt.nbd_fields ); }else{ factor += $scope.validate_float( soption_price[pt.quantity_break.index] ); } } } } } } if( $scope.isMultipleSelectPage( origin_field ) ){ factor = []; angular.forEach(field.values, function(val, v_index){ var option = origin_field.general.attributes.options[val]; if(origin_field.general.depend_quantity == 'n'){ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[0], origin_field, pt.from, pt.nbd_fields ); }else{ factor[v_index] = option.price[0]; } }else{ if( origin_field.general.price_type == 'mf' ){ factor[v_index] = $scope.eval_price( option.price[pt.quantity_break.index], origin_field, pt.from, pt.nbd_fields ); }else{ factor[v_index] = option.price[pt.quantity_break.index]; } } }); field.price = 0; var xfac = 0; angular.forEach(factor, function(fac){ fac = $scope.validate_float(fac); var _fac = fac; if( $scope.is_independent_qty( origin_field ) ){ fac = 0; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price += _fac; if( ! $scope.is_fixed_amount( origin_field ) ) pt.total_price += fac; break; case 'p': field.price += $scope.basePrice * _fac / 100; pt.total_price += $scope.basePrice * fac / 100; break; case 'p+': field.price += fac / 100; xfac += fac / 100; field.is_pp = 1; break; } }); if( $scope.is_fixed_amount( origin_field ) ){ fixed_amount += field.price; field.fixed_amount = true; } field.price_val = field.price * 1; field.price = $scope.convert_to_wc_price( field.price ); if(origin_field.general.price_type == 'p+'){ xfactor *= (1 + xfac / 100); } }else{ factor = $scope.validate_float(factor) ; field.is_pp = 0; if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.price_type == 'c' ){ origin_field.general.price_type = 'f'; } var _factor = factor; if( $scope.is_independent_qty( origin_field ) ){ factor = 0; } switch(origin_field.general.price_type){ case 'f': case 'mf': field.price_val = _factor; field.price = $scope.convert_to_wc_price( _factor ); if( ! $scope.is_fixed_amount( origin_field ) ) pt.total_price += factor; break; case 'p': field.price_val = $scope.basePrice * _factor / 100; field.price = $scope.convert_to_wc_price(field.price_val ); pt.total_price += ($scope.basePrice * factor / 100); break; case 'p+': field.price = factor / 100; xfactor *= (1 + factor / 100); field.is_pp = 1; break; case 'c': var current_value = $scope.validate_int( field.value ); if( ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page' && origin_field.general.data_type == 'i' ) || ( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'page1' ) || ( angular.isDefined(origin_field.nbe_type) && origin_field.nbe_type == 'number_file' ) ){ if( angular.isUndefined( origin_field.general.input_option.default ) || origin_field.general.input_option.default == '' ){ origin_field.general.input_option.default = 0; } var default_val = $scope.validate_int( origin_field.general.input_option.default ); current_value = current_value - default_val; if( current_value 0 ? pt.final_price : 0; pt.final_price = $scope.convert_to_wc_price( pt.final_price, true ); pt.total_price = $scope.convert_to_wc_price( pt.total_price, true ); pt.discount_by_qty = $scope.convert_to_wc_price( pt.discount_by_qty, true ); }); }; $scope.is_independent_qty = function( field ){ if( angular.isDefined( field.general.depend_qty ) && field.general.depend_qty == 'n' ){ return true; }else{ return false; } }; $scope.is_fixed_amount = function( field ){ if( angular.isDefined( field.general.depend_qty ) && field.general.depend_qty == 'n2' ){ return true; }else{ return false; } }; $scope.isMultipleSelectPage = function(field){ if( angular.isDefined(field.nbd_type) && ( field.nbd_type == 'page' || field.nbd_type == 'page2' ) && field.general.data_type == 'm' ){ return true; } return false; }; $scope.calculate_price_base_measurement = function(origin_field, width, height, qty){ var mesure_range = origin_field.general.mesure_range; var area = $scope.validate_float( width ) * $scope.validate_float( height ), _area = area; if( angular.isDefined( origin_field.general.mesure_base_qty ) && origin_field.general.mesure_base_qty == 'y' ){ area *= qty; } var price_per_unit = 0, start_range = 0, end_range = 0, price_range = 0; angular.forEach(mesure_range, function(range, key){ start_range = $scope.validate_float(range[0]); end_range = $scope.validate_float(range[1]); price_range = $scope.validate_float(range[2]); if( start_range end_range ){ price_per_unit = price_range; } }); if( angular.isDefined( origin_field.general.mesure_type ) && origin_field.general.mesure_type == 'r' ) return price_per_unit; return price_per_unit * _area; }; $scope.calculate_product_area = function(){ var area = 0, hasDim = false; angular.forEach($scope.nbd_fields, function(field, field_id){ if( field.enable ){ var origin_field = $scope.get_field( field_id ); if( origin_field.general.data_type == 'i' ){ if( angular.isDefined(origin_field.nbd_type) && origin_field.nbd_type == 'dimension' && origin_field.general.mesure == 'y' && angular.isDefined(origin_field.general.mesure_range) && origin_field.general.mesure_range.length > 0 ){ area = $scope.validate_float( field.width ) * $scope.validate_float( field.height ); hasDim = true; } } } }); if( !hasDim ){ if( $scope.type == 'variable' ){ var variation_id = jQuery('input[name="variation_id"], input.variation_id').val(), width = $scope.dimensions[variation_id].width, height = $scope.dimensions[variation_id].height; }else{ width = $scope.width; height = $scope.height; } area = $scope.validate_float( width ) * $scope.validate_float( height ); } return area; }; $scope.eval_price = function( formula, origin_field, qty, fields ){ if( !formula ) return 0; var price = 0, area = $scope.calculate_product_area(); formula = formula.replace(/{quantity}/g, qty); formula = formula.replace(/{price}/g, $scope.basePrice); formula = formula.replace(/{area}/g, area); formula = formula.replace(/{this.value}/g, fields[origin_field.id].value); formula = formula.replace(/{this.value_length}/g, fields[origin_field.id].value.length); if (formula.match(/\{(\s)*?field\.([^}]*)}/)) { var matches = formula.match(/\{(\s)*?field\.([^}]*)}/g), pos, reg, field_id, type, val; matches.forEach(function (field) { match = field.match(/\{(\s)*?field\.([^}]*)}/); if (undefined !== match[2] && "string" == typeof match[2]) { pos = match[2].lastIndexOf("."); val = 0; if ( pos !== -1 ) { field_id = match[2].substr(0, pos); type = match[2].substr(pos + 1); switch (type) { case 'price': val = angular.isDefined( fields[field_id].price_val ) ? fields[field_id].price_val : 0; break; case 'value': val = fields[field_id].value; break; case 'value_length': val = fields[field_id].value.length; break; case 'implicit_value': var _origin_field = $scope.get_field( field_id ); if( _origin_field.general.data_type == 'm' ){ var field_value = fields[field_id].value; var option = _origin_field.general.attributes.options[field_value]; if( option && angular.isDefined( option.implicit_value ) ){ val = option.implicit_value; } } break; case 'sub_implicit_value': var _origin_field = $scope.get_field( field_id ); if( _origin_field.general.data_type == 'm' ){ var field_value = fields[field_id].value; var option = _origin_field.general.attributes.options[field_value]; if( option ){ if( angular.isDefined( option.enable_subattr ) && option.enable_subattr == 'on' && angular.isDefined( option.sub_attributes ) && option.sub_attributes.length > 0 ){ var sub_field_value = fields[field_id].sub_value; var sub_option = option.sub_attributes[sub_field_value]; if( sub_option && angular.isDefined( sub_option.implicit_value ) ){ val = sub_option.implicit_value; } } } } break; } } reg = new RegExp(match[0]); formula = formula.replace(reg, val + ''); } }); } try { price = mexp.eval(formula); } catch (e) { price = 0; } return price; }; $scope.toggle_group = function( $event ){ jQuery($event.target).parents( '.nbo-group-body' ).toggleClass('nbo-collapse'); jQuery($event.target).parents( '.nbo-group-type2-wrap' ).toggleClass('nbo-collapse'); }; $scope.toggle_float_summary = function(){ jQuery( '.nbo-float-summary' ).toggleClass('nbo-collapse'); }; $scope.toggle_field = function( $event ){ jQuery($event.target).parents( '.nbd-option-field' ).toggleClass('nbo-collapse'); }; $scope.select_adv_attr = function( field_id, attr_index ){ $scope.nbd_fields[field_id].value = attr_index; $scope.check_valid(); }; $scope.select_adv_subattr = function( field_id, attr_index, subattr_index ){ $scope.nbd_fields[field_id].value = attr_index; $scope.nbd_fields[field_id].sub_value = subattr_index; $scope.check_valid(); }; $scope.changeGroupPanel = function( $event, command ){ $timeout(function(){ var wrapper = jQuery( '#' + nbOption.crtlId ).find('.nbo-fields-wrapper'); if( command == 'prev' ){ if( $scope.current_group_panel > 0 ) $scope.current_group_panel--; }else if( command == 'next' ){ if( $scope.current_group_panel = 0 && command containerWidth ){ $scope.totalGroupPage++; $timeout(function(){ containerWidth = timelineCon.innerWidth(), timelineWidth = timelineLine.outerWidth(); $scope.totalGroupPage = Math.ceil( timelineWidth / containerWidth ); $scope.changeGroupPage( null, 0 ); }); }else{ $scope.changeGroupPage( null, 0 ); } }); }; $scope.changeGroupPage = function( $event, command ){ if( command == 'prev' ){ if( $scope.currentGroupPage > 0 ) $scope.currentGroupPage--; }else if( command == 'next' ){ if( $scope.currentGroupPage = 0 && command file.size ){ alert("Sorry, file is too small, min size: " + scope.minsize + 'MB'); resetInput(); } } if( scope.types != '' ){ var types = scope.types.replace(/ /g,'').split(','), filetype = file.type.toLowerCase(), checType = false; filetype = ''; filetype = filetype != '' ? filetype : file.name.substring(file.name.lastIndexOf('.')+1).toLowerCase(); angular.forEach(types, function(type){ if( filetype.indexOf(type) > -1 ){ checType = true; } }); if( !checType ){ alert("Sorry, this file type is not permitted for security reasons. Only accept: " + scope.types); resetInput(); } } } } if( element[0].files[0] ){ ctrl.$setViewValue(element[0].files[0]); }else{ ctrl.$setViewValue( '' ); } jQuery(element).parent('.nbd-field-content').find('.nbd-upload-hidden').remove(); scope.fileChange(); } } }; }).directive( 'nboDisabled', function($timeout) { return { restrict: 'A', scope: { nboDisabled: '=', nboDisabledType: '@' }, link: function( scope, element, attrs ) { function updateStatus(){ if( scope.nboDisabled ){ if( scope.nboDisabledType == 'attr' ){ jQuery(element).attr( 'disabled', true ); }else{ jQuery(element).addClass( 'nbo-disabled-wrap' ); } }else{ if( scope.nboDisabledType == 'attr' ){ jQuery(element).removeAttr( 'disabled' ); }else{ jQuery(element).removeClass( 'nbo-disabled-wrap' ); } } }; $timeout(function() { updateStatus(); }); scope.$watch('nboDisabled', function(newValue, oldValue){ if( newValue != oldValue ){ $timeout(function() { updateStatus(); }); } }, true) } }; }).filter('to_trusted', ['$sce', function($sce){ return function(text) { var div = document.createElement('div'); text += ''; div.innerHTML = text; return $sce.trustAsHtml(div.textContent); }; }]).filter('svg_trusted', ['$sce', function($sce){ return function(text) { return $sce.trustAsHtml(text); }; }]).filter('updateDimension', [function(){ return function(val, args) { var validate_float = function(input){ var output = parseFloat(input); if( isNaN(output) ) output = 0; return output; } if( args.curr ){ current_val = validate_float( args.curr ), min_val = validate_float( args.min ), max_val = validate_float( args.max ); current_val = ( current_val max_val ) ? max_val : current_val; }else{ current_val = val; } var _scope = angular.element(document.getElementById(nbOption.crtlId)).scope(); setTimeout(function(){ _scope.update_dimensionvalue(args.fid, 'width'); setTimeout(function(){ _scope.check_valid(); } , 300); }, 100); return current_val; }; }]); var appEl = document.getElementById('nbo-app-1630316606714'); angular.element(function() { angular.bootstrap(appEl, ['nboApp']); }); jQuery(document).on( 'update_nbo_options_from_builder', function(e, data){ var $scope = angular.element(document.getElementById(nbOption.crtlId)).scope(); angular.forEach(data.nbd_fields, function(nbd_field, field_id){ $scope.nbd_fields[field_id].value = nbd_field.value; $scope.nbd_fields[field_id].sub_value = nbd_field.sub_value; }); $scope.check_valid( true, true ); }); jQuery(document).on( 'update_product_image_from_builder', function(e, data){ var $scope = angular.element(document.getElementById(nbOption.crtlId)).scope(); $scope.change_product_image_without_field( data ); }); jQuery(document).on( 'update_nbo_options_from_advenced_upload', function(e, data){ var $scope = angular.element(document.getElementById(nbOption.crtlId)).scope(); angular.forEach(data.options, function(option){ $scope.nbd_fields[option.field_id].value = option.value; }); $scope.check_valid( true, true ); });

Crea subito!

×

Descrizione

Espositore telescopico che permette la realizzazione di molteplici dimensioni della tua stampa, fino ad un massimo di 180×320 cm.
Disponibile con il servizio di stampa incluso:
Stampa in quadrimonia su PVC

Recensioni

Ancora non ci sono recensioni.

Recensisci per primo “Fondale telescopico”

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

{{frontendLayout.unreadMsg}}
Ciao 👋👋. Come possiamo aiutarti?
Team Print-Station.it
{{status.activeMod > 0 ? 'Online' : 'Offline'}}
Help Center
Chiedici qualsiasi cosa, ti risponderemo al pià presto.
{{mod.name}}
Ciao! Come possiamo aiutarti?
 
{{message.time}}
Scrivici su WhatsApp! Avvia una conversazione utilizzando il pulsante sottostante e proveremo a rispondere il prima possibile.
Apri WhatsApp
E' stato utile?
😃 😞
{{status.partner_name}} is typing{{status.typing_hellip}}
{{cat.name}}
{{icon.char}}
Formato email non valido
Email send successfully
Send