Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/public/html/js/calendar-init.js
Назад
document.addEventListener('DOMContentLoaded', function () { var calendarEl = document.getElementById('calendar'); let objectDate = new Date(); let month = objectDate.getMonth(); console.log(month + 1); var calendar = new FullCalendar.Calendar(calendarEl, { // height:'auto', headerToolbar: { // left: 'prev,next today', // left: 'prev,next', right: 'customButton', center: 'prev title next', // right: 'dayGridMonth,timeGridWeek,timeGridDay', left: 'dayGridYear,timeGridWeek,dayGridMonth,timeGridDay', }, dateClick: function (info) { // Prevent the default behavior (the built-in event creation prompt) info.jsEvent.preventDefault(); // // Show your custom modal $('#eventModal').modal('show'); // // Clear the input fields in the modal $('#eventTitle').val(''); function saveEvent() { var title = $('#eventTitle').val(); calendar.addEvent({ title: title, start: info.dateStr,// Use the clicked date as the event's start date }); // Remove the event listener after it has been executed $('#saveEvent')[0].removeEventListener('click', saveEvent); // Close the modal $('#eventModal').modal('hide'); } $('#saveEvent')[0].addEventListener('click', saveEvent); // // Handle saving the event data here (when the "Save Event" button is clicked) // $('#saveEvent').on('click', function () { // var eventTitle = $('#eventTitle').val(); // // Create a new event and add it to the calendar // calendar.addEvent({ // title: eventTitle, // start: info.dateStr // Use the clicked date as the event's start date // }); // }); }, customButtons: { customButton: { text: 'New Event', click: function () { $('#eventTitle').val(''); $("#eventModal").modal("show"); } } }, initialDate: '2023-05-08', initialView: 'timeGridWeek', // events: [ // { // title: 'Event 1', // start: '2023-05-16T10:00:00', // end: '2023-09-16T12:00:00', // }, // { // title: 'Event 2', // start: '2023-09-17T14:00:00', // end: '2023-09-17T16:00:00', // }, // // Add more events here // ], views: { timeGridWeek: { // name of view titleFormat: { month: 'short', day: '2-digit' } // other view-specific options here } }, dayHeaderFormat: { weekday: 'long', day: 'numeric', }, dayHeaderContent: (args) => { return moment(args.date).format('dddd D') // return 'abc' }, columnFormat: 'dddd', slotLabelInterval: { minutes: 30 }, // timeGrid: true, // timeFormat: 'HH:mm', scrollTime: '00:00:00', allDaySlot: false, navLinks: true, selectable: true, // slotWidth: 200, selectMirror: true, eventAfterRender: function (event, element, view) { console.log('asd'); }, eventClick: function (arg) { if (confirm('Are you sure you want to delete this event?')) { arg.event.remove() } }, editable: true, dayMaxEvents: true, events: [ { title: 'Lorem Ipsum', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-07T00:00:00', end: '2023-05-07T01:00:00', backgroundColor: '#33bfff0d', textColor: '#4D5E80', classNames: ['primary', 'all-events'], extendedProps: { userDisplay: true, users: ['Rick', 'William'] } }, { title: 'Lorem Ipsum', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-08T01:00:00', end: '2023-05-08T01:30:00', backgroundColor: '#29cc390d', textColor: '#4D5E80', classNames: ['success', 'all-events'], extendedProps: { userDisplay: true, users: ['Quintin'] } }, { title: 'Lorem Ipsum', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-10T00:30:00', end: '2023-05-10T01:30:00', backgroundColor: '#29cc390d', textColor: '#4D5E80', classNames: ['success', 'all-events'], extendedProps: { userDisplay: true, users: ['Rick', 'Rick'] } }, { title: 'Lorem Ipsum', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-10T02:00:00', end: '2023-05-10T02:30:00', backgroundColor: '#29cc390d', textColor: '#4D5E80', classNames: ['success', 'all-events'], extendedProps: { userDisplay: true, users: ['Quintin', 'Quintin'] } }, { title: 'Lorem Ipsum', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-11T00:30:00', end: '2023-05-11T01:30:00', backgroundColor: '#29cc390d', textColor: '#4D5E80', classNames: ['primary', 'all-events'], extendedProps: { userDisplay: true, users: ['Rick', 'William'] } }, { title: 'Lorem Vellum Ipsum Aut Lorem', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-08T02:00:00', end: '2023-05-08T03:00:00', backgroundColor: '#33bfff0d', textColor: '#4D5E80', classNames: ['purple', 'all-events'], extendedProps: { userDisplay: true, users: ['Saint','Frank'] } }, { title: 'Lorem Ipsum', // start: '2023-05-06T24:23:00', // end: '2023-05-12T1:23:30', start: '2023-05-13T00:00:00', end: '2023-05-13T01:00:00', backgroundColor: '#33bfff0d', textColor: '#4D5E80', classNames: ['primary', 'all-events'], extendedProps: { userDisplay: true, users: ['Rick', 'William'] } }, { title: 'Long Event', start: '2023-01-07', end: '2023-01-10' }, { groupId: 999, title: 'Repeating Event', start: '2023-01-09T16:00:00' }, { groupId: 999, title: 'Repeating Event', start: '2023-01-16T16:00:00' }, { title: 'Conference', start: '2023-01-11', end: '2023-01-13' }, { title: 'Meeting', start: '2023-01-12T10:30:00', end: '2023-01-12T12:30:00' }, { title: 'Lunch', start: '2023-01-12T12:00:00' }, { title: 'Meeting', start: '2023-01-12T14:30:00' }, { title: 'Happy Hour', start: '2023-01-12T17:30:00' }, { title: 'Dinner', start: '2023-01-12T20:00:00' }, { title: 'Birthday Party', start: '2023-01-13T07:00:00' }, { title: 'Click for Google', url: 'http://google.com/', start: '2023-01-28' } ], // eventDidMount: function (info) { // console.log(info); // // {description: "Lecture", department: "BioChemistry"} // } eventDidMount: function (info) { // Access and log the event information // console.log(info.event.extendedProps); const userDisplay = info.event?.extendedProps?.userDisplay ?? false; if (userDisplay) { console.log($(info.el).closest('.all-events')) const parentElement = $(info.el).closest('.all-events'); let newDiv = `<div class="custom-div">`; // Replace with your HTML content const users = info.event?.extendedProps?.users ?? []; for (let index = 0; index < users.length; index++) { const user = users[index]; newDiv += `<span class="user-display">${user[0]}</span>`; } newDiv += `</div>` parentElement.append(newDiv); } // var $successParent = $(info.el).closest('.success'); // if ($successParent.length > 0) { // // Create an HTML div element with your desired content // var newDiv = '<div class="custom-div">Custom Content</div>'; // Replace with your HTML content // // Append the new div to the success parent element using jQuery // $successParent.append(newDiv); // } }, }); calendar.render(); }); // custom select ds-calendar // custom select function toggleSelectOptions($customSelect) { const $options = $customSelect.find(".select-options"); // Close all other select options except the current one $(".custom-select").not($customSelect).find(".select-options").slideUp(); if (!$options.is(":animated")) { $options.slideToggle(); } } // Handle click on select items // Function to close all select options function closeSelectOptions() { $(".select-options").slideUp(); $('.select-arrow').removeClass('active') } $(".select-selected, .select-arrow").on("click", function (e) { e.stopPropagation(); const $customSelect = $(this).closest(".custom-select"); const $selectOptions = $customSelect.find(".select-options"); $(this).next('.select-arrow').toggleClass('active'); // Toggle the options panel with a slide animation $selectOptions.slideToggle(); }); $(".select-option").on("click", function () { const value = $(this).data("value"); const text = $(this).text(); const $customSelect = $(this).closest(".custom-select"); const isMultiple = $customSelect.data("multiple"); if (isMultiple) { $(this).toggleClass("selected"); const selectedOptions = $customSelect .find(".select-option.selected") .map(function () { return $(this).data("value"); }) .get(); $customSelect.find(".select-selected").text(selectedOptions.join(", ")); $customSelect.find(".select-selected").attr("data-value", selectedOptions.join(", ")); selectValidation();//IF NULL } else { $customSelect.find(".select-selected").text(text); $customSelect.find(".select-selected").attr("data-value", value); closeSelectOptions(); // Close the options panel selectValidation(); // You can customize the behavior when an option is selected here console.log("Selected Value:", value); } }); // Close the dropdowns when clicking outside $(document).on("click", function () { closeSelectOptions(); }); // Prevent clicks inside the dropdown from closing it $(".select-options").on("click", function (e) { e.stopPropagation(); }); // custom select ds-calendar
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка