<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script>
(function () {
    function initAxisReportDatepickers() {
        if (!window.flatpickr) {
            return false;
        }

        document.querySelectorAll('.axis-report-datepicker').forEach(function (el) {
            if (el._flatpickr) {
                return;
            }

            const picker = flatpickr(el, {
                dateFormat: 'Y-m-d',
                altInput: true,
                altFormat: 'd-m-Y',
                altInputClass: 'form-control',
                allowInput: true,
                disableMobile: true,
                monthSelectorType: 'dropdown',
                shorthandCurrentMonth: true,
                onReady: function (_selectedDates, _dateStr, instance) {
                    instance.calendarContainer.classList.add('axis-report-calendar');
                },
            });

            const field = el.closest('.axis-date-field');
            field?.querySelectorAll('[data-axis-date-open]').forEach(function (trigger) {
                trigger.addEventListener('click', function () {
                    picker.open();
                });
            });
        });

        return true;
    }

    function boot() {
        if (initAxisReportDatepickers()) {
            return;
        }

        setTimeout(boot, 50);
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', boot);
    } else {
        boot();
    }

    window.axisInitReportDatepickers = initAxisReportDatepickers;
})();
</script>
<?php /**PATH /home/duiclick/public_html/test.duiclick.com/resources/views/partials/report-datepicker-init.blade.php ENDPATH**/ ?>