MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / recurring

Function recurring

codebase/sources/dhtmlxscheduler.es.js:18241–19775  ·  view source on GitHub ↗
(scheduler2)

Source from the content-addressed store, hash-verified

18239 return "".concat(header).concat(dateString);
18240}
18241function recurring(scheduler2) {
18242 scheduler2.ext.recurring = { confirm: function(context) {
18243 }, confirmDefault: function showRecurringConfirmModal(context) {
18244 const labels = context.labels || {};
18245 const options = Array.isArray(context.options) ? context.options : [];
18246 if (options.length === 0) {
18247 return Promise.resolve(null);
18248 }
18249 if (options.length === 1) {
18250 return Promise.resolve(options[0]);
18251 }
18252 const modalOptions = options.map((decision, index) => ({ value: decision, label: labelForDecision(decision, labels), checked: index === 0 }));
18253 return new Promise((resolve) => {
18254 scheduler2.modalbox({ text: `<div class="dhx_edit_recurrence_options">
18255 ${modalOptions.map((option) => `<label class="dhx_styled_radio">
18256 <input type="radio" value="${option.value}" name="option" ${option.checked ? "checked" : ""}>
18257 ${option.label}
18258 </label>`).join("")}
18259 </div>`, type: "recurring_mode", title: labels.title || scheduler2.locale.labels.confirm_recurring, width: "auto", position: "middle", buttons: [{ label: labels.ok || scheduler2.locale.labels.message_ok, value: "ok", css: "rec_ok" }, { label: labels.cancel || scheduler2.locale.labels.message_cancel, value: "cancel" }], callback: function onModalClose(value, event2) {
18260 if (value === "cancel") {
18261 resolve(null);
18262 return;
18263 }
18264 const box = event2.target.closest(".scheduler_modal_box");
18265 const checked = box && box.querySelector("input[type='radio']:checked");
18266 const selected = checked ? checked.value : null;
18267 if (!selected) {
18268 resolve(null);
18269 return;
18270 }
18271 resolve(selected);
18272 } });
18273 });
18274 }, _getDecision: async function _getDecision(context) {
18275 const confirmHandler = scheduler2.ext.recurring.confirm;
18276 let decision;
18277 if (typeof confirmHandler === "function") {
18278 decision = await confirmHandler(context);
18279 } else {
18280 decision = void 0;
18281 }
18282 if (decision === void 0) {
18283 decision = await scheduler2.ext.recurring.confirmDefault(context);
18284 }
18285 if (decision === null) {
18286 return null;
18287 }
18288 if (context.options && context.options.length > 0) {
18289 if (context.options.indexOf(decision) === -1) {
18290 console.warning(`[recurring extension] - the custom confirm handler returned a value ("${decision}") which is not in the allowed options list. The allowed options are: [${context.options.join(", ")}]. The operation will be cancelled.`);
18291 return null;
18292 }
18293 }
18294 return decision;
18295 } };
18296 scheduler2.ext.recurring.confirm = scheduler2.ext.recurring.confirmDefault;
18297 function labelForDecision(decision, labels) {
18298 if (decision === "occurrence") {

Callers

nothing calls this directly

Calls 15

labelForDecisionFunction · 0.70
clearMillisecondsFunction · 0.70
isDeletedOccurrenceFunction · 0.70
deleteEventFromSeriesFunction · 0.70
isSeriesFunction · 0.70
createExceptionFunction · 0.70
removeTempDraggedEventFunction · 0.70
setPropsForStorageEventFunction · 0.70
updateTextEventsFunction · 0.70
clearRecurringPropertiesFunction · 0.70

Tested by

no test coverage detected