(scheduler2)
| 18243 | return "".concat(header).concat(dateString); |
| 18244 | } |
| 18245 | function recurring(scheduler2) { |
| 18246 | scheduler2.ext.recurring = { confirm: function(context) { |
| 18247 | }, confirmDefault: function showRecurringConfirmModal(context) { |
| 18248 | const labels = context.labels || {}; |
| 18249 | const options = Array.isArray(context.options) ? context.options : []; |
| 18250 | if (options.length === 0) { |
| 18251 | return Promise.resolve(null); |
| 18252 | } |
| 18253 | if (options.length === 1) { |
| 18254 | return Promise.resolve(options[0]); |
| 18255 | } |
| 18256 | const modalOptions = options.map((decision, index) => ({ value: decision, label: labelForDecision(decision, labels), checked: index === 0 })); |
| 18257 | return new Promise((resolve) => { |
| 18258 | scheduler2.modalbox({ text: `<div class="dhx_edit_recurrence_options"> |
| 18259 | ${modalOptions.map((option) => `<label class="dhx_styled_radio"> |
| 18260 | <input type="radio" value="${option.value}" name="option" ${option.checked ? "checked" : ""}> |
| 18261 | ${option.label} |
| 18262 | </label>`).join("")} |
| 18263 | </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) { |
| 18264 | if (value === "cancel") { |
| 18265 | resolve(null); |
| 18266 | return; |
| 18267 | } |
| 18268 | const box = event2.target.closest(".scheduler_modal_box"); |
| 18269 | const checked = box && box.querySelector("input[type='radio']:checked"); |
| 18270 | const selected = checked ? checked.value : null; |
| 18271 | if (!selected) { |
| 18272 | resolve(null); |
| 18273 | return; |
| 18274 | } |
| 18275 | resolve(selected); |
| 18276 | } }); |
| 18277 | }); |
| 18278 | }, _getDecision: async function _getDecision(context) { |
| 18279 | const confirmHandler = scheduler2.ext.recurring.confirm; |
| 18280 | let decision; |
| 18281 | if (typeof confirmHandler === "function") { |
| 18282 | decision = await confirmHandler(context); |
| 18283 | } else { |
| 18284 | decision = void 0; |
| 18285 | } |
| 18286 | if (decision === void 0) { |
| 18287 | decision = await scheduler2.ext.recurring.confirmDefault(context); |
| 18288 | } |
| 18289 | if (decision === null) { |
| 18290 | return null; |
| 18291 | } |
| 18292 | if (context.options && context.options.length > 0) { |
| 18293 | if (context.options.indexOf(decision) === -1) { |
| 18294 | 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.`); |
| 18295 | return null; |
| 18296 | } |
| 18297 | } |
| 18298 | return decision; |
| 18299 | } }; |
| 18300 | scheduler2.ext.recurring.confirm = scheduler2.ext.recurring.confirmDefault; |
| 18301 | function labelForDecision(decision, labels) { |
| 18302 | if (decision === "occurrence") { |
nothing calls this directly
no test coverage detected