% markup (from '+$this.data('mkup-lo')+'% to '+$this.data('mkup-hi')+'%)*
'+'*Prices will not go higher than retail price, so maximum markup may vary.
';$('#wl_email_price_warning').html(html);break;default:$('#wl_email_price_warning').html('');$('#wl_email_markup_input').remove();break;}} function handle_email_wishlist_request(request_type) {let url='https://www.lightology.com/index.php?module=dispatcher';let data='action=process_email_wishlist_request&request_type='+request_type;let $email_dialog_message=$('#email_dialog_message');$email_dialog_message.html('');data+='&'+$('#form-email-wishlist').serialize();$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {if(data){let $modal_content=$('.modal-content');let $static_display_email=$('#static-display-email');switch(data.code){case 0:$static_display_email.height(650);$modal_content.height(690);$modal_content.width(600);$email_dialog_message.html(data.message);break;case 1:$email_dialog_message.html('');if(request_type===PREVIEW_WISHLIST_EMAIL){let item_count=data.item_count;let modal_content_height=1360+item_count*420;let static_display_email_height=1220+item_count*420;$static_display_email.height(static_display_email_height);$modal_content.height(modal_content_height);$modal_content.width(700);$('#wl_preview_email_section').html(data.html);} else if(request_type===SEND_WISHLIST_EMAIL){$('#wl_preview_email_section').html('');$static_display_email.height(680);$modal_content.height(750);$modal_content.width(600);$('#email_dialog_message').html(data.html);setTimeout(function(){$('#emailModal').modal('hide');},2500);} break;}}},error:function(){$('#email_dialog_message').html('Unable to send email - please try again later');}});} function handle_item_quantity_focusout($this){let quantity=$this.val();if(quantity.length>0){quantity=parseInt(quantity,10);if(quantity<1){$this.val('1');}}else{$this.val('1');}} function handle_item_quantity_dec_click($this){let prod_id=$this.data('prodId');let $quantity=$('#quantity_'+prod_id);let quantity=parseInt($quantity.val(),10);if(quantity>1){$quantity.val(quantity-1);}} function handle_item_quantity_inc_click($this){let prod_id=$this.data('prodId');let $quantity=$('#quantity_'+prod_id);let quantity=parseInt($quantity.val(),10);if(quantity<999){$quantity.val(quantity+1);}} function handle_item_quantity_key(event){let key=event.which;if((key<48||key>57)&&key!=8&&key!=9&&key!=35&&key!=36&&key!=46) {event.preventDefault();}} function handle_move_to_button_click($this){if(move_buttons_enabled){let prod_id=$this.data('prodId');selected_item=prod_id;$('#moveModal').modal('show');}} function handle_move_to_submit(){let wishlist_id=$('#move_to_wishlist option:selected').val();let data='';if(wishlist_id<1){$('#move_to_wishlist_error').text('Please select a list');}else{let mode=$('input[name="wishlist_move_mode"]:checked').val();if(selected_item>0){selected_items=[];selected_items.push(selected_item);selected_item=0;} if(selected_items.length>0){let url='https://www.lightology.com/index.php?module=dispatcher';let prod_ids=get_available_selected_item_prod_ids();let quantities=get_available_selected_item_quantities();if(mode==='cut'){let from_wishlist_id=parseInt($('span#wishlist_id').text(),10);data='action=move_to_wishlist&from_wishlist_id='+from_wishlist_id+'&to_wishlist_id='+ wishlist_id+'&prod_id='+prod_ids.join('|')+'&quantity='+quantities.join('|');}else{data='action=copy_to_wishlist&wishlist_id='+wishlist_id+'&prod_id='+prod_ids.join('|')+'&quantity='+quantities.join('|');} $.ajax({type:'POST',url:url,data:data,dataType:'json',success:function() {window.location='https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id;},error:function(){window.location='https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id;}});}}} function handle_print_wishlist_click() {let url='https://www.lightology.com/index.php?module=dispatcher';let wishlist_id=parseInt($('span#wishlist_id').text(),10);let data='action=build_print_wishlist_html&wishlist_id='+wishlist_id;if(wishlist_id>0){$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {if(data){let printer=window.open('','');printer.document.write(data);printer.document.close();printer.print();printer.close();}}});}} function handle_remove_selected_items_click() {if(selected_items.length<1){return;} $('#removeSelectedModal').modal('show');} function handle_remove_selected_items_submit() {let wishlist_id=parseInt($('span#wishlist_id').text(),10);let prod_ids=selected_items.join(':');let data='&wishlist_id='+wishlist_id+'&prod_ids='+encodeURIComponent(prod_ids);window.location='https://www.lightology.com/index.php?module=dispatcher&action=remove_items_from_wishlist'+data;} function handle_rename_wishlist_submit() {let url='https://www.lightology.com/index.php?module=dispatcher';let wishlist_id=parseInt($('span#wishlist_id').text(),10);let wishlist_name=encodeURIComponent($('input[name="rename_wishlist_name"]:first').val());let data='action=rename_wishlist&wishlist_id='+wishlist_id+'&wishlist_name='+wishlist_name;if(wishlist_id>0){$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {if(data){switch(data.code){case 0:$('#rename_wishlist_error').html(data.content);break;case 1:window.location='https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id;break;}}}});}} function handle_save_cart_to_wishlist_click() {let url='https://www.lightology.com/index.php?module=dispatcher';let data='action=save_cart_to_wishlist';$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data){if(data){switch(data.code){case 1:$('.wishlist_count').html(data.count.toString());$('li.wishlist').addClass('active');show_wishlist_dialog(data.content);break;case 2:show_wishlist_dialog(data.content);$('input[name="wishlist_select"]:eq(0)').prop('checked',true);break;}}}});} function handle_save_cart_to_wishlist_submit($this) {let url='https://www.lightology.com/index.php?module=dispatcher';let data='action=save_cart_to_wishlist';data+='&'+$this.serialize();$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data){if(data.code==1){$('.wishlist_count').html(data.count.toString());$('li.wishlist').addClass('active');$('#wishlist_dialog_error_message').html('');$('#wishlist_dialog_success_message').html(data.content);}else{$('#wishlist_dialog_success_message').html('');$('#wishlist_dialog_error_message').html(data.content);}},error:function(){$('#wishlist_dialog_success_message').html('');$('#wishlist_dialog_error_message').html('A system error has occurred - changes may not have been saved');}});} function handle_select_action_cancel_click() {$('.select_wishlist_item').each(function(){$(this).prop('checked',false);handle_select_wishlist_item_click($(this));});selected_items=[];$('.action-bar').removeClass('active');move_buttons_enabled=true;} function handle_select_all_items_click() {if($('#select_all_items').is(':checked')){selected_items=[];$('.select_wishlist_item').each(function(){$(this).prop('checked',true);handle_select_wishlist_item_click($(this));});}else{$('.select_wishlist_item').each(function(){$(this).prop('checked',false);handle_select_wishlist_item_click($(this));});selected_items=[];}} function handle_select_wishlist_item_click($this) {let prod_id=parseInt($this.data().prodId,10);let item_offset=selected_items.indexOf(prod_id);if(item_offset>-1){selected_items.splice(item_offset,1);}else{selected_items.push(prod_id);} console.log(selected_items.join(' '));if(selected_items.length>0){$('.action-bar').addClass('active');move_buttons_enabled=false;}else{$('.action-bar').removeClass('active');move_buttons_enabled=true;} let all=$('.select_wishlist_item').length;let checked=$('.select_wishlist_item:checked').length;if(checked===all){$('#select_all_items').prop('checked',true);}else{$('#select_all_items').prop('checked',false);}} function update_wishlist_item_notes($this) {let url='https://www.lightology.com/index.php?module=dispatcher';let prod_id=parseInt($this.data().prodId,10);let wishlist_id=parseInt($this.data().wishlistId,10);let type=$('#type_'+prod_id).val();let room=$('#room_'+prod_id).val();let note=$('#note_'+prod_id).val();let data='action=update_wishlist_item_notes&wishlist_id='+wishlist_id+'&prod_id='+prod_id+'&type='+encodeURIComponent(type)+'&room='+encodeURIComponent(room)+'¬e='+ encodeURIComponent(note);let button=$this;let div=$this.closest('div');button.replaceWith('Saving…');$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function() {div.find('span').replaceWith('Saved');div.find('span').fadeOut(1000,function(){$(this).replaceWith(button);});let room_note='';if(room.length>0){room_note=room;if(note.length>0){room_note=room_note+' / '+note;}} else if(note.length>0){room_note=note;} room_note=' Notes: '+room_note;$('#wishlist_room_note_'+prod_id).text(room_note);}});} function update_wishlist_item_quantity($this) {let url='https://www.lightology.com/index.php?module=dispatcher';let prod_id=parseInt($this.data().prodId,10);let wishlist_id=parseInt($this.data().wishlistId,10);let quantity=parseInt($('#quantity_'+prod_id).val(),10);let data='action=update_wishlist_item_quantity&wishlist_id='+wishlist_id+'&prod_id='+prod_id+'&quantity='+quantity;let $div=$this.closest('div.update_wishlist_item_quantity_div');let a=$div.find('a');a.replaceWith('Updating…');$.ajax({type:'POST',url:url,data:data,dataType:'json',success:function(data) {$div.find('span').replaceWith(data.message);$div.find('span').fadeOut(1000,function(){$(this).replaceWith(a);});if(data.subtotal){$('#price_subtotal_'+prod_id).html(data.subtotal);} if(data.total){$('#wishlist_total').html(data.total);}}});} $(document).ready(function(){$(window).on('scroll',function(){let scrollTop=$(window).scrollTop();if(scrollTop>50){$('.action-bar').stop().css("padding","12px 20px 15px");$('.scroll-fx').stop().css("height","25px");} else{$('.action-bar').stop().css("padding","50px 20px");$('.scroll-fx').stop().css("height","50px");}});if(matchMedia('only screen and (max-width: 820px)').matches){$(".wishlist-collapse").hide();} $('body').on('click','#add_selected_items_to_cart',function(event){event.preventDefault();handle_add_selected_items_to_cart_click();}).on('click','#add_to_wishlist, #add_to_wishlist_new',function(event){event.preventDefault();handle_add_to_wishlist_click();}).on('submit','form[name="add_to_wishlist"]',function(event){event.preventDefault();handle_add_to_wishlist_submit($(this));}).on('click','.atc-btn',function(event){event.preventDefault();handle_add_wishlist_item_to_cart_click($(this));}).on('click','#atc-total',function(event){event.preventDefault();handle_add_all_items_to_cart_click();}).on('click','.collapse-list',function(){$(this).next('.wishlist-collapse').slideToggle('fast');$(this).toggleClass('list-open');$(this).find('i').toggleClass('fa fa-plus fa fa-minus');}).on('keypress','input[name="create_wishlist_name"]',function(event){let key=event.which;if(key==13){event.preventDefault();handle_create_wishlist_submit();}}).on('click','#submit-new-inquiry',function(event){event.preventDefault();handle_create_wishlist_submit();}).on('click','#submit-remove-list',function(event){event.preventDefault();handle_delete_wishlist_submit();}).on('click','.dropbtn',function(){$(this).next(".dropdown-content").slideToggle("fast");$(this).text($(this).text()=='Show Options and Notes'?'Hide Options and Notes x':'Show Options and Notes');}).on('click','#email_wishlist',function(event){event.preventDefault();handle_email_wishlist_click();}).on('focusout','.item_quantity',function(event){event.preventDefault();handle_item_quantity_focusout($(this));}).on('keydown','.item_quantity',function(event){handle_item_quantity_key(event);}).on('click','.item_quantity_dec',function(){handle_item_quantity_dec_click($(this));}).on('click','.item_quantity_inc',function(){handle_item_quantity_inc_click($(this));}).on('click','.modal-header .close',function(){$('#wishlist_quickview_box').empty();$('#wishlist_quickview_box').removeAttr("style")}).on('click','.move-btn',function(event){event.preventDefault();handle_move_to_button_click($(this));}).on('click','#submit-move-list',function(event){event.preventDefault();handle_move_to_submit();}).on('click','#move_selected_items',function(event){event.preventDefault();$('#moveModal').modal('show');}).on('click','#print_wishlist',function(event){event.preventDefault();handle_print_wishlist_click();}).on('click','#remove_selected_items',function(){handle_remove_selected_items_click();}).on('click','#submit-remove-selected',function(event){event.preventDefault();handle_remove_selected_items_submit();}).on('click','#rename_wishlist_submit',function(event){event.preventDefault();handle_rename_wishlist_submit();}).on('click','#save_cart_to_wishlist',function(event){event.preventDefault();handle_save_cart_to_wishlist_click();}).on('submit','form[name="save_cart_to_wishlist"]',function(event){event.preventDefault();handle_save_cart_to_wishlist_submit($(this));}).on('click','#search_wishlist',function(){let wishlist_id=$('#search_wishlist_id').val();window.location.href=('https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id);}).on('keypress','#search_wishlist_id',function(event){let key=event.which;if(key==13){event.preventDefault();let wishlist_id=$('#search_wishlist_id').val();window.location.href=('https://www.lightology.com/index.php?module=wishlist&wishlist_id='+wishlist_id);}}).on('click','#select_action_cancel',function(event){event.preventDefault();handle_select_action_cancel_click();}).on('click','#select_all_items',function(){handle_select_all_items_click();}).on('click','.select_wishlist_item',function(){handle_select_wishlist_item_click($(this));}).on('click','#studio-designer',function(event){event.preventDefault();function BasicLoader(){}BasicLoader.currentSiteUrl='https://studiowebware.secure.force.com/';BasicLoader.pageToLoad=BasicLoader.currentSiteUrl+'/apex/SDCaptureLoader';BasicLoader.TIMEOUT=10000;BasicLoader.INTERVAL=100;BasicLoader.CURRENT_TIMEOUT=0;BasicLoader.validated=false;BasicLoader.onComplete=function(){console.log('BasicLoader.completed');};BasicLoader.wait=function(){try{if(BasicLoader.CURRENT_TIMEOUT>=BasicLoader.TIMEOUT){alert('Timeout elapsed!');} else if(BasicLoader.validated){BasicLoader.onComplete();}else{BasicLoader.CURRENT_TIMEOUT+=BasicLoader.INTERVAL;window.setTimeout('BasicLoader.wait();',BasicLoader.INTERVAL);}}catch(e){console.error('BasicLoader.wait() exception: ',e);}};BasicLoader.addScriptElement=function(){let iFrame=document.createElement('iframe');iFrame.src=BasicLoader.pageToLoad;iFrame.id='basicLoader';iFrame.name='basicLoader';iFrame.frameBorder=1;iFrame.style.display='none';document.getElementsByTagName('body')[0].appendChild(iFrame);};BasicLoader.load=function(){let basicLoaderIFrame=document.getElementById('basicLoader');if(basicLoaderIFrame){if(Loader)Loader.load();return;}window.addEventListener('message',BasicLoader.receiveMessage,false);BasicLoader.addScriptElement();BasicLoader.wait();};BasicLoader.receiveMessage=function(e){if(e.origin&&e.origin==BasicLoader.currentSiteUrl){window.removeEventListener('message',BasicLoader.receiveMessage,false);if(e.data&&e.data.executable&&typeof e.data.executable=='string'){let script=document.createElement('script');script.type='text/javascript';script.innerHTML=e.data.executable;document.getElementsByTagName('head')[0].appendChild(script);BasicLoader.validated=true;}else{console.error(['BasicLoader.receiveMessage',e]);BasicLoader.validated=false;}}};BasicLoader.load();}).on('click','#submit-email-list',function(event){event.preventDefault();handle_email_wishlist_request(SEND_WISHLIST_EMAIL);}).on('click','#submit-preview-list',function(event){event.preventDefault();handle_email_wishlist_request(PREVIEW_WISHLIST_EMAIL);}).on('click','.update_wishlist_item_notes',function(event){event.preventDefault();update_wishlist_item_notes($(this));}).on('click','.update_wishlist_item_quantity',function(event){event.preventDefault();update_wishlist_item_quantity($(this));}).on('change','select[name="wishlist_email_pricing"]',function(){handle_email_wishlist_pricing_change($(this));}).on('click','.wishlist_prod_sku',function(event){event.preventDefault();let temp=$('');$('body').append(temp);temp.val($(this).text()).select();document.execCommand('copy');temp.remove();});});