@teamco/ischeduler-mui 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/index.cjs.js +1 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.es.js +1200 -0
  4. package/dist/mui/src/components/Scheduler.d.ts +13 -0
  5. package/dist/mui/src/components/Scheduler.d.ts.map +1 -0
  6. package/dist/mui/src/components/SchedulerDrawerButton.d.ts +15 -0
  7. package/dist/mui/src/components/SchedulerDrawerButton.d.ts.map +1 -0
  8. package/dist/mui/src/components/SchedulersList.d.ts +12 -0
  9. package/dist/mui/src/components/SchedulersList.d.ts.map +1 -0
  10. package/dist/mui/src/components/behaviors/AfterBehavior.d.ts +10 -0
  11. package/dist/mui/src/components/behaviors/AfterBehavior.d.ts.map +1 -0
  12. package/dist/mui/src/components/behaviors/MonthlyBehavior.d.ts +13 -0
  13. package/dist/mui/src/components/behaviors/MonthlyBehavior.d.ts.map +1 -0
  14. package/dist/mui/src/components/behaviors/OnThisDayBehavior.d.ts +11 -0
  15. package/dist/mui/src/components/behaviors/OnThisDayBehavior.d.ts.map +1 -0
  16. package/dist/mui/src/components/behaviors/WeeklyBehavior.d.ts +12 -0
  17. package/dist/mui/src/components/behaviors/WeeklyBehavior.d.ts.map +1 -0
  18. package/dist/mui/src/components/behaviors/YearlyBehavior.d.ts +15 -0
  19. package/dist/mui/src/components/behaviors/YearlyBehavior.d.ts.map +1 -0
  20. package/dist/mui/src/components/internal/CheckboxButton.d.ts +19 -0
  21. package/dist/mui/src/components/internal/CheckboxButton.d.ts.map +1 -0
  22. package/dist/mui/src/components/internal/DeleteAction.d.ts +9 -0
  23. package/dist/mui/src/components/internal/DeleteAction.d.ts.map +1 -0
  24. package/dist/mui/src/components/internal/DrawerEditAction.d.ts +9 -0
  25. package/dist/mui/src/components/internal/DrawerEditAction.d.ts.map +1 -0
  26. package/dist/mui/src/components/internal/Duration.d.ts +17 -0
  27. package/dist/mui/src/components/internal/Duration.d.ts.map +1 -0
  28. package/dist/mui/src/components/internal/HideColumns.d.ts +14 -0
  29. package/dist/mui/src/components/internal/HideColumns.d.ts.map +1 -0
  30. package/dist/mui/src/components/internal/SaveButton.d.ts +16 -0
  31. package/dist/mui/src/components/internal/SaveButton.d.ts.map +1 -0
  32. package/dist/mui/src/components/internal/StatusTag.d.ts +8 -0
  33. package/dist/mui/src/components/internal/StatusTag.d.ts.map +1 -0
  34. package/dist/mui/src/components/internal/Toolbar.d.ts +14 -0
  35. package/dist/mui/src/components/internal/Toolbar.d.ts.map +1 -0
  36. package/dist/mui/src/components/metadata/metadata.handlers.d.ts +4 -0
  37. package/dist/mui/src/components/metadata/metadata.handlers.d.ts.map +1 -0
  38. package/dist/mui/src/components/metadata/schedulersList.metadata.d.ts +23 -0
  39. package/dist/mui/src/components/metadata/schedulersList.metadata.d.ts.map +1 -0
  40. package/dist/mui/src/index.d.ts +7 -0
  41. package/dist/mui/src/index.d.ts.map +1 -0
  42. package/dist/mui/src/utils/table.util.d.ts +14 -0
  43. package/dist/mui/src/utils/table.util.d.ts.map +1 -0
  44. package/package.json +57 -0
@@ -0,0 +1,1200 @@
1
+ import { CDiscountTypeValues as e, CEndReasonTypes as t, CFirstDayIdx as n, CNsDiscount as r, DEFAULT_DISCOUNT_SCHEDULER as i, DEFAULT_SALE_SCHEDULER as a, DEFAULT_SCHEDULERS_LIMIT as o, EDays as s, EDiscountType as c, EDurationTypes as l, EMonths as u, ESchedulerPrefix as d, getKeyFromEnum as f, handleChangeStartDate as p, handleDurationValueChange as m, handleSelectWeeklyDay as h, numberToCurrency as g, tsToLocaleDateTime as _, useColumnsToggle as v, useSchedulerContext as y } from "@teamco/ischeduler-core";
2
+ import { useCallback as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
3
+ import { Box as T, Button as E, Checkbox as D, Chip as O, CircularProgress as k, Dialog as A, DialogActions as j, DialogContent as M, DialogContentText as N, DialogTitle as P, Divider as F, Drawer as ee, FormControl as I, FormHelperText as L, Grid2 as R, IconButton as z, InputLabel as B, ListItemIcon as te, ListItemText as V, Menu as H, MenuItem as U, OutlinedInput as ne, Paper as re, Select as W, Table as ie, TableBody as ae, TableCell as oe, TableContainer as se, TableHead as ce, TablePagination as le, TableRow as G, TextField as K, ToggleButton as q, ToggleButtonGroup as J, Tooltip as Y, Typography as X } from "@mui/material";
4
+ import { DateTimePicker as ue } from "@mui/x-date-pickers/DateTimePicker";
5
+ import { LocalizationProvider as de } from "@mui/x-date-pickers/LocalizationProvider";
6
+ import { AdapterDayjs as fe } from "@mui/x-date-pickers/AdapterDayjs";
7
+ import Z from "dayjs";
8
+ import { Fragment as pe, jsx as Q, jsxs as $ } from "react/jsx-runtime";
9
+ import me from "@mui/icons-material/CalendarMonth";
10
+ import he from "@mui/icons-material/Settings";
11
+ import ge from "@mui/icons-material/Add";
12
+ import _e from "@mui/icons-material/DateRange";
13
+ import ve from "@mui/icons-material/Close";
14
+ import ye from "@mui/icons-material/Save";
15
+ import be from "@mui/icons-material/MoreVert";
16
+ import xe from "@mui/icons-material/Refresh";
17
+ import Se from "@mui/icons-material/Delete";
18
+ import Ce from "@mui/icons-material/Edit";
19
+ export * from "@teamco/ischeduler-core";
20
+ //#region src/components/internal/Duration.tsx
21
+ var we = (e) => {
22
+ let { t } = y(), { min: n = 1, label: r, disabled: i, durationTypes: a = [], exclude: o = [], typeValue: s, periodValue: c, onTypeChange: u, onValueChange: d } = e;
23
+ return /* @__PURE__ */ $(T, {
24
+ sx: {
25
+ display: "flex",
26
+ gap: 1,
27
+ width: "100%"
28
+ },
29
+ children: [/* @__PURE__ */ $(I, {
30
+ fullWidth: !0,
31
+ size: "small",
32
+ children: [/* @__PURE__ */ Q(B, {
33
+ id: "duration-type-label",
34
+ children: t("scheduler.meta.period")
35
+ }), /* @__PURE__ */ Q(W, {
36
+ labelId: "duration-type-label",
37
+ value: s || "",
38
+ label: t("scheduler.meta.period"),
39
+ disabled: i,
40
+ onChange: (e) => u?.(e.target.value),
41
+ children: a.filter((e) => !o.includes(e)).map((e) => /* @__PURE__ */ Q(U, {
42
+ value: e,
43
+ children: l[e]
44
+ }, String(e)))
45
+ })]
46
+ }), /* @__PURE__ */ Q(K, {
47
+ fullWidth: !0,
48
+ size: "small",
49
+ type: "number",
50
+ label: r,
51
+ value: c ?? "",
52
+ disabled: i,
53
+ slotProps: { htmlInput: { min: n } },
54
+ onChange: (e) => d?.(parseInt(e.target.value, 10))
55
+ })]
56
+ });
57
+ }, Te = (e) => {
58
+ let { options: t, value: n = [], onChange: r, disabled: i, loading: a, label: o, error: s, helperText: c } = e;
59
+ return /* @__PURE__ */ $(T, { children: [
60
+ o && /* @__PURE__ */ Q(X, {
61
+ variant: "caption",
62
+ color: s ? "error" : "textSecondary",
63
+ sx: {
64
+ mb: .5,
65
+ display: "block"
66
+ },
67
+ children: o
68
+ }),
69
+ /* @__PURE__ */ Q(J, {
70
+ value: n,
71
+ onChange: (e, t) => {
72
+ r?.(t ?? []);
73
+ },
74
+ disabled: i || a,
75
+ size: "small",
76
+ exclusive: !1,
77
+ sx: {
78
+ flexWrap: "wrap",
79
+ gap: .5,
80
+ "& .MuiToggleButtonGroup-grouped": {
81
+ margin: 0,
82
+ border: "1px solid rgba(0, 0, 0, 0.12) !important",
83
+ borderRadius: "4px !important"
84
+ }
85
+ },
86
+ children: t.map((e) => /* @__PURE__ */ Q(q, {
87
+ value: e.value,
88
+ sx: {
89
+ minWidth: 40,
90
+ px: 1
91
+ },
92
+ children: e.label
93
+ }, e.key))
94
+ }),
95
+ c && /* @__PURE__ */ Q(L, {
96
+ error: s,
97
+ children: c
98
+ })
99
+ ] });
100
+ }, Ee = (e) => {
101
+ let { t, loading: r } = y(), { value: i = [], onChange: a, disabled: o, setOccurs: c, scheduler: l } = e, u = C(l);
102
+ x(() => {
103
+ u.current = l;
104
+ }, [l]);
105
+ let d = S(() => Object.keys(s).map((e) => t(`scheduler.weekdays.short.${s[e].toLowerCase()}`)), [t]), p = S(() => Object.keys(s).map((e) => t(`scheduler.weekdays.${s[e].toLowerCase()}`)), [t]), h = (e) => e.map((t, r) => e[(r + n) % 7]), g = h(d), _ = h(p), v = g.map((e, t) => {
106
+ let n = _[t], r = f(s, n);
107
+ return {
108
+ key: `${e}-${t}`,
109
+ label: e,
110
+ value: r
111
+ };
112
+ }), w = b((e) => {
113
+ if (a) {
114
+ let n = e;
115
+ a(n);
116
+ let r = u.current, i = {
117
+ ...r,
118
+ repeat: {
119
+ ...r.repeat,
120
+ weekly: { days: n }
121
+ }
122
+ };
123
+ m(i.duration, i, c, t);
124
+ }
125
+ }, [
126
+ a,
127
+ c,
128
+ t
129
+ ]);
130
+ return /* @__PURE__ */ Q(T, { children: /* @__PURE__ */ Q(Te, {
131
+ label: t("scheduler.days"),
132
+ options: v,
133
+ value: i,
134
+ onChange: w,
135
+ disabled: o,
136
+ loading: r
137
+ }) });
138
+ }, De = (e) => {
139
+ let { t, loading: n } = y(), { value: r, onChange: i, onWeeklyChange: a, disabled: o, setOccurs: s, scheduler: c } = e, l = C(c);
140
+ x(() => {
141
+ l.current = c;
142
+ }, [c]);
143
+ let u = r?.type || "DAY", d = (e, n) => {
144
+ if (n !== null && i) {
145
+ let e = {
146
+ ...r,
147
+ type: n,
148
+ ...n === "PERIOD" && !r?.weekDay ? { weekDay: "FIRST" } : {}
149
+ };
150
+ i(e);
151
+ let a = l.current, o = {
152
+ ...a,
153
+ repeat: {
154
+ ...a.repeat,
155
+ monthly: e
156
+ }
157
+ };
158
+ n === "DAY" ? h(o.duration.period, o, s, t) : m(o.duration, o, s, t);
159
+ }
160
+ }, f = (e) => {
161
+ if (i) {
162
+ let n = {
163
+ ...r,
164
+ monthDay: e
165
+ };
166
+ i(n);
167
+ let a = l.current;
168
+ h(e, {
169
+ ...a,
170
+ repeat: {
171
+ ...a.repeat,
172
+ monthly: n
173
+ }
174
+ }, s, t);
175
+ }
176
+ }, p = (e, n) => {
177
+ if (n !== null && i) {
178
+ let e = {
179
+ ...r,
180
+ weekDay: n
181
+ };
182
+ i(e);
183
+ let a = l.current, o = {
184
+ ...a,
185
+ repeat: {
186
+ ...a.repeat,
187
+ monthly: e
188
+ }
189
+ };
190
+ m(o.duration, o, s, t);
191
+ }
192
+ }, g = [
193
+ {
194
+ value: "FIRST",
195
+ label: t("scheduler.day.first")
196
+ },
197
+ {
198
+ value: "SECOND",
199
+ label: t("scheduler.day.second")
200
+ },
201
+ {
202
+ value: "THIRD",
203
+ label: t("scheduler.day.third")
204
+ },
205
+ {
206
+ value: "FOURTH",
207
+ label: t("scheduler.day.fourth")
208
+ },
209
+ {
210
+ value: "LAST",
211
+ label: t("scheduler.day.last")
212
+ }
213
+ ];
214
+ return /* @__PURE__ */ $(T, {
215
+ sx: {
216
+ display: "flex",
217
+ flexDirection: "column",
218
+ gap: 2
219
+ },
220
+ children: [/* @__PURE__ */ $(J, {
221
+ value: u,
222
+ exclusive: !0,
223
+ onChange: d,
224
+ disabled: o || n,
225
+ size: "small",
226
+ children: [/* @__PURE__ */ $(q, {
227
+ value: "DAY",
228
+ "aria-label": "day",
229
+ children: [/* @__PURE__ */ Q(me, {
230
+ fontSize: "small",
231
+ sx: { mr: 1 }
232
+ }), t("scheduler.day")]
233
+ }), /* @__PURE__ */ $(q, {
234
+ value: "PERIOD",
235
+ "aria-label": "period",
236
+ children: [/* @__PURE__ */ Q(he, {
237
+ fontSize: "small",
238
+ sx: { mr: 1 }
239
+ }), t("scheduler.meta.period")]
240
+ })]
241
+ }), u === "DAY" ? /* @__PURE__ */ Q(K, {
242
+ label: t("scheduler.day"),
243
+ type: "number",
244
+ size: "small",
245
+ value: r?.monthDay ?? "",
246
+ disabled: o || n,
247
+ slotProps: { htmlInput: {
248
+ min: 1,
249
+ max: 31
250
+ } },
251
+ onChange: (e) => f(parseInt(e.target.value, 10)),
252
+ sx: { width: 120 }
253
+ }) : /* @__PURE__ */ $(T, {
254
+ sx: {
255
+ display: "flex",
256
+ flexDirection: "column",
257
+ gap: 2
258
+ },
259
+ children: [/* @__PURE__ */ Q(J, {
260
+ value: r?.weekDay || "",
261
+ exclusive: !0,
262
+ onChange: p,
263
+ disabled: o || n,
264
+ size: "small",
265
+ sx: { flexWrap: "wrap" },
266
+ children: g.map((e) => /* @__PURE__ */ Q(q, {
267
+ value: e.value,
268
+ children: e.label
269
+ }, e.value))
270
+ }), /* @__PURE__ */ Q(Ee, {
271
+ value: c.repeat?.weekly?.days,
272
+ onChange: (e) => {
273
+ a?.(e);
274
+ },
275
+ disabled: o,
276
+ setOccurs: s,
277
+ scheduler: c
278
+ })]
279
+ })]
280
+ });
281
+ }, Oe = (e) => {
282
+ let { t, loading: n } = y(), { value: r, onChange: i, disabled: a, setOccurs: o, scheduler: s, repeatMonthly: c, onMonthlyChange: l, onWeeklyChange: d } = e, f = C(s);
283
+ x(() => {
284
+ f.current = s;
285
+ }, [s]);
286
+ let p = S(() => Object.keys(u).map((e) => t(`scheduler.months.${u[e].toLowerCase()}`)), [t]), h = S(() => Object.keys(u).map((e) => t(`scheduler.months.short.${u[e].toLowerCase()}`)), [t]), g = Object.keys(u).map((e, t) => ({
287
+ key: `${e}-${t}`,
288
+ label: /* @__PURE__ */ Q(Y, {
289
+ title: p[t],
290
+ children: /* @__PURE__ */ Q("span", { children: h[t] })
291
+ }),
292
+ value: e
293
+ }));
294
+ return /* @__PURE__ */ $(T, {
295
+ sx: {
296
+ display: "flex",
297
+ flexDirection: "column",
298
+ gap: 3
299
+ },
300
+ children: [/* @__PURE__ */ Q(Te, {
301
+ label: t("scheduler.months"),
302
+ options: g,
303
+ value: r?.months || [],
304
+ onChange: (e) => {
305
+ if (i) {
306
+ let n = e, a = {
307
+ ...r,
308
+ months: n
309
+ };
310
+ i(a);
311
+ let s = f.current, c = {
312
+ ...s,
313
+ repeat: {
314
+ ...s.repeat,
315
+ yearly: a
316
+ }
317
+ };
318
+ m(c.duration, c, o, t);
319
+ }
320
+ },
321
+ disabled: a,
322
+ loading: n
323
+ }), /* @__PURE__ */ Q(De, {
324
+ value: c,
325
+ onChange: l,
326
+ onWeeklyChange: d,
327
+ disabled: a,
328
+ setOccurs: o,
329
+ scheduler: s
330
+ })]
331
+ });
332
+ }, ke = (e) => {
333
+ let { disabled: t, value: n, startedAt: r, onChange: i } = e, { t: a } = y(), o = r ? Z(r).add(1, "day") : Z();
334
+ return /* @__PURE__ */ Q(ue, {
335
+ label: a("scheduler.duration.endDate"),
336
+ value: n ?? null,
337
+ onChange: i,
338
+ disabled: t || !r,
339
+ minDateTime: o,
340
+ slotProps: { textField: {
341
+ size: "small",
342
+ fullWidth: !0
343
+ } }
344
+ });
345
+ }, Ae = (e) => {
346
+ let { t } = y(), { min: n = 1, value: r, onChange: i, disabled: a = !1 } = e;
347
+ return /* @__PURE__ */ Q(K, {
348
+ fullWidth: !0,
349
+ size: "small",
350
+ type: "number",
351
+ label: t("scheduler.occurrences"),
352
+ value: r ?? "",
353
+ disabled: a,
354
+ slotProps: { htmlInput: { min: n } },
355
+ onChange: (e) => i?.(parseInt(e.target.value, 10))
356
+ });
357
+ }, je = (e) => {
358
+ let { t: n, loading: r } = y(), { value: o, onChange: s, disabled: u = !1, durationTypes: f = Object.keys(l), discountTypes: h = Object.keys(c), schedulerType: g } = e, _ = g === d.SALE ? a : i, [v, b] = w(() => _), S = o ?? v, [C, E] = w("0"), [D, O] = w(null);
359
+ x(() => {
360
+ S.range?.startedAt && p(Z(S.range.startedAt), O), S.duration && m(S.duration, S, E, n);
361
+ }, [o, n]);
362
+ let k = (e, t) => {
363
+ let n = e.split("."), r = (e, t, n) => {
364
+ if (t.length === 1) return {
365
+ ...e,
366
+ [t[0]]: n
367
+ };
368
+ let [i, ...a] = t;
369
+ return {
370
+ ...e,
371
+ [i]: r(e[i] ?? {}, a, n)
372
+ };
373
+ }, i = r(S, n, t);
374
+ b(i), s?.(i);
375
+ };
376
+ return /* @__PURE__ */ Q(de, {
377
+ dateAdapter: fe,
378
+ children: /* @__PURE__ */ $(T, {
379
+ sx: {
380
+ display: "flex",
381
+ flexDirection: "column",
382
+ gap: 3,
383
+ py: 2
384
+ },
385
+ children: [
386
+ [d.DISCOUNT, d.TRIAL_DISCOUNT].includes(g) && /* @__PURE__ */ Q(R, {
387
+ container: !0,
388
+ spacing: 2,
389
+ children: /* @__PURE__ */ Q(R, {
390
+ size: {
391
+ xs: 12,
392
+ sm: 6
393
+ },
394
+ children: /* @__PURE__ */ $(T, {
395
+ sx: {
396
+ display: "flex",
397
+ gap: 1
398
+ },
399
+ children: [/* @__PURE__ */ $(I, {
400
+ fullWidth: !0,
401
+ size: "small",
402
+ children: [/* @__PURE__ */ Q(B, { children: n("scheduler.meta.duration") }), /* @__PURE__ */ Q(W, {
403
+ value: S.discount?.type || "",
404
+ label: n("scheduler.meta.duration"),
405
+ disabled: u || r,
406
+ onChange: (e) => k("discount.type", e.target.value),
407
+ children: h.map((e) => /* @__PURE__ */ Q(U, {
408
+ value: e,
409
+ children: c[e]
410
+ }, String(e)))
411
+ })]
412
+ }), /* @__PURE__ */ Q(K, {
413
+ fullWidth: !0,
414
+ size: "small",
415
+ type: "number",
416
+ label: n("scheduler.meta.duration"),
417
+ value: S.discount?.value || "",
418
+ disabled: u || r,
419
+ onChange: (e) => k("discount.value", parseInt(e.target.value, 10))
420
+ })]
421
+ })
422
+ })
423
+ }),
424
+ /* @__PURE__ */ $(R, {
425
+ container: !0,
426
+ spacing: 2,
427
+ children: [/* @__PURE__ */ Q(R, {
428
+ size: {
429
+ xs: 12,
430
+ sm: 6
431
+ },
432
+ children: /* @__PURE__ */ Q(we, {
433
+ label: n("scheduler.duration"),
434
+ disabled: u || r,
435
+ typeValue: S.duration?.type,
436
+ periodValue: S.duration?.period,
437
+ durationTypes: f,
438
+ required: !0,
439
+ onTypeChange: (e) => k("duration.type", e),
440
+ onValueChange: (e) => k("duration.period", e)
441
+ })
442
+ }), /* @__PURE__ */ Q(R, {
443
+ size: {
444
+ xs: 12,
445
+ sm: 6
446
+ },
447
+ children: /* @__PURE__ */ Q(ue, {
448
+ label: n("scheduler.startedAt"),
449
+ value: Z(S.range?.startedAt),
450
+ onChange: (e) => k("range.startedAt", e),
451
+ disabled: u || r,
452
+ slotProps: { textField: {
453
+ size: "small",
454
+ fullWidth: !0
455
+ } }
456
+ })
457
+ })]
458
+ }),
459
+ S.duration?.type === "WEEK" && /* @__PURE__ */ Q(Ee, {
460
+ value: S.repeat?.weekly?.days,
461
+ onChange: (e) => k("repeat.weekly.days", e),
462
+ disabled: u,
463
+ setOccurs: E,
464
+ scheduler: S
465
+ }),
466
+ S.duration?.type === "MONTH" && /* @__PURE__ */ Q(De, {
467
+ value: S.repeat?.monthly,
468
+ onChange: (e) => k("repeat.monthly", e),
469
+ onWeeklyChange: (e) => k("repeat.weekly.days", e),
470
+ disabled: u,
471
+ setOccurs: E,
472
+ scheduler: S
473
+ }),
474
+ S.duration?.type === "YEAR" && /* @__PURE__ */ Q(Oe, {
475
+ value: S.repeat?.yearly,
476
+ onChange: (e) => k("repeat.yearly", e),
477
+ disabled: u,
478
+ setOccurs: E,
479
+ scheduler: S,
480
+ repeatMonthly: S.repeat?.monthly,
481
+ onMonthlyChange: (e) => k("repeat.monthly", e),
482
+ onWeeklyChange: (e) => k("repeat.weekly.days", e)
483
+ }),
484
+ /* @__PURE__ */ $(R, {
485
+ container: !0,
486
+ spacing: 2,
487
+ children: [/* @__PURE__ */ Q(R, {
488
+ size: {
489
+ xs: 12,
490
+ sm: 6
491
+ },
492
+ children: /* @__PURE__ */ $(I, {
493
+ fullWidth: !0,
494
+ size: "small",
495
+ children: [/* @__PURE__ */ Q(B, { children: n("scheduler.duration.end") }), /* @__PURE__ */ Q(W, {
496
+ value: S.range?.endReason?.type || "",
497
+ label: n("scheduler.duration.end"),
498
+ disabled: u,
499
+ onChange: (e) => k("range.endReason.type", e.target.value),
500
+ children: [
501
+ {
502
+ label: n("scheduler.duration.end.day"),
503
+ value: t[0]
504
+ },
505
+ {
506
+ label: n("scheduler.duration.end.after"),
507
+ value: t[1]
508
+ },
509
+ {
510
+ label: n("scheduler.duration.end.no"),
511
+ value: t[2]
512
+ }
513
+ ].map((e) => /* @__PURE__ */ Q(U, {
514
+ value: e.value,
515
+ children: e.label
516
+ }, e.value))
517
+ })]
518
+ })
519
+ }), /* @__PURE__ */ $(R, {
520
+ size: {
521
+ xs: 12,
522
+ sm: 6
523
+ },
524
+ children: [S.range?.endReason?.type === t[0] && /* @__PURE__ */ Q(ke, {
525
+ value: Z(S.range?.endReason?.expiredAt),
526
+ startedAt: Z(S.range?.startedAt),
527
+ onChange: (e) => k("range.endReason.expiredAt", e),
528
+ disabled: u
529
+ }), S.range?.endReason?.type === t[1] && /* @__PURE__ */ Q(Ae, {
530
+ value: S.range?.endReason?.occurrences,
531
+ onChange: (e) => k("range.endReason.occurrences", e),
532
+ disabled: u
533
+ })]
534
+ })]
535
+ }),
536
+ /* @__PURE__ */ Q(X, {
537
+ variant: "body2",
538
+ sx: {
539
+ fontStyle: "italic",
540
+ color: "text.secondary"
541
+ },
542
+ dangerouslySetInnerHTML: { __html: n("scheduler.result", {
543
+ occurs: C,
544
+ startAt: D ?? ""
545
+ }) }
546
+ })
547
+ ]
548
+ })
549
+ });
550
+ }, Me = (e) => {
551
+ let { t, permissions: n } = y(), { loading: r, className: i, isEdit: a, disabled: o, size: s = "small", color: c = "primary", icon: l = /* @__PURE__ */ Q(ye, { fontSize: "small" }), type: u = "button", variant: d = "contained", onClick: f } = e;
552
+ if (!(a ? n.canUpdate : n.canCreate)) return null;
553
+ let p = t(a ? "actions.update" : "actions.save");
554
+ return /* @__PURE__ */ Q(E, {
555
+ type: u,
556
+ size: s,
557
+ variant: d,
558
+ className: i,
559
+ disabled: o || r,
560
+ startIcon: r ? /* @__PURE__ */ Q(k, {
561
+ size: 16,
562
+ color: "inherit"
563
+ }) : l,
564
+ onClick: f,
565
+ color: c,
566
+ children: p
567
+ });
568
+ }, Ne = ({ schedulerType: e, disabled: t, onSuccess: n, setDirty: s, dirty: c, isCreating: l, setIsCreating: u, buttonProps: f }) => {
569
+ let { t: p, loading: m, permissions: h, onCreate: g } = y(), [_, v] = w(!1), b = S(() => e === d.SALE ? a : i, [e]), [x, C] = w(b);
570
+ if (!h.canCreate) return null;
571
+ let D = (e) => {
572
+ e.preventDefault(), e.stopPropagation(), C(b), v(!0);
573
+ }, O = () => {
574
+ v(!1), s(!1);
575
+ }, k = async () => {
576
+ try {
577
+ u(!0);
578
+ let t = {
579
+ id: `new-${Date.now()}`,
580
+ ...x,
581
+ type: e,
582
+ [r]: e === d.SALE ? null : x?.[r]
583
+ };
584
+ g && await g(e, t), n?.(t), v(!1), s(!1);
585
+ } catch (e) {
586
+ console.error("Failed to save scheduler:", e);
587
+ } finally {
588
+ u(!1);
589
+ }
590
+ };
591
+ return /* @__PURE__ */ $(pe, { children: [/* @__PURE__ */ Q(Y, {
592
+ title: t ? p("scheduler.limited", { limit: o }) : "",
593
+ children: /* @__PURE__ */ Q("span", { children: /* @__PURE__ */ Q(E, {
594
+ variant: "text",
595
+ size: "small",
596
+ ...f,
597
+ disabled: t || m,
598
+ onClick: D,
599
+ sx: {
600
+ textTransform: "none",
601
+ p: 0,
602
+ minWidth: "auto",
603
+ ...f?.sx
604
+ },
605
+ children: p("scheduler")
606
+ }) })
607
+ }), /* @__PURE__ */ Q(ee, {
608
+ anchor: "right",
609
+ open: _,
610
+ onClose: O,
611
+ PaperProps: { sx: {
612
+ width: {
613
+ xs: "100%",
614
+ sm: 600
615
+ },
616
+ p: 0
617
+ } },
618
+ children: /* @__PURE__ */ $(T, {
619
+ sx: {
620
+ display: "flex",
621
+ flexDirection: "column",
622
+ height: "100%"
623
+ },
624
+ children: [
625
+ /* @__PURE__ */ $(T, {
626
+ sx: {
627
+ p: 2,
628
+ display: "flex",
629
+ alignItems: "center",
630
+ justifyContent: "space-between"
631
+ },
632
+ children: [/* @__PURE__ */ $(T, {
633
+ sx: {
634
+ display: "flex",
635
+ alignItems: "center",
636
+ gap: 1
637
+ },
638
+ children: [/* @__PURE__ */ Q(_e, { color: "primary" }), /* @__PURE__ */ Q(X, {
639
+ variant: "h6",
640
+ children: p("scheduler")
641
+ })]
642
+ }), /* @__PURE__ */ $(T, {
643
+ sx: {
644
+ display: "flex",
645
+ alignItems: "center",
646
+ gap: 1
647
+ },
648
+ children: [/* @__PURE__ */ Q(Me, {
649
+ loading: m || l,
650
+ disabled: t || !c,
651
+ onClick: k
652
+ }), /* @__PURE__ */ Q(z, {
653
+ onClick: O,
654
+ size: "small",
655
+ children: /* @__PURE__ */ Q(ve, {})
656
+ })]
657
+ })]
658
+ }),
659
+ /* @__PURE__ */ Q(F, {}),
660
+ /* @__PURE__ */ Q(T, {
661
+ sx: {
662
+ p: 3,
663
+ flexGrow: 1,
664
+ overflowY: "auto"
665
+ },
666
+ children: /* @__PURE__ */ Q(je, {
667
+ schedulerType: e,
668
+ value: x,
669
+ onChange: (e) => {
670
+ C(e), s(!0);
671
+ },
672
+ disabled: t
673
+ })
674
+ })
675
+ ]
676
+ })
677
+ })] });
678
+ }, Pe = (e) => {
679
+ let { t } = y(), { selectedColumns: n = [], columnsList: r = [], onChange: i } = e;
680
+ if (!r?.length) return /* @__PURE__ */ Q(pe, {});
681
+ let a = t("table.hideColumns");
682
+ return /* @__PURE__ */ $(I, {
683
+ sx: {
684
+ m: 1,
685
+ minWidth: 250
686
+ },
687
+ size: "small",
688
+ children: [/* @__PURE__ */ Q(B, {
689
+ id: "hide-columns-label",
690
+ children: a
691
+ }), /* @__PURE__ */ Q(W, {
692
+ labelId: "hide-columns-label",
693
+ id: "hide-columns-select",
694
+ multiple: !0,
695
+ value: n,
696
+ onChange: (e) => {
697
+ let t = e.target.value, n = typeof t == "string" ? t.split(",") : t;
698
+ n.length < 1 || i?.(n);
699
+ },
700
+ input: /* @__PURE__ */ Q(ne, { label: a }),
701
+ renderValue: (e) => e.map((e) => r.find((t) => t.value === e)?.label ?? e).join(", "),
702
+ sx: { maxHeight: 40 },
703
+ children: r.map((e) => /* @__PURE__ */ $(U, {
704
+ value: e.value,
705
+ children: [/* @__PURE__ */ Q(D, {
706
+ checked: n.indexOf(e.value) > -1,
707
+ size: "small"
708
+ }), /* @__PURE__ */ Q(V, { primary: e.label })]
709
+ }, e.value))
710
+ })]
711
+ });
712
+ }, Fe = (e) => {
713
+ let { loading: t, t: n } = y(), { children: r, items: i = [], onRefresh: a } = e, [o, s] = w(null), c = !!o, l = (e) => {
714
+ s(e.currentTarget);
715
+ }, u = () => {
716
+ s(null);
717
+ };
718
+ return /* @__PURE__ */ $(T, {
719
+ sx: {
720
+ display: "flex",
721
+ alignItems: "center",
722
+ justifyContent: "flex-end",
723
+ gap: 1,
724
+ mb: 1
725
+ },
726
+ children: [
727
+ r,
728
+ /* @__PURE__ */ Q(z, {
729
+ "aria-label": "more",
730
+ id: "toolbar-button",
731
+ "aria-controls": c ? "toolbar-menu" : void 0,
732
+ "aria-expanded": c ? "true" : void 0,
733
+ "aria-haspopup": "true",
734
+ onClick: l,
735
+ size: "small",
736
+ children: t ? /* @__PURE__ */ Q(k, { size: 20 }) : /* @__PURE__ */ Q(be, {})
737
+ }),
738
+ /* @__PURE__ */ $(H, {
739
+ id: "toolbar-menu",
740
+ anchorEl: o,
741
+ open: c,
742
+ onClose: u,
743
+ MenuListProps: { "aria-labelledby": "toolbar-button" },
744
+ children: [
745
+ i.map((e, t) => /* @__PURE__ */ $(U, {
746
+ onClick: () => {
747
+ e.onClick?.(), u();
748
+ },
749
+ children: [e.icon && /* @__PURE__ */ Q(te, { children: e.icon }), /* @__PURE__ */ Q(V, { children: e.label })]
750
+ }, t)),
751
+ i.length > 0 && a && /* @__PURE__ */ Q(F, {}),
752
+ a && /* @__PURE__ */ $(U, {
753
+ onClick: () => {
754
+ a(), u();
755
+ },
756
+ children: [/* @__PURE__ */ Q(te, { children: /* @__PURE__ */ Q(xe, { fontSize: "small" }) }), /* @__PURE__ */ Q(V, { children: n("toolbar.refresh") })]
757
+ })
758
+ ]
759
+ })
760
+ ]
761
+ });
762
+ }, Ie = {
763
+ ACTIVE: "success",
764
+ DEACTIVATED: "default",
765
+ DELETED: "error",
766
+ PROCESSING: "info",
767
+ PENDING: "warning",
768
+ APPROVED: "success",
769
+ PUBLISHED: "primary"
770
+ }, Le = ({ status: e }) => /* @__PURE__ */ Q(O, {
771
+ label: String(e),
772
+ size: "small",
773
+ color: Ie[e] || "default",
774
+ variant: "outlined"
775
+ }), Re = (e) => {
776
+ let { t, permissions: n } = y(), { entity: r, disabled: i, onDelete: a, showLabel: o = !1 } = e, [s, c] = w(!1);
777
+ if (!r || !n.canDelete) return null;
778
+ let l = (e) => {
779
+ e.stopPropagation(), c(!0);
780
+ }, u = (e) => {
781
+ e.stopPropagation(), c(!1);
782
+ };
783
+ return /* @__PURE__ */ $(pe, { children: [/* @__PURE__ */ Q(Y, {
784
+ title: t("actions.delete"),
785
+ children: /* @__PURE__ */ Q("span", { children: /* @__PURE__ */ $(z, {
786
+ color: "error",
787
+ size: "small",
788
+ onClick: l,
789
+ disabled: i,
790
+ children: [/* @__PURE__ */ Q(Se, { fontSize: "small" }), o && t("actions.delete")]
791
+ }) })
792
+ }), /* @__PURE__ */ $(A, {
793
+ open: s,
794
+ onClose: u,
795
+ onClick: (e) => e.stopPropagation(),
796
+ children: [
797
+ /* @__PURE__ */ Q(P, { children: t("actions.delete") }),
798
+ /* @__PURE__ */ Q(M, { children: /* @__PURE__ */ Q(N, { children: t("actions.confirm.delete") }) }),
799
+ /* @__PURE__ */ $(j, { children: [/* @__PURE__ */ Q(E, {
800
+ onClick: u,
801
+ size: "small",
802
+ children: t("actions.cancel")
803
+ }), /* @__PURE__ */ Q(E, {
804
+ onClick: (e) => {
805
+ e.stopPropagation(), a?.(r), c(!1);
806
+ },
807
+ color: "error",
808
+ variant: "contained",
809
+ size: "small",
810
+ autoFocus: !0,
811
+ children: t("actions.delete")
812
+ })] })
813
+ ]
814
+ })] });
815
+ }, ze = (e) => {
816
+ let { t, permissions: n } = y(), { entity: r, disabled: i, onEdit: a, showLabel: o = !1 } = e;
817
+ return !r || !n.canUpdate ? null : /* @__PURE__ */ Q(Y, {
818
+ title: t("actions.edit"),
819
+ children: /* @__PURE__ */ Q("span", { children: /* @__PURE__ */ $(z, {
820
+ color: "primary",
821
+ size: "small",
822
+ onClick: (e) => {
823
+ e.stopPropagation(), a?.(r);
824
+ },
825
+ disabled: i,
826
+ children: [/* @__PURE__ */ Q(Ce, { fontSize: "small" }), o && t("actions.edit")]
827
+ }) })
828
+ });
829
+ }, Be = (e) => /* @__PURE__ */ Q(T, {
830
+ sx: {
831
+ display: "flex",
832
+ flexWrap: "wrap",
833
+ gap: .5
834
+ },
835
+ children: e?.days.map((e, t) => /* @__PURE__ */ Q(O, {
836
+ label: e,
837
+ size: "small",
838
+ variant: "outlined",
839
+ color: "primary"
840
+ }, t))
841
+ }), Ve = (e, t) => e?.type === "PERIOD" ? /* @__PURE__ */ Q(T, {
842
+ sx: {
843
+ display: "flex",
844
+ flexWrap: "wrap",
845
+ gap: .5
846
+ },
847
+ children: t?.days.map((t, n) => /* @__PURE__ */ Q(O, {
848
+ label: `${e.weekDay} ${t}`,
849
+ size: "small",
850
+ variant: "outlined",
851
+ color: "secondary"
852
+ }, n))
853
+ }) : /* @__PURE__ */ Q(T, {
854
+ sx: {
855
+ display: "flex",
856
+ flexWrap: "wrap",
857
+ gap: .5
858
+ },
859
+ children: /* @__PURE__ */ Q(O, {
860
+ label: e?.monthDay?.toString(),
861
+ size: "small",
862
+ variant: "outlined",
863
+ color: "info"
864
+ }, "monthDay")
865
+ }), He = (e, t, n) => /* @__PURE__ */ $(T, {
866
+ sx: {
867
+ display: "flex",
868
+ flexDirection: "column",
869
+ gap: .5
870
+ },
871
+ children: [Ve(t, n), /* @__PURE__ */ Q(T, {
872
+ sx: {
873
+ display: "flex",
874
+ flexWrap: "wrap",
875
+ gap: .5
876
+ },
877
+ children: e?.months?.map((e, t) => /* @__PURE__ */ Q(O, {
878
+ label: e,
879
+ size: "small",
880
+ variant: "outlined",
881
+ color: "warning"
882
+ }, t))
883
+ })]
884
+ }), Ue = (t) => {
885
+ let { disabled: n, schedulerType: r, currency: i, t: a, onEdit: o, onDelete: s } = t;
886
+ return [
887
+ {
888
+ id: "index",
889
+ key: "index",
890
+ label: "#",
891
+ minWidth: 50
892
+ },
893
+ {
894
+ id: "duration",
895
+ key: "duration",
896
+ label: a("scheduler.meta.duration"),
897
+ minWidth: 120,
898
+ format: (e) => {
899
+ let t = e;
900
+ return `${t?.period} (${t?.type})`;
901
+ }
902
+ },
903
+ {
904
+ id: "repeat",
905
+ key: "repeat",
906
+ label: a("scheduler.duration"),
907
+ minWidth: 200,
908
+ format: (e, t) => {
909
+ let { duration: n, repeat: r } = t, { weekly: i, monthly: a, yearly: o } = r;
910
+ switch (n?.type) {
911
+ case "WEEK": return Be(i);
912
+ case "MONTH": return Ve(a, i);
913
+ case "YEAR": return He(o, a, i);
914
+ default: return null;
915
+ }
916
+ }
917
+ },
918
+ [d.DISCOUNT, d.TRIAL_DISCOUNT].includes(r) ? {
919
+ id: "discount",
920
+ key: "discount",
921
+ label: a("scheduler.meta.duration"),
922
+ minWidth: 120,
923
+ format: (t) => {
924
+ let n = t;
925
+ return n ? n.type === "PERCENT" ? `${n.value}${e[n.type]}` : g(n.value, i ?? "USD") : "—";
926
+ }
927
+ } : null,
928
+ {
929
+ id: "status",
930
+ key: "status",
931
+ label: a("scheduler.status"),
932
+ minWidth: 120,
933
+ align: "center",
934
+ concealable: !0,
935
+ format: (e) => /* @__PURE__ */ Q(Le, { status: e })
936
+ },
937
+ {
938
+ id: "updatedAt",
939
+ key: "updatedAt",
940
+ label: a("scheduler.updatedAt"),
941
+ minWidth: 180,
942
+ align: "center",
943
+ concealable: !0,
944
+ format: (e) => {
945
+ let t = e;
946
+ return /* @__PURE__ */ Q("span", { children: t?.updatedAt ? _(Z(t.updatedAt).toDate()) : "—" });
947
+ }
948
+ },
949
+ o || s ? {
950
+ id: "actions",
951
+ key: "actions",
952
+ label: a("table.actions"),
953
+ minWidth: 100,
954
+ align: "center",
955
+ format: (e, t) => /* @__PURE__ */ $(T, {
956
+ sx: {
957
+ display: "flex",
958
+ justifyContent: "center",
959
+ gap: .5
960
+ },
961
+ children: [o && /* @__PURE__ */ Q(ze, {
962
+ onEdit: o,
963
+ disabled: n,
964
+ entity: t
965
+ }), s && /* @__PURE__ */ Q(Re, {
966
+ onDelete: s,
967
+ entity: t,
968
+ disabled: n
969
+ })]
970
+ })
971
+ } : null
972
+ ].filter(Boolean);
973
+ }, We = (e) => e.map((e, t) => ({
974
+ ...e,
975
+ key: e.id || t.toString(),
976
+ index: t + 1
977
+ })), Ge = () => ({
978
+ title: "#",
979
+ dataIndex: "index",
980
+ key: "index",
981
+ width: 50
982
+ }), Ke = (e) => ({
983
+ title: e("table.actions"),
984
+ key: "actions",
985
+ width: 100
986
+ }), qe = (e) => {
987
+ let { type: t, title: n, disabled: r, readOnlyFields: i = [], currency: a, onRefresh: s } = e, { schedulers: c, loading: l, disabled: u, t: d, permissions: f, onUpdate: p, onDelete: m } = y(), h = r ?? u, [g, _] = w(/* @__PURE__ */ new Set()), [x, C] = w(!1), [E, D] = w(!1), [O, k] = w(!1), [A, j] = w(null), [M, N] = w(0), [P, I] = w(10), L = S(() => {
988
+ let e = c[t] ?? [];
989
+ return g.size > 0 && (e = e.filter((e) => !e.id || !g.has(e.id))), We(e);
990
+ }, [
991
+ c,
992
+ t,
993
+ g
994
+ ]), R = L.length >= o, B = b((e) => {
995
+ j(JSON.parse(JSON.stringify(e))), k(!0), C(!1);
996
+ }, []), te = async () => {
997
+ if (!(!A || !p)) try {
998
+ await p(t, A), k(!1), j(null), C(!1), s?.();
999
+ } catch (e) {
1000
+ console.error("Failed to update scheduler:", e);
1001
+ }
1002
+ }, V = b(async (e) => {
1003
+ if (e.id?.startsWith("new-")) {
1004
+ _((t) => {
1005
+ let n = new Set(t);
1006
+ return e.id && n.add(e.id), n;
1007
+ });
1008
+ return;
1009
+ }
1010
+ m && e.id && (await m(t, e.id), s?.());
1011
+ }, [
1012
+ m,
1013
+ t,
1014
+ s
1015
+ ]), { filteredColumns: H, columnsList: U, selectedColumns: ne, setSelectedColumns: W } = v(S(() => Ue({
1016
+ disabled: h,
1017
+ schedulerType: t,
1018
+ entities: L,
1019
+ currency: a,
1020
+ t: d,
1021
+ onEdit: f.canUpdate ? B : void 0,
1022
+ onDelete: f.canDelete ? V : void 0
1023
+ }), [
1024
+ h,
1025
+ t,
1026
+ L,
1027
+ a,
1028
+ d,
1029
+ f,
1030
+ B,
1031
+ V
1032
+ ])), K = (e, t) => {
1033
+ N(t);
1034
+ }, q = (e) => {
1035
+ I(parseInt(e.target.value, 10)), N(0);
1036
+ }, J = L.slice(M * P, M * P + P);
1037
+ return /* @__PURE__ */ $(re, {
1038
+ sx: {
1039
+ width: "100%",
1040
+ overflow: "hidden",
1041
+ mb: 2
1042
+ },
1043
+ children: [
1044
+ /* @__PURE__ */ Q(T, {
1045
+ sx: {
1046
+ p: 2,
1047
+ display: "flex",
1048
+ alignItems: "center",
1049
+ justifyContent: "flex-end",
1050
+ gap: 2
1051
+ },
1052
+ children: /* @__PURE__ */ Q(Fe, {
1053
+ onRefresh: s,
1054
+ items: f.canCreate && !R ? [{
1055
+ label: /* @__PURE__ */ Q(Ne, {
1056
+ setDirty: C,
1057
+ dirty: x,
1058
+ isCreating: E,
1059
+ setIsCreating: D,
1060
+ schedulerType: t,
1061
+ disabled: h || l || R || E,
1062
+ onSuccess: () => s?.(),
1063
+ buttonProps: { startIcon: /* @__PURE__ */ Q(ge, {}) }
1064
+ }),
1065
+ onClick: () => {}
1066
+ }] : [],
1067
+ children: /* @__PURE__ */ Q(Pe, {
1068
+ columnsList: U,
1069
+ selectedColumns: ne,
1070
+ onChange: W
1071
+ })
1072
+ })
1073
+ }),
1074
+ /* @__PURE__ */ Q(se, {
1075
+ sx: { maxHeight: 440 },
1076
+ children: /* @__PURE__ */ $(ie, {
1077
+ stickyHeader: !0,
1078
+ "aria-label": "schedulers table",
1079
+ size: "small",
1080
+ children: [/* @__PURE__ */ Q(ce, { children: /* @__PURE__ */ Q(G, { children: H.filter((e) => !e.hidden).map((e) => /* @__PURE__ */ Q(oe, {
1081
+ align: e.align,
1082
+ style: { minWidth: e.minWidth },
1083
+ children: e.label
1084
+ }, e.id)) }) }), /* @__PURE__ */ $(ae, { children: [J.map((e) => /* @__PURE__ */ Q(G, {
1085
+ hover: !0,
1086
+ role: "checkbox",
1087
+ tabIndex: -1,
1088
+ children: H.filter((e) => !e.hidden).map((t) => {
1089
+ let n = t.id.includes(".") ? t.id.split(".").reduce((e, t) => e?.[t], e) : e[t.id];
1090
+ return /* @__PURE__ */ Q(oe, {
1091
+ align: t.align,
1092
+ children: t.format ? t.format(n, e) : n
1093
+ }, t.id);
1094
+ })
1095
+ }, e.key)), J.length === 0 && /* @__PURE__ */ Q(G, { children: /* @__PURE__ */ Q(oe, {
1096
+ colSpan: H.length,
1097
+ align: "center",
1098
+ sx: { py: 3 },
1099
+ children: /* @__PURE__ */ Q(X, {
1100
+ variant: "body2",
1101
+ color: "text.secondary",
1102
+ children: "No items found"
1103
+ })
1104
+ }) })] })]
1105
+ })
1106
+ }),
1107
+ /* @__PURE__ */ Q(le, {
1108
+ rowsPerPageOptions: [
1109
+ 5,
1110
+ 10,
1111
+ 25,
1112
+ 100
1113
+ ],
1114
+ component: "div",
1115
+ count: L.length,
1116
+ rowsPerPage: P,
1117
+ page: M,
1118
+ onPageChange: K,
1119
+ onRowsPerPageChange: q
1120
+ }),
1121
+ /* @__PURE__ */ Q(ee, {
1122
+ anchor: "right",
1123
+ open: O,
1124
+ onClose: () => {
1125
+ k(!1), j(null);
1126
+ },
1127
+ PaperProps: { sx: {
1128
+ width: {
1129
+ xs: "100%",
1130
+ sm: 600
1131
+ },
1132
+ p: 0
1133
+ } },
1134
+ children: /* @__PURE__ */ $(T, {
1135
+ sx: {
1136
+ display: "flex",
1137
+ flexDirection: "column",
1138
+ height: "100%"
1139
+ },
1140
+ children: [
1141
+ /* @__PURE__ */ $(T, {
1142
+ sx: {
1143
+ p: 2,
1144
+ display: "flex",
1145
+ alignItems: "center",
1146
+ justifyContent: "space-between"
1147
+ },
1148
+ children: [/* @__PURE__ */ $(T, {
1149
+ sx: {
1150
+ display: "flex",
1151
+ alignItems: "center",
1152
+ gap: 1
1153
+ },
1154
+ children: [/* @__PURE__ */ Q(_e, { color: "primary" }), /* @__PURE__ */ Q(X, {
1155
+ variant: "h6",
1156
+ children: n ?? d("scheduler")
1157
+ })]
1158
+ }), /* @__PURE__ */ $(T, {
1159
+ sx: {
1160
+ display: "flex",
1161
+ alignItems: "center",
1162
+ gap: 1
1163
+ },
1164
+ children: [/* @__PURE__ */ Q(Me, {
1165
+ isEdit: !0,
1166
+ loading: l,
1167
+ disabled: h || !x || E,
1168
+ onClick: te
1169
+ }), /* @__PURE__ */ Q(z, {
1170
+ onClick: () => k(!1),
1171
+ size: "small",
1172
+ children: /* @__PURE__ */ Q(ve, {})
1173
+ })]
1174
+ })]
1175
+ }),
1176
+ /* @__PURE__ */ Q(F, {}),
1177
+ /* @__PURE__ */ Q(T, {
1178
+ sx: {
1179
+ p: 3,
1180
+ flexGrow: 1,
1181
+ overflowY: "auto"
1182
+ },
1183
+ children: O && A && /* @__PURE__ */ Q(je, {
1184
+ schedulerType: t,
1185
+ value: A,
1186
+ onChange: (e) => {
1187
+ j(e), C(!0);
1188
+ },
1189
+ disabled: h,
1190
+ readOnlyFields: i
1191
+ })
1192
+ })
1193
+ ]
1194
+ })
1195
+ })
1196
+ ]
1197
+ });
1198
+ };
1199
+ //#endregion
1200
+ export { je as Scheduler, Ne as SchedulerDrawerButton, qe as SchedulersList, Ke as actionField, Ge as indexColumn, We as indexable };