'); } // IFRAME Commands To // Blog $('.cmd-button').click(function(e){ e.stopImmediatePropagation(); e.preventDefault(); var _this = $(this); var _cmd = _this.data('cmd'); // if ( $('.ss-blog').length > 0 ) { // $('.ss-blog').each(function(bi,bv){ // if ( _cmd === 'blogcmd:menu' ) { // $(bv).find('iframe').get(0).contentWindow.postMessage({ 'wid': ' echo $widget_id; ', 'function': 'cmd_menu' },'http://prosoftwareuk.co.uk/' ); // } else if ( _cmd === 'blogcmd:prev' ) { // $(bv).find('iframe').get(0).contentWindow.postMessage({ 'wid': ' echo $widget_id; ', 'function': 'cmd_back' },'http://prosoftwareuk.co.uk/' ); // } else if ( _cmd === 'blogcmd:next' ) { // $(bv).find('iframe').get(0).contentWindow.postMessage({ 'wid': ' echo $widget_id; ', 'function': 'cmd_next' },'http://prosoftwareuk.co.uk/' ); // } // }); // } }); $('body').on('submit','.ss-blog #comment-form',function(e){ e.stopImmediatePropagation(); e.preventDefault(); var _this = $(this); var widgetID = _this.closest('ss-object').prop('id'); var tplID = parseInt( $('body').prop('id').replace('tpl-','') ); $.ajax({ url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', crossDomain: true, type: 'post', data: { 'obj': { 'cmd': 'blog_comment', 'name': _this.find('[name="name"]').val(), 'email': _this.find('[name="email"]').val(), 'comment': _this.find('[name="comment"]').val(), 'blogid': _this.find('[name="blogid"]').val(), 'userid': _this.find('[name="userid"]').val(), 'widgetid': widgetID, 'tplid': tplID, 'apikey': _this.find('[name="apikey"]').val() } }, success: function(data){ var dataJSON = JSON.parse(data); // $('.content-area').prepend(function(){ // if ( dataJSON.ok ) { // _this.find('.btn-warning').remove(); // '; // return wTPL.blog.msg.ajaxMSG(dataJSON.msg); // } else { // return wTPL.blog.msg.ajaxMSGError(dataJSON.msg); // } // }()); // removeLoadStatus(); // resize_page(); setTimeout(function(){ window.location.reload(); //$('#'+widgetID+' .content-area .alert').remove(); },5000); }, error: function(){ // $('#request-error').addClass('error'); // resize_page(); } }); }); $('body').on('change','.ss-blog .search-box-blog',function(e){ e.stopImmediatePropagation(); window.location.href = 'https://www.alco-pop.co.uk//'+init.slug+'/blog/search/'+$(this).val(); }); var widgetMenuAccountActive = false; var dashboardLogin = false; var dashboardLoginBasket = false; // Widget Listeners var ajaxSend = "https://alco-pop.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php"; $('article').on('click','.classic-item-tile',function(e){ e.stopImmediatePropagation(); window.location.href = $(this).data('item-url'); }); $('article').on('change','.search-box-widget',function(e){ e.stopImmediatePropagation(); window.location.href = $(this).data('search-url')+slugify_url($(this).val()); }); $('article').on('click','.widget-login-access',function(e){ if ( $(this).closest('div').find('.dropdown-menu').length === 0 ) { modalBoxes(); } }); $('article').on('click','.log-out-client',function(e){ e.stopImmediatePropagation(); e.preventDefault(); var apikey = '86DFE56C91FB554A3CA198CB56955E'; var lPath = 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/clientlogin/logout.php?apikey='+apikey+'&tplid='+init.tpl+'&logout'; $('body').append(''); }); $('article').on('click','.toggle-cat',function(e){ e.stopImmediatePropagation(); e.preventDefault(); var _this = $(this); _this.toggleClass('fa-caret-right fa-caret-down'); $('.sub-cat-'+_this.closest('a').data('group-id')).toggleClass('sub-cat-hide'); }); var getSlug = "shop-widget"; var getCat = ""; var getURL = "https://www.alco-pop.co.uk/"; if ( typeof getCat !== 'undefined' ) { if ( getCat !== '' ) { $('.change-category[href="'+getURL+getSlug+'/products/category/'+getCat+'"]').addClass('active'); } else { $('.change-category[href="'+getURL+getSlug+'/"]').addClass('active'); } } else { $('.change-category[href="'+getURL+getSlug+'/"]').addClass('active'); } $('.internal-widget-frame').on('click','.widget-filter-sort',function(e){ e.preventDefault(); e.stopImmediatePropagation(); var _this = $(this); var pageTo = '1'; var groupID = _this.data('group-id'); var listStyle = _this.data('style'); var widgetID = _this.data('widget-id'); var tplID = parseInt(2308); var keyword = $('#'+widgetID+' .search-box-blog').val(); var cmdSelect = ''; var canvasSel = _this.data('canvas'); var sortMode = _this.data('sort'); $('.widget-filter-sort').removeClass('active'); _this.addClass('active'); // Change Sort Mode if ( sortMode === 'AZ' ) { _this.data('sort','ZA'); } else if ( sortMode === 'ZA' ) { _this.data('sort','AZ'); } else if ( sortMode === 'az' ) { _this.data('sort','za'); } else if ( sortMode === 'za' ) { _this.data('sort','az'); } // Toggle Arrow _this.find('.sort-caret').toggleClass('fa-caret-up fa-caret-down'); $('.widget-sort-select').removeClass('active'); _this.addClass('active'); if ( _this.closest('.ss-object').hasClass('ss-products') ) { cmdSelect = 'sale_item'; } $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': cmdSelect, 'search': keyword, 'sort': sortMode, 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'pageto': pageTo, 'groupid': groupID, 'widgetid': widgetID, 'tplid': tplID, 'generate': '1', 'generateCols': $('#'+widgetID+' .content-area').data('col'), 'canvas': canvasSel, 'slug': "shop-widget", 'domain': "https://www.alco-pop.co.uk/" } }, success: function(data){ var dataJSON = JSON.parse(data); if ( typeof dataJSON.generate !== 'undefined' ) { $('#'+widgetID+' #classic-item-list-'+widgetID).empty().append(dataJSON.generate); } //removeLoadStatus(); $(window).resize(); setTimeout(function(){ $(window).resize(); },500); }, error: function(){ //$('#request-error').addClass('error'); } }); }); $('.internal-widget-frame').on('click','.get-item-data-widget',function(e){ e.stopImmediatePropagation(); var _this = $(this); var pageTo = _this.data('page-to'); var groupID = _this.data('group-id'); var listStyle = _this.data('style'); var widgetID = _this.closest('.ss-object').prop('id'); var tplID = parseInt("2308"); var keyword = $('#'+widgetID+' .search-box-widget').val(); var hasSearch = false; var cmdSelect = ''; var canvasSel = _this.data('canvas'); var sortMode = _this.data('sort'); if ( _this.closest('.ss-object').hasClass('ss-products') ) { if ( _this.data('list') === 'search' ) { cmdSelect = 'sale_search'; } else { cmdSelect = 'sale_item'; } } else if ( _this.closest('.ss-object').hasClass('ss-blog') ) { if ( _this.data('list') === 'search' ) { cmdSelect = 'blog_menu_page_search'; } else { cmdSelect = 'blog_menu_page'; } } else if ( _this.closest('.ss-object').hasClass('ss-eventpro') ) { if ( _this.data('list') === 'search' ) { cmdSelect = 'event_item_more_search'; } else { cmdSelect = 'event_item_more'; } } else if ( _this.closest('.ss-object').hasClass('ss-courses') ) { if ( _this.data('list') === 'search' ) { cmdSelect = 'courses_menu_page_search'; } else { cmdSelect = 'courses_menu_page_search'; } } _this.closest('div').remove(); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': cmdSelect, 'search': keyword, 'sort': sortMode, 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'pageto': pageTo, 'groupid': groupID, 'widgetid': widgetID, 'tplid': tplID, 'generate': '1', 'generateCols': $('#'+widgetID+' .content-area').data('col'), 'canvas': canvasSel, 'slug': "shop-widget", 'domain': "https://www.alco-pop.co.uk/", 'domain2': "www.alco-pop.co.uk" } }, success: function(data){ var dataJSON = JSON.parse(data); if ( typeof dataJSON.generate !== 'undefined' ) { $('#'+widgetID+' #classic-item-list-'+widgetID).append(dataJSON.generate); } //removeLoadStatus(); $(window).resize(); setTimeout(function(){ $(window).resize(); },500); }, error: function(){ //$('#request-error').addClass('error'); } }); }); // Update Sale Item Info Page function slugify_url(text){ text = text.toString().toLowerCase() .replace(/\s+/g, '-') // Replace spaces with - .replace(/&/g, '-') // Replace & with - .replace(/\\/g, '-') // Replace \ with - .replace(/[^\w\-](?:nt|\\)+/g, '') // Remove all non-word chars .replace(/\-\-+/g, '-') // Replace multiple - with single - .replace(/^-+/, '') // Trim - from start of text .replace(/-+$/, '') // Trim - from end of text .replace(/(™|®|©|™|®|©|™|®|©)/g, ''); // Replace . with - while ( text.indexOf('.') >= 0 ) { text = text.replace('.', '-'); } // Replace + with No Character while ( text.indexOf('+') >= 0 ) { text = text.replace('+', ''); } return text; } function starRatings(rating){ var html = ''; if ( parseInt(rating) >= 1 && parseInt(rating) <= 5 ) { html += ''; for(s=1;s<=5;s++) { html += ''; } html += ''; } return html; } // Easy Zoom // var $easyzoom = $('.easyzoom').easyZoom(), // $easyzoom_api = $easyzoom.filter('.easyzoom--with-thumbnails').data('easyZoom'); $('.thumbnail-gallery-small').on('click', 'ul a', function(e){ let $this = $(this); let el = $this.closest('.ss-object'); e.preventDefault(); el .find('.easyzoom a') .prop('href',$this.data('standard')) .find('img') .prop('src',$this.data('standard')); //$easyzoom_api.swap($this.data('standard'), $this.prop('href')); }); function saleBasketBox(){ $('.widget-sale-basket-box').each(function(wi,wv){ var _wv = $(wv); var hasStockText = _wv.hasClass('hasStockText'); var hasVarLabelText = _wv.hasClass('hasVarLabelText'); var hasPriceText = _wv.hasClass('hasPriceText'); var hasRating = _wv.hasClass('hasRating'); var widgetID = _wv.data('widget-id'); var tplID = parseInt("2308"); var productID = _wv.data('item-id'); var placeAt = $('#'+_wv.prop('id')); var layout = _wv.data('canvas'); $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'sale_item_info', 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'widgetid': widgetID, 'tplid': tplID, 'productid': productID } }, success: function(data){ var dataJSON = JSON.parse(data); var itemInBasket = dataJSON.basket.items; var itemData = dataJSON.productinfo; var addBasketText = 'Add'; var thisBasketText = 'Add'; var inBasketText = ''; // Empty Basket Space placeAt.empty(); // Infinite Stock var isStockInfinite = false; if ( typeof itemData.sale_stock_infinite !== 'undefined' ) { if ( parseInt(itemData.sale_stock_infinite) === 1 ) { isStockInfinite = true; } } // Process Offline Variants var droppedKeywords = []; var stripOfflineVar = function(){ var keywordFound = []; // Get Online Keywords $(itemData['field']['variations']).each(function(vi,vv){ if ( typeof vv.is_online !== 'undefined' ) { if ( vv.is_online === '1' ) { if ( isStockInfinite ) { if ( typeof vv.variant_keyword !== 'undefined' ) { var kw = vv.variant_keyword.split('/'); $(kw).each(function(kwi,kwv){ if ( keywordFound.indexOf(kwv) < 0 ) { keywordFound.push(kwv); } }); } } else if ( typeof vv.current !== 'undefined' ) { if ( parseInt( vv.current ) > 0 ) { if ( typeof vv.variant_keyword !== 'undefined' ) { var kw = vv.variant_keyword.split('/'); $(kw).each(function(kwi,kwv){ if ( keywordFound.indexOf(kwv) < 0 ) { keywordFound.push(kwv); } }); } } } } } }); // Go Through All Keywords, Drop Any That Are Offline $(itemData['field']['attributes']).each(function(vi,vv){ if ( typeof vv.attribute_option !== 'undefined' ) { var jda = JSON.parse( vv.attribute_option ); $(jda).each(function(ji,jv){ var _jv = jv; _jv = slugify_url(_jv); _jv = _jv.replace(/[+£]/g,''); if ( keywordFound.indexOf(_jv) < 0 ) { droppedKeywords.push(_jv); } }); } }); }; stripOfflineVar(); // var itemStock = itemData['sale_stock_infinite'] === '1' ? 'i' : parseInt( itemData['current'] ); var itemPrice = parseFloat( ( itemData['sold'] * ( 1 + ( itemData['sale_vat'] /100 ) ) ) ); var reducedPercent = itemData['promo'] === '1' ? itemPrice / 100 * itemData['sale_discount'] : 0; var priceDiscount = itemData['promo'] === '1' ? parseFloat( ( itemPrice - reducedPercent ) ) : itemPrice; var tpl = ''; // Variations var varRange = ''; var hasVar = false; var removeSaleAttr = []; // Variations if ( typeof itemData.field !== 'undefined' ) { if ( typeof itemData.field.variations !== 'undefined' ) { if ( itemData.field.variations.length > 0 ) { hasVar = true; var varStock = false; (function(){ var vLow, vHigh, vLDisc, vHDisc, vf = itemData.field.variations, vfN = []; varStock = _.find(vf,function(vs){ return _.toNumber(vs.current) > 0 || parseInt( vs.sale_stock_infinite ) === 1; }); $(itemData.field.variations).each(function(vi,vv){ var sold = parseFloat( vv.sold * ( 1 + ( vv.sale_vat / 100 ) ) ).toFixed(2); var discount = vv.promo === '1' ? ( sold / 100 * parseFloat( vv.sale_discount ) ).toFixed(2) : 0; vv.priceDiscount = parseFloat( sold - discount ).toFixed(2); vfN.push(vv); }); var vLow = _.minBy( vfN, function(vr){ return parseFloat(vr.priceDiscount); } ); var vHigh = _.maxBy( vfN, function(vr){ return parseFloat(vr.priceDiscount); } ); varRange = '£' + ( vLow.priceDiscount === vHigh.priceDiscount ? vLow.priceDiscount : vLow.priceDiscount + ' - £'+vHigh.priceDiscount ); })(); } } } // Ratings if ( $('#'+widgetID+' .view-rating .glyphicon').length === 0 ) { if ( hasRating ) { if ( hasVar ) { if ( parseInt( itemData.rating.var ) > 0 ) { $('#'+widgetID+' .view-rating').append(starRatings(itemData.rating.var)); } } else { if ( parseInt( itemData.rating.main ) > 0 ) { $('#'+widgetID+' .view-rating').append(starRatings(itemData.rating.main)); } } } } // Description var showAttr = true; $( itemData['field']['attributes'] ).each( function( ai, av ){ if ( av.attribute_label === null ) { showAttr = false; return false; } }); if ( itemStock === 'i' || itemStock > 0 || ( itemData['field']['variations'].length > 0 ) ) { tpl += '
'; // Price Text if ( hasPriceText ) { if ( hasVar ) { tpl += '
£'+varRange.replace('£','')+'
'; } else { tpl += '
£'+( itemData['promo'] === '1' ? priceDiscount.toFixed(2) : itemPrice.toFixed(2) )+'
'; } if ( parseInt( itemData['promo'] ) === 1 ) { tpl += '
'; tpl += '£'+itemPrice.toFixed(2)+' ('+parseInt( itemData['sale_discount'] )+'%)'; tpl += '
'; } } // Stock Text if ( hasStockText ) { tpl += '
'; if ( hasVar ) { tpl += ''+( varStock ? 'In Stock' : 'Out Of Stock' )+''; } else { if ( itemStock !== 'i' ) { tpl += ' 0 ? '' : 'class="out-of-stock"' )+'>'+( itemStock > 0 ? 'Stock: '+itemStock : 'Stock: 0' )+''; } else { tpl += 'In Stock'; } } tpl += '
'; } // tpl += '
'; var thisBasketTextQTY = 1; if ( typeof itemInBasket === 'object' ) { thisBasketText = addBasketText; $(itemInBasket).each(function(ibi,ibv){ if ( parseInt( ibv.id ) === parseInt( itemData['idProductList'] ) ) { thisBasketText = inBasketText; thisBasketTextQTY = parseInt( ibv.qty ); } }); } else { thisBasketText = itemInBasket.indexOf( parseInt( itemData['idProductList'] ) ) >= 0 ? inBasketText : addBasketText; thisBasketTextQTY = 1; } tpl += '
'; tpl += ''; tpl += '
'; tpl += '
'; tpl += ''; tpl += '
'; } else { tpl += '
'; // Price Text if ( hasPriceText ) { tpl += '
£'+( itemData['promo'] === '1' ? priceDiscount.toFixed(2) : itemPrice.toFixed(2) )+'
'; if ( parseInt( itemData['promo'] ) === 1 ) { tpl += '
'; tpl += '£'+itemPrice.toFixed(2)+' ('+parseInt( itemData['sale_discount'] )+'%)'; tpl += '
'; } } // Stock Text if ( hasStockText ) { tpl += '
'; if ( hasVar ) { tpl += ''+( varStock ? 'In Stock' : 'Out Of Stock' )+''; } else { if ( itemStock !== 'i' ) { tpl += ' 0 ? '' : 'class="out-of-stock"' )+'>'+( itemStock > 0 ? 'Stock: '+itemStock : 'Out Of Stock' )+''; } else { tpl += 'In Stock'; } } tpl += '
'; } // tpl += '
'; } if ( ( itemData['field']['variations'].length > 0 ) && showAttr ) { tpl += '
'; $(itemData['field']['attributes']).each(function(fi,fv){ tpl += '
'; if ( typeof fv['attribute_option'] !== 'undefined' ) { tpl += '
'+fv['attribute_label']+'
'; tpl += '
'; tpl += '
'; } tpl += '
'; }); tpl += '
'; } tpl += ''; tpl += ''; tpl += ''; tpl += ''; tpl += ''; placeAt.append(tpl); if ( ( itemData['field']['variations'].length > 0 ) && showAttr ) { $('#item-submit').hide(); } $(function() { var itemQtyEl = $('#'+widgetID+' #item-qty'); var itemSubmitEl = $('#'+widgetID+' #item-submit'); var itemCurrentVaration = $('#'+widgetID+' .select__stock--variation'); var itemPromo = itemData['promo']; var itemPromoDiscount = itemData['sale_discount']; itemCurrentVaration.hide().eq(0).show(); var itemCheckStock = function(chosenItems) { var itemVariations = itemData['field']['variations']; itemQtyEl.val(''); itemQtyEl.hide(); itemSubmitEl.hide(); $('#'+widgetID+' .sale-variations').hide(); $('#'+widgetID+' #item-stock-text').addClass('out-of-stock').text('Stock: 0'); $('#'+widgetID+' #item-stock').val(0); $('#'+widgetID+' .sale-variations').show(); $('#'+widgetID+' .view-price').empty().append('£'+varRange.replace('£','')+''); if ( varStock ) { $('#'+widgetID+' #item-stock-text').removeClass('out-of-stock').html('In Stock'); } else { $('#'+widgetID+' #item-stock-text').html('Out Of Stock'); } if ( itemVariations ) { $.each(itemVariations, function(k,v) { chosenItems.find(function(item){ var galleryChange = false; // Remove Characters item = slugify_url(item); item = item.replace(/[+£]/g,''); if ( v.variant_keyword === item ) { if ( v.variant_keyword ) { if ( v.is_online === '0' ) { $('#'+widgetID+' #item-stock-text').text('Unavailable Online'); $('#'+widgetID+' #item-submit,#item-qty').hide(); return; } // Change Images //saleGalleryUpdate(v.product_id); var soldVAT = parseFloat( ( v.sold * ( 1 + ( v.sale_vat /100 ) ) ) ).toFixed(2); $('#'+widgetID+' #item-sold').text(soldVAT); $('#'+widgetID+' #item-sold-orig').text(soldVAT); $('#'+widgetID+' #item-price').val(soldVAT); $('#'+widgetID+' .discount-price small').text('£'+soldVAT); if ( itemData['promo'] === '1' ) { // only 2 decimal number no rounding $('#'+widgetID+' #item-sold').text( (soldVAT*(100-itemData['sale_discount'])/100).toFixed(2).toString().match(/^-?\d+(?:\.\d{0,2})?/)[0] ); $('#'+widgetID+' #item-price').val( $('#'+widgetID+' #item-sold').text() ); } $('#'+widgetID+' #item-stock').val( ( isStockInfinite ? 32000 : v.current ) ); $('#'+widgetID+' .sale-variations').show(); $('#'+widgetID+' #item-id').val(1); $('#'+widgetID+' #item-id').attr('name','item['+v.product_id+']'); itemQtyEl .data('item-id',v.product_id) .val(1) .change(); thisBasketText = addBasketText; if ( typeof itemInBasket === 'object' ) { thisBasketText = addBasketText; $(itemInBasket).each(function(ibi,ibv){ if ( parseInt( ibv.id ) === parseInt( v.product_id ) ) { thisBasketText = inBasketText; thisBasketTextQTY = parseInt( ibv.qty ); } }); } $('#'+widgetID+' #item-submit').html(thisBasketText); if ( v.current < 1 && parseInt(v.sale_stock_infinite) !== 1 ) { $('#'+widgetID+' #item-stock-text').addClass('out-of-stock').text('Out Of Stock'); $('#'+widgetID+' #item-submit,#item-qty').hide(); } else { $('#'+widgetID+' #item-stock-text').removeClass('out-of-stock').text( ( isStockInfinite ? 'In Stock' : 'Stock: '+v.current ) ); $('#'+widgetID+' #item-submit,#item-qty').show(); } if ( v.current > 0 || parseInt(v.sale_stock_infinite) !== 1 ) { itemCurrentVaration.find('option').css('display','block'); itemSubmitEl.show(); itemQtyEl.prop({ 'max': ( isStockInfinite ? 32000 : v.current ), 'disabled': false }) .show(); } } return false; } }); }); } }; itemCurrentVaration.change(function(){ var blankIndex = 1; var blankAssign = false; var itemVariant = []; var itemCompare = []; var varC = itemCurrentVaration.length; var varList = itemData['field']['variations']; itemCurrentVaration.find('option').css('display','block'); itemCurrentVaration.show(); itemCurrentVaration.each(function(index) { if ( this.value === '' && !blankAssign && index !== 0) { hasBlank = index; blankAssign = true; } itemVariant.push(this.value); }); itemCompare.push(itemVariant.join('/')); itemCompare.push(itemVariant.reverse().join('/')); itemCheckStock( itemCompare ); if ( itemCurrentVaration.eq(0).val() === '' ) { itemCurrentVaration.hide(); itemCurrentVaration.eq(0).show(); } else if ( blankAssign ) { for ( c = blankIndex; c < varC; c++ ) { if ( itemCurrentVaration.eq(c).find('option').length === 1 ) { itemCurrentVaration.eq(c).hide(); } itemCurrentVaration.eq(c+1).hide(); } } else { blankIndex = varC + 1; } }); itemQtyEl.on('keyup change', function() { var that = $(this); var notify = $('#item-alert'); itemSubmitEl.hide(); notify.hide(); if ( parseInt(that.val()) > parseInt(that.prop('max')) && !isStockInfinite ) { notify.text('Please enter quantity less than ' + that.prop('max')+'.').show(); } else { if ( that.val() && that.val() != 0 ) { $('#'+widgetID+' #item-qty, #'+widgetID+' .qty-label').show(); itemSubmitEl.show(); $('#'+widgetID+' .qty-label').show(); $('#'+widgetID+' .sale-variations').show(); $('#'+widgetID+' #item-id').val(that.val()); $('#'+widgetID+' #item-id').attr('name','item['+itemQtyEl.data('item-id')+']'); } } }); }); // End Of Success } }); }); } saleBasketBox(); function refreshBasketCounter(counter){ $('.view-basket .badge').html(counter); } function refreshTaskCounter(counter){ $('.view-tasks .badge, .wf-tasks-menu .badge').html(counter); if ( parseInt( counter ) > 0 ) { $('.view-tasks,.wf-tasks-menu').removeClass('no-tasks'); } else { $('.view-tasks,.wf-tasks-menu').addClass('no-tasks'); } } $('.internal-widget-frame').on('click','.sale-add-to-basket',function(e){ var _this = $(this); var widgetID = _this.closest('.ss-object').prop('id'); var tplID = parseInt("2308"); var itemID = _this.closest('.widget-sale-basket-box').find('#item-id').prop('name').replace('item[','').replace(']',''); var itemQTY = _this.closest('.widget-sale-basket-box').find('#item-id').val(); $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'sale_add_to_basket', 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'widgetid': widgetID, 'tplid': tplID, 'itemID': itemID, 'itemQTY': itemQTY } }, success: function(data){ var dataJSON = JSON.parse(data); window.location.href = "https://www.alco-pop.co.uk/dashboard/basket/?c=https://www.alco-pop.co.uk/shop-widget/";viewBasketPage(widgetID); //saleBasketBox(); //efreshBasketCounter(dataJSON['basket']['counter']); } }); }); // // Review function mobileReview(){ $('.ss-review').each(function(rwi,rwv){ var _rwv = $(rwv); var reviewWID = _rwv.prop('id'); var reviewWidth = _rwv.outerWidth(); if ( 640 > reviewWidth ) { _rwv.addClass('mobile-layout'); _rwv.find('.col-xs-12,.review-item-button').css('width','100%'); _rwv.find('.hidden-sm,.hidden-md,.hidden-lg').removeClass('hidden-sm hidden-md hidden-lg').addClass('mobile-layout-only'); _rwv.find('.hidden-xs').removeClass('hidden-xs').addClass('desktop-layout-only'); } else { _rwv.find('.hidden-xs').removeClass('hidden-xs').addClass('desktop-layout-only'); } }); } mobileReview(); $('.ss-review .rating').barrating({ theme: 'fontawesome-stars' }); $('.ss-review form').on('submit',function(e){ e.preventDefault(); var $this = $(this), $submit = $this.find('button[type=submit]'), $notify = $this.find('.alert'), reviewID = $this.closest('.ss-object').prop('id'), _csrf_token_review = $this.find('input[name="_csrf_token"]').val(0), aKey = '86DFE56C91FB554A3CA198CB56955E'; $.ajax({ crossDomain: true, type: 'post', url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/review/?wid='+reviewID+'&tplid='+init.tpl+'&apikey='+aKey, dataType: 'json', cache: true, data: $this.serialize(), beforeSend: function(){ $notify.addClass('hidden').removeClass('alert-success alert-warning alert-danger'); $submit.prop('disabled',true).html(''); }, }).done(function(data) { if ( !data.ok ) { $submit.prop('disabled',false).html('Submit'); $notify.removeClass('hidden').addClass('alert-warning').html(data.msg); } else { // Fix Ratings $('.rating').barrating('readonly', true); $('.feedback-space').each(function(i,v){ var _v = $(v); var fc = _v.find('.form-control'); if ( fc.length > 0 ) { // Insert User Feedback Response _v.append('

"'+fc.val()+'"

'); // Remove Field fc.remove(); } }); $('.result-space') .append('

Thank you for having taken your time to provide us with your valuable feedback.

'); if ( typeof data.social !== 'undefined' ) { if ( data.social !== '' ) { $('.result-space').append(data.social); } } $('.panel-footer').remove(); $('.panel-heading small').remove(); mobileReview(); var newSize = $('#'+reviewID).outerHeight(); $('#'+reviewID) .closest('.ss-zone') .css('height', newSize+'px') .data('height', newSize); desktop_scale(true); parallax_position(); hide_outside_object(); desktop_scale(true); parallax_position(); hide_outside_object(); } }).fail(function() { $notify.removeClass('hidden').addClass('alert-warning').html('Please try again later.'); $submit.prop('disabled',false).html('Submit'); }); return false; }); // Collapsable Text $('.internal-widget-frame .collapsable-description-area').each(function(){ var _this = $(this); var ctime = setInterval(function(){ if ( _this.find('*').length > 0 ) { clearInterval(ctime); if ( parseInt( _this.css('height') ) > 500 ) { _this.addClass('collapse'); } else { _this.closest('.internal-widget-frame').find('.collapse-text-expand').remove(); } } }); }); $('.internal-widget-frame').on('click','.collapse-text-expand',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _id = _this.closest('.ss-object').prop('id'); var _obj = $('#'+_id); _this.closest('.ss-object').find('.collapsable-description-area').removeClass('collapse'); _this.remove(); var newHeight = _obj.find('.internal-widget-frame').height(); _obj .css({ 'height': newHeight+'px' }) .closest('.ss-zone') .css('height', newHeight+'px') .data('height', newHeight); desktop_scale(true); parallax_position(); hide_outside_object(); desktop_scale(true); parallax_position(); hide_outside_object(); }); // $('.internal-widget-frame .wf-gmap').each(function(){ var _this = $(this); var map = new GMaps({ div: '#'+_this.prop('id'), lat: 54.963916, lng: -1.605827, zoom: 13, disableDefaultUI: true, scrollwheel: false, draggable: false }); GMaps.geocode({ address: _this.data('postcode'), callback: function(results, status) { if (status == 'OK') { var latlng = results[0].geometry.location; map.setCenter(latlng.lat(), latlng.lng()); map.addMarker({ lat: latlng.lat(), lng: latlng.lng() }); } } }); _this.css({ 'width': '100%' }); $(window).resize(); setTimeout(function(){ $(window).resize(); },500); }); $('.internal-widget-frame .book-event-ticket-now').each(function(tci,tcv){ var _this = $(tcv); var widgetID = _this.closest('.ss-object').prop('id'); var tplID = parseInt("2308"); $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'event_check_if_in_basket', 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'widgetid': widgetID, 'tplid': tplID, 'ticketID': _this.data('ticket-id'), 'eventID': _this.data('event-id') } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.attending ) { _this.html(' '); } else if ( dataJSON.in ) { _this.html(' '); } } }); }); $('.internal-widget-frame').on('click','.book-event-ticket-now',function(e){ e.stopImmediatePropagation(); var _this = $(this); var widgetID = _this.closest('.ss-object').prop('id'); var eventID = _this.data('event-id'); var ticketID = _this.data('ticket-id'); var tplID = parseInt("2308"); if ( _this.find('i.fa.fa-shopping-basket').length > 0 ) { window.location.href = "https://www.alco-pop.co.uk/dashboard/basket/"; //viewBasketPage(widgetID); return false; } else if ( _this.find('i.fa.fa-check').length > 0 ) { return false; } _this.addClass('book-event-now-activated').data({'beid': eventID, 'btid': ticketID, 'bwid': widgetID }); bookEventNow(); }); // Courses function bookCourseNow(){ $('.book-course-now-activated').each(function(bi,bv){ var _bv = $(bv); var widgetID = _bv.data('bwid'); var courseID = _bv.data('bcid'); var courseDate = _bv.closest('tr').find('.select-this-course').val(); var tplID = parseInt("2308"); if ( _bv.closest('tr').find('.select-this-course').length === 0 ) { courseID = _bv.data('course-id'); } if ( init.loggedin ) { $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'course_add_basket', 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'widgetid': widgetID, 'tplid': tplID, 'courseDate': courseDate, 'courseID': courseID } }, beforeSend: function(){ $('#'+widgetID+' .book-course-ticket-now').addClass('wf-disabled'); }, success: function(data){ var dataJSON = JSON.parse(data); refreshBasketCounter(dataJSON['basket']['counter']); if ( dataJSON.ok ) { _bv.removeClass('book-course-now-activated'); if ( typeof dataJSON.booked !== 'undefined' ) { $('#'+widgetID+' .book-course-ticket-now').removeClass('wf-disabled'); _bv.html(' '); $('body').prepend('
Course successfully booked.
'); $('#'+widgetID+' .book-course-ticket-now').removeClass('wf-disabled'); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } else { $('#'+widgetID+' .book-course-ticket-now').removeClass('wf-disabled'); _bv.html(' '); viewBasketPage(widgetID); } } else if ( typeof dataJSON.loginToBook !== 'undefined' ) { modalBoxes(); $('#'+widgetID+' .book-course-ticket-now').removeClass('wf-disabled'); } else { _bv.removeClass('book-course-now-activated'); $('body').prepend('
'+dataJSON.msg+'
'); $('#'+widgetID+' .book-course-ticket-now').removeClass('wf-disabled'); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }, error: function(){ _bv.removeClass('book-course-now-activated'); $('body').prepend('
Please try again later.
'); $('#'+widgetID+' .book-course-ticket-now').removeClass('wf-disabled'); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }); } else { _bv.addClass('book-course-now-activated').data({'bcid': courseID, 'bwid': widgetID}); modalBoxes(); } }); } $('.internal-widget-frame .book-course-ticket-now').each(function(tci,tcv){ var _this = $(tcv); var widgetID = _this.closest('.ss-object').prop('id'); var tplID = parseInt("2308"); $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'course_check_if_in_basket', 'apikey': "86DFE56C91FB554A3CA198CB56955E", 'widgetid': widgetID, 'tplid': tplID, 'courseID': _this.data('course-id') } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.attending ) { _this.html(' '); } else if ( dataJSON.in ) { _this.html(' '); } } }); }); $('.internal-widget-frame').on('click','.book-course-ticket-now',function(e){ e.stopImmediatePropagation(); var _this = $(this); var widgetID = _this.closest('.ss-object').prop('id'); var tplID = parseInt("2308"); var courseDate = _this.closest('tr').find('.select-this-course').val(); var courseID = _this.closest('tr').find('.select-this-course').data('course-id'); var taskListID = _this.data('tasklist-id'); if ( _this.hasClass('wf-disabled') ) { return false; } else if ( _this.find('i.fa.fa-shopping-basket').length > 0 ) { window.location.href = "https://www.alco-pop.co.uk/dashboard/basket/"; return false; } else if ( _this.find('i.fa-check').length > 0 ) { window.location.href = "https://www.alco-pop.co.uk/dashboard/task/course/list/"+taskListID+"/"; return false; } _this.addClass('book-course-now-activated').data({'bcid': courseID, 'bwid': widgetID}); bookCourseNow(); }); $('.container-fluid').on('click','.more-review-button',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _page = _this.data('page'); var widgetID = _this.closest('.ss-object').prop('id'); var tplID = parseInt("2308"); $('#'+widgetID+' .more-review-button').closest('div').remove(); $.ajax({ type: 'post', url: "https://alco-pop.prosoftwareuk.co.uk/api/form/review/?wid="+widgetID+"&tplid="+tplID+"&apikey=86DFE56C91FB554A3CA198CB56955E", headers: { 'X-CSRF-TOKEN':"", }, dataType: 'json', data: { 'page': _page }, success: function(data){ //console.log(data); $('#'+widgetID+' .form-block > .panel > div > .panel').append(data.html); $(window).resize(); setTimeout(function(){ $(window).resize(); },500); } }); }); // Diary var diaryBook = null; var widgetBasket = null; $('body').on('click','.wf-mobile-search-bar-toggle',function(e){ e.stopPropagation(); var _this = $(this); _this.closest('.ss-object').find('.wf-mobile-search-bar').toggleClass('wf-toggle-hide'); resizeWidgetFrame(); }); $('body').on('click','.wf-gallery-prev,.wf-gallery-next',function(e){ e.stopPropagation(); var _this = $(this); var thumbs = _this.closest('.thumbnail-gallery-small'); var filmStripList = thumbs.find('ul'); var getImages = thumbs.data('imgs'); var getImageCount = parseInt( thumbs.data('imgcount') ); var getPages = parseInt( thumbs.data('pages') ); var getPage = parseInt( thumbs.data('page') ); if ( getImages !== '' ) { var splitImages = getImages.split('|:|'); if ( _this.hasClass('wf-gallery-prev') ) { getPage -= 1; } else { getPage += 1; } if ( getPage <= 0 ) { getPage = getPages; } if ( getPage > getPages ) { getPage = 1; } thumbs.data('page',getPage); var endNo = ( getPage * 3 ) - 1; var startNo = endNo - 2; filmStripList.empty(); for ( tn = startNo; tn <= endNo; tn++ ) { if ( tn < getImageCount ) { filmStripList.append('
  • '); } else { break; } } } }); // Counter Refresh function wfTaskCounterRefresh(){ $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfClientTaskCounter', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E' } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.ok ) { refreshTaskCounter(dataJSON.counter); } } }); } function diarySlotBooked(){ $('.ss-diary').each(function(di,dv){ var _dv = $(dv); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'diaryGetClientBooked', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E' } }, success: function(data){ var dataJSON = JSON.parse(data); // Change Booking Slots if ( typeof dataJSON.d !== 'undefined' ) { $(dataJSON.d).each(function(csi,csv){ _dv.find('.consultant-slot[data-timestamp="'+csv.timeslot+'"]').addClass('busy conflict').removeClass('available').html(''); var _slot = _dv.find('.consultant-slot-'+csv.idConsultant+'[data-timestamp="'+csv.timeslot+'"]'); _slot .removeClass('busy available conflict') .addClass('edit-slot '+( parseInt( csv.status ) === 1 ? 'slot-edit-confirmed' : 'slot-edit-pending' ) ) .data({ 'diary-id': csv.idDiary, 'service-id': csv.idService, 'diary-group-id': csv.diary_group_id, 'slot-status': csv.status }) .html(''); }); $('.busy.consultant-slot').each(function(ci,cv){ if ( $(cv).html() === 'Busy' ) { $(cv).addClass('diary-busy'); } }); } resizeWidgetFrame(); } }); }); } $('body').on('mouseleave','.available.wf-diary-move-to-this-slot',function(e){ var _this = $(this); $('.consultant-slot').removeClass('slot-edit-highlight'); }); $('body').on('mouseenter','.available.wf-diary-move-to-this-slot',function(e){ var _this = $(this); var _widget = _this.closest('.ss-object'); var consultant = _this.data('consultant'); var timestamp = parseInt( _this.data('timestamp') ); var durations = parseInt(_widget.find('.diary-content-area').data('diary-duration')); var diaryID = _widget.find('.diary-content-area').data('diary-id'); $('.consultant-slot').removeClass('slot-edit-highlight'); for ( t = 0; t < durations; t += 15 ) { $('.consultant-slot-'+consultant+'[data-timestamp="'+( timestamp + ( t * 60 ) )+'"]').addClass('slot-edit-highlight'); } }); function diaryMoveClientBookingShow(_widget,timestamp,consultant,consultantName){ var durations = parseInt(_widget.find('.diary-content-area').data('diary-duration')); var diaryID = _widget.find('.diary-content-area').data('diary-id'); $('.consultant-slot').removeClass('slot-edit-pending slot-edit-highlight'); for ( t = 0; t < durations; t += 15 ) { $('.consultant-slot-'+consultant+'[data-timestamp="'+( timestamp + ( t * 60 ) )+'"]').addClass('slot-edit-pending'); } diaryConfirmMoveSlot($('.consultant-slot-'+consultant+'[data-timestamp="'+timestamp+'"]'),_widget,timestamp,consultant,consultantName,diaryID); } function diaryFindClientBookingSpace(_widget,diaryID,timestamp){ $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'diaryFindClientBookingSpace', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'diaryID': diaryID, 'day': _widget.find('#datetimepicker').val(), } }, beforeSend: function(){ _widget.find('td.consultant-slot').removeClass('conflict available slot-edit-pending slot-edit-confirmed').addClass('busy').html(''); }, success: function(data){ var dataJSON = JSON.parse(data); var diaryID2 = diaryID; if ( typeof dataJSON.d !== 'undefined' ) { _widget.find('.diary-content-area').data('diary-duration',dataJSON.d).addClass('edit-mode-active'); } if ( typeof dataJSON.s !== 'undefined' ) { _widget.find('.wf-date-cancel-bar').show(); $(dataJSON.s).each(function(si,sv){ _widget.find('td.consultant-slot-'+sv.c).each(function(i,v){ var _v = $(v); var addWrite = parseInt( sv.w ) === 1 ? '' : ''; var addWriteClass = addWrite ? ' wf-diary-move-to-this-slot ' : ''; if ( parseInt( $(v).data('timestamp') ) === parseInt( sv.ts ) ) { _v.addClass('available '+addWriteClass).removeClass('busy conflict slot-edit-pending slot-edit-confirmed').html(addWrite); } }); }); } resizeWidgetFrame(); } }); resizeWidgetFrame(); } $('body').on('click','.wf-edit-slot-diary-edit',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _widget = _this.closest('.ss-object'); var diaryID = _this.data('diary-id'); var timestamp = _this.data('ts'); _widget.find('.wf-diary-hide-book,.wf-diary-hide-edit').addClass('hide'); _widget.find('.consultant-slot').removeClass('active'); _widget.find('.wf-diary-hide-edit').addClass('hide').find('.wf-edit-diary-body').empty(); _widget.find('.diary-content-area').data('diary-id',diaryID); diaryFindClientBookingSpace(_widget,diaryID,timestamp); }); $('body').on('click','.edit-slot',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _widget = _this.closest('.ss-object'); var timestamp = _this.data('timestamp'); var consultant = _this.data('consultant'); var consultantName = _this.data('name'); var diaryID = _this.data('diary-id'); _widget.find('.wf-diary-hide-book,.wf-diary-hide-edit').addClass('hide'); _widget.find('.consultant-slot').removeClass('active'); _this.addClass('active'); _widget.find('.wf-diary-hide-edit').addClass('hide').find('.wf-edit-diary-body').empty(); _widget.find('.wf-diary-hide-edit td').attr('colspan', ( $('#table-diary').hasClass('mobile') ? 2 : $('#table-diary > thead > tr >th.consultant-slot').length + 1 ) ); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'diaryEditAppointment', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'diaryID': diaryID } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.ok ) { if ( typeof dataJSON.html !== 'undefined' ) { _widget.find('.wf-diary-hide-edit-'+timestamp).removeClass('hide'); _widget.find('.wf-diary-hide-edit-'+timestamp).find('.wf-edit-diary-body').append(dataJSON.html); } } resizeWidgetFrame(); } }); resizeWidgetFrame(); }); function diaryConfirmMoveSlot(_this,_widget,timestamp,consultant,consultantName,diaryID){ _widget.find('.wf-diary-hide-book,.wf-diary-hide-edit').addClass('hide'); _widget.find('.consultant-slot').removeClass('active'); _this.addClass('active'); _widget.find('.wf-diary-hide-edit').addClass('hide').find('.wf-edit-diary-body').empty(); _widget.find('.wf-diary-hide-edit td').attr('colspan', ( $('#table-diary').hasClass('mobile') ? 2 : $('#table-diary > thead > tr >th.consultant-slot').length + 1 ) ); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'diaryEditAppointmentConfirmMove', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'diaryID': diaryID, 'timeslot': timestamp, 'cid': consultant, 'cname': consultantName } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.ok ) { if ( typeof dataJSON.html !== 'undefined' ) { _widget.find('.wf-diary-hide-edit-'+timestamp).removeClass('hide'); _widget.find('.wf-diary-hide-edit-'+timestamp).find('.wf-edit-diary-body').append(dataJSON.html); } } resizeWidgetFrame(); } }); resizeWidgetFrame(); } var resetBasketWidgets = null; var bookEventNow = null; var resetSaleWidget = null; var wfPrepareCheckoutPage = null; function leapYear(year){ return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); } function resizeWidgetFrame(){ $('.internal-widget-frame').each(function(iwfi,iwfv){ var _iwfv = $(iwfv); var newHeight = _iwfv.height(); _iwfv .closest('.ss-object') .css({ 'height': newHeight+'px' }) .closest('.ss-zone') .css('height', newHeight+'px') .data('height', newHeight); }); desktop_scale(true); parallax_position(); hide_outside_object(); desktop_scale(true); parallax_position(); hide_outside_object(); } function viewBasketPage(widgetID,cShop){ var _widget = $('#'+widgetID); var ajaxSend = 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php'; var apikey = '86DFE56C91FB554A3CA198CB56955E'; if ( typeof cShop === 'undefined' ) { cShop = ''; } var dataSend = { 'obj': { 'cmd': 'wfBasket', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'website': "https://www.alco-pop.co.uk/", 'cshop': cShop } } // Temporary Hide Buttons _widget.find('.search-box-wrapper-bar,.top-menu-button,.wf-location-select,.widget-button-back').addClass('wf-temp-hide-payment'); _widget.find('.internal-widget-frame .wf-basket-back,.widget-back-btn').remove(); _widget.find('.internal-widget-frame .navbar-default .container-fluid').append(''); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: dataSend, success: function(data){ var dataJSON = JSON.parse(data); if ( typeof dataJSON.html !== 'undefined' ) { _widget.find('.basket-insert').html(dataJSON.html); _widget.find('.wf-main-content-area').hide(); if ( $('head #style-'+widgetID+'-basket').length === 0 ) { $('head').append(''); } else { $('head #style-'+widgetID+'-basket').empty().append(dataJSON.css); } resizeWidgetFrame(); } if ( typeof dataJSON.basketCounter !== 'undefined' ) { refreshBasketCounter(dataJSON.basketCounter); } if ( _widget.find('.wf-daterangepicker').length > 0 ) { _widget.find('.wf-daterangepicker').daterangepicker({ 'timePicker': true, 'timePicker24Hour': true, 'timePickerIncrement': 15, 'autoApply': true, 'dateLimit': { 'days': 30 }, 'showCustomRangeLabel': false, //'locale': { 'format': 'DD/MM/YYYY', //}, 'minDate': '11/14/2018', 'startDate': '11/14/2018', 'endDate': '12/14/2018', }).on('apply.daterangepicker',function(e,picker){ var startDate = picker.startDate.format('YYYY-MM-DD hh:mm:ss'); var endDate = picker.endDate.format('YYYY-MM-DD HH:mm:ss'); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'wfBasketHireDateRange', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'start': startDate, 'finish': endDate } }, success: function(data){ viewBasketPage(widgetID); resizeWidgetFrame(); }, error: function(){ //$('#request-error').addClass('error'); } }); }); } // Add Dashboard Event Listeners dashboardJQEventListeners(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container,#dashboard-basket-area').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); // //removeLoadStatus(); }, error: function(){ //$('#request-error').addClass('error'); } }); } // $('.ss-products .internal-widget-frame,.ss-courses .internal-widget-frame,.ss-eventpro .internal-widget-frame').on('click','.view-basket',function(e){ // e.stopImmediatePropagation(); // e.preventDefault(); // viewBasketPage($(this).closest('.ss-object').prop('id')); // }); var dashboardJQEventListeners = null; (function(){ var ajaxSend = 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php'; var apikey = '86DFE56C91FB554A3CA198CB56955E'; $('.internal-widget-frame').on('click','.wf-dashboard-link',function(e){ e.stopImmediatePropagation(); if ( !init.loggedin ) { e.preventDefault(); modalBoxes(); } //wfBackToDashboard(); }); dashboardJQEventListeners = function(){ // Task View $('.wf-dashboard-container').on('click','.wf-task-subtask-toggle',function(e){ var _this = $(this); var taskID = ""; var dataSend = {}; dataSend['form'] = 'task'; dataSend['section'] = _this.data('section'), dataSend['keyId'] = _this.data('key'); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/script/php/json/client/', type: 'post', data: dataSend, success: function(data){ if ( data.ok ) { $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfClientTask', 'widgetid': 'previewer', 'tplid': init.tpl, 'taskID': taskID, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop" } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { $('#widget-zone-dashboard').html(dataJSON.render); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); pageResizeRefresh(); } },50); } } } }); } }, error: function(){ $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); } }); }); $('.wf-dashboard-container').on('click','.wf-task-complete',function(e){ e.stopImmediatePropagation(); var _this = $(this); var taskID = ""; var dataSend = {}; dataSend['form'] = 'online_training'; dataSend['section'] = 'course|:|task|:|complete'; dataSend['keyId'] = _this.data('key'); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/script/php/json/client/', type: 'post', data: dataSend, success: function(data){ $('body').prepend('
    '+data.message+'
    '); if ( typeof data.taskCounter !== 'undefined' ) { $('.wf-tasks-menu span').html(data.taskCounter); } setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); if ( data.ok ) { if ( $('.get-main-task-list-id').length === 0 ) { $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfClientTask', 'widgetid': 'previewer', 'tplid': init.tpl, 'taskID': taskID, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop" } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { $('#widget-zone-dashboard').html(dataJSON.render); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); pageResizeRefresh(); } },50); } } } }); } else { $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfClientTask', 'widgetid': 'previewer', 'tplid': init.tpl, 'taskID': '', 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop", 'taskmenu': ( $('.get-main-task-list-id').data('task-filter') !== 'undefined' && typeof $('.get-main-task-list-id').data('task-filter') !== 'undefined' && $('.get-main-task-list-id').data('task-filter') !== '' ? $('.get-main-task-list-id').data('task-filter') : '' ), 'taskmenulist': ( $('.get-main-task-list-id').data('task-list') !== 'undefined' && typeof $('.get-main-task-list-id').data('task-list') !== 'undefined' && $('.get-main-task-list-id').data('task-list') !== '' ? $('.get-main-task-list-id').data('task-list') : '' ) } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { $('#widget-zone-dashboard').html(dataJSON.render); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); pageResizeRefresh(); } },50); } } } }); } } }, error: function(){ $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); } }); }); $('.wf-dashboard-container').on('submit','.wf-task-form',function(e){ e.preventDefault(); var _this = $(this); var dataSend = {}; var taskID = ""; $(_this.serializeArray()).each(function(si,sv){ if ( sv.name === 'file[]' ) { if ( typeof dataSend.file === 'undefined' ) { dataSend.file = []; } dataSend.file.push(sv.value); } else { dataSend[ sv.name ] = sv.value; } }); dataSend['form'] = 'online_training'; dataSend['section'] = 'course|:|task|:|comment'; $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/script/php/json/client/', type: 'post', data: dataSend, success: function(data){ $('body').prepend('
    '+data.message+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); if ( data.ok ) { $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfClientTask', 'widgetid': 'previewer', 'tplid': init.tpl, 'taskID': taskID, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop" } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { $('#widget-zone-dashboard').html(dataJSON.render); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); pageResizeRefresh(); } },50); } } } }); } }, error: function(){ $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); } }); }); $('body').on('click', '.delete-uploaded-file', function() { $(this).closest('.sButton').remove(); }); $('#wf-task-input--uploader').liteUploader({ script: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/script/php/html/client/index.php', params: {form: 'upload', section: 'online_training', key_id: "1542209023"}, }) .on('lu:success', function(e, response) { if ( response.ok ) { $('.wf-task-upload-area').append(' '+response.msg+' × '); } else { $('body').prepend('
    '+response.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); } $('#wf-task-uploader--button').prop('disabled', false).html(' Upload'); }) .on('lu:progress', function(e, response) { $('#wf-task-uploader--button').prop('disabled', true).html(' Upload'); }); // $('.wf-dashboard-container').on('click','.wf-log-out',function(e){ e.stopImmediatePropagation(); e.preventDefault(); //$('.wf-dashboard-container').remove(); var apikey = '86DFE56C91FB554A3CA198CB56955E'; var lPath = 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/clientlogin/logout.php?apikey='+apikey+'&tplid='+init.tpl+'&logout'; $('body').append(''); // $.ajax({ // crossDomain: true, // url: ajaxSend, // type: 'post', // data: { 'obj': { // 'cmd': 'wfLogOut', // 'widgetid': 'previewer', // 'tplid': init.tpl, // 'apikey': apikey // } // }, // success: function(data){ // var dashView; // var dataJSON = JSON.parse(data); // if ( typeof dataJSON !== 'undefined' ) { // if ( dataJSON.ok ) { // window.location.href = "https://www.alco-pop.co.uk/"; // } // } // } // }); }); $('.wf-dashboard-container').on('click','.button-submit-form',function(e){ e.stopImmediatePropagation(); var _dashboard = $('.wf-dashboard-container'); var cmd = { 'profile': 'wfProfile', 'profileEmail': 'wfUpdateEmail', 'profilePassword': 'wfUpdatePassword', 'profileForget': 'wfProfileForgetProcess' }; var req = ['streetAdd','city','pcode']; var ds = { 'profile': { 'fName': _dashboard.find('.submit-form [name="fName"]').val(), 'lName': _dashboard.find('.submit-form [name="lName"]').val(), 'gender': _dashboard.find('.submit-form [name="gender"]').val(), 'dobDay': _dashboard.find('.submit-form [name="dobDay"]').val(), 'dobMonth': _dashboard.find('.submit-form [name="dobMonth"]').val(), 'dobYear': _dashboard.find('.submit-form [name="dobYear"]').val(), 'telp': _dashboard.find('.submit-form [name="telp"]').val(), 'mobile': _dashboard.find('.submit-form [name="mobile"]').val(), 'streetAdd': _dashboard.find('.submit-form [name="streetAdd"]').val(), 'city': _dashboard.find('.submit-form [name="city"]').val(), 'county': _dashboard.find('.submit-form [name="county"]').val(), 'pcode': _dashboard.find('.submit-form [name="pcode"]').val(), 'theme_layout': _dashboard.find('.submit-form [name="theme_layout"]').val(), 'two_step_verification': _dashboard.find('.submit-form [name="two_step_verification"]').val(), 'email_notice': _dashboard.find('.submit-form [name="email_notice"]').val(), 'sms_notice': _dashboard.find('.submit-form [name="sms_notice"]').val(), 'email_market': _dashboard.find('.submit-form [name="email_market"]').val(), 'sms_market': _dashboard.find('.submit-form [name="sms_market"]').val(), 'comm_mob': _dashboard.find('.submit-form [name="comm_mob"]').val(), 'comm_tel': _dashboard.find('.submit-form [name="comm_tel"]').val(), 'comm_email': _dashboard.find('.submit-form [name="comm_email"]').val(), 'comm_sms': _dashboard.find('.submit-form [name="comm_sms"]').val(), 'comm_third': _dashboard.find('.submit-form [name="comm_third"]').val(), }, 'profileEmail': { 'email1': _dashboard.find('.submit-form [name="email1"]').val(), 'email2': _dashboard.find('.submit-form [name="email2"]').val() }, 'profilePassword': { 'curPwd': _dashboard.find('.submit-form [name="curPwd"]').val(), 'newPwd': _dashboard.find('.submit-form [name="newPwd"]').val(), 'newPwd2': _dashboard.find('.submit-form [name="newPwd2"]').val() }, 'profileForget': { 'password': _dashboard.find('.wf-forget-me-pwd').val(), 'request_type': _dashboard.find('.wf-forget-me-request').val(), 'reason': _dashboard.find('.wf-forget-me-reason').val() } }; var _this = $(this); var sel = _this.data('submit'); var button = _this; var hasBlank = false; $(req).each(function(ri,rv){ if ( ds.profile[rv] === '' ) { hasBlank = true; } }); if ( hasBlank ) { button.prop('disabled',false); $('body').prepend('
    Please fill in all the required fields.
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } else { // Disable Button button.prop('disabled',true); if ( typeof cmd[sel] !== 'undefined' ) { if ( typeof ds[sel] !== 'undefined' ) { // Get Dashboard Page $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': cmd[sel], 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': apikey, 'formdata': ds[sel] } }, success: function(data){ button.prop('disabled',false); var data = JSON.parse(data); if ( data.ok ) { if ( sel === 'profileForget' ) { $('body').prepend('
    '+data.msg+'
    '); setTimeout(function(){ window.location.href = 'https://www.alco-pop.co.uk/'; },5000); } else { // Open Dashboard $('.dashboard-menu-section').show(); $('.dashboard-page-section').empty().hide(); $('.dashboard-profile-page-menu-section').hide(); $('.btn.dashboard-page').hide(); $('.btn.dashboard-menu').show(); $('body').prepend('
    '+data.msg+'
    '); setTimeout(function(){ window.location.href = 'https://www.alco-pop.co.uk/dashboard/'; },5000); } } else { $('body').prepend('
    '+data.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }, error: function(){ button.prop('disabled',false); $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }); } } } }); $('.wf-dashboard-container').on('change','select[name="dobMonth"]',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _row = _this.closest('.row'); _row.removeClass('month-selected month-feb month-apr month-jun month-sep month-nov'); switch ( parseInt( _this.val() ) ) { case 2: _row.addClass('month-feb'); break; case 4: _row.addClass('month-apr'); break; case 6: _row.addClass('month-jun'); break; case 9: _row.addClass('month-sep'); break; case 11: _row.addClass('month-nov'); break; default: } if ( parseInt( _this.val() ) > 0 ) { _row.addClass('month-selected'); } }); $('.wf-dashboard-container').on('change','select[name="dobYear"]',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _row = _this.closest('.row'); _row.removeClass('leap-year year-selected'); if ( leapYear(_this.val()) ) { _row.addClass('leap-year'); } if ( parseInt( _this.val() ) > 0 ) { _row.addClass('year-selected'); } else { _row.removeClass('month-selected'); $('[name="dobDay"],[name="dobMonth"]').val(0); } }); $('.wf-dashboard-container').on('click','.forget-me',function(e){ e.stopImmediatePropagation(); var _this = $(this); $('.dashboard-page-section').empty(); $(window).scrollTop(0); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'wfForgetMeBox', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E' } }, success: function(data){ data = JSON.parse(data); if ( typeof data.html !== 'undefined' ) { $('.wf-dashboard-area .block-form.submit-form').remove(); $('.wf-dashboard-area').append(data.html); resizeWidgetFrame(); } } }); }); $('.wf-dashboard-container').on('click','.wf-dashboard-close',function(e){ e.stopImmediatePropagation(); var _this = $(this); if ( $('.ss-object.ss-diary.wf-return-here').length > 0 && $('.wf-temp-hide-payment').length > 0 ) { wfBackToContent(); $('.wf-temp-hide-payment').removeClass('wf-temp-hide-payment'); $('.basket-insert').empty(); updateDiaryDay(Date.now()/1000); } else if ( $('.submit-form-forget-me').length > 0 ) { $('.dashboard-page-section').empty(); $(window).scrollTop(0); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'wfDashboardProfile', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': apikey } }, success: function(data){ var data = JSON.parse(data); if ( typeof data.render !== 'undefined' ) { var renderThis = JSON.parse(data.render); $('.dashboard-page-section').html(renderThis.html); } } }); } else if ( $('.dashboard-page-section').css('display') === 'block' ) { $(window).scrollTop(0); $('.dashboard-menu-section').hide(); $('.dashboard-page-section').empty().hide(); $('.dashboard-profile-page-menu-section').show(); $('.btn.dashboard-page').show(); $('.btn.dashboard-menu').hide(); } else if ( $('.dashboard-profile-page-menu-section').css('display') === 'block' ) { wfBackToDashboardMenu(); } else { $('.wf-dashboard-container').remove(); wfBackToContent(); } }); // $('.wf-dashboard-container').on('click','.view-basket',function(e){ // e.stopImmediatePropagation(); // e.preventDefault(); // if ( $('.ss-diary').length > 0 ) { // $('.ss-diary').each(function(di,dv){ // var _dv = $(dv); // var _dv_id = _dv.prop('id'); // _dv.find('.diary-checkout-content-area').empty(); // _dv.find('.diary-content-area').show(); // viewBasketPageDiaryDashboard(_dv_id); // }); // } else { // viewBasketPage(); // } // wfBackToContent(); // $('.wf-dashboard-area').addClass('back-to-dashboard'); // }); $('.wf-dashboard-container').on('click','.wf-dashboard-profile-open',function(e){ e.stopImmediatePropagation(); $(window).scrollTop(0); $('.dashboard-menu-section').hide(); $('.dashboard-profile-page-menu-section').show(); $('.btn.dashboard-page').show(); $('.btn.dashboard-menu').hide(); }); $('.wf-dashboard-container').on('click','.wf-dashboard-profile-email-open,.wf-dashboard-profile-password-open,.wf-dashboard-profile-profile-open',function(e){ e.stopImmediatePropagation(); var _this = $(this); var cmd = 'wfDashboardProfileEmail'; $(window).scrollTop(0); $('.btn.dashboard-page').show(); $('.dashboard-profile-page-menu-section,.btn.dashboard-menu').hide(); $('.dashboard-page-section').empty().show(); if ( _this.hasClass('wf-dashboard-profile-profile-open') ) { cmd = 'wfDashboardProfile'; } else if ( _this.hasClass('wf-dashboard-profile-password-open') ) { cmd = 'wfDashboardProfilePassword'; } $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': cmd, 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': apikey } }, success: function(data){ var data = JSON.parse(data); if ( typeof data.render !== 'undefined' ) { var renderThis = JSON.parse(data.render); $('.dashboard-page-section').html(renderThis.html); } } }); }); } function wfBackToDashboard(){ $('.wf-dashboard-container').remove(); $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'wfDashboardRender', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': apikey, 'ext': '1', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop" } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { $('article').prepend('
    '+dataJSON.render+'
    '); $('head').append(''); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Dashboard Page Set Up $(window).scrollTop(0); $('.wf-dashboard-container').show(); $('.internal-widget-frame').hide(); $('.wf-dashboard-link-home').hide(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); } },50); } } } }); } function wfBackToContent(){ $(window).scrollTop(0); $('.wf-dashboard-container').hide(); $('.internal-widget-frame').show(); } function wfBackToDashboardMenu(){ $(window).scrollTop(0); $('.wf-dashboard-area').removeClass('back-to-dashboard'); $('.btn.dashboard-page').hide(); $('.btn.dashboard-menu').show(); $('.dashboard-menu-section').show(); $('.dashboard-profile-page-menu-section').hide(); $('.dashboard-page-section').empty().hide(); } // Date Picker function setupDatePicker(){ $('.ss-diary').each(function(di,dv){ var _dv = $(dv); _dv.find('#datetimepicker').datepicker({ format: 'D, dd/M/yyyy', autoclose: true, startDate: new Date(), }).on('changeDate', function(e){ var ts = Math.floor(e.date.getTime()/1000); var c = _dv.find('.internal-widget-frame').data('c'); updateDiaryDay(ts,c); }); }); } setupDatePicker(); function updateDiaryDay(ts,c){ $('.ss-diary').each(function(di,dv){ var _dv = $(dv); $('.alert').remove(); _dv.find('.internal-widget-frame .wf-basket-back').remove(); _dv.find('.basket-insert').hide(); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'diaryUpdateDiary', 'ts': ts, 'c': 0, 'apikey': apikey, 'widgetid': _dv.prop('id'), 'tplid': init.tpl } }, success: function(data){ var dataJSON = JSON.parse(data); if ( typeof dataJSON.html !== 'undefined' ) { //$('.input-group.date').remove(); _dv.find('.diary-content-area').html(dataJSON.html); (function(){ // Get Date From Time String var days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; var tsc = new Date(ts*1000); var tsStr = days[tsc.getDay()]+', '+tsc.getDate()+'/'; tsStr += months[tsc.getMonth()]+'/'; tsStr += tsc.getFullYear(); $('.ss-diary #datetimepicker').val(tsStr); })(); setupDatePicker(); if ( _dv.outerWidth() < 640 ) { var _cid = _dv.find('.diary-consultant-mobile').val(); _dv.find('#table-diary .consultant-slot').addClass('consultant-slot-hide'); _dv.find('#table-diary .consultant-slot-'+_cid).removeClass('consultant-slot-hide'); _dv.find('.change-ts').data('c',_cid); _dv.find('.internal-widget-frame').data('c',_cid); _dv.find('.show-mobile').show(); _dv.find('.hide-mobile').hide(); _dv.find('#table-diary').addClass('mobile'); } else { _dv.find('#table-diary .consultant-slot').removeClass('consultant-slot-hide'); _dv.find('.change-ts').data('c','0'); _dv.find('.internal-widget-frame').data('c','0'); _dv.find('.show-mobile').hide(); _dv.find('.hide-mobile').show(); _dv.find('#table-diary').removeClass('mobile'); } if ( typeof $('html').data('msg') !== 'undefined' ) { if ( $('html').data('msg') !== '' ) { $('body').prepend('
    '+$('html').data('msg')+'
    '); $('html').data('msg',''); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } } } // //removeLoadStatus(); if ( _dv.find('.diary-content-area').hasClass('edit-mode-active') ) { diaryFindClientBookingSpace(_dv,_dv.find('.diary-content-area').data('diary-id'),_dv.find('.consultant-slot.available').data('ts')); } else { diarySlotBooked(); } resizeWidgetFrame(); }, error: function(){ //$('#request-error').addClass('error'); } }); }); } $('body').on('click','.wf-edit-slot-diary-edit-move',function(e){ // Confirm Diary Position var _this = $(this); var _widget = _this.closest('.ss-object'); var diaryID = _widget.find('.diary-content-area').data('diary-id'); var selectedSlot = _widget.find('.slot-edit-pending').eq(0); var timestamp = selectedSlot.data('timestamp'); var consultant = selectedSlot.data('consultant'); var consultantName = selectedSlot.data('name'); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'diaryConfirmClientBookingSpace', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'diaryID': diaryID, 'consultant': consultant, 'consultantName': consultantName, 'timestamp': timestamp, 'day': _widget.find('#datetimepicker').val(), } }, success: function(data){ var dataJSON = JSON.parse(data); //console.log(dataJSON); if ( typeof dataJSON.msg !== 'undefined' ) { $('html').data('msg',dataJSON.msg); if ( dataJSON.ok ) { _widget.find('.wf-date-cancel-bar').hide(); _widget.find('.diary-content-area').removeClass('edit-mode-active').removeData('diary-id','diary-id2'); updateDiaryDay(timestamp,consultant); } } } }); }); function diaryCancelMove(_widget,timestamp){ _widget.find('.wf-date-cancel-bar').hide(); _widget.find('.diary-content-area').removeClass('edit-mode-active').removeData('diary-id','diary-id2'); updateDiaryDay(timestamp); } $('body').on('click','.wf-diary-cancel-move-button',function(e){ e.stopImmediatePropagation(); var months = { 'jan': 0, 'feb': 1, 'mar': 2, 'apr': 3, 'may': 4, 'jun': 5, 'jul': 6, 'aug': 7, 'sep': 8, 'oct': 9, 'nov': 10, 'dec': 11 }; var _this = $(this); var _widget = _this.closest('.ss-object'); var timestamp = _widget.find('#datetimepicker').val(); timestamp = timestamp.split(',')[1].trim().split('/'); var newTime = new Date(); newTime.setDate(timestamp[0]); newTime.setMonth(months[timestamp[1].toLowerCase()]) newTime.setFullYear(timestamp[2]); timestamp = newTime.getTime() / 1000; diaryCancelMove(_widget,timestamp); }); $('body').on('click','.wf-edit-slot-diary-cancel-move',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _widget = _this.closest('.ss-object'); var timestamp = _this.data('ts'); diaryCancelMove(_widget,timestamp); }); $('.ss-diary .internal-widget-frame').on('change','.diary-consultant-mobile',function(e){ e.stopImmediatePropagation(); var _widget = $(this).closest('.ss-object'); var _cid = $(this).val(); _widget.find('.diary-consultant-mobile').val(_cid); _widget.find('#table-diary .consultant-slot').addClass('consultant-slot-hide'); _widget.find('#table-diary .consultant-slot-'+_cid).removeClass('consultant-slot-hide'); }); $('.ss-diary').each(function(di,dv){ var _dv = $(dv); if ( _dv.outerWidth() < 640 ) { var _cid = _dv.find('.diary-consultant-mobile').val(); _dv.find('#table-diary .consultant-slot').addClass('consultant-slot-hide'); _dv.find('#table-diary .consultant-slot-'+_cid).removeClass('consultant-slot-hide'); _dv.find('.change-ts').data('c',_cid); _dv.find('.internal-widget-frame').data('c',_cid); _dv.find('.show-mobile').show(); _dv.find('.hide-mobile').hide(); _dv.find('#table-diary').addClass('mobile'); } else { _dv.find('#table-diary .consultant-slot').removeClass('consultant-slot-hide'); _dv.find('.change-ts').data('c','0'); _dv.find('.internal-widget-frame').data('c','0'); _dv.find('.show-mobile').hide(); _dv.find('.hide-mobile').show(); _dv.find('#table-diary').removeClass('mobile'); } // Convert Bootstrap // if ( _dv.outerWidth < 768 ) { // xs // $('.ss-diary .wf-book-diary-body .masonry-item').removeClass('col-lg-6 col-md-6').addClass('col-lg-12 col-md-12'); // } else if ( _dv.outerWidth >= 768 && _dv.outerWidth < 992 ) { // sm // $('.ss-diary .wf-book-diary-body .masonry-item').removeClass('col-lg-6 col-md-6').addClass('col-lg-12 col-md-12'); // } else if ( _dv.outerWidth >= 992 && _dv.outerWidth < 1200 ) { // md // $('.ss-diary .wf-book-diary-body .masonry-item').removeClass('col-lg-6 col-md-6 col-xs-12 col-sm-12').addClass('col-lg-6 col-md-6 col-xs-6 col-col-sm-6'); // } else { // $('.ss-diary .wf-book-diary-body .masonry-item').removeClass('col-lg-6 col-md-6 col-xs-12 col-sm-12').addClass('col-lg-6 col-md-6 col-xs-6 col-col-sm-6'); // //col-lg-6 col-md-6 col-sm-12 col-xs-12 // } }); $('.ss-diary .internal-widget-frame').on('click','.change-ts',function(e){ e.stopImmediatePropagation(); var ts = $(this).data('ts'); var c = $(this).data('c'); updateDiaryDay(ts,c); }); $('body').on('click','.wf-edit-slot-diary-cancel',function(e){ var _this = $(this); var diaryID = _this.data('diary-id'); var timestamp = _this.data('ts'); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'diaryDeleteAppointment', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'diaryID': diaryID, 'timestamp': timestamp } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.ok ) { updateDiaryDay(timestamp); } } }); }); $('.ss-diary .internal-widget-frame').on('click','.wf-book-diary-close',function(e){ e.stopImmediatePropagation(); var _widget = $(this).closest('.ss-object'); _widget.find('.wf-diary-hide-book').addClass('hide'); _widget.find('.consultant-slot').removeClass('active'); _widget.find('.wf-book-diary-body').empty(); _widget.find('.internal-widget-frame').removeClass('diary-book-at-login'); resizeWidgetFrame(); }); $('.ss-diary .internal-widget-frame').on('click','.wf-edit-diary-close',function(e){ e.stopImmediatePropagation(); var _widget = $(this).closest('.ss-object'); _widget.find('.wf-diary-hide-edit').addClass('hide'); _widget.find('.consultant-slot').removeClass('active'); _widget.find('.wf-edit-diary-body').empty(); _widget.find('.internal-widget-frame').removeClass('diary-book-at-login'); resizeWidgetFrame(); }); $('.ss-diary .internal-widget-frame').on('click','.available.consultant-slot',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _widget = _this.closest('.ss-object'); var ts = _this.data('timestamp'); var consultant = _this.data('consultant'); var consultantName = _this.data('name'); if ( _this.hasClass('wf-diary-move-to-this-slot') ) { diaryMoveClientBookingShow(_widget,ts,consultant,consultantName); return false; } else if ( _widget.find('.diary-content-area').hasClass('edit-mode-active') ) { return false; } if ( _this.hasClass('edit-slot-move-to') ) { var diaryID = _widget.find('.diary-content-area').data('diary-id2'); diaryConfirmMoveSlot(_this,_widget,ts,consultant,consultantName,diaryID); return false; } var isDepositBooking = "0"; var consultantGetCols = $('#table-diary > thead > tr >th.consultant-slot').length + 1; if ( $('#table-diary').hasClass('mobile') ) { consultantGetCols = 2; } _widget.find('.internal-widget-frame').removeClass('diary-book-at-login'); _widget.find('.wf-diary-hide-book').addClass('hide'); _this.closest('tr').next('tr.wf-diary-hide-book').removeClass('hide'); _widget.find('.wf-diary-hide-book td').attr('colspan',consultantGetCols); _widget.find('.consultant-slot').removeClass('active'); _this.addClass('active'); _widget.find('.wf-book-diary-body').empty(); var insertAtSlot = _this.closest('tr').next('tr.wf-diary-hide-book').find('.wf-book-diary-body'); _widget.find('.wf-diary-header-consultant-name').html(consultantName); if ( parseInt( isDepositBooking ) < 1 ) { _widget.find('.wf-diary-price-counter').remove(); } $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'diaryBookConsultant', 'ts': ts, 'c': consultant, 'cname': consultantName, 'isDepositBooking': isDepositBooking, 'apikey': apikey, 'widgetid': _widget.prop('id'), 'tplid': init.tpl } }, success: function(data){ var dataJSON = JSON.parse(data); if ( typeof dataJSON.html !== 'undefined' ) { insertAtSlot.html(dataJSON.html); // if ( $('html').hasClass('device-desktop') ) { // $(this).closest('.ss-object').find('.masonry-grid').masonry({ // itemSelector: '.masonry-item' // }); // } _widget.find('.masonry-grid').masonry({ itemSelector: '.masonry-item' }); _widget.find('.service-duration').text(0); _widget.find('.service-price,.wf-diary-book-total').text('0.00'); // Diary Update $('.diary-service').change(function(){ var $this = $(this), dmins = 0, dprice = 0; dmain = 0; dsub = 0; dsHTML = ''; var _widget = $(this).closest('.ss-object'); _widget.find('.diary-service:checked').each(function(){ dmins += parseInt(this.value); dprice += parseFloat(this.dataset.price); if ( _widget.find('.internal-widget-frame .wf-diary-book-confirm-table').hasClass('wf-diary-free-book') ) { dsHTML += ''+this.dataset.name+'
    Duration: '+this.value+''; } else { dsHTML += ''+this.dataset.name+'
    Duration: '+this.value+''+( parseInt(this.dataset.sub) === 1 ? ' ' : '' )+'£'+parseFloat(this.dataset.price).toFixed(2)+''; } if ( parseInt(this.dataset.sub) === 1 ) { dsub += parseFloat(this.dataset.price); } else { dmain += parseFloat(this.dataset.price); } }); _widget.find('.wf-book-diary-table-confirm').html(dsHTML); _widget.find('.service-duration').text(dmins); _widget.find('.field-duration').val(dmins) _widget.find('.wf-diary-book-oneoff').text( dmain.toFixed(2) ); _widget.find('.wf-diary-book-sub').text( dsub.toFixed(2) ); _widget.find('.service-price,.wf-diary-book-total').text( dprice.toFixed(2) ); }); // Diary Uploader (function(){ _widget.find('#input--uploader').liteUploader({ //script: '//'+init.sub_domain+'.prosoftwareuk.co.uk/script/php/html/client/index.php', script: '//'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', params: { 'obje': JSON.stringify({ 'cmd': 'file_upload', 'apikey': apikey, 'widgetid': _widget.prop('id'), 'tplid': init.tpl, 'part': 'diary', 'key_id': "1542209023" }) } }) .on('lu:success', function(e, response) { response = JSON.parse(response); if ( response.ok ) { _widget.find('#uploader--result').val(response.url); } else { $('body').prepend('
    '+response.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } _widget.find('#input--uploader').val(''); _widget.find('#uploader--button').prop('disabled', false).html(''); }) .on('lu:progress', function(e, response) { _widget.find('#input--uploader').val(''); _widget.find('#uploader--button').prop('disabled', true).html(' Browse'); }); })(); resizeWidgetFrame(); } } }); }); $('body').on('click','.wf-note',function(e){ e.stopImmediatePropagation(); if ( $(this).find('.wf-expand-msg').hasClass('hide') ) { $(this) .find('.wf-expand-msg-show') .hide() .closest('.label') .removeClass('info-icon-only') .find('.wf-expand-msg') .removeClass('hide'); } else { $(this) .find('.wf-expand-msg') .addClass('hide') .closest('.label') .addClass('info-icon-only') .find('.wf-expand-msg-show') .show(); } //if ( $('html').hasClass('device-desktop') ) { $(this).closest('.ss-object').find('.masonry-grid').masonry({ itemSelector: '.masonry-item' }); //} resizeWidgetFrame(); }); // $('body').on('click','.wf-expand-msg-show',function(e){ // e.stopImmediatePropagation(); // $(this) // .hide() // .closest('.label') // .removeClass('info-icon-only') // .find('.wf-expand-msg') // .removeClass('hide'); // $(this).closest('.ss-object').find('.masonry-grid').masonry({ // itemSelector: '.masonry-item' // }); // resizeWidgetFrame(); // }); // $('body').on('click','.wf-expand-msg',function(e){ // e.stopImmediatePropagation(); // $(this) // .addClass('hide') // .closest('.label') // .addClass('info-icon-only') // .find('.wf-expand-msg-show') // .show(); // $(this).closest('.ss-object').find('.masonry-grid').masonry({ // itemSelector: '.masonry-item' // }); // resizeWidgetFrame(); // }); bookEventNow = function(){ $('.book-event-now-activated').each(function(bi,bv){ var _bv = $(bv); var eventID = _bv.data('event-id'); var ticketID = _bv.data('ticket-id'); var widgetID = _bv.closest('.ss-object').prop('id'); if ( init.loggedin ) { $.ajax({ crossDomain: true, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'event_add_basket', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'ticketID': ticketID, 'eventID': eventID, } }, success: function(data){ var dataJSON = JSON.parse(data); refreshBasketCounter(dataJSON['basket']['counter']); if ( dataJSON.ok ) { viewBasketPage(widgetID); } }, error: function(){ _bv.removeClass('book-event-now-activated'); $('.internal-widget-frame').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }); } else { _bv.addClass('book-event-now-activated').data({'beid': eventID, 'btid': ticketID, 'bwid': widgetID }); modalBoxes(); } }); } diaryBook = function diaryBook(){ $('.ss-diary').each(function(dfi,dfv){ var _widget = $(dfv); _widget.find('.internal-widget-frame').removeClass('diary-book-at-login'); if ( typeof _widget.find('.internal-widget-frame').data('diary-booking') !== 'undefined' ) { if ( _widget.find('.internal-widget-frame').data('diary-booking') !== '' ) { var diaryJSON = JSON.parse( _widget.find('.internal-widget-frame').data('diary-booking') ); var serviceID = {}; for ( diaryKey in diaryJSON ){ if ( diaryKey.indexOf('sid') >= 0 ) { var getSid = parseInt(diaryKey.replace('sid[','').replace(']','')); serviceID[getSid] = diaryJSON[diaryKey]; } } // prosoftwareuk.co.uk/api/form/diary/index.php $.ajax({ crossDomain: true, beforeSend: function(){ _widget.find('.diary-book-now').addClass('wf-disabled'); }, url: '//'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfDiaryCheckSlot', 'ts': diaryJSON.timestamp, 'cid': diaryJSON.consultant_id, 'sid': serviceID, 'apikey': apikey, 'widgetid': _widget.prop('id'), 'tplid': init.tpl } }, success: function(datajs) { var data = JSON.parse(datajs); if ( !data.ok ) { $('body').prepend('
    '+data.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); _widget.find('.diary-book-now').removeClass('wf-disabled'); } else { $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'diaryBookServicesExpress', 'ts': diaryJSON.timestamp, 'c': diaryJSON.consultant_id, 'sid': serviceID, 'diary_message': diaryJSON.diary_message, 'diary_attachment': diaryJSON.diary_attachment, 'apikey': apikey, 'widgetid': _widget.prop('id'), 'tplid': init.tpl } }, success: function(data){ var dataJSON = JSON.parse(data); _widget.find('.diary-book-now').removeClass('wf-disabled'); if ( dataJSON.ok ) { if ( typeof dataJSON.no_checkout !== 'undefined' ) { if ( parseInt( dataJSON.no_checkout ) === 1 ) { $('html').data('msg',dataJSON.msg); updateDiaryDay(diaryJSON.timestamp,diaryJSON.consultant_id); } } else if ( typeof dataJSON.output !== 'undefined' ) { if ( typeof dataJSON.output.html !== 'undefined' ) { _widget.find('.basket-insert').show(); if ( _widget.find('.widget-back-btn').length === 0 ) { var backBtn = '
    Back
    '; if ( _widget.find('.wf-location-select').length > 0 ) { _widget.find('.wf-location-select').hide(); } _widget.find('.navbar .container-fluid').prepend(backBtn); } _widget.find('.diary-content-area,.wf-date-picker-bar').hide(); _widget.find('.diary-checkout-content-area').show().html(dataJSON.output.html); //$(window).scrollTop(0); } } } else { updateDiaryDay(diaryJSON.timestamp,diaryJSON.consultant_id); $('body').prepend('
    '+dataJSON.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } // //removeLoadStatus(); resizeWidgetFrame(); }, error: function(){ _widget.find('.diary-book-now').removeClass('wf-disabled'); //$('#request-error').addClass('error'); } }); } }, error: function(){ _widget.find('.diary-book-now').removeClass('wf-disabled'); } }); } } }); } $('.ss-diary .internal-widget-frame').on('click','.diary-book-now',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _widget = $(this).closest('.ss-object'); var bookArray = { 'cmd': '_diary', 'sub_url': init.sub_domain, 'consultant_id': _widget.find('input[name="consultant_id"]').val(), 'durations': _widget.find('.field-duration').val(), 'services': _widget.find('.field-services').val(), 'timestamp': _widget.find('input[name="timestamp"]').val(), 'api_key': apikey, 'validate_availability': '', 'deposit_type': _widget.find('input[name="deposit_type"]').val(), 'deposit_cost': _widget.find('input[name="deposit_cost"]').val(), 'diary_message': _widget.find('textarea[name="diary_message"]').val(), 'diary_attachment': _widget.find('#uploader--result').val() }; if ( _this.hasClass('wf-disabled') ) { return false; } if ( _widget.find('.diary-service').is(':checked') ) { _widget.find('.diary-service:checked').each(function(si,sv){ bookArray[$(sv).attr('name')] = $(sv).val(); }); _widget.find('.internal-widget-frame').data('diary-booking',JSON.stringify(bookArray)); if ( init.loggedin ) { diaryBook(); } else { _widget.find('.internal-widget-frame').addClass('diary-book-at-login'); modalBoxes(); } } }); wfPrepareCheckoutPage = function(mode,widgetID){ var cmd = 'wfPrepareCheckout'; var _widget = $('#'+widgetID); if ( _widget.hasClass('ss-products') || _widget.hasClass('ss-eventpro') || _widget.hasClass('ss-courses') ) { _widget.find('.internal-widget-frame').removeClass('widget-book-at-login'); } if ( mode === 'diary_express' ) { $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'wfPrepareCheckoutDiaryExpress', 'c': $('.internal-widget-frame .wf-checkout-click[data-func="add_card_diary_express"]').data('checkout-id'), 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.ok ) { $('.diary-checkout-content-area').html(dataJSON.html); } else { $('.diary-checkout-content-area .alert').remove(); $('body').prepend('
    '+dataJSON.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },2000); } resizeWidgetFrame(); }, error: function(){ $('.diary-checkout-content-area .alert').remove(); $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },2000); resizeWidgetFrame(); } }); } else { $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'wfPrepareCheckout', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl } }, success: function(data){ var dataJSON = JSON.parse(data); if ( dataJSON.ok ) { _widget.find('.basket-insert').html('
    '+dataJSON.html+'
    '); } else { _widget.find('.wf-basket-frame .alert').remove(); $('body').prepend('
    '+dataJSON.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },2000); } resizeWidgetFrame(); }, error: function(){ $('.wf-basket-frame .alert').remove(); $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },2000); resizeWidgetFrame(); } }); } } $('.ss-diary .internal-widget-frame').on('change','.wf-checkout-change',function(e){ e.stopPropagation(); var _widget = $(this).closest('.ss-object'); var _this = $(this); var _f = _this.data('func'); var fn = { 'removeCardAlert': function(){ _widget.find('.wf-checkout-alert-card').remove(); } }; if ( typeof fn[_f] !== 'undefined' ) { fn[_f](); } }); // Main Checkout $('.internal-widget-frame').on('click','.wf-checkout-click',function(e){ e.stopPropagation(); var _widget = $(this).closest('.ss-object'); var widgetID = _widget.prop('id'); var _this = $(this); if ( typeof widgetID === 'undefined' ) { _widget = $('#dashboard-basket-area'); widgetID = 'dashboard-basket-area'; } if ( _this.hasClass('wf-disabled') ) { return false; } var _f = _this.data('func'); var fn = { 'pay_now_diary_express': function(){ $('.wf-checkout-alert').remove(); _widget.find('.internal-widget-frame').removeClass('diary-book-at-login'); var payData = { 'cmd': 'wfCheckoutPayNowDiaryExpress', 'apikey': apikey, 'widgetid': _this.closest('.ss-object').prop('id'), 'tplid': init.tpl, 'pm_card': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="pm_card"]:checked').val(), '_co_token': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="_co_token"]').val(), '_csrf_token': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="_csrf_token"]').val(), '_total_pay': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="_total_pay"]').val(), 'wfTotalPay': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="wfTotalPay"]').val(), '_total_postage': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="_total_postage"]').val(), 'paypal_payer_id': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="paypal_payer_id"]').val(), 'paypal_payment_id': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="paypal_payment_id"]').val(), 'paypal_token': _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="paypal_token"]').val() }; if ( _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="tc"][type="checkbox"]').length > 0 ) { payData.tc = _widget.find('.internal-widget-frame .diary-checkout-content-area input[name="tc"]').is(':checked') ? '1' : '0'; } else { payData.tc = '1'; } if ( typeof payData.pm_card === 'undefined' ) { $('body').prepend('
    Please select a credit / debit card before continuing.
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); return false; } $.ajax({ type: 'POST', url: ajaxSend, data: { 'obj': payData }, dataType: 'json', cache: false, beforeSend: function(){ _this.addClass('wf-disabled'); }, success: function(data) { _this.removeClass('wf-disabled'); if ( data.ok ) { $('html').data('msg',data.msg); updateDiaryDay(Date.now()/1000); _widget.find('.diary-checkout-content-area').empty(); _widget.find('.diary-content-area,.wf-date-picker-bar').show(); //$(window).scrollTop(0); _widget.find('.widget-back-btn').remove(); } else { $('body').prepend('
    '+data.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } resizeWidgetFrame(); }, error: function() { _this.removeClass('wf-disabled'); $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); resizeWidgetFrame(); } }); }, 'cancel_diary_express': function(){ _widget.find('.internal-widget-frame').removeClass('diary-book-at-login'); _widget.find('.diary-checkout-content-area').empty(); _widget.find('.diary-content-area').show(); _widget.find('.wf-date-picker-bar').show(); //$(window).scrollTop(0); _widget.find('.widget-back-btn').remove(); _widget.find('.basket-insert').hide(); resizeWidgetFrame(); }, 'cancel': function(){ _widget.find('.internal-widget-frame').removeClass('widget-book-at-login'); if ( _widget.hasClass('ss-products') ) { _widget.find('.basket-insert').empty(); _widget.find('.wf-main-content-area').show(); _widget.find('.wf-basket-back').remove(); resizeWidgetFrame(); //resetSaleWidget(widgetID); //_widget.find('.wf-basket-back').remove(); } else if ( _widget.hasClass('ss-eventpro') || _widget.hasClass('ss-courses') ) { _widget.find('.basket-insert').empty(); _widget.find('.wf-main-content-area').show(); _widget.find('.wf-basket-back').remove(); resizeWidgetFrame(); //resetBasketWidget(widgetID); //_widget.find('.wf-basket-back').remove(); } else if ( _widget.hasClass('ss-diary') ) { updateDiaryDay(Date.now()/1000); } }, 'add_card_diary_express': function(){ // Remove Messages _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel .alert').remove(); Stripe.setPublishableKey( "pk_live_6qn1phfMzMM2hy1MsLKqN5fM" ); var $form = { 'number': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_no"]').val(), 'cvc': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_cvc"]').val(), 'exp_month': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_month"]').val(), 'exp_year': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_year"]').val(), }; Stripe.card.createToken($form, function(status,response){ if (response.error) { _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel') .prepend('
    '+response.error.message+'
    '); } else { // token contains id, last4, and card type var token = response.id; $.ajax({ type: 'POST', url: ajaxSend, data: { 'obj': { 'stripe_token': token, 'clientID': _this.data('client-id'), 'cmd': 'wfBankCardAdd', 'apikey': apikey, 'widgetid': _widget.prop('id'), 'tplid': init.tpl } }, dataType: 'json', cache: false, success: function(data) { if ( data.ok ) { // Remove Errors _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel .alert').remove(); // Clear Inputs _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel input').val(''); _widget.find('.internal-widget-frame .wf-checkout-add-card').dropdown('toggle'); wfPrepareCheckoutPage('diary_express',_widget.prop('id')); } else { $('body').prepend('
    '+data.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }, error: function() { $('body').prepend('
    Error processing your card. Please try again later!
    '); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } }); } }); }, 'add_card': function(){ // Remove Messages _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel .alert').remove(); Stripe.setPublishableKey( "pk_live_6qn1phfMzMM2hy1MsLKqN5fM" ); var $form = { 'number': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_no"]').val(), 'cvc': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_cvc"]').val(), 'exp_month': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_month"]').val(), 'exp_year': _widget.find('.internal-widget-frame .wf-add-card-input[name="card_year"]').val(), }; Stripe.card.createToken($form, function(status,response){ if (response.error) { _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel') .prepend('
    '+response.error.message+'
    '); } else { // token contains id, last4, and card type var token = response.id; $.ajax({ type: 'POST', url: ajaxSend, data: { 'obj': { 'stripe_token': token, 'clientID': _this.data('client-id'), 'cmd': 'wfBankCardAdd', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl } }, dataType: 'json', cache: false, success: function(data) { if ( data.ok ) { // Remove Errors _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel .alert').remove(); // Clear Inputs _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel input').val(''); _widget.find('.internal-widget-frame .wf-checkout-add-card').dropdown('toggle'); wfPrepareCheckoutPage('',widgetID); } else { _widget.find('.internal-widget-frame .wf-checkout-add-card') .closest('.btn-group') .find('.panel') .prepend('
    '+data.msg+'
    '); } resizeWidgetFrame(); }, error: function() { // button.prop('disabled', false); // notify.addClass('error').text('Error processing your card. Please try again later!'); } }); } }); }, 'pay_now': function(){ _this.addClass('wf-disabled'); _widget.find('.wf-checkout-alert').remove(); var payData = { 'cmd': 'wfCheckoutPayNow', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'pm_card': _widget.find('.internal-widget-frame .wf-basket-frame input[name="pm_card"]:checked').val(), '_co_token': _widget.find('.internal-widget-frame .wf-basket-frame input[name="_co_token"]').val(), '_csrf_token': _widget.find('.internal-widget-frame .wf-basket-frame input[name="_csrf_token"]').val(), '_total_pay': _widget.find('.internal-widget-frame .wf-basket-frame input[name="_total_pay"]').val(), 'wfTotalPay': _widget.find('.internal-widget-frame .wf-basket-frame input[name="wfTotalPay"]').val(), '_total_postage': _widget.find('.internal-widget-frame .wf-basket-frame input[name="_total_postage"]').val(), 'paypal_payer_id': _widget.find('.internal-widget-frame .wf-basket-frame input[name="paypal_payer_id"]').val(), 'paypal_payment_id': _widget.find('.internal-widget-frame .wf-basket-frame input[name="paypal_payment_id"]').val(), 'paypal_token': _widget.find('.internal-widget-frame .wf-basket-frame input[name="paypal_token"]').val() }; if ( _widget.find('.internal-widget-frame .wf-basket-frame input[name="tc"][type="checkbox"]').length > 0 ) { payData.tc = _widget.find('.internal-widget-frame .wf-basket-frame input[name="tc"]').is(':checked') ? '1' : '0'; } else { payData.tc = '1'; } if ( typeof payData.pm_card === 'undefined' ) { if ( widgetID === 'dashboard-basket-area' ) { $('body') .prepend('
    Please select a credit / debit card before continuing.
    '); } else { $('body') .prepend('
    Please select a credit / debit card before continuing.
    '); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); _this.removeClass('wf-disabled'); return false; } $.ajax({ type: 'POST', url: ajaxSend, data: { 'obj': payData }, dataType: 'json', cache: false, success: function(data) { if ( data.ok ) { if ( widgetID === 'dashboard-basket-area' ) { _widget.find('.wf-temp-hide-payment').removeClass('wf-temp-hide-payment'); $('body').prepend('
    '+data.msg+'
    '); $('.view-basket .badge').html('0'); setTimeout(function(){ window.location.href = 'https://www.alco-pop.co.uk/dashboard/basket/'; },5000); } else { _widget.find('.wf-temp-hide-payment').removeClass('wf-temp-hide-payment'); $('body').prepend('
    '+data.msg+'
    '); $('.view-basket .badge').html('0'); _widget.find('.basket-insert').empty(); _widget.find('.wf-main-content-area').show(); _widget.find('.wf-basket-back').remove(); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } else { if ( widgetID === 'dashboard-basket-area' ) { $('body').prepend('
    '+data.msg+'
    '); } else { $('body') .prepend('
    '+data.msg+'
    '); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); _this.removeClass('wf-disabled'); } resizeWidgetFrame(); }, error: function() { if ( widgetID === 'dashboard-basket-area' ) { $('body').prepend('
    Please try again later.
    '); } else { $('body') .prepend('
    Please try again later.
    '); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); _this.removeClass('wf-disabled'); resizeWidgetFrame(); } }); }, 'add_voucher': function(){ _widget.find('.wf-checkout-alert').remove(); var payData = { 'cmd': 'wfCheckoutUseVoucher', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'code': _widget.find('.internal-widget-frame .wf-basket-frame #promo-code').val(), 'extra': _this.data('extra'), }; if ( _widget.find('.internal-widget-frame .wf-basket-frame #promo-code').val() === '' ) { if ( widgetID === 'dashboard-basket-area' ) { $('body').prepend('
    Please enter promo code.
    '); } else { $('body') .prepend('
    Please enter promo code.
    '); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); return false; } $.ajax({ type: 'POST', url: ajaxSend, data: { 'obj': payData }, dataType: 'json', cache: false, success: function(data) { if ( data.ok ) { //_widget.find('.wf-temp-hide-payment').removeClass('wf-temp-hide-payment'); if ( widgetID === 'dashboard-basket-area' ) { $('body').prepend('
    '+data.msg+'
    '); } else { $('body').prepend('
    '+data.msg+'
    '); } wfPrepareCheckoutPage('',widgetID); setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } else { if ( widgetID === 'dashboard-basket-area' ) { $('body').prepend('
    '+data.msg+'
    '); } else { $('body') .prepend('
    '+data.msg+'
    '); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); } resizeWidgetFrame(); }, error: function() { if ( widgetID === 'dashboard-basket-area' ) { $('body').prepend('
    Please try again later.
    '); } else { $('body') .prepend('
    Please try again later.
    '); } setTimeout(function(){ $('.alert-top-dismissable').fadeOut('slow',function(){ $('.alert-top-dismissable').remove(); }); },5000); resizeWidgetFrame(); } }); } }; if ( typeof fn[_f] !== 'undefined' ) { fn[_f](); } }); $('.ss-diary .internal-widget-frame').on('click','.widget-back-btn',function(e){ e.stopImmediatePropagation; e.preventDefault(); $('.diary-checkout-content-area').empty(); $('.diary-content-area,.wf-date-picker-bar').show(); //$(window).scrollTop(0); $('.ss-diary .widget-back-btn').remove(); $('.ss-diary .consultant-slot.available.active').removeClass('active'); $('.wf-diary-hide-book').addClass('hide'); resizeWidgetFrame(); }); // Basket Events $('#dashboard-basket-area .internal-widget-frame, .ss-products .internal-widget-frame,.ss-courses .internal-widget-frame,.ss-eventpro .internal-widget-frame').on('change click','.wf-basket-change',function(e){ e.stopImmediatePropagation(); var _this = $(this); var _section = _this.data('update'); var _type = _this.data('type'); var changeEvents = ['ticket-guest-info','qty','delivery','postage']; var clickEvents = ['delete','cancel','refresh']; var widgetID = _this.closest('.ss-object').prop('id'); var _widget = _this.closest('.ss-object'); if ( typeof widgetID === 'undefined' ) { _widget = $('#dashboard-basket-area'); widgetID = 'dashboard-basket-area'; } var wfChangeAjaxBefore = function(){ }; if ( _this.hasClass('wf-disabled') ) { return false; } if ( e.type !== 'change' && changeEvents.indexOf(_section) >= 0 ) { return false; } switch ( _section ) { case 'basket': window.location.href = "https://www.alco-pop.co.uk/dashboard/basket/"; break; case 'delivery': var wfChangeAjaxSuccess = function(dataJSON){ viewBasketPage(widgetID); }; switch ( _type ) { case 'hire': case 'sale': var basketData = { 'obj': { 'cmd': 'wfBasketDeliveryMethod', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'delivery': _this.val(), 'type': _type } }; break; } break; case 'postage': var wfChangeAjaxSuccess = function(dataJSON){ viewBasketPage(widgetID); }; switch ( _type ) { case 'hire': case 'sale': var basketData = { 'obj': { 'cmd': 'wfBasketPostage', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'postage': _this.val(), 'type': _type } }; break; } break; case 'ticket-guest-info': var basketData = { 'obj': { 'cmd': 'wfBasketEventGuestUpdate', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'val': _this.val(), 'field': _this.data('field'), 'guestno': _this.data('guest'), 'ticketid': _this.data('id') } }; $('#'+widgetID+' .wf-ticket-guest-information[data-guest="'+_this.data('guest')+'"][data-id="'+_this.data('id')+'"][data-field="'+_this.data('field')+'"]').val(_this.val()); break; case 'qty': var qty = _this.val(); var id = _this.data('id'); var wfChangeAjaxSuccess = function(dataJSON){ viewBasketPage(widgetID); }; switch ( _type ) { case 'event': var basketData = { 'obj': { 'cmd': 'wfBasketQtyItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'id': id, 'type': 'event', 'qty': qty } }; break; case 'hire': case 'sale': var basketData = { 'obj': { 'cmd': 'wfBasketQtyItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'id': id, 'type': _type, 'qty': qty } }; break; default: } break; case 'back': if ( widgetID === 'dashboard-basket-area' ) { window.location.href = 'https://www.alco-pop.co.uk/'; } else { _widget.find('.internal-widget-frame').removeClass('widget-book-at-login'); _widget.find('.wf-temp-hide-payment').removeClass('wf-temp-hide-payment'); _widget.find('.wf-main-content-area').show(); _widget.find('.basket-insert').empty(); _widget.find('.wf-basket-back').remove(); resizeWidgetFrame(); } break; case 'cancel': _widget.find('.internal-widget-frame').removeClass('widget-book-at-login'); var basketData = { 'obj': { 'cmd': 'wfBasketCancel', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, } }; var wfChangeAjaxSuccess = function(dataJSON){ if ( getContinueShopping !== '' ) { window.location.href = getContinueShopping; } else { viewBasketPage(widgetID); } }; break; case 'refresh': viewBasketPage(widgetID); break; case 'remove': var wfChangeAjaxSuccess = function(dataJSON){ viewBasketPage(widgetID); }; switch ( _this.data('type') ) { case 'diary': var ts = $(this).data('ts'); var id = $(this).data('id'); var basketData = { 'obj': { 'cmd': 'wfBasketCancelItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'ts': ts, 'id': id, 'type': 'diary' } }; break; case 'course': var id = $(this).data('id'); var basketData = { 'obj': { 'cmd': 'wfBasketCancelItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'id': id, 'type': 'course' } }; break; case 'training': var id = $(this).data('id'); var basketData = { 'obj': { 'cmd': 'wfBasketCancelItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'id': id, 'type': 'training' } }; break; case 'event': var id = $(this).data('id'); var basketData = { 'obj': { 'cmd': 'wfBasketCancelItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'id': id, 'type': 'event' } }; break; case 'hire': case 'sale': var id = $(this).data('id'); var basketData = { 'obj': { 'cmd': 'wfBasketCancelItem', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl, 'id': id, 'type': _type } }; break; default: } break; case 'free_event_add': var wfChangeAjaxBefore = function(){ _this.addClass('wf-disabled'); }; var basketData = { 'obj': { 'cmd': 'wfEventBookFree', 'apikey': apikey, 'widgetid': widgetID, 'tplid': init.tpl } }; var wfChangeAjaxSuccess = function(dataJSON){ if ( dataJSON.ok ) { _widget.find('.internal-widget-frame').removeClass('widget-book-at-login'); _widget.find('.wf-temp-hide-payment').removeClass('wf-temp-hide-payment'); //_widget.find('.wf-main-content-area').show(); //_widget.find('.basket-insert').empty(); //_widget.find('.wf-basket-back').remove(); //resetBasketWidgets(); $('.wf-basket-frame .alert').remove(); //$('body').prepend('
    '+dataJSON.msg+'
    '); $('body').prepend('
    '+dataJSON.msg+'
    '); setTimeout(function(){ window.location.href = "https://www.alco-pop.co.uk/dashboard/basket/"; //$('.alert-top-dismissable').remove(); },2000); refreshBasketCounter(0); _this.removeClass('wf-disabled'); resizeWidgetFrame(); } else { $('.wf-basket-frame .alert').remove(); $('body').prepend('
    '+dataJSON.msg+'
    '); //$('body').prepend('
    '+dataJSON.msg+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },2000); _this.removeClass('wf-disabled'); } }; break; default: } if ( typeof basketData !== 'undefined' ) { $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: basketData, beforeSend: function(){ wfChangeAjaxBefore(); }, success: function(data){ var dataJSON = JSON.parse(data); if ( typeof wfChangeAjaxSuccess !== 'undefined' ) { wfChangeAjaxSuccess(dataJSON); } }, error: function(){ if ( _this.hasClass('wf-disabled') ) { _this.removeClass('wf-disabled'); } $('body').prepend('
    Please try again later.
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },2000); //$('#request-error').addClass('error'); } }); } }); $('#dashboard-basket-area .internal-widget-frame, .ss-products .internal-widget-frame,.ss-courses .internal-widget-frame,.ss-eventpro .internal-widget-frame').on('click','.wf-basket-frame-checkout',function(e){ e.stopImmediatePropagation(); var ts = $(this).data('ts'); var id = $(this).data('id'); var _widget = $(this).closest('.ss-object'); var widgetID = _widget.prop('id'); if ( typeof widgetID === 'undefined' ) { _widget = $('#dashboard-basket-area'); widgetID = 'dashboard-basket-area'; } if ( init.loggedin ) { wfPrepareCheckoutPage('',widgetID); } else { _widget.find('.internal-widget-frame').addClass('widget-book-at-login'); modalBoxes(); } }); $('.ss-products .internal-widget-frame,.ss-courses .internal-widget-frame,.ss-eventpro .internal-widget-frame').on('hide.bs.dropdown','.wf-basket-checkout-box-empty', function(e){ var _this = $(this); var _widget = _this.closest('.ss-object'); var widgetID = _widget.prop('id'); var f = _this.data('func'); var fn = { 'card': function(){ _widget.find('.internal-widget-frame .wf-add-card-input').val(''); } }; if ( typeof fn[f] !== 'undefined' ) { fn[f](); } }); resetBasketWidgets = function(widgetID){ var _widget = $('#'+widgetID); _widget.find('.content-area').empty(); var ajaxSendWF = "https://www.alco-pop.co.uk/"; ajaxSendWF = ajaxSendWF.replace('/p/'+init.tpl,''); ajaxSendWF += 'p/widgets/ajax/index.php'; // Breadcrumb var breadcrumb = '
  • All
  • '; _widget.find('.breadcrumb').empty().append(breadcrumb); var request_data = [] request_data.push({ 'ownerID' : '3372', 'element' : 'get', 'view' : 'menu', 'render' : 'true', 'canvas' : 'desktop', 'website' : 'https://www.alco-pop.co.uk/', 'subdomain' : 'alco-pop', 'slug' : "shop-widget", 'alpha' : apikey, 'widgetID' : widgetID, 'tplID' : init.tpl, }); $.ajax({ type: 'post', url: ajaxSendWF, data: { 'object': request_data }, dataType: 'json', cache: false, success: function(data){ _widget.find('.content-area').append(data.html); _widget.find('.widget-back-btn').remove(); if ( _widget.find('.wf-location-select').length > 0 ) { _widget.find('.wf-location-select').show(); } } }); } resetSaleWidget = function(widgetID){ var _widget = $('#'+widgetID); // Reset Sort //resetSort(); // Highlight Category _widget.find('.change-category.list-group-item').removeClass('active'); _widget.find('.change-category.list-group-item[data-group-id="0"]').addClass('active'); $.ajax({ crossDomain: true, beforeSend: function(){ //loadStatus(); }, url: ajaxSend, type: 'post', data: { 'obj': { 'cmd': 'sale_item', 'search': '', 'sort': '', 'apikey': apikey, 'pageto': 1, 'groupid': 0, 'widgetid': widgetID, 'tplid': init.tpl, 'generate': '1', 'generateCols': 'get', 'canvas': 'desktop', 'ext': '1' } }, success: function(data){ var dataJSON = JSON.parse(data); // Breadcrumb var breadcrumb = '
  • '+dataJSON.group.name+'
  • '; _widget.find('.breadcrumb').empty().append(breadcrumb); if ( typeof dataJSON.generate !== 'undefined' ) { if ( _widget.find('#classic-item-list-'+widgetID).length > 0 ) { _widget.find('#classic-item-list-'+widgetID).empty().append(dataJSON.generate); } else { _widget.find('.content-area').empty().append('
    '+dataJSON.generate+'
    '); } } //removeLoadStatus(); }, error: function(){ //$('#request-error').addClass('error'); } }); } $('#preview').on('click','.wf-login-dashboard-replace',function(e){ e.stopImmediatePropagation(); modalBoxes(); }); $('body').on('keydown',function(e) { e.stopImmediatePropagation(); if (e.keyCode === 13) { if ( $('.login-submit').length > 0 ) { $('.login-submit').click(); } } }); var dSale = "shop-widget"; var dCourse = ""; var dEvent = ""; $('.ss-object').each(function(si,sv){ var _sv = $(sv); var locfw = "https://www.alco-pop.co.uk/"; var widgetID = _sv.prop('id'); if ( _sv.hasClass('ss-products') ) { if ( dSale !== '' ) { var loc = locfw + 'dashboard/basket/?c=' + locfw + dSale + '/'; _sv.find('.view-basket').prop('href',loc); } } if ( _sv.hasClass('ss-eventpro') ) { if ( dEvent !== '' ) { var loc = locfw + 'dashboard/basket/?c=' + locfw + dEvent + '/'; _sv.find('.view-basket').prop('href',loc); } } if ( _sv.hasClass('ss-courses') ) { if ( dCourse !== '' ) { var loc = locfw + 'dashboard/basket/?c=' + locfw + dCourse + '/'; _sv.find('.view-basket').prop('href',loc); } } }); })(); // Bootstrap Column Collapse Fix $('.ss-object').not('#dashboard-alert-space').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bs = ['ss-diary','ss-products','ss-eventpro','ss-courses']; var bsf = false; $(c).each(function(sci,scv){ if ( _ov.hasClass('mobile') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); // // Page function pageResizeRefresh(){ desktop_scale(true); parallax_position(); hide_outside_object(); desktop_scale(true); parallax_position(); hide_outside_object(); } // IFrame Event Listener // Create IE + others compatible event handler var eventMethod = window.addEventListener ? 'addEventListener' : 'attachEvent'; var eventer = window[eventMethod]; var messageEvent = eventMethod == 'attachEvent' ? 'onmessage' : 'message'; // Listen to message from child window eventer(messageEvent,function(e) { if ( e.data ) { var idata = e.data; if ( typeof idata.wid !== 'undefined' ) { if ( typeof idata.function !== 'undefined' ) { var window_width = $(window).innerWidth(); var window_height = $('html').innerHeight(); var canvas_width = parseInt( $('article').data('canvas-width') ); var ratio = parseFloat( window_width / canvas_width ); if ( idata.function === 'taskItemCount' ) { refreshTaskCounter( idata.value ); } else if ( idata.function === 'basketItemCount') { $('.ss-object .view-basket .badge').html(idata.value); // if ( parseInt( idata.value ) !== 0 ) { // $('.ss-object[href*="/dashboard/basket/"]').show(); // } else { // $('.ss-object[href*="/dashboard/basket/"]').hide(); // } } else if ( idata.function === 'reload' ) { window.location.reload(); } else if ( idata.function === 'login_to_dashboard_basket' ) { $('html').addClass('login-to-basket'); if ( init.loggedin ) { window.location.href = 'https://www.alco-pop.co.uk/dashboard/basket/'; } else { modalBoxes(); } } else if ( idata.function === 'login_to_dashboard' ) { if ( init.loggedin ) { window.location.href = 'https://www.alco-pop.co.uk/dashboard/'; } else { modalBoxes(); } } else if ( idata.function === 'hideModal' ) { if ( idata.wid === 'forgotpw' ) { $('#modal-forgot-pw').modal('hide'); } else if ( idata.wid === 'registerclient' ) { $('#modal-register-client').modal('hide'); $('#modal-reg-client-fname').val(''); $('#modal-reg-client-lname').val(''); $('#modal-reg-client-email').val(''); $('#modal-reg-client-email2').val(''); $('#modal-reg-client-pass').val(''); $alert.removeClass('alert-danger alert-success alert-warning').addClass('hidden'); } } else if ( idata.function === 'enableSubmit' ) { if ( idata.wid === 'login' ) { if ( idata.value ) { $('#b-modal-form-login button[type=submit]').prop('disabled',false); } else { $('#b-modal-form-login button[type=submit]').prop('disabled',true); } } else if ( idata.wid === 'forgotpw' ) { if ( idata.value ) { $('#modal-forgot-pw button[type=submit]').prop('disabled',false); } else { $('#modal-forgot-pw button[type=submit]').prop('disabled',true); } } else if ( idata.wid === 'registerclient' ) { if ( idata.value ) { $('#modal-register-client button[type=submit]').prop('disabled',false); } else { $('#modal-register-client button[type=submit]').prop('disabled',true); } } } else if ( idata.function === 'openDashboard' ) { var login_dashboard_full_website_address = ''; var hasWFLogin = false; if ( $('#dashboard-basket-area').length > 0 ) { window.location.reload(); return false; } // Diary Checkout After Login if ( $('.book-event-now-activated').length > 0 ) { hasWFLogin = true; init.loggedin = true; bookEventNow(); // Close Modals // Register Box $('#modal-register-client').modal('hide'); $('#modal-reg-client-fname').val(''); $('#modal-reg-client-lname').val(''); $('#modal-reg-client-email').val(''); $('#modal-reg-client-email2').val(''); $('#modal-reg-client-pass').val(''); // Login Box $('#modal-login').modal('hide'); $('#modal-login-email').val(''); $('#modal-login-password').val(''); // Add Menu if ( $('.widget-login-access-menu').length > 0 ) { $('.widget-login-access-menu').append(''); } } else if ( $('.book-course-now-activated').length > 0 ) { hasWFLogin = true; init.loggedin = true; bookCourseNow(); // Close Modals // Register Box $('#modal-register-client').modal('hide'); $('#modal-reg-client-fname').val(''); $('#modal-reg-client-lname').val(''); $('#modal-reg-client-email').val(''); $('#modal-reg-client-email2').val(''); $('#modal-reg-client-pass').val(''); // Login Box $('#modal-login').modal('hide'); $('#modal-login-email').val(''); $('#modal-login-password').val(''); // Add Menu if ( $('.widget-login-access-menu').length > 0 ) { $('.widget-login-access-menu').append(''); } } else if ( $('.widget-book-at-login').length > 0 ) { var widgetID = $('.widget-book-at-login').closest('.ss-object').prop('id'); $('.widget-book-at-login').removeClass('.widget-book-at-login'); hasWFLogin = true; init.loggedin = true; viewBasketPage(widgetID); wfPrepareCheckoutPage('',widgetID); // Close Modals // Register Box $('#modal-register-client').modal('hide'); $('#modal-reg-client-fname').val(''); $('#modal-reg-client-lname').val(''); $('#modal-reg-client-email').val(''); $('#modal-reg-client-email2').val(''); $('#modal-reg-client-pass').val(''); // Login Box $('#modal-login').modal('hide'); $('#modal-login-email').val(''); $('#modal-login-password').val(''); // Add Menu if ( $('.widget-login-access-menu').length > 0 ) { $('.widget-login-access-menu').append(''); } } else if ( $('.diary-book-at-login').length > 0 ) { $('.internal-widget-frame').removeClass('.diary-book-at-login'); hasWFLogin = true; init.loggedin = true; diaryBook(); $('.wf-dashboard-link i').removeClass('fa-sign-in').addClass('fa-dashboard'); // Close Modals // Register Box $('#modal-register-client').modal('hide'); $('#modal-reg-client-fname').val(''); $('#modal-reg-client-lname').val(''); $('#modal-reg-client-email').val(''); $('#modal-reg-client-email2').val(''); $('#modal-reg-client-pass').val(''); // Login Box $('#modal-login').modal('hide'); $('#modal-login-email').val(''); $('#modal-login-password').val(''); // Add Menu if ( $('.widget-login-access-menu').length > 0 ) { $('.widget-login-access-menu').append(''); } } if ( !hasWFLogin ) { if ( dashboardLoginBasket ) { login_dashboard_full_website_address = "https://www.alco-pop.co.uk/dashboard/basket/"; } else { login_dashboard_full_website_address = "https://www.alco-pop.co.uk/dashboard/"; } window.location.href = login_dashboard_full_website_address; } //php } } else if ( idata.function === 'alertDanger' ) { $('body').prepend('
    '+idata.value+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); // if ( idata.wid === 'login' ) { // $('.modal-body .alert').addClass('alert-danger').removeClass('alert-success alert-warning').html(idata.value); // } else if ( idata.wid === 'forgotpw' ) { // $('.modal-body .alert').addClass('alert-danger').removeClass('alert-success alert-warning').html(idata.value); // } else if ( idata.wid === 'registerclient' ) { // $('.modal-body .alert').addClass('alert-danger').removeClass('alert-success alert-warning').html(idata.value); // } } else if ( idata.function === 'alertWarning' ) { $('body').prepend('
    '+idata.value+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); // if ( idata.wid === 'login' ) { // $('.modal-body .alert').addClass('alert-warning').removeClass('alert-success alert-danger').html(idata.value); // } else if ( idata.wid === 'forgotpw' ) { // $('.modal-body .alert').addClass('alert-warning').removeClass('alert-success alert-danger').html(idata.value); // } else if ( idata.wid === 'registerclient' ) { // $('.modal-body .alert').addClass('alert-warning').removeClass('alert-success alert-danger').html(idata.value); // } } else if ( idata.function === 'alertSuccess' ) { $('body').prepend('
    '+idata.value+'
    '); setTimeout(function(){ $('.alert-top-dismissable').remove(); },5000); // if ( idata.wid === 'login' ) { // $('.modal-body .alert').addClass('alert-success').removeClass('alert-warning alert-danger').html(idata.value); // } else if ( idata.wid === 'forgotpw' ) { // $('.modal-body .alert').addClass('alert-success').removeClass('alert-warning alert-danger').html(idata.value); // } else if ( idata.wid === 'registerclient' ) { // $('.modal-body .alert').addClass('alert-success').removeClass('alert-warning alert-danger').html(idata.value); // } } else if ( idata.function === 'showAlert' ) { if ( idata.wid === 'login' ) { if ( idata.value ) { $('.modal-body .alert').removeClass('hidden'); } else { $('.modal-body .alert').removeClass('hidden'); } } else if ( idata.wid === 'forgotpw' ) { if ( idata.value ) { $('.modal-body .alert').removeClass('hidden'); } else { $('.modal-body .alert').removeClass('hidden'); } } else if ( idata.wid === 'registerclient' ) { if ( idata.value ) { $('.modal-body .alert').removeClass('hidden'); } else { $('.modal-body .alert').removeClass('hidden'); } } } else if ( idata.function === 'pingWebsite' ) { // Does not need anything here, just to be defined } else if ( idata.function === 'isDashboardPage' ) { $('.widget-login').each(function(i,v){ $(v) .addClass('widget-dashboard') .find('p') .html($(v).data('logout')); }); } else if ( idata.function === 'notDashboardPage' ) { $('.widget-login').each(function(i,v){ $(v) .removeClass('widget-dashboard') .find('p') .html($(v).data('dashboard')); }); } else if ( idata.function === 'statusLogin' ) { init.loggedin = true; // Enable Pusher Updates // } else if ( idata.function === 'logout' ) { $('#logout-check').remove(); window.location = 'https://www.alco-pop.co.uk/'; } else if ( idata.function === 'isLoggedIn') { // Enable Pusher Updates var counterClient = parseInt( idata.client ); var pusherTasks = new Pusher("be44fdd15e03671f6e45"); var channelTasks = pusherTasks.subscribe('widget_client_counter_channel'); channelTasks.bind('client_task_counter_event', function(data) { if ( typeof data !== 'undefined' ) { if ( typeof data.id !== 'undefined' ) { if ( data.id === "37d0b499fb84a552c17fcbb1442d7895" ) { if ( parseInt( data.client ) === counterClient ) { wfTaskCounterRefresh(); // Refresh Task View if ( $('.get-main-task-list-id').length > 0 ) { var taskListData = $('.get-main-task-list-id'); var taskID = ''; var taskFilter = ''; var taskList = ''; if ( typeof taskListData.data('task-list') !== 'undefined' ) { if ( taskListData.data('task-list') !== 'undefined' ) { if ( taskListData.data('task-list') !== '' ) { taskList = taskListData.data('task-list'); } } } if ( typeof taskListData.data('task-filter') !== 'undefined' ) { if ( taskListData.data('task-filter') !== 'undefined' ) { if ( taskListData.data('task-filter') !== '' ) { taskFilter = taskListData.data('task-filter'); } } } // if ( typeof taskListData.data('main-id') !== 'undefined' ) { // if ( taskListData.data('main-id') !== 'undefined' ) { // if ( taskListData.data('main-id') !== '' ) { // taskID = taskListData.data('main-id'); // } // } // } $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfClientTask', 'widgetid': 'previewer', 'tplid': init.tpl, 'taskID': taskID, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop", 'dashboardSale': "shop-widget", 'dashboardEvent': "", 'dashboardCourse': "", 'dashboardDiary': "", 'taskmenu': taskFilter, 'taskmenulist': taskList } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { //var h = dataJSON.render.replace(/\\/g, ''); $('#widget-zone-dashboard').html(dataJSON.render); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); pageResizeRefresh(); //resizeWidgetFrame(); } },50); } } } }); } } } } } }); // var dashboardButton = $('.widget-login').length > 0 ? '1' : '0'; if ( dashboardLogin ) { if ( idata.value === '1' ) { if ( dashboardLoginBasket ) { window.location.href = 'https://www.alco-pop.co.uk/dashboard/basket/'; } else { window.location.href = 'https://www.alco-pop.co.uk/dashboard/'; } } else { modalBoxes(); } return false; } if ( idata.value === '1' ) { init.loggedin = true; //console.log('logged in'); diarySlotBooked(); if ( $('.widget-login-access-menu').length > 0 ) { $('.widget-login-access-menu').append(''); } $('.wf-dashboard-link i').removeClass('fa-sign-in').addClass('fa-dashboard'); if ( $('#dashboard-replace').length > 0 ) { $('#dashboard-replace').remove(); $.ajax({ crossDomain: true, url: 'https://'+init.sub_domain+'.prosoftwareuk.co.uk/api/form/widgets/ajax/index.php', type: 'post', data: { 'obj': { 'cmd': 'wfDashboardRender', 'widgetid': 'previewer', 'tplid': init.tpl, 'apikey': '86DFE56C91FB554A3CA198CB56955E', 'website': "https://www.alco-pop.co.uk/", 'subdomain': "alco-pop" } }, success: function(data){ var dashView; var dataJSON = JSON.parse(data); if ( typeof dataJSON !== 'undefined' ) { if ( typeof dataJSON.render !== 'undefined' ) { $('article').prepend('
    '+dataJSON.render+'
    '); $('head').append(''); $('#dashboard-basket-area,#dashboard-alert-space').appendTo( $('.wf-dashboard-container') ); dashView = setInterval(function(){ if ( $('.wf-dashboard-container').length > 0 ) { // Clear Interval clearInterval(dashView); // Add Dashboard Event Listeners dashboardJQEventListeners(); // Dashboard Page Set Up $(window).scrollTop(0); $('.wf-dashboard-container').show(); $('.internal-widget-frame').hide(); $('.wf-dashboard-link-home').hide(); // Bootstrap Column Collapse Fix $('.wf-dashboard-container').each(function(oi,ov){ var _ov = $(ov); var w = _ov.outerWidth(); var c = [{ 'b': 768, 'c': 'xs'},{ 'b': 992, 'c': 'sm' },{ 'b': 1200, 'c': 'md' },{ 'b': 32000, 'c': 'lg' }]; var fw = false; var bsf = false; $(c).each(function(sci,scv){ if ( !$('html').hasClass('device-desktop') ) { _ov.addClass('width-xs'); } else { if (!fw) { if ( w < scv.b ) { _ov.addClass('width-'+scv.c); fw = true; } } } }); }); pageResizeRefresh(); } },50); } } } }); } if ( $('#dashboard-iframe').length > 0 ) { var dashboardBasket = false; var thisSite = 'https://www.alco-pop.co.uk/'; if ( dashboardBasket ) { $('#dashboard-iframe').prop('src','https://'+init.sub_domain+'.prosoftwareuk.co.uk/client/basket2/all/?usrl=1&dsale=shop-widget&ws='+thisSite+'&dbutton='+dashboardButton+'&wstpl=2308'); // +'&referrer='+thisSite } else { $('#dashboard-iframe').prop('src','https://'+init.sub_domain+'.prosoftwareuk.co.uk/client/dashboard/?usrl=1&dsale=shop-widget&ws='+thisSite+'&dbutton='+dashboardButton+'&wstpl=2308'); } } } else { init.loggedin = false; $('.widget-login').each(function(i,v){ $(v).find('p').html($(v).data('login')); }); var dashboardBasket = false; var thisSite = 'https://www.alco-pop.co.uk/'; ///// if ( $('#dashboard-replace').length > 0 ) { $('#dashboard-replace').remove(); window.location.href = "https://www.alco-pop.co.uk/dashboard/login/"; } else { ///// if ( dashboardBasket ) { $('#dashboard-iframe').prop('src','https://'+init.sub_domain+'.prosoftwareuk.co.uk/client/basket2/all/?usrl=1&dsale=shop-widget&ws='+thisSite+'&usrlo=1&dbutton='+dashboardButton+'&wstpl=2308'); //+'&referrer='+thisSite } else { // Dashboard Log In Check if ( $('#dashboard-iframe').length > 0 ) { window.location = 'https://www.alco-pop.co.uk/'; } } } } //$('#login-check').remove(); } else if ( idata.function === 'description' ) { if ( idata.value !== '' ) { $('html meta[name="description"],html meta[name="twitter:description"],html meta[property="og:description"]').attr('content',idata.value); } } else if ( idata.function === 'title' ) { if ( idata.value !== '' ) { $('html title').text(idata.value); $('html meta[name="twitter:title"],html meta[property="og:title"]').attr('content',idata.value); } } else if ( idata.function === 'blog_hide_back' ) { $('.cmd-button[data-cmd="blogcmd:prev"]').hide(); } else if ( idata.function === 'blog_show_back' ) { $('.cmd-button[data-cmd="blogcmd:prev"]').show(); } else if ( idata.function === 'blog_hide_next' ) { $('.cmd-button[data-cmd="blogcmd:next"]').hide(); } else if ( idata.function === 'blog_show_back' ) { $('.cmd-button[data-cmd="blogcmd:next"]').show(); } else if ( idata.function === 'blog_hide_menu' ) { $('.cmd-button[data-cmd="blogcmd:menu"]').hide(); } else if ( idata.function === 'blog_show_menu' ) { $('.cmd-button[data-cmd="blogcmd:menu"]').show(); } else if ( idata.function === 'dashboard_resize' ) { $('#dashboard-zone') .css('height', idata.size+'px') .data('height', idata.size); desktop_scale(true); parallax_position(); hide_outside_object(); desktop_scale(true); parallax_position(); hide_outside_object(); $(window).scrollTop( $('header').height() - 30 ); } else if ( idata.function === 'fill_expand_zone' ) { if ( idata.wid === 'client' ) { $('#dashboard-zone').css({ 'top': '0px', 'height': '100%' }) .find('iframe') .prop('scrolling','no'); $('#dashboard-zone') .closest('.ss-zone') .css('height', idata.size+'px') .data('height', idata.size); } else if ( $('#'+idata.wid).length > 0 ) { $('#'+idata.wid).css({ 'top': '0px', 'height': '100%' }) .find('iframe') .prop('scrolling','no') .addClass('lazy-load'); $('#'+idata.wid) .closest('.ss-zone') .css('height', idata.size+'px') .data('height', idata.size); } desktop_scale(true); parallax_position(); hide_outside_object(); desktop_scale(true); parallax_position(); hide_outside_object(); } else if ( idata.function === 'back_to_top' ) { /* if ( $('html').hasClass('device-mobile') ) { if ( $('header #'+idata.wid).length > 0 ) { $(window).scrollTop( ( $('#'+idata.wid).position().top - 30 ) ); } else if ( $('article #'+idata.wid).length > 0 ) { $(window).scrollTop( ( $('#'+idata.wid).position().top - 30 + $('header').height() ) ); } else if ( $('footer #'+idata.wid).length > 0 ) { $(window).scrollTop( ( $('#'+idata.wid).position().top - 30 + $('header').height() + $('article').height() ) ); } } else { if ( $('header #'+idata.wid).length > 0 ) { $(window).scrollTop( ( ( $('#'+idata.wid).position().top - 30 ) * ratio ) ); } else if ( $('article #'+idata.wid).length > 0 ) { if ( $('#'+idata.wid).closest('.ss-zone').length === 0 ) { $(window).scrollTop( ( ( $('#'+idata.wid).position().top - 30 + $('header').height() ) * ratio ) ); } else { var zt = $('#'+idata.wid).closest('.ss-zone').position().top; $(window).scrollTop( ( ( $('#'+idata.wid).position().top - 30 + $('header').height() + zt ) * ratio ) ); } } else if ( $('footer #'+idata.wid).length > 0 ) { $(window).scrollTop( ( ( $('#'+idata.wid).position().top - 30 + $('header').height() + $('article').height() ) * ratio ) ); } } */ } } } } },false); }); $('a[href*="mailto:"],a[href*="skype:"],a[href*="tel:"]').removeAttr('target');