/*
* jQuery Nivo Slider v3.2
* http://nivo.dev7studios.com
*
* Copyright 2012, Dev7studios
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function(e){var t=function(t,n){var r=e.extend({},e.fn.nivoSlider.defaults,n);var i={currentSlide:0,currentImage:"",totalSlides:0,running:false,paused:false,stop:false,controlNavEl:false};var s=e(t);s.data("nivo:vars",i).addClass("nivoSlider");var o=s.children();o.each(function(){var t=e(this);var n="";if(!t.is("img")){if(t.is("a")){t.addClass("nivo-imageLink");n=t}t=t.find("img:first")}var r=r===0?t.attr("width"):t.width(),s=s===0?t.attr("height"):t.height();if(n!==""){n.css("display","none")}t.css("display","none");i.totalSlides++});if(r.randomStart){r.startSlide=Math.floor(Math.random()*i.totalSlides)}if(r.startSlide>0){if(r.startSlide>=i.totalSlides){r.startSlide=i.totalSlides-1}i.currentSlide=r.startSlide}if(e(o[i.currentSlide]).is("img")){i.currentImage=e(o[i.currentSlide])}else{i.currentImage=e(o[i.currentSlide]).find("img:first")}if(e(o[i.currentSlide]).is("a")){e(o[i.currentSlide]).css("display","block")}var u=e("
").addClass("nivo-main-image");u.attr("src",i.currentImage.attr("src")).show();s.append(u);e(window).resize(function(){s.children("img").width(s.width());u.attr("src",i.currentImage.attr("src"));u.stop().height("auto");e(".nivo-slice").remove();e(".nivo-box").remove()});s.append(e('
'));var a=function(t){var n=e(".nivo-caption",s);if(i.currentImage.attr("title")!=""&&i.currentImage.attr("title")!=undefined){var r=i.currentImage.attr("title");if(r.substr(0,1)=="#")r=e(r).html();if(n.css("display")=="block"){setTimeout(function(){n.html(r)},t.animSpeed)}else{n.html(r);n.stop().fadeIn(t.animSpeed)}}else{n.stop().fadeOut(t.animSpeed)}};a(r);var f=0;if(!r.manualAdvance&&o.length>1){f=setInterval(function(){d(s,o,r,false)},r.pauseTime)}if(r.directionNav){s.append('");e(s).on("click","a.nivo-prevNav",function(){if(i.running){return false}clearInterval(f);f="";i.currentSlide-=2;d(s,o,r,"prev")});e(s).on("click","a.nivo-nextNav",function(){if(i.running){return false}clearInterval(f);f="";d(s,o,r,"next")})}if(r.controlNav){i.controlNavEl=e('');s.after(i.controlNavEl);for(var l=0;l
')}else{i.controlNavEl.append(''+(l+1)+"")}}e("a:eq("+i.currentSlide+")",i.controlNavEl).addClass("active");e("a",i.controlNavEl).bind("click",function(){if(i.running)return false;if(e(this).hasClass("active"))return false;clearInterval(f);f="";u.attr("src",i.currentImage.attr("src"));i.currentSlide=e(this).attr("rel")-1;d(s,o,r,"control")})}if(r.pauseOnHover){s.hover(function(){i.paused=true;clearInterval(f);f=""},function(){i.paused=false;if(f===""&&!r.manualAdvance){f=setInterval(function(){d(s,o,r,false)},r.pauseTime)}})}s.bind("nivo:animFinished",function(){u.attr("src",i.currentImage.attr("src"));i.running=false;e(o).each(function(){if(e(this).is("a")){e(this).css("display","none")}});if(e(o[i.currentSlide]).is("a")){e(o[i.currentSlide]).css("display","block")}if(f===""&&!i.paused&&!r.manualAdvance){f=setInterval(function(){d(s,o,r,false)},r.pauseTime)}r.afterChange.call(this)});var h=function(t,n,r){if(e(r.currentImage).parent().is("a"))e(r.currentImage).parent().css("display","block");e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").width(t.width()).css("visibility","hidden").show();var i=e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").parent().is("a")?e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").parent().height():e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").height();for(var s=0;s
').css({left:o*s+"px",width:t.width()-o*s+"px",height:i+"px",opacity:"0",overflow:"hidden"}))}else{t.append(e('
').css({left:o*s+"px",width:o+"px",height:i+"px",opacity:"0",overflow:"hidden"}))}}e(".nivo-slice",t).height(i);u.stop().animate({height:e(r.currentImage).height()},n.animSpeed)};var p=function(t,n,r){if(e(r.currentImage).parent().is("a"))e(r.currentImage).parent().css("display","block");e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").width(t.width()).css("visibility","hidden").show();var i=Math.round(t.width()/n.boxCols),s=Math.round(e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").height()/n.boxRows);for(var o=0;o
').css({opacity:0,left:i*a+"px",top:s*o+"px",width:t.width()-i*a+"px"}));e('.nivo-box[name="'+a+'"]',t).height(e('.nivo-box[name="'+a+'"] img',t).height()+"px")}else{t.append(e('
').css({opacity:0,left:i*a+"px",top:s*o+"px",width:i+"px"}));e('.nivo-box[name="'+a+'"]',t).height(e('.nivo-box[name="'+a+'"] img',t).height()+"px")}}}u.stop().animate({height:e(r.currentImage).height()},n.animSpeed)};var d=function(t,n,r,i){var s=t.data("nivo:vars");if(s&&s.currentSlide===s.totalSlides-1){r.lastSlide.call(this)}if((!s||s.stop)&&!i){return false}r.beforeChange.call(this);if(!i){u.attr("src",s.currentImage.attr("src"))}else{if(i==="prev"){u.attr("src",s.currentImage.attr("src"))}if(i==="next"){u.attr("src",s.currentImage.attr("src"))}}s.currentSlide++;if(s.currentSlide===s.totalSlides){s.currentSlide=0;r.slideshowEnd.call(this)}if(s.currentSlide<0){s.currentSlide=s.totalSlides-1}if(e(n[s.currentSlide]).is("img")){s.currentImage=e(n[s.currentSlide])}else{s.currentImage=e(n[s.currentSlide]).find("img:first")}if(r.controlNav){e("a",s.controlNavEl).removeClass("active");e("a:eq("+s.currentSlide+")",s.controlNavEl).addClass("active")}a(r);e(".nivo-slice",t).remove();e(".nivo-box",t).remove();var o=r.effect,f="";if(r.effect==="random"){f=new Array("sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse");o=f[Math.floor(Math.random()*(f.length+1))];if(o===undefined){o="fade"}}if(r.effect.indexOf(",")!==-1){f=r.effect.split(",");o=f[Math.floor(Math.random()*f.length)];if(o===undefined){o="fade"}}if(s.currentImage.attr("data-transition")){o=s.currentImage.attr("data-transition")}s.running=true;var l=0,c=0,d="",m="",g="",y="";if(o==="sliceDown"||o==="sliceDownRight"||o==="sliceDownLeft"){h(t,r,s);l=0;c=0;d=e(".nivo-slice",t);if(o==="sliceDownLeft"){d=e(".nivo-slice",t)._reverse()}d.each(function(){var n=e(this);n.css({top:"0px"});if(c===r.slices-1){setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed)},100+l)}l+=50;c++})}else if(o==="sliceUp"||o==="sliceUpRight"||o==="sliceUpLeft"){h(t,r,s);l=0;c=0;d=e(".nivo-slice",t);if(o==="sliceUpLeft"){d=e(".nivo-slice",t)._reverse()}d.each(function(){var n=e(this);n.css({bottom:"0px"});if(c===r.slices-1){setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed)},100+l)}l+=50;c++})}else if(o==="sliceUpDown"||o==="sliceUpDownRight"||o==="sliceUpDownLeft"){h(t,r,s);l=0;c=0;var b=0;d=e(".nivo-slice",t);if(o==="sliceUpDownLeft"){d=e(".nivo-slice",t)._reverse()}d.each(function(){var n=e(this);if(c===0){n.css("top","0px");c++}else{n.css("bottom","0px");c=0}if(b===r.slices-1){setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed)},100+l)}l+=50;b++})}else if(o==="fold"){h(t,r,s);l=0;c=0;e(".nivo-slice",t).each(function(){var n=e(this);var i=n.width();n.css({top:"0px",width:"0px"});if(c===r.slices-1){setTimeout(function(){n.animate({width:i,opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({width:i,opacity:"1.0"},r.animSpeed)},100+l)}l+=50;c++})}else if(o==="fade"){h(t,r,s);m=e(".nivo-slice:first",t);m.css({width:t.width()+"px"});m.animate({opacity:"1.0"},r.animSpeed*2,"",function(){t.trigger("nivo:animFinished")})}else if(o==="slideInRight"){h(t,r,s);m=e(".nivo-slice:first",t);m.css({width:"0px",opacity:"1"});m.animate({width:t.width()+"px"},r.animSpeed*2,"",function(){t.trigger("nivo:animFinished")})}else if(o==="slideInLeft"){h(t,r,s);m=e(".nivo-slice:first",t);m.css({width:"0px",opacity:"1",left:"",right:"0px"});m.animate({width:t.width()+"px"},r.animSpeed*2,"",function(){m.css({left:"0px",right:""});t.trigger("nivo:animFinished")})}else if(o==="boxRandom"){p(t,r,s);g=r.boxCols*r.boxRows;c=0;l=0;y=v(e(".nivo-box",t));y.each(function(){var n=e(this);if(c===g-1){setTimeout(function(){n.animate({opacity:"1"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1"},r.animSpeed)},100+l)}l+=20;c++})}else if(o==="boxRain"||o==="boxRainReverse"||o==="boxRainGrow"||o==="boxRainGrowReverse"){p(t,r,s);g=r.boxCols*r.boxRows;c=0;l=0;var w=0;var E=0;var S=[];S[w]=[];y=e(".nivo-box",t);if(o==="boxRainReverse"||o==="boxRainGrowReverse"){y=e(".nivo-box",t)._reverse()}y.each(function(){S[w][E]=e(this);E++;if(E===r.boxCols){w++;E=0;S[w]=[]}});for(var x=0;x=0&&T {
if(props.attributes.types.includes('All')){
return option === 'All'
}
return true
}).map(function(key) {
// Render the checkboxes elements inside a parent container
// Only render the uncheck all button besides the All checkbox
return el(
"div",
{ className: "ssa-checkboxes-input-container" },
el(CheckboxControl, {
onChange: onCheckChange.bind(key),
label: apptTypeOptions[key],
checked: props.attributes.types.includes(key)
}),
(key === 'All' && !props.attributes.types.includes('All') && props.attributes.types.length ) ?
el(Button, {
isSecondary: true,
className: "ssa-block-booking-uncheck-all",
onClick: function () {
props.setAttributes({
types: [],
});
}
}, 'Uncheck All') :
null,
)
})
var LabelsOptions = [
{
value: "All",
label: "All",
},
];
Object.keys(ssaAppointmentTypeLabels).forEach(function (key) {
LabelsOptions.push({
value: key,
label: ssaAppointmentTypeLabels[key],
});
});
/* BOOKING FLOW */
let bookingFlowTabs = [
{
name: 'date',
title: 'Date View',
className: 'tab-date-view',
},
{
name: 'time',
title: 'Time View',
className: 'tab-time-view',
},
];
const displaybookingFlowTabs = () => {
if (props.attributes.flow === 'express') {
return bookingFlowTabs.filter(tab => tab.name !== 'date')
} else if (props.attributes.flow === 'first_available' && props.attributes.fallback_flow === 'express') {
return bookingFlowTabs.filter(tab => tab.name !== 'date')
}
return bookingFlowTabs;
}
/* END BOOKING FLOW */
return [
el(
"div",
{ className: "ssa-block-container" },
el(ServerSideRender, {
block: "ssa/booking",
attributes: props.attributes,
}),
el("div", {
className: "ssa-block-handler",
})
),
el(
InspectorControls,
{},
el(
PanelBody,
{ title: "Select Appointment types", initialOpen: false },
el(SelectControl, {
label: 'Filter by',
value: props.attributes.filter,
options: [
{
value: "types",
label: "Appointment types",
},
{
value: "label",
label: "Label",
},
],
onChange: function (value) {
props.setAttributes({ filter: value });
},
}),
props.attributes.filter === 'label' ?
el(SelectControl, {
label: "Labels",
value: props.attributes.label,
options: LabelsOptions,
onChange: function (value) {
props.setAttributes({ label: value });
},
}) :
el('div', null, apptTypeCheckboxes)
),
/* Appointment types view */
ssaAppointmentTypesViewOptions && el(
PanelBody,
{ title: "Appointment types view", initialOpen: false },
el(SelectControl, {
label: "Appointment types view",
value: props.attributes.appointment_types_view,
options: ssaAppointmentTypesViewOptions,
onChange: function (value) {
props.setAttributes({ appointment_types_view: value });
},
}),
),
/* End Appointment types view */
/* Booking flow */
ssaBookingFlowOptions && el(
PanelBody,
{ title: "Booking Flow", initialOpen: false },
el(SelectControl, {
label: "Main Booking layout",
value: props.attributes.flow,
options: ssaBookingFlowOptions.main_booking_flow,
onChange: function (value) {
props.setAttributes({ flow: value });
},
}),
props.attributes.flow === 'first_available' && el(
'PanelBody',
{ title: "first_available", initialOpen: false },
el('div', {}, 'First available within:'),
el(
'div',
{ className: "ssa_first_available_control_wrapper" },
el(NumberControl, {
label:"Duration",
value: props.attributes.suggest_first_available_duration,
min:1,
onChange: function (value) {
props.setAttributes({ suggest_first_available_duration: value });
},
}),
el(SelectControl, {
label: "Duration Unit",
className: 'ssa_duration_unit',
value: props.attributes.suggest_first_available_duration_unit,
options: ssaBookingFlowOptions.suggest_first_available.duration_unit,
onChange: function (value) {
props.setAttributes({ suggest_first_available_duration_unit: value });
},
}),
),
),
props.attributes.flow === 'first_available' && el(SelectControl, {
label: "Fallback Flow",
value: props.attributes.fallback_flow,
options: ssaBookingFlowOptions.fallback_flow,
onChange: function (value) {
props.setAttributes({ fallback_flow: value });
},
}),
props.attributes.flow !== 'appt_type_settings' && el(TabPanel, {
className: 'ssa-bookingflow-tab-panel',
activeClass: 'active-tab',
tabs: displaybookingFlowTabs(),
orientation: 'horizontal',
// initialTabName: 'team_members', // the name of the tab that is selected by default
children: function(tab) {
switch (tab.name) {
case 'date':
return el(SelectControl, {
label: 'Date view',
value: props.attributes.date_view,
options: ssaBookingFlowOptions.date_view,
onChange: function (value) {
props.setAttributes({ date_view: value });
},
});
case 'time':
return el(SelectControl, {
label: 'Time view',
value: props.attributes.time_view,
options: ssaBookingFlowOptions.time_view,
onChange: function (value) {
props.setAttributes({ time_view: value });
},
});
}
},
}),
),
/* End Booking flow */
el(PanelColorSettings, {
title: "Colors",
colorSettings: [
{
value: props.attributes.accent_color,
label: "Accent Color",
onChange: function (value) {
props.setAttributes({
accent_color: value,
});
},
},
{
value: props.attributes.background,
label: "Background Color",
onChange: function (value) {
props.setAttributes({
background: value,
});
},
},
],
}),
el(
PanelBody,
{ title: "Padding", initialOpen: true },
el(RangeControl, {
initialPosition: 0,
value: props.attributes.padding,
onChange: function (value) {
props.setAttributes({
padding: value,
});
},
min: 0,
max: 100,
}),
el(SelectControl, {
label: "Padding Unit",
value: props.attributes.padding_unit,
options: [
{
value: "px",
label: "px",
},
{
value: "em",
label: "em",
},
{
value: "rem",
label: "rem",
},
{
value: "vw",
label: "vw",
},
{
value: "percent",
label: "%",
},
],
onChange: function (value) {
props.setAttributes({ padding_unit: value });
},
})
)
),
];
},
save: function () {
return null;
},
});