Deprecated: Return type of Carbon\Traits\Date::createFromTimestamp($timestamp, $tz = null) should either be compatible with DateTime::createFromTimestamp(int|float $timestamp): static, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fit4good/public_html/demo.fit4good.net/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php on line 29
;(function(){
/**
* AlertDialog implements fancy alert and confirm dialog windows.
*
* - alertMessage(message)
* - confirmMessage(message, function(ok))
*/
class AlertDialog extends oc.ControlBase
{
connect() {
addEventListener('ajax:error-message', this.proxy(this.onErrorMessage));
addEventListener('ajax:confirm-message', this.proxy(this.onConfirmMessage));
}
disconnect() {
removeEventListener('ajax:error-message', this.proxy(this.onErrorMessage));
removeEventListener('ajax:confirm-message', this.proxy(this.onConfirmMessage));
}
onErrorMessage(event) {
const { message } = event.detail;
if (!message) {
return;
}
this.alertMessage(message);
// Prevent the default alert() message
event.preventDefault();
}
onConfirmMessage(event) {
const { message, promise } = event.detail;
if (!message) {
return;
}
this.confirmMessage(message, isConfirm => {
if (isConfirm) {
promise.resolve();
}
else {
promise.reject();
}
});
// Prevent the default confirm() message
event.preventDefault();
}
alertMessage(message) {
var popup = this.getDialogElement();
document.body.appendChild(popup);
popup.querySelector('[data-cancel]').remove();
popup.querySelector('[data-message]').innerText = message;
var modal = new bootstrap.Modal(popup);
modal.show();
popup.querySelector('[data-ok]').addEventListener('click', () => {
modal.hide();
}, { once: true });
popup.addEventListener('hidden.bs.modal', () => {
modal.dispose();
popup.remove();
}, { once: true });
popup.querySelector('[data-ok]').focus();
}
confirmMessage(message, callback) {
var popup = this.getDialogElement();
document.body.appendChild(popup);
popup.querySelector('[data-message]').innerText = message;
var modal = new bootstrap.Modal(popup);
modal.show();
popup.querySelector('[data-ok]').addEventListener('click', () => {
callback && callback(true);
modal.hide();
}, { once: true });
popup.querySelector('[data-cancel]').addEventListener('click', () => {
callback && callback(false);
modal.hide();
}, { once: true });
popup.addEventListener('hidden.bs.modal', () => {
modal.dispose();
popup.remove();
}, { once: true });
popup.querySelector('[data-cancel]').focus();
}
getDialogElement() {
var template = document.createElement('template');
template.innerHTML = this.element.innerHTML.trim();
return template.content.firstChild;
}
static alertMessageGlobal(message) {
const alertDialog = oc.fetchControl('[data-control=alert-dialog]');
if (alertDialog) {
alertDialog.alertMessage(message);
}
}
static confirmMessageGlobal(message, callback) {
const alertDialog = oc.fetchControl('[data-control=alert-dialog]');
if (alertDialog) {
alertDialog.confirmMessage(message, callback);
}
}
}
oc.registerControl('alert-dialog', AlertDialog);
window.alertMessage = AlertDialog.alertMessageGlobal;
window.confirmMessage = AlertDialog.confirmMessageGlobal;
})();
;(function(){
/**
* PasswordDialog implements a password confirmation screen for sensitive actions
*/
class PasswordDialog extends oc.ControlBase {
connect() {
addEventListener('app:password-confirming', this.proxy(this.onShowPasswordPrompt));
}
disconnect() {
removeEventListener('app:password-confirming', this.proxy(this.onShowPasswordPrompt));
}
onShowPasswordPrompt(event) {
this.target = event.target;
this.popup = this.getDialogElement();
this.form = this.popup.querySelector('form');
document.body.appendChild(this.popup);
// Create a new modal
this.modal = new bootstrap.Modal(this.popup);
this.modal.show();
// Focus the input
this.popup.querySelector('input[name=confirmable_password]').focus();
// Bind events
this.popup.querySelector('[data-cancel]').addEventListener('click', () => this.modal.hide(), { once: true });
this.popup.addEventListener('hidden.bs.modal', () => this.disposeDialog(), { once: true });
this.form.addEventListener('ajax:done', this.proxy(this.onPasswordConfirmed), { once: true });
// Prevent the update workflow
event.preventDefault();
}
onPasswordConfirmed(event) {
const { data } = event.detail;
// Resubmit original AJAX event, skipping confirmation prompts
if (data.passwordConfirmed) {
oc.request(this.target, null, { confirm: false });
}
this.modal.hide();
}
disposeDialog() {
this.modal.dispose();
this.form.removeEventListener('ajax:done', this.proxy(this.onPasswordConfirmed), { once: true });
this.popup.remove();
this.form = null;
this.popup = null;
this.modal = null;
this.target = null;
}
getDialogElement() {
var template = document.createElement('template');
template.innerHTML = this.element.innerHTML.trim();
return template.content.firstChild;
}
}
oc.registerControl('password-dialog', PasswordDialog);
})();
;(function(){
oc.registerControl('gallery-slider', class extends oc.ControlBase {
init() {
this.$thumbs = this.element.querySelector('[data-slider-thumbs]') || this.element;
this.$previews = this.element.querySelector('[data-slider-previews]');
}
connect() {
this.connectSlickThumbs();
if (this.$previews) {
this.connectSlickPreviews();
}
this.connectLightbox();
setTimeout(() => {
this.prepareLightbox();
}, 1);
}
disconnect() {
if (this.lightbox) {
this.lightbox.destroy();
this.lightbox = null;
}
$(this.$thumbs).slick('unslick');
this.$thumbs = null;
if (this.$previews) {
$(this.$previews).slick('unslick');
this.$previews = null;
}
}
connectSlickPreviews() {
$(this.$previews).slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: this.$thumbs
});
}
connectSlickThumbs() {
$(this.$thumbs).slick({
dots: true,
infinite: false,
speed: 300,
slidesToShow: 3,
slidesToScroll: 3,
focusOnSelect: !!this.$previews,
asNavFor: this.$previews,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
}
connectLightbox() {
this.lightbox = new PhotoSwipeLightbox({
gallery: this.$previews || this.$thumbs,
children: '.slick-slide',
pswpModule: PhotoSwipeModule,
showHideAnimationType: 'none'
});
new PhotoSwipeDynamicCaption(this.lightbox, {
type: 'auto'
});
this.lightbox.init();
}
prepareLightbox() {
$('.slick-slide a', this.$el).each(function () {
var image = new Image(),
link = this;
image.src = this.getAttribute('href');
image.onload = function () {
link.setAttribute('data-pswp-width', image.naturalWidth);
link.setAttribute('data-pswp-height', image.naturalHeight);
};
});
}
});
})();
;(function(){
oc.registerControl('card-slider', class extends oc.ControlBase {
init() {
this.$el = $(this.element);
this.sliderType = this.config.sliderType || 'hero';
this.element.classList.add('type-' + this.sliderType);
}
connect() {
this.connectSlick();
}
disconnect() {
this.$el.slick('unslick');
this.$el = null;
}
connectSlick() {
this.$el.slick(this.getSlickOptions());
}
getSlickOptions() {
if (this.sliderType === 'hero') {
return this.getHeroTypeOptions();
}
if (this.sliderType === 'team') {
return this.getTeamTypeOptions();
}
if (this.sliderType === 'category') {
return this.getCategoryTypeOptions();
}
return {};
}
getHeroTypeOptions() {
return {
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
dots: true,
arrows: false,
};
}
getTeamTypeOptions() {
return {
dots: true,
infinite: false,
speed: 300,
slidesToShow: 4,
slidesToScroll: 4,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
dots: true
}
},
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 576,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
};
}
getCategoryTypeOptions() {
return {
dots: false,
infinite: true,
slidesToShow: 6,
slidesToScroll: 1,
autoplay: true,
arrows: true,
prevArrow: '',
nextArrow: '',
responsive: [
{
breakpoint: 1400,
settings: {
slidesToShow: 4,
slidesToScroll: 4
}
},
{
breakpoint: 820,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
}
]
};
}
});
})();
;(function(){
oc.registerControl('quantity-input', class extends oc.ControlBase {
connect() {
this.$qty = this.element.querySelector('input.quantity-field');
this.listen('click', '.button-plus', this.onIncrementValue);
this.listen('click', '.button-minus', this.onDecrementValue);
}
disconnect() {
this.$qty = null;
}
onIncrementValue(ev) {
ev.preventDefault();
var value = parseInt(this.$qty.value, 10);
if (isNaN(value)) {
value = 0;
}
this.$qty.value = Math.max(++value, 0);
}
onDecrementValue(ev) {
ev.preventDefault();
var value = parseInt(this.$qty.value, 10);
if (isNaN(value)) {
value = 0;
}
this.$qty.value = Math.max(--value, 0);
}
});
})();
addEventListener('render', function() {
// Auto Collapsed List
$('ul.bullet-list li.active:first').each(function() {
$(this).parents('ul.collapse').each(function() {
$(this).addClass('show').prevAll('.collapse-caret:first').removeClass('collapsed');
});
});
// Tooltips
$('[data-bs-toggle="tooltip"]').each(function() {
$(this).tooltip();
});
// Popovers
$('[data-bs-toggle="popover"]').each(function() {
var $el = $(this);
if ($el.data('content-target')) {
$el
.popover({ html: true, content: $($el.data('content-target')).get(0) })
.on('shown.bs.popover', function() {
$('input:first', $($el.data('content-target'))).focus();
})
;
}
else {
$el.popover();
}
});
// How it is made
setTimeout(function() {
$('.how-its-made').removeClass('init');
}, 1);
});