@mamrp/components 1.0.0

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.
package/dist/index.js ADDED
@@ -0,0 +1,3824 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Accordion: () => Page,
34
+ AdvancedSearchButton: () => AdvancedSearchButton,
35
+ ConfirmationDialog: () => ConfirmationDialog,
36
+ CustomCheckbox: () => CustomCheckbox,
37
+ CustomTimePicker: () => CustomTimePicker,
38
+ DateFilter: () => DateFilter,
39
+ DateFilterRange: () => DateFilterRange,
40
+ DatePicker: () => date_picker_default,
41
+ DateTimePicker: () => date_time_picker_default,
42
+ DateTimeRangePicker: () => date_time_range_picker_default,
43
+ FormInputNumber: () => number_type_default,
44
+ FormInputText: () => text_type_default,
45
+ HorizontalStepper: () => HorizontalStepper,
46
+ LicensePlate: () => LicensePlate,
47
+ Loading: () => Loading,
48
+ MobileDateTimePicker: () => mobile_date_time_picker_default,
49
+ Modal: () => ConfirmationDialog2,
50
+ NestedSelectort: () => selector_default,
51
+ NoResult: () => NoResult,
52
+ PaginationList: () => PaginationList,
53
+ RadioButton: () => RadioButton,
54
+ SearchLicensePlate: () => SearchLicensePlate,
55
+ Selector: () => MultipleSelectChip,
56
+ SkeletonCard: () => card_skeleton_default,
57
+ SonarSpinner: () => SonarSpinner,
58
+ SwitchButton: () => switch_button_default,
59
+ Table: () => table_default,
60
+ UploadImage: () => upload_image_default
61
+ });
62
+ module.exports = __toCommonJS(index_exports);
63
+
64
+ // react-shim.js
65
+ var React = __toESM(require("react"));
66
+
67
+ // src/auto-complete/selector/index.tsx
68
+ var import_material3 = require("@mui/material");
69
+ var import_Autocomplete = __toESM(require("@mui/material/Autocomplete"));
70
+ var import_TextField = __toESM(require("@mui/material/TextField"));
71
+ var React3 = __toESM(require("react"));
72
+ var import_react_hook_form = require("react-hook-form");
73
+
74
+ // src/constants/httpMethod.ts
75
+ var numberToHttpMethodMapping = {
76
+ 0: "POST",
77
+ 1: "GET",
78
+ 2: "PUT",
79
+ 3: "DELETE"
80
+ };
81
+
82
+ // src/auto-complete/selector/custome-style.tsx
83
+ var import_react2 = __toESM(require("react"));
84
+
85
+ // src/license-plate/index.tsx
86
+ var import_material = require("@mui/material");
87
+ var import_Button = __toESM(require("@mui/material/Button"));
88
+ var import_Dialog = __toESM(require("@mui/material/Dialog"));
89
+ var import_DialogContent = __toESM(require("@mui/material/DialogContent"));
90
+ var import_DialogTitle = __toESM(require("@mui/material/DialogTitle"));
91
+ var import_image = __toESM(require("next/image"));
92
+ var import_react = require("react");
93
+ var import_io5 = require("react-icons/io5");
94
+
95
+ // src/constants/letters.ts
96
+ var letters = [
97
+ "\u0627\u0644\u0641",
98
+ "\u0628",
99
+ "\u067E",
100
+ "\u062A",
101
+ "\u062B",
102
+ "\u062C",
103
+ "\u0686",
104
+ "\u062D",
105
+ "\u062E",
106
+ "\u062F",
107
+ "\u0630",
108
+ "\u0631",
109
+ "\u0632",
110
+ "\u0698",
111
+ "\u0633",
112
+ "\u0634",
113
+ "\u0635",
114
+ "\u0636",
115
+ "\u0637",
116
+ "\u0638",
117
+ "\u0639",
118
+ "\u063A",
119
+ "\u0641",
120
+ "\u0642",
121
+ "\u06A9",
122
+ "\u06AF",
123
+ "\u0644",
124
+ "\u0645",
125
+ "\u0646",
126
+ "\u0648",
127
+ "\u0647",
128
+ "\u06CC"
129
+ ];
130
+ var letters_default = letters;
131
+
132
+ // src/license-plate/index.tsx
133
+ var import_utils = require("@mamrp/utils");
134
+ function LicensePlate({
135
+ width = "100%",
136
+ name,
137
+ setValue,
138
+ data,
139
+ readOnly = true,
140
+ size
141
+ }) {
142
+ const theme = (0, import_material.useTheme)();
143
+ const [open, setOpen] = (0, import_react.useState)(false);
144
+ const [selectedValue, setSelectedValue] = (0, import_react.useState)("");
145
+ const [inputValues, setInputValues] = (0, import_react.useState)({
146
+ input1: "",
147
+ input2: "",
148
+ input3: "",
149
+ input4: ""
150
+ });
151
+ const inputRefs = {
152
+ input1: (0, import_react.useRef)(null),
153
+ input2: (0, import_react.useRef)(null),
154
+ input3: (0, import_react.useRef)(null),
155
+ input4: (0, import_react.useRef)(null)
156
+ };
157
+ (0, import_react.useEffect)(() => {
158
+ if (data) {
159
+ let newdata = data.split(" ").filter((word) => word !== "\u0627\u06CC\u0631\u0627\u0646");
160
+ setInputValues({
161
+ input1: newdata[0],
162
+ input2: newdata[1],
163
+ input3: newdata[2],
164
+ input4: newdata[3]
165
+ });
166
+ } else if (data == "") {
167
+ setInputValues({
168
+ input1: "",
169
+ input2: "",
170
+ input3: "",
171
+ input4: ""
172
+ });
173
+ }
174
+ }, [data]);
175
+ const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
176
+ const newInputValues = {
177
+ ...inputValues,
178
+ [inputName]: enteredInput
179
+ };
180
+ setInputValues(newInputValues);
181
+ const formattedPlate = (0, import_utils.convertToEnglishDigits)(newInputValues.input1) + " " + newInputValues.input2 + " " + (0, import_utils.convertToEnglishDigits)(newInputValues.input3) + " \u0627\u06CC\u0631\u0627\u0646 " + (0, import_utils.convertToEnglishDigits)(newInputValues.input4);
182
+ setValue(name, formattedPlate);
183
+ if (enteredInput.length === maxlength || minLength === 1) {
184
+ if (inputName === "input1") {
185
+ setOpen(true);
186
+ } else if (inputName === "input2") {
187
+ setSelectedValue(enteredInput);
188
+ setOpen(false);
189
+ } else {
190
+ inputRefs["input4"]?.current?.focus();
191
+ }
192
+ }
193
+ };
194
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
195
+ import_material.Box,
196
+ {
197
+ sx: {
198
+ width,
199
+ border: "1px solid #e5e7eb",
200
+ borderRadius: "7px",
201
+ display: "flex",
202
+ alignItems: "center"
203
+ },
204
+ dir: "ltr"
205
+ },
206
+ /* @__PURE__ */ React.createElement(
207
+ import_material.Box,
208
+ {
209
+ sx: {
210
+ display: "flex",
211
+ alignItems: "center"
212
+ }
213
+ },
214
+ /* @__PURE__ */ React.createElement(
215
+ import_material.Box,
216
+ {
217
+ sx: {
218
+ backgroundColor: "#172554",
219
+ width: size === "small" ? "30px" : "36px",
220
+ minHeight: size === "small" ? "40px" : "52px",
221
+ maxHeight: size === "small" ? "40px" : "52px",
222
+ display: "flex",
223
+ justifyContent: "center",
224
+ alignItems: "center",
225
+ borderRadius: "7px",
226
+ mr: 0.4
227
+ }
228
+ },
229
+ /* @__PURE__ */ React.createElement(
230
+ import_image.default,
231
+ {
232
+ src: "/assets/images/iran-flag-dark.svg",
233
+ alt: "Iran Flag",
234
+ width: size === "small" ? 16 : 20,
235
+ height: size === "small" ? 14 : 12
236
+ }
237
+ )
238
+ )
239
+ ),
240
+ /* @__PURE__ */ React.createElement(
241
+ import_material.Box,
242
+ {
243
+ sx: {
244
+ width: "100%",
245
+ display: "flex",
246
+ justifyContent: "space-around",
247
+ fontSize: "1.125rem",
248
+ lineHeight: "1.75rem",
249
+ fontWeight: 600,
250
+ color: "#1f2937",
251
+ alignItems: "center"
252
+ }
253
+ },
254
+ /* @__PURE__ */ React.createElement(
255
+ "input",
256
+ {
257
+ disabled: readOnly || !!data && readOnly,
258
+ ref: inputRefs.input1,
259
+ type: "text",
260
+ maxLength: 2,
261
+ placeholder: "- -",
262
+ style: {
263
+ color: theme.palette.text.primary,
264
+ width: "24px",
265
+ textAlign: "center",
266
+ backgroundColor: "transparent",
267
+ outline: "none",
268
+ cursor: readOnly || !!data && readOnly ? "" : "text"
269
+ },
270
+ value: (0, import_utils.convertToPersianDigits)(inputValues.input1),
271
+ onChange: (e) => handleInputChange(e.target.value, "input1", 2)
272
+ }
273
+ ),
274
+ /* @__PURE__ */ React.createElement(
275
+ import_material.Box,
276
+ {
277
+ sx: {
278
+ display: "flex",
279
+ alignItems: "center"
280
+ }
281
+ },
282
+ !data && /* @__PURE__ */ React.createElement(
283
+ import_image.default,
284
+ {
285
+ src: "/assets/images/solid-arrow-down.svg",
286
+ width: 20,
287
+ height: 20,
288
+ alt: "arrow",
289
+ style: { cursor: "pointer", marginRight: 4 }
290
+ }
291
+ ),
292
+ /* @__PURE__ */ React.createElement(
293
+ "input",
294
+ {
295
+ disabled: readOnly || !!data && readOnly,
296
+ ref: inputRefs.input2,
297
+ onClick: () => {
298
+ if (!(readOnly || !!data && readOnly)) {
299
+ setOpen(true);
300
+ }
301
+ },
302
+ type: "text",
303
+ minLength: 1,
304
+ maxLength: 3,
305
+ placeholder: "-",
306
+ style: {
307
+ color: theme.palette.text.primary,
308
+ width: "28px",
309
+ textAlign: "center",
310
+ backgroundColor: "transparent",
311
+ outline: "none",
312
+ cursor: readOnly || !!data && readOnly ? "" : "pointer"
313
+ },
314
+ value: inputValues.input2,
315
+ readOnly: true
316
+ }
317
+ )
318
+ ),
319
+ /* @__PURE__ */ React.createElement(
320
+ import_Dialog.default,
321
+ {
322
+ dir: "rtl",
323
+ open,
324
+ onClose: () => setOpen(false),
325
+ "aria-labelledby": "alert-dialog-title",
326
+ "aria-describedby": "alert-dialog-description"
327
+ },
328
+ /* @__PURE__ */ React.createElement(
329
+ import_material.Box,
330
+ {
331
+ sx: {
332
+ display: "flex",
333
+ justifyContent: "space-between",
334
+ alignItems: "center",
335
+ backgroundColor: "#f5f5f5"
336
+ // bg-neutral-100
337
+ }
338
+ },
339
+ /* @__PURE__ */ React.createElement(import_DialogTitle.default, { id: "alert-dialog-title" }, "\u0627\u0646\u062A\u062E\u0627\u0628 \u062D\u0631\u0641 \u067E\u0644\u0627\u06A9"),
340
+ /* @__PURE__ */ React.createElement(
341
+ import_material.Box,
342
+ {
343
+ sx: {
344
+ cursor: "pointer",
345
+ paddingRight: "1rem",
346
+ color: "#737373"
347
+ // text-neutral-500
348
+ },
349
+ onClick: () => setOpen(false)
350
+ },
351
+ /* @__PURE__ */ React.createElement(import_material.IconButton, null, /* @__PURE__ */ React.createElement(import_io5.IoClose, null))
352
+ )
353
+ ),
354
+ /* @__PURE__ */ React.createElement(import_DialogContent.default, null, /* @__PURE__ */ React.createElement(
355
+ import_material.Box,
356
+ {
357
+ sx: {
358
+ display: "flex",
359
+ alignItems: "center",
360
+ justifyContent: "center",
361
+ flexWrap: "wrap",
362
+ gap: 2,
363
+ my: 2
364
+ }
365
+ },
366
+ letters_default.map((letter, index) => /* @__PURE__ */ React.createElement(
367
+ import_Button.default,
368
+ {
369
+ key: index,
370
+ variant: "outlined",
371
+ color: "primary",
372
+ sx: {
373
+ border: "none",
374
+ backgroundColor: "#f0f0f0",
375
+ width: "70px",
376
+ height: "50px",
377
+ fontWeight: "bold",
378
+ ":hover": {
379
+ backgroundColor: "#e3e3e3"
380
+ }
381
+ },
382
+ onClick: () => handleInputChange(letter, "input2", 3, 1)
383
+ },
384
+ /* @__PURE__ */ React.createElement(import_material.Typography, { color: "#117A4F", fontWeight: "bold" }, letter)
385
+ ))
386
+ ), /* @__PURE__ */ React.createElement(import_material.Box, { sx: { display: "flex", justifyContent: "center", mt: 2.5 } }, /* @__PURE__ */ React.createElement(
387
+ import_Button.default,
388
+ {
389
+ sx: { width: "6rem" },
390
+ variant: "outlined",
391
+ color: "error",
392
+ onClick: () => {
393
+ handleInputChange("", "input2", 3, 1);
394
+ setOpen(false);
395
+ }
396
+ },
397
+ "\u062D\u0630\u0641 \u062D\u0631\u0641"
398
+ )))
399
+ ),
400
+ /* @__PURE__ */ React.createElement(
401
+ "input",
402
+ {
403
+ disabled: readOnly || !!data && readOnly,
404
+ ref: inputRefs.input3,
405
+ type: "text",
406
+ maxLength: 3,
407
+ placeholder: "- - -",
408
+ style: {
409
+ color: theme.palette.text.primary,
410
+ width: "40px",
411
+ // w-10
412
+ textAlign: "center",
413
+ backgroundColor: "transparent",
414
+ outline: "none",
415
+ cursor: readOnly || !!data && readOnly ? "" : "text"
416
+ },
417
+ value: (0, import_utils.convertToPersianDigits)(inputValues.input3),
418
+ onChange: (e) => handleInputChange(e.target.value, "input3", 3)
419
+ }
420
+ ),
421
+ /* @__PURE__ */ React.createElement(
422
+ import_material.Box,
423
+ {
424
+ sx: {
425
+ height: "40px",
426
+ width: "1px",
427
+ backgroundColor: "#e5e7eb"
428
+ }
429
+ }
430
+ ),
431
+ /* @__PURE__ */ React.createElement(
432
+ import_material.Box,
433
+ {
434
+ sx: {
435
+ display: "flex",
436
+ flexDirection: "column-reverse",
437
+ gap: size === "small" ? 0.25 : 1,
438
+ alignItems: "center"
439
+ }
440
+ },
441
+ /* @__PURE__ */ React.createElement(
442
+ "input",
443
+ {
444
+ disabled: readOnly || !!data && readOnly,
445
+ ref: inputRefs.input4,
446
+ type: "text",
447
+ maxLength: 2,
448
+ placeholder: "- -",
449
+ style: {
450
+ color: theme.palette.text.primary,
451
+ width: "24px",
452
+ textAlign: "center",
453
+ backgroundColor: "transparent",
454
+ outline: "none",
455
+ cursor: readOnly || !!data && readOnly ? "" : "text"
456
+ },
457
+ value: (0, import_utils.convertToPersianDigits)(inputValues.input4),
458
+ onChange: (e) => handleInputChange(e.target.value, "input4", 2)
459
+ }
460
+ ),
461
+ /* @__PURE__ */ React.createElement(
462
+ import_image.default,
463
+ {
464
+ src: "/assets/images/iran.svg",
465
+ alt: "Iran",
466
+ width: size === "small" ? 25 : 30,
467
+ height: size === "small" ? 21 : 26
468
+ }
469
+ )
470
+ )
471
+ )
472
+ ));
473
+ }
474
+
475
+ // src/auto-complete/selector/custome-style.tsx
476
+ var import_material2 = require("@mui/material");
477
+ var import_fa = require("react-icons/fa");
478
+ function CustomeStyle({
479
+ props,
480
+ option,
481
+ multipleitems
482
+ }) {
483
+ let methodColor = "black";
484
+ let boldOption = multipleitems ? "bold" : "normal";
485
+ if (option.httpMethod === "GET") {
486
+ methodColor = "#4990e2";
487
+ } else if (option.httpMethod === "POST") {
488
+ methodColor = "green";
489
+ } else if (option.httpMethod === "DELETE") {
490
+ methodColor = "red";
491
+ } else if (option.httpMethod === "PUT") {
492
+ methodColor = "orange";
493
+ }
494
+ if (option.httpMethod || option.url) {
495
+ return /* @__PURE__ */ import_react2.default.createElement("li", { ...props, key: option.key }, /* @__PURE__ */ import_react2.default.createElement(
496
+ "div",
497
+ {
498
+ style: {
499
+ display: "flex",
500
+ alignItems: "center",
501
+ flexDirection: "row",
502
+ width: "100%"
503
+ }
504
+ },
505
+ /* @__PURE__ */ import_react2.default.createElement(
506
+ "div",
507
+ {
508
+ style: {
509
+ display: "flex",
510
+ flexDirection: "column",
511
+ justifyContent: "space-between",
512
+ width: "100%"
513
+ }
514
+ },
515
+ /* @__PURE__ */ import_react2.default.createElement("div", { style: { fontWeight: boldOption } }, option.title),
516
+ /* @__PURE__ */ import_react2.default.createElement("span", { style: { fontSize: "small", color: "gray" } }, option.url)
517
+ ),
518
+ /* @__PURE__ */ import_react2.default.createElement("div", { style: { fontWeight: "normal", color: methodColor } }, option.httpMethod)
519
+ ));
520
+ } else if (option.licensePlate) {
521
+ return /* @__PURE__ */ import_react2.default.createElement("li", { ...props, key: option.key }, /* @__PURE__ */ import_react2.default.createElement(
522
+ "div",
523
+ {
524
+ style: {
525
+ display: "flex",
526
+ alignItems: "center",
527
+ flexDirection: "row",
528
+ width: "100%",
529
+ flexWrap: "wrap"
530
+ }
531
+ },
532
+ /* @__PURE__ */ import_react2.default.createElement(import_fa.FaCar, null),
533
+ /* @__PURE__ */ import_react2.default.createElement(import_material2.Box, { sx: { marginLeft: "7px" } }, option.title),
534
+ /* @__PURE__ */ import_react2.default.createElement(
535
+ "div",
536
+ {
537
+ style: {
538
+ marginTop: 1,
539
+ display: "flex",
540
+ flexDirection: "column",
541
+ justifyContent: "space-between",
542
+ width: "100%"
543
+ }
544
+ },
545
+ /* @__PURE__ */ import_react2.default.createElement(LicensePlate, { data: option.licensePlate })
546
+ )
547
+ ));
548
+ } else {
549
+ return /* @__PURE__ */ import_react2.default.createElement("li", { ...props, key: option.key }, /* @__PURE__ */ import_react2.default.createElement(
550
+ "div",
551
+ {
552
+ style: {
553
+ display: "flex",
554
+ alignItems: "center",
555
+ flexDirection: "row",
556
+ width: "100%"
557
+ }
558
+ },
559
+ /* @__PURE__ */ import_react2.default.createElement(
560
+ "div",
561
+ {
562
+ style: {
563
+ display: "flex",
564
+ flexDirection: "column",
565
+ justifyContent: "space-between",
566
+ width: "100%"
567
+ }
568
+ },
569
+ /* @__PURE__ */ import_react2.default.createElement("div", { style: { fontWeight: boldOption } }, option.title)
570
+ )
571
+ ));
572
+ }
573
+ }
574
+
575
+ // src/auto-complete/selector/index.tsx
576
+ function MultipleSelectChip({
577
+ name,
578
+ control,
579
+ label,
580
+ data,
581
+ multipleitems,
582
+ //قابلیت انتخاب چند گزینه ای
583
+ isLoading,
584
+ disabled = false,
585
+ size = "medium",
586
+ clear = false
587
+ }) {
588
+ const dataOptions = data?.map((value) => ({
589
+ title: value.userName || value.name || `${value.firstName} ${value.lastName}`,
590
+ key: value.id || `key_${Math.random()}`,
591
+ // Assuming each item has an 'id'
592
+ httpMethod: numberToHttpMethodMapping[value.httpMethod],
593
+ url: value.url,
594
+ licensePlate: value.licensePlate
595
+ })) || [];
596
+ const combinedOptions = [
597
+ multipleitems && dataOptions.length > 0 && { title: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0647\u0645\u0647", key: "All" },
598
+ ...dataOptions
599
+ ].filter(Boolean);
600
+ const [selectedValues, setSelectedValues] = React3.useState([]);
601
+ const handleChange = (event, value, onChange) => {
602
+ console.log(value);
603
+ if (multipleitems) {
604
+ if (value.some((item) => item.title === "\u0627\u0646\u062A\u062E\u0627\u0628 \u0647\u0645\u0647")) {
605
+ const allItems = [...dataOptions];
606
+ setSelectedValues(allItems);
607
+ onChange(allItems.map((item) => item.key));
608
+ } else {
609
+ setSelectedValues(value);
610
+ onChange(value.map((item) => item.key));
611
+ }
612
+ } else {
613
+ setSelectedValues([value]);
614
+ onChange(value?.key || null);
615
+ }
616
+ };
617
+ function search(option, value) {
618
+ if (option.title.includes(value.title)) {
619
+ return true;
620
+ }
621
+ if (value.title.includes(option.title)) {
622
+ return true;
623
+ }
624
+ return false;
625
+ }
626
+ const CustomStyledValue = ({ children }) => /* @__PURE__ */ React3.createElement("span", { style: { color: "green", fontStyle: "italic" } }, children);
627
+ return /* @__PURE__ */ React3.createElement(
628
+ import_react_hook_form.Controller,
629
+ {
630
+ name,
631
+ control,
632
+ render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ React3.createElement(
633
+ import_Autocomplete.default,
634
+ {
635
+ disableClearable: clear,
636
+ disabled: disabled || isLoading,
637
+ disablePortal: true,
638
+ size,
639
+ disableCloseOnSelect: multipleitems,
640
+ options: combinedOptions,
641
+ multiple: multipleitems,
642
+ sx: {
643
+ width: "100%"
644
+ },
645
+ noOptionsText: "\u062F\u0627\u062F\u0647 \u0627\u06CC \u0628\u0631\u0627\u06CC \u0646\u0645\u0627\u06CC\u0634 \u0648\u062C\u0648\u062F \u0646\u062F\u0627\u0631\u062F",
646
+ value: multipleitems ? selectedValues : combinedOptions.find(
647
+ (option) => String(option.key) === String(value)
648
+ ) || { title: "", key: "" },
649
+ onChange: (event, value2) => {
650
+ handleChange(event, value2, onChange);
651
+ },
652
+ isOptionEqualToValue: (option, value2) => String(option.key) === String(value2?.key),
653
+ getOptionLabel: (option) => option.title,
654
+ loading: isLoading,
655
+ loadingText: "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...",
656
+ renderOption: (props, option) => {
657
+ return /* @__PURE__ */ React3.createElement(
658
+ CustomeStyle,
659
+ {
660
+ props,
661
+ option,
662
+ multipleitems: !!multipleitems
663
+ }
664
+ );
665
+ },
666
+ slots: { popper: import_material3.Popper },
667
+ slotProps: {
668
+ popper: {
669
+ modifiers: [
670
+ {
671
+ name: "preventOverflow",
672
+ options: {
673
+ boundary: "window",
674
+ rootBoundary: "viewport",
675
+ altBoundary: true,
676
+ padding: 10
677
+ }
678
+ },
679
+ {
680
+ name: "flip",
681
+ options: {
682
+ fallbackPlacements: ["top", "bottom"]
683
+ // Ensures it flips to the top if needed
684
+ }
685
+ }
686
+ ]
687
+ }
688
+ },
689
+ renderInput: (params) => /* @__PURE__ */ React3.createElement(
690
+ import_TextField.default,
691
+ {
692
+ ...params,
693
+ label,
694
+ error: !!error,
695
+ helperText: error?.message,
696
+ inputRef: ref,
697
+ InputProps: {
698
+ ...params.InputProps,
699
+ startAdornment: /* @__PURE__ */ React3.createElement(
700
+ "div",
701
+ {
702
+ style: {
703
+ display: "flex",
704
+ flexWrap: "wrap",
705
+ maxHeight: "250px",
706
+ // Set the maximum height for the chip container
707
+ overflowY: "auto",
708
+ // Enable vertical scroll
709
+ padding: 0
710
+ // Remove any padding to ensure chips stay inside the container
711
+ }
712
+ },
713
+ /* @__PURE__ */ React3.createElement(React3.Fragment, null, isLoading ? /* @__PURE__ */ React3.createElement(import_material3.Typography, { sx: { marginRight: 1 } }, "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC...") : null, params.InputProps.startAdornment)
714
+ )
715
+ }
716
+ }
717
+ )
718
+ }
719
+ )
720
+ }
721
+ );
722
+ }
723
+
724
+ // src/button/search/index.tsx
725
+ var import_material4 = require("@mui/material");
726
+ var import_react3 = __toESM(require("react"));
727
+ var import_io = require("react-icons/io");
728
+ var AnimatedIcon = (0, import_material4.styled)(import_io.IoIosArrowUp, {
729
+ shouldForwardProp: (prop) => prop !== "isShowFilter"
730
+ // Don't pass isShowFilter to the underlying component
731
+ })(({ isShowFilter }) => ({
732
+ transition: "all 0.5s ease",
733
+ transform: `rotate(${isShowFilter ? 0 : "0.5turn"})`
734
+ }));
735
+ function AdvancedSearchButton({
736
+ isShowFilter,
737
+ setIsShowFilter,
738
+ color = "black",
739
+ title = "\u0641\u0631\u0645 \u062C\u0633\u062A\u062C\u0648",
740
+ optional,
741
+ icon,
742
+ borderRadius,
743
+ paddingY,
744
+ fontSize
745
+ }) {
746
+ const theme = (0, import_material4.useTheme)();
747
+ return /* @__PURE__ */ import_react3.default.createElement(
748
+ import_material4.Button,
749
+ {
750
+ onClick: () => {
751
+ setIsShowFilter((prev) => !prev);
752
+ optional && optional(false);
753
+ },
754
+ startIcon: /* @__PURE__ */ import_react3.default.createElement(AnimatedIcon, { isShowFilter }),
755
+ sx: {
756
+ color: theme.palette.text.primary ?? color,
757
+ borderRadius,
758
+ paddingY,
759
+ fontSize
760
+ },
761
+ fullWidth: true
762
+ },
763
+ /* @__PURE__ */ import_react3.default.createElement(import_material4.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react3.default.createElement(import_material4.Box, null, icon ? icon : null), /* @__PURE__ */ import_react3.default.createElement(import_material4.Box, null, title))
764
+ );
765
+ }
766
+
767
+ // src/card-skeleton/index.tsx
768
+ var import_react4 = __toESM(require("react"));
769
+ var import_material5 = require("@mui/material");
770
+ function SkeletonCard() {
771
+ return /* @__PURE__ */ import_react4.default.createElement(
772
+ import_material5.Card,
773
+ {
774
+ sx: {
775
+ minWidth: 300,
776
+ borderRadius: "12px"
777
+ }
778
+ },
779
+ /* @__PURE__ */ import_react4.default.createElement(import_material5.CardContent, { sx: { padding: "1rem 1rem !important" } }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { spacing: 2 }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "text", width: 100, height: 20 })), /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "text", width: 100, height: 20 }))), /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "text", width: 100, height: 20 })), /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "text", width: 80, height: 20 }))), /* @__PURE__ */ import_react4.default.createElement(
780
+ import_material5.Stack,
781
+ {
782
+ direction: "row",
783
+ spacing: 2,
784
+ alignItems: "center",
785
+ justifyContent: "space-between"
786
+ },
787
+ /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "text", width: 80, height: 20 })),
788
+ /* @__PURE__ */ import_react4.default.createElement(import_material5.Stack, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "circular", width: 24, height: 24 }), /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "text", width: 80, height: 20 }))
789
+ ), /* @__PURE__ */ import_react4.default.createElement(
790
+ import_material5.Box,
791
+ {
792
+ sx: {
793
+ display: "flex",
794
+ justifyContent: "center",
795
+ paddingY: "0.5rem"
796
+ }
797
+ },
798
+ /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "rectangular", width: 240, height: 40 })
799
+ ), /* @__PURE__ */ import_react4.default.createElement(
800
+ import_material5.Box,
801
+ {
802
+ sx: {
803
+ display: "flex",
804
+ justifyContent: "center",
805
+ paddingTop: "1.5rem"
806
+ }
807
+ },
808
+ /* @__PURE__ */ import_react4.default.createElement(import_material5.Skeleton, { variant: "rectangular", width: 200, height: 40 })
809
+ )))
810
+ );
811
+ }
812
+ var card_skeleton_default = SkeletonCard;
813
+
814
+ // src/checkbox/index.tsx
815
+ var import_react_hook_form2 = require("react-hook-form");
816
+ var import_material6 = require("@mui/material");
817
+ var import_react5 = __toESM(require("react"));
818
+ function CustomCheckbox({ name, control, label }) {
819
+ return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(
820
+ import_react_hook_form2.Controller,
821
+ {
822
+ name,
823
+ control,
824
+ defaultValue: false,
825
+ render: ({ field }) => /* @__PURE__ */ import_react5.default.createElement(
826
+ import_material6.FormControlLabel,
827
+ {
828
+ control: /* @__PURE__ */ import_react5.default.createElement(
829
+ import_material6.Checkbox,
830
+ {
831
+ ...field,
832
+ checked: field.value
833
+ }
834
+ ),
835
+ label
836
+ }
837
+ )
838
+ }
839
+ ));
840
+ }
841
+
842
+ // src/confirmation-modal/index.tsx
843
+ var React7 = __toESM(require("react"));
844
+ var import_Dialog2 = __toESM(require("@mui/material/Dialog"));
845
+ var import_DialogActions = __toESM(require("@mui/material/DialogActions"));
846
+ var import_DialogContent2 = __toESM(require("@mui/material/DialogContent"));
847
+ var import_DialogTitle2 = __toESM(require("@mui/material/DialogTitle"));
848
+ var import_material7 = require("@mui/material");
849
+ var import_ai = require("react-icons/ai");
850
+ var import_md = require("react-icons/md");
851
+ var import_link = __toESM(require("next/link"));
852
+ function ConfirmationDialog({
853
+ open,
854
+ handleClose,
855
+ callback,
856
+ callbackParams,
857
+ headerText,
858
+ bodyText
859
+ }) {
860
+ return /* @__PURE__ */ React7.createElement(import_Dialog2.default, { open, onClose: handleClose, fullWidth: true, maxWidth: "sm" }, /* @__PURE__ */ React7.createElement(import_material7.Box, null, /* @__PURE__ */ React7.createElement(
861
+ import_DialogTitle2.default,
862
+ {
863
+ fontWeight: 700,
864
+ fontSize: "1.2rem",
865
+ display: "flex",
866
+ alignItems: "center",
867
+ gap: "4px"
868
+ },
869
+ /* @__PURE__ */ React7.createElement(import_ai.AiOutlineDeliveredProcedure, { style: { color: "inherit" }, size: 22 }),
870
+ headerText
871
+ ), /* @__PURE__ */ React7.createElement(
872
+ import_material7.IconButton,
873
+ {
874
+ "aria-label": "close",
875
+ onClick: handleClose,
876
+ sx: {
877
+ position: "absolute",
878
+ right: 8,
879
+ top: 8,
880
+ color: (theme) => theme.palette.grey[500]
881
+ }
882
+ },
883
+ /* @__PURE__ */ React7.createElement(import_md.MdClose, null)
884
+ ), /* @__PURE__ */ React7.createElement(import_material7.Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React7.createElement(import_DialogContent2.default, null, bodyText), /* @__PURE__ */ React7.createElement(
885
+ import_DialogActions.default,
886
+ {
887
+ sx: {
888
+ display: "flex",
889
+ justifyContent: "flex-end",
890
+ width: "100%",
891
+ gap: "12px",
892
+ alignItems: "center",
893
+ padding: "2rem"
894
+ }
895
+ },
896
+ /* @__PURE__ */ React7.createElement(import_link.default, { href: "/module/transportation/workflow/confirm-deliver" }, /* @__PURE__ */ React7.createElement(
897
+ import_material7.Button,
898
+ {
899
+ onClick: () => {
900
+ callback(callbackParams);
901
+ handleClose();
902
+ },
903
+ variant: "contained",
904
+ color: "primary",
905
+ startIcon: /* @__PURE__ */ React7.createElement(import_ai.AiOutlineDeliveredProcedure, { size: 16 }),
906
+ sx: { minWidth: "120px" }
907
+ },
908
+ "\u062A\u0623\u06CC\u06CC\u062F"
909
+ )),
910
+ /* @__PURE__ */ React7.createElement(
911
+ import_material7.Button,
912
+ {
913
+ onClick: handleClose,
914
+ variant: "outlined",
915
+ color: "inherit",
916
+ startIcon: /* @__PURE__ */ React7.createElement(import_md.MdOutlineCancel, null),
917
+ sx: { minWidth: "120px" }
918
+ },
919
+ "\u0627\u0646\u0635\u0631\u0627\u0641"
920
+ )
921
+ )));
922
+ }
923
+
924
+ // src/custom-time-picker/index.tsx
925
+ var import_material8 = require("@mui/material");
926
+ var import_Dialog3 = __toESM(require("@mui/material/Dialog"));
927
+ var import_DialogActions2 = __toESM(require("@mui/material/DialogActions"));
928
+ var import_DialogContent3 = __toESM(require("@mui/material/DialogContent"));
929
+ var import_DialogTitle3 = __toESM(require("@mui/material/DialogTitle"));
930
+ var import_react6 = require("react");
931
+ var import_md2 = require("react-icons/md");
932
+ var import_Tooltip = __toESM(require("@mui/material/Tooltip"));
933
+ var import_react_hook_form3 = require("react-hook-form");
934
+ var import_common = require("@mamrp/icons/common");
935
+ function CustomTimePicker({
936
+ name,
937
+ control,
938
+ label,
939
+ size = "small",
940
+ fullwidth = false,
941
+ autoRefresh = false,
942
+ disabled = false
943
+ }) {
944
+ return /* @__PURE__ */ React.createElement(
945
+ import_react_hook_form3.Controller,
946
+ {
947
+ name,
948
+ control,
949
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ React.createElement(
950
+ TimePickerComponent,
951
+ {
952
+ ...field,
953
+ label,
954
+ size,
955
+ error,
956
+ fullwidth,
957
+ autoRefresh,
958
+ disabled
959
+ }
960
+ )
961
+ }
962
+ );
963
+ }
964
+ var TimePickerComponent = ({
965
+ value,
966
+ onChange,
967
+ onBlur,
968
+ label,
969
+ size = "small",
970
+ error,
971
+ fullwidth,
972
+ autoRefresh,
973
+ disabled = false
974
+ }) => {
975
+ const theme = (0, import_material8.useTheme)();
976
+ const initialHour = value ? parseInt(value.split(":")[0]) : null;
977
+ const initialMinute = value ? parseInt(value.split(":")[1]) : null;
978
+ const [isModalOpen, setIsModalOpen] = (0, import_react6.useState)(false);
979
+ const [selectedHour, setSelectedHour] = (0, import_react6.useState)(initialHour);
980
+ const [selectedMinute, setSelectedMinute] = (0, import_react6.useState)(
981
+ initialMinute
982
+ );
983
+ const hourRefs = (0, import_react6.useRef)([]);
984
+ const minuteRefs = (0, import_react6.useRef)([]);
985
+ const hours = Array.from({ length: 24 }, (_, i) => i);
986
+ const minutes = Array.from({ length: 60 }, (_, i) => i);
987
+ (0, import_react6.useEffect)(() => {
988
+ if (isModalOpen) {
989
+ setTimeout(() => {
990
+ if (selectedHour !== null) {
991
+ hourRefs.current[selectedHour]?.scrollIntoView({
992
+ behavior: "smooth",
993
+ block: "center"
994
+ });
995
+ }
996
+ if (selectedMinute !== null) {
997
+ minuteRefs.current[selectedMinute]?.scrollIntoView({
998
+ behavior: "smooth",
999
+ block: "center"
1000
+ });
1001
+ }
1002
+ }, 0);
1003
+ }
1004
+ }, [isModalOpen, selectedHour, selectedMinute]);
1005
+ (0, import_react6.useEffect)(() => {
1006
+ const updatedHour = value ? parseInt(value.split(":")[0]) : null;
1007
+ setSelectedHour(updatedHour);
1008
+ const updatedMinute = value ? parseInt(value.split(":")[1]) : null;
1009
+ setSelectedMinute(updatedMinute);
1010
+ }, [value, autoRefresh]);
1011
+ const handleSelectHour = (hour) => {
1012
+ setSelectedHour(hour);
1013
+ if (selectedMinute !== null) {
1014
+ onChange(formatTime(hour, selectedMinute));
1015
+ }
1016
+ };
1017
+ const handleSelectMinute = (minute) => {
1018
+ setSelectedMinute(minute);
1019
+ if (selectedHour !== null) {
1020
+ onChange(formatTime(selectedHour, minute));
1021
+ }
1022
+ };
1023
+ const formatTime = (hour, minute) => {
1024
+ return `${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}`;
1025
+ };
1026
+ const handleInputChange = (e) => {
1027
+ let inputValue = e.target.value;
1028
+ if (!/^\d{0,2}:\d{0,2}$/.test(inputValue)) {
1029
+ return;
1030
+ }
1031
+ const [hourPart = "", minutePart = ""] = inputValue.split(":");
1032
+ if (parseInt(hourPart) > 23) {
1033
+ inputValue = `23:${minutePart}`;
1034
+ }
1035
+ if (parseInt(minutePart) > 59) {
1036
+ inputValue = `${hourPart}:59`;
1037
+ }
1038
+ if (hourPart.length === 2 && !inputValue.includes(":")) {
1039
+ inputValue = hourPart + ":";
1040
+ }
1041
+ onChange(inputValue);
1042
+ };
1043
+ const handleBlur = () => {
1044
+ if (!value || value === ":") {
1045
+ onChange("00:00");
1046
+ return;
1047
+ }
1048
+ const [hourPart = "0", minutePart = "0"] = value.split(":");
1049
+ const hour = Math.min(23, parseInt(hourPart) || 0);
1050
+ const minute = Math.min(59, parseInt(minutePart) || 0);
1051
+ const formattedTime = formatTime(hour, minute);
1052
+ onChange(formattedTime);
1053
+ };
1054
+ return /* @__PURE__ */ React.createElement(import_material8.Box, { display: "flex", alignItems: "center", gap: 0.5, sx: { width: "100%" } }, /* @__PURE__ */ React.createElement(
1055
+ import_material8.TextField,
1056
+ {
1057
+ disabled,
1058
+ label,
1059
+ value,
1060
+ onChange: handleInputChange,
1061
+ onBlur: handleBlur,
1062
+ InputLabelProps: { shrink: true },
1063
+ variant: "outlined",
1064
+ size,
1065
+ inputProps: {
1066
+ maxLength: 5,
1067
+ // Ensures the format is always "HH:MM"
1068
+ style: { textAlign: "center" }
1069
+ },
1070
+ InputProps: {
1071
+ ...!disabled && {
1072
+ endAdornment: /* @__PURE__ */ React.createElement(import_material8.InputAdornment, { position: "end" }, /* @__PURE__ */ React.createElement(import_Tooltip.default, { title: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646" }, /* @__PURE__ */ React.createElement(import_material8.IconButton, { onClick: () => setIsModalOpen(true) }, /* @__PURE__ */ React.createElement(import_common.Clock, { size: 22, color: theme.palette.text.primary }))))
1073
+ }
1074
+ },
1075
+ sx: { width: fullwidth ? "100%" : "8rem" },
1076
+ fullWidth: true
1077
+ }
1078
+ ), /* @__PURE__ */ React.createElement(
1079
+ import_Dialog3.default,
1080
+ {
1081
+ open: isModalOpen,
1082
+ onClose: () => setIsModalOpen(false),
1083
+ fullWidth: true,
1084
+ maxWidth: "xs"
1085
+ },
1086
+ /* @__PURE__ */ React.createElement(
1087
+ import_DialogTitle3.default,
1088
+ {
1089
+ fontWeight: 700,
1090
+ fontSize: "1.2rem",
1091
+ display: "flex",
1092
+ alignItems: "center",
1093
+ gap: "4px"
1094
+ },
1095
+ "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646"
1096
+ ),
1097
+ /* @__PURE__ */ React.createElement(
1098
+ import_material8.IconButton,
1099
+ {
1100
+ "aria-label": "close",
1101
+ onClick: () => setIsModalOpen(false),
1102
+ sx: {
1103
+ position: "absolute",
1104
+ right: 8,
1105
+ top: 8,
1106
+ color: (theme2) => theme2.palette.grey[500]
1107
+ }
1108
+ },
1109
+ /* @__PURE__ */ React.createElement(import_md2.MdClose, null)
1110
+ ),
1111
+ /* @__PURE__ */ React.createElement(import_material8.Divider, { sx: { my: "10px" } }),
1112
+ /* @__PURE__ */ React.createElement(import_DialogContent3.default, null, /* @__PURE__ */ React.createElement(import_material8.Box, { display: "flex", justifyContent: "space-between", gap: "20px" }, /* @__PURE__ */ React.createElement(import_material8.Box, { flex: 1 }, /* @__PURE__ */ React.createElement(import_material8.Typography, { variant: "h6", textAlign: "center", gutterBottom: true }, "\u062F\u0642\u06CC\u0642\u0647"), /* @__PURE__ */ React.createElement(
1113
+ import_material8.Box,
1114
+ {
1115
+ maxHeight: "200px",
1116
+ overflow: "auto",
1117
+ border: "1px solid lightgray",
1118
+ borderRadius: "8px"
1119
+ },
1120
+ minutes.map((minute) => /* @__PURE__ */ React.createElement(
1121
+ import_material8.Box,
1122
+ {
1123
+ key: minute,
1124
+ ref: (el) => {
1125
+ minuteRefs.current[minute] = el;
1126
+ },
1127
+ p: "10px",
1128
+ textAlign: "center",
1129
+ bgcolor: minute === selectedMinute ? "primary.light" : "inherit",
1130
+ color: minute === selectedMinute ? "white" : "inherit",
1131
+ sx: { cursor: "pointer" },
1132
+ onClick: () => handleSelectMinute(minute)
1133
+ },
1134
+ /* @__PURE__ */ React.createElement(import_material8.Typography, null, minute.toString().padStart(2, "0"))
1135
+ ))
1136
+ )), /* @__PURE__ */ React.createElement(import_material8.Box, { flex: 1 }, /* @__PURE__ */ React.createElement(import_material8.Typography, { variant: "h6", textAlign: "center", gutterBottom: true }, "\u0633\u0627\u0639\u062A"), /* @__PURE__ */ React.createElement(
1137
+ import_material8.Box,
1138
+ {
1139
+ maxHeight: "200px",
1140
+ overflow: "auto",
1141
+ border: "1px solid lightgray",
1142
+ borderRadius: "8px"
1143
+ },
1144
+ hours.map((hour) => /* @__PURE__ */ React.createElement(
1145
+ import_material8.Box,
1146
+ {
1147
+ key: hour,
1148
+ ref: (el) => {
1149
+ hourRefs.current[hour] = el;
1150
+ },
1151
+ p: "10px",
1152
+ textAlign: "center",
1153
+ bgcolor: hour === selectedHour ? "primary.light" : "inherit",
1154
+ color: hour === selectedHour ? "white" : "inherit",
1155
+ sx: { cursor: "pointer" },
1156
+ onClick: () => handleSelectHour(hour)
1157
+ },
1158
+ /* @__PURE__ */ React.createElement(import_material8.Typography, null, hour.toString().padStart(2, "0"))
1159
+ ))
1160
+ )))),
1161
+ /* @__PURE__ */ React.createElement(import_DialogActions2.default, { sx: { padding: 2 } }, /* @__PURE__ */ React.createElement(
1162
+ import_material8.Button,
1163
+ {
1164
+ onClick: () => setIsModalOpen(false),
1165
+ sx: { fontSize: "1.1rem" }
1166
+ },
1167
+ "\u0627\u0646\u062A\u062E\u0627\u0628"
1168
+ ))
1169
+ ));
1170
+ };
1171
+
1172
+ // src/date-filter-range/index.tsx
1173
+ var import_yup = require("@hookform/resolvers/yup");
1174
+ var import_Button2 = __toESM(require("@mui/material/Button"));
1175
+ var import_Grid2 = __toESM(require("@mui/material/Grid2"));
1176
+ var import_system = require("@mui/system");
1177
+ var import_moment = __toESM(require("moment"));
1178
+ var import_react8 = require("react");
1179
+ var import_react_hook_form5 = require("react-hook-form");
1180
+ var import_fa3 = require("react-icons/fa");
1181
+ var yup = __toESM(require("yup"));
1182
+
1183
+ // src/date-picker/index.tsx
1184
+ var import_material9 = require("@mui/material");
1185
+ var import_CircularProgress = __toESM(require("@mui/material/CircularProgress"));
1186
+ var import_x_date_pickers = require("@mui/x-date-pickers");
1187
+ var import_AdapterMomentJalaali = require("@mui/x-date-pickers/AdapterMomentJalaali");
1188
+ var import_dayjs = __toESM(require("dayjs"));
1189
+ var import_moment_jalaali = __toESM(require("moment-jalaali"));
1190
+ var import_fa2 = require("moment/locale/fa");
1191
+ var import_react7 = __toESM(require("react"));
1192
+ var import_react_hook_form4 = require("react-hook-form");
1193
+ import_moment_jalaali.default.locale("fa");
1194
+ import_moment_jalaali.default.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1195
+ var JalaliDatePicker = ({
1196
+ name,
1197
+ control,
1198
+ label,
1199
+ size = "medium",
1200
+ disabled = false,
1201
+ persian = false,
1202
+ align = "left",
1203
+ isLoading,
1204
+ maxDate,
1205
+ minDate,
1206
+ clear = true
1207
+ }) => {
1208
+ const today = (0, import_moment_jalaali.default)();
1209
+ const [open, setOpen] = (0, import_react7.useState)(false);
1210
+ const customLocaleText = {
1211
+ cancelButtonLabel: "\u0644\u063A\u0648",
1212
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
1213
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
1214
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646",
1215
+ start: "\u0634\u0631\u0648\u0639",
1216
+ end: "\u067E\u0627\u06CC\u0627\u0646",
1217
+ previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
1218
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
1219
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
1220
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
1221
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1222
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1223
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1224
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1225
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
1226
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
1227
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
1228
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
1229
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
1230
+ calendarWeekNumberHeaderText: "#",
1231
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
1232
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
1233
+ };
1234
+ return /* @__PURE__ */ import_react7.default.createElement(
1235
+ import_x_date_pickers.LocalizationProvider,
1236
+ {
1237
+ dateAdapter: import_AdapterMomentJalaali.AdapterMomentJalaali,
1238
+ localeText: customLocaleText
1239
+ },
1240
+ /* @__PURE__ */ import_react7.default.createElement(
1241
+ import_react_hook_form4.Controller,
1242
+ {
1243
+ name,
1244
+ control,
1245
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ import_react7.default.createElement(import_material9.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react7.default.createElement(
1246
+ import_x_date_pickers.DatePicker,
1247
+ {
1248
+ disabled: isLoading || disabled,
1249
+ closeOnSelect: false,
1250
+ openTo: "day",
1251
+ views: ["year", "month", "day"],
1252
+ label,
1253
+ value: field.value ? (0, import_moment_jalaali.default)(field.value) : null,
1254
+ slotProps: {
1255
+ ...clear && !disabled ? { field: { clearable: true } } : {},
1256
+ popper: {
1257
+ modifiers: [
1258
+ {
1259
+ name: "preventOverflow",
1260
+ options: {
1261
+ boundary: "window"
1262
+ }
1263
+ },
1264
+ {
1265
+ name: "flip",
1266
+ options: {
1267
+ fallbackPlacements: ["right", "left", "top"]
1268
+ }
1269
+ }
1270
+ ]
1271
+ },
1272
+ textField: {
1273
+ size,
1274
+ placeholder: field.value ? "" : "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ",
1275
+ InputLabelProps: {
1276
+ shrink: true,
1277
+ style: { color: error ? "#D32F2F" : "inherit" }
1278
+ },
1279
+ InputProps: {
1280
+ ...isLoading && { endAdornment: /* @__PURE__ */ import_react7.default.createElement(import_CircularProgress.default, { color: "secondary", size: 20 }) } || disabled && { endAdornment: false },
1281
+ ...field.value && {
1282
+ value: persian ? `${(0, import_moment_jalaali.default)(field.value).format("dddd - jDD/jMMMM/jYYYY")}` : `${(0, import_moment_jalaali.default)(field.value).format("jYYYY/jMM/jDD")}`
1283
+ },
1284
+ sx: {
1285
+ textAlign: align,
1286
+ "& input": {
1287
+ textAlign: align,
1288
+ direction: "rtl"
1289
+ }
1290
+ }
1291
+ }
1292
+ },
1293
+ actionBar: {
1294
+ actions: ["cancel", "accept"]
1295
+ // نمایش دکمه‌های تأیید، لغو و پاک کردن
1296
+ }
1297
+ },
1298
+ onChange: (value) => {
1299
+ if (value == null) {
1300
+ field.onChange(null);
1301
+ }
1302
+ },
1303
+ onAccept: (newValue) => {
1304
+ if (newValue) {
1305
+ const currentDate = (0, import_dayjs.default)(newValue);
1306
+ const nowUTC3 = /* @__PURE__ */ new Date();
1307
+ let iranHour = nowUTC3.getUTCHours();
1308
+ let iranMinute = nowUTC3.getUTCMinutes();
1309
+ const dateTimeWithIranTime4 = currentDate.hour(iranHour).minute(iranMinute).second(nowUTC3.getUTCSeconds());
1310
+ console.log(
1311
+ currentDate.format("YYYY-MM-DDTHH:mm:ss"),
1312
+ dateTimeWithIranTime4.format("YYYY-MM-DDTHH:mm:ss")
1313
+ );
1314
+ field.onChange(
1315
+ dateTimeWithIranTime4.format("YYYY-MM-DDTHH:mm:ss")
1316
+ );
1317
+ } else {
1318
+ field.onChange(null);
1319
+ }
1320
+ },
1321
+ sx: {
1322
+ width: "100%",
1323
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
1324
+ "& .MuiOutlinedInput-notchedOutline": {
1325
+ borderColor: error ? "#D32F2F" : "#C4C4C4"
1326
+ },
1327
+ "& .MuiInputBase-root": {
1328
+ height: size === "small" ? 40 : 56
1329
+ }
1330
+ },
1331
+ slots: {
1332
+ ...!clear && {
1333
+ clearButton: import_react7.default.Fragment,
1334
+ clearIcon: import_react7.default.Fragment
1335
+ },
1336
+ toolbar: (props) => {
1337
+ const currentDate = (0, import_moment_jalaali.default)(field.value);
1338
+ const formattedDate = currentDate.format("dddd, jDD jMMMM");
1339
+ return /* @__PURE__ */ import_react7.default.createElement(
1340
+ import_material9.Box,
1341
+ {
1342
+ sx: {
1343
+ my: 2,
1344
+ mx: 4
1345
+ }
1346
+ },
1347
+ /* @__PURE__ */ import_react7.default.createElement(import_material9.Typography, { variant: "overline", color: "primary" }, "\u062A\u0627\u0631\u06CC\u062E \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F"),
1348
+ /* @__PURE__ */ import_react7.default.createElement(import_material9.Typography, { variant: "h4" }, formattedDate == "Invalid date" ? "" : formattedDate)
1349
+ );
1350
+ },
1351
+ monthButton: (props) => {
1352
+ return /* @__PURE__ */ import_react7.default.createElement(
1353
+ "button",
1354
+ {
1355
+ className: `${props.className}`,
1356
+ style: {
1357
+ width: "80%",
1358
+ padding: "10px",
1359
+ marginBottom: "20px",
1360
+ border: "1px solid #ccc",
1361
+ borderRadius: "12px",
1362
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
1363
+ fontSize: "14px",
1364
+ cursor: props.disabled ? "default" : "pointer"
1365
+ },
1366
+ disabled: props.disabled,
1367
+ onFocus: props.onFocus,
1368
+ onBlur: props.onBlur,
1369
+ onClick: props.onClick,
1370
+ ref: props.ref
1371
+ },
1372
+ props["aria-label"],
1373
+ " "
1374
+ );
1375
+ }
1376
+ },
1377
+ minDate: minDate ? minDate : null,
1378
+ maxDate: maxDate ? maxDate : today
1379
+ }
1380
+ ), error && /* @__PURE__ */ import_react7.default.createElement(import_material9.Typography, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message))
1381
+ }
1382
+ )
1383
+ );
1384
+ };
1385
+ var date_picker_default = JalaliDatePicker;
1386
+
1387
+ // src/date-filter-range/index.tsx
1388
+ var nowUTC = import_moment.default.utc();
1389
+ var dateTimeWithIranTime2 = nowUTC;
1390
+ var dateTimeWithIranTime = nowUTC;
1391
+ var RoleFormSchema = yup.object().shape({});
1392
+ var defaultValues = {
1393
+ time: dateTimeWithIranTime.toDate().toISOString(),
1394
+ // تبدیل به ISO بدون تغییر آفست
1395
+ time2: dateTimeWithIranTime2.toDate().toISOString()
1396
+ // تبدیل به ISO بدون تغییر آفست
1397
+ };
1398
+ function DateFilterRange({ FromDate, ToDate }) {
1399
+ const isMobile = (0, import_system.useMediaQuery)("(max-width:900px)");
1400
+ const isSmMobile = (0, import_system.useMediaQuery)("(max-width:600px)");
1401
+ const { control, watch, setValue } = (0, import_react_hook_form5.useForm)({
1402
+ defaultValues,
1403
+ mode: "onChange",
1404
+ resolver: (0, import_yup.yupResolver)(RoleFormSchema)
1405
+ });
1406
+ (0, import_react8.useEffect)(() => {
1407
+ FromDate(nowUTC);
1408
+ ToDate(nowUTC);
1409
+ }, []);
1410
+ const currentDate = watch("time");
1411
+ const currentDate2 = watch("time2");
1412
+ (0, import_react8.useEffect)(() => {
1413
+ FromDate(currentDate);
1414
+ ToDate(currentDate2);
1415
+ }, [currentDate, currentDate2]);
1416
+ const handleDate = (direction, time) => {
1417
+ const currentDate3 = watch(time);
1418
+ const newDate = (0, import_moment.default)(currentDate3);
1419
+ if (direction === "forward") {
1420
+ newDate.add(1, "day");
1421
+ } else if (direction === "backward") {
1422
+ newDate.subtract(1, "day");
1423
+ }
1424
+ setValue(time, newDate.toISOString());
1425
+ };
1426
+ const isNextDisabledTime = (0, import_moment.default)(watch("time")).format("YYYY-MM-DD") == (0, import_moment.default)(watch("time2")).format("YYYY-MM-DD");
1427
+ const isLastDisabledTime = (0, import_moment.default)(watch("time")).format("YYYY-MM-DD") == (0, import_moment.default)(watch("time2")).format("YYYY-MM-DD");
1428
+ const today = (0, import_moment.default)().format("YYYY-MM-DD");
1429
+ const isNextDisabled = (0, import_moment.default)(watch("time")).format("YYYY-MM-DD") >= today;
1430
+ const isNextDisabledTime2 = (0, import_moment.default)(watch("time2")).format("YYYY-MM-DD") >= today;
1431
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(import_system.GlobalStyles, { styles: {
1432
+ //حذف مارجین های اضافی سمت راست و چپ
1433
+ ".MuiBox-root.muirtl-1crki0u": {
1434
+ marginLeft: 0,
1435
+ marginRight: 0
1436
+ }
1437
+ } }), /* @__PURE__ */ React.createElement(import_Grid2.default, { container: true, spacing: 2, justifyContent: "center", alignItems: "center", paddingTop: 3, width: "100%" }, /* @__PURE__ */ React.createElement(import_Grid2.default, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, justifyContent: "start" }, /* @__PURE__ */ React.createElement(
1438
+ import_Button2.default,
1439
+ {
1440
+ sx: {
1441
+ display: "flex",
1442
+ width: "100%",
1443
+ justifyContent: "center",
1444
+ padding: 0
1445
+ },
1446
+ onClick: () => handleDate("forward", "time"),
1447
+ disabled: isNextDisabled || isNextDisabledTime
1448
+ },
1449
+ /* @__PURE__ */ React.createElement(import_fa3.FaChevronRight, { size: 30 })
1450
+ )), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ React.createElement(date_picker_default, { name: "time", control, label: "\u062A\u0627\u0631\u06CC\u062E \u0627\u0632", maxDate: (0, import_moment.default)(watch("time2")), align: "center", persian: true, clear: false, size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React.createElement(
1451
+ import_Button2.default,
1452
+ {
1453
+ sx: {
1454
+ display: "flex",
1455
+ width: "100%",
1456
+ justifyContent: "center",
1457
+ padding: 0
1458
+ },
1459
+ onClick: () => handleDate("backward", "time")
1460
+ },
1461
+ /* @__PURE__ */ React.createElement(import_fa3.FaChevronLeft, { size: 30 })
1462
+ ))), /* @__PURE__ */ React.createElement(import_Grid2.default, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, justifyContent: "start" }, /* @__PURE__ */ React.createElement(
1463
+ import_Button2.default,
1464
+ {
1465
+ sx: {
1466
+ display: "flex",
1467
+ width: "100%",
1468
+ justifyContent: "center",
1469
+ padding: 0
1470
+ },
1471
+ onClick: () => handleDate("forward", "time2"),
1472
+ disabled: isNextDisabledTime2
1473
+ },
1474
+ /* @__PURE__ */ React.createElement(import_fa3.FaChevronRight, { size: 30 })
1475
+ )), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ React.createElement(date_picker_default, { name: "time2", control, label: "\u062A\u0627\u0631\u06CC\u062E \u062A\u0627", minDate: (0, import_moment.default)(watch("time")), persian: true, align: "center", clear: false, size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ React.createElement(
1476
+ import_Button2.default,
1477
+ {
1478
+ sx: {
1479
+ display: "flex",
1480
+ width: "100%",
1481
+ justifyContent: "center",
1482
+ padding: 0
1483
+ },
1484
+ onClick: () => handleDate("backward", "time2"),
1485
+ disabled: isLastDisabledTime
1486
+ },
1487
+ /* @__PURE__ */ React.createElement(import_fa3.FaChevronLeft, { size: 30 })
1488
+ )))), /* @__PURE__ */ React.createElement(import_Grid2.default, { container: true, size: 12 }, /* @__PURE__ */ React.createElement(import_Grid2.default, { size: 12 })));
1489
+ }
1490
+
1491
+ // src/date-filter/index.tsx
1492
+ var import_yup2 = require("@hookform/resolvers/yup");
1493
+ var import_Button3 = __toESM(require("@mui/material/Button"));
1494
+ var import_Grid22 = __toESM(require("@mui/material/Grid2"));
1495
+ var import_system2 = require("@mui/system");
1496
+ var import_moment2 = __toESM(require("moment"));
1497
+ var import_react9 = __toESM(require("react"));
1498
+ var import_react10 = require("react");
1499
+ var import_react_hook_form6 = require("react-hook-form");
1500
+ var import_fa4 = require("react-icons/fa");
1501
+ var yup2 = __toESM(require("yup"));
1502
+ var nowUTC2 = import_moment2.default.utc();
1503
+ var dateTimeWithIranTime3 = nowUTC2;
1504
+ var RoleFormSchema2 = yup2.object().shape({});
1505
+ var defaultValues2 = {
1506
+ time: dateTimeWithIranTime3.toDate().toISOString()
1507
+ // تبدیل به ISO بدون تغییر آفست
1508
+ };
1509
+ function DateFilter({ setHandler }) {
1510
+ const isMobile = (0, import_system2.useMediaQuery)("(max-width:900px)");
1511
+ const isSmMobile = (0, import_system2.useMediaQuery)("(max-width:600px)");
1512
+ const { control, watch, setValue } = (0, import_react_hook_form6.useForm)({
1513
+ defaultValues: defaultValues2,
1514
+ mode: "onChange",
1515
+ resolver: (0, import_yup2.yupResolver)(RoleFormSchema2)
1516
+ });
1517
+ (0, import_react10.useEffect)(() => {
1518
+ setHandler((0, import_moment2.default)().toISOString());
1519
+ }, []);
1520
+ const currentDate = watch("time");
1521
+ (0, import_react10.useEffect)(() => {
1522
+ setHandler(currentDate);
1523
+ }, [currentDate]);
1524
+ const handleDate = (direction) => {
1525
+ const currentDate2 = watch("time");
1526
+ const newDate = (0, import_moment2.default)(currentDate2);
1527
+ if (direction === "forward") {
1528
+ newDate.add(1, "day");
1529
+ } else if (direction === "backward") {
1530
+ newDate.subtract(1, "day");
1531
+ }
1532
+ setValue("time", newDate.toISOString());
1533
+ };
1534
+ const today = (0, import_moment2.default)().format("YYYY-MM-DD");
1535
+ const isNextDisabled = (0, import_moment2.default)(watch("time")).format("YYYY-MM-DD") >= today;
1536
+ return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement(import_system2.GlobalStyles, { styles: {
1537
+ //حذف مارجین های اضافی سمت راست و چپ
1538
+ ".MuiBox-root.muirtl-1crki0u": {
1539
+ marginLeft: 0,
1540
+ marginRight: 0
1541
+ }
1542
+ } }), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { container: true, spacing: 2, justifyContent: "center", alignItems: "center", paddingTop: 3, width: "100%" }, /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { container: true, size: 12, width: !isMobile ? "50%" : "100%", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: 2, justifyContent: "start" }, /* @__PURE__ */ import_react9.default.createElement(
1543
+ import_Button3.default,
1544
+ {
1545
+ sx: {
1546
+ display: "flex",
1547
+ width: "100%",
1548
+ justifyContent: "center",
1549
+ padding: 0
1550
+ },
1551
+ onClick: () => handleDate("forward"),
1552
+ disabled: isNextDisabled
1553
+ },
1554
+ /* @__PURE__ */ import_react9.default.createElement(import_fa4.FaChevronRight, { size: 30 })
1555
+ )), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: { xs: 7, sm: 8, md: 8, lg: 6 } }, /* @__PURE__ */ import_react9.default.createElement(date_picker_default, { name: "time", control, label: "", persian: true, clear: false, align: "center", size: isSmMobile ? "small" : "medium" })), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: 2, display: "flex", justifyContent: "end" }, /* @__PURE__ */ import_react9.default.createElement(
1556
+ import_Button3.default,
1557
+ {
1558
+ sx: {
1559
+ display: "flex",
1560
+ width: "100%",
1561
+ justifyContent: "center",
1562
+ padding: 0
1563
+ },
1564
+ onClick: () => handleDate("backward")
1565
+ },
1566
+ /* @__PURE__ */ import_react9.default.createElement(import_fa4.FaChevronLeft, { size: 30 })
1567
+ )))), /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { container: true, size: 12 }, /* @__PURE__ */ import_react9.default.createElement(import_Grid22.default, { size: 12 })));
1568
+ }
1569
+
1570
+ // src/date-time-picker/index.tsx
1571
+ var import_material10 = require("@mui/material");
1572
+ var import_useMediaQuery = __toESM(require("@mui/material/useMediaQuery"));
1573
+ var import_system3 = require("@mui/system");
1574
+ var import_x_date_pickers2 = require("@mui/x-date-pickers");
1575
+ var import_AdapterMomentJalaali2 = require("@mui/x-date-pickers/AdapterMomentJalaali");
1576
+ var import_moment_jalaali2 = __toESM(require("moment-jalaali"));
1577
+ var import_react11 = __toESM(require("react"));
1578
+ var import_react_hook_form7 = require("react-hook-form");
1579
+ import_moment_jalaali2.default.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1580
+ var JalaliDatePicker2 = ({
1581
+ size = "medium",
1582
+ name,
1583
+ control,
1584
+ label,
1585
+ isLoading,
1586
+ disabled,
1587
+ minDateTime,
1588
+ // Add the new optional prop
1589
+ centeredTime = false
1590
+ }) => {
1591
+ const today = (0, import_moment_jalaali2.default)();
1592
+ const isMobile = (0, import_useMediaQuery.default)("(max-width:700px)");
1593
+ const [open, setOpen] = (0, import_react11.useState)(false);
1594
+ const customLocaleText = {
1595
+ cancelButtonLabel: "\u0644\u063A\u0648",
1596
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
1597
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
1598
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646",
1599
+ start: "\u0634\u0631\u0648\u0639",
1600
+ end: "\u067E\u0627\u06CC\u0627\u0646",
1601
+ previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
1602
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
1603
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
1604
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
1605
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1606
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1607
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
1608
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
1609
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
1610
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
1611
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
1612
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
1613
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
1614
+ calendarWeekNumberHeaderText: "#",
1615
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
1616
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
1617
+ };
1618
+ return /* @__PURE__ */ import_react11.default.createElement(
1619
+ import_x_date_pickers2.LocalizationProvider,
1620
+ {
1621
+ dateAdapter: import_AdapterMomentJalaali2.AdapterMomentJalaali,
1622
+ localeText: customLocaleText
1623
+ },
1624
+ /* @__PURE__ */ import_react11.default.createElement(
1625
+ import_react_hook_form7.Controller,
1626
+ {
1627
+ name,
1628
+ control,
1629
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ import_react11.default.createElement(import_system3.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react11.default.createElement(
1630
+ import_x_date_pickers2.DateTimePicker,
1631
+ {
1632
+ open,
1633
+ onClose: () => {
1634
+ setOpen(false);
1635
+ field.onBlur();
1636
+ },
1637
+ onOpen: () => setOpen(true),
1638
+ orientation: isMobile ? "portrait" : "landscape",
1639
+ disabled: isLoading || disabled,
1640
+ openTo: "day",
1641
+ views: ["year", "month", "day", "hours", "minutes"],
1642
+ label,
1643
+ value: field.value ? import_moment_jalaali2.default.utc(field.value).utcOffset(210) : null,
1644
+ onChange: (newValue) => {
1645
+ if (newValue) {
1646
+ field.onChange(
1647
+ (0, import_moment_jalaali2.default)(newValue).utc().locale("en").format("YYYY-MM-DDTHH:mm:ss[Z]")
1648
+ );
1649
+ } else {
1650
+ field.onChange(null);
1651
+ }
1652
+ },
1653
+ onAccept: () => {
1654
+ setOpen(false);
1655
+ field.onBlur();
1656
+ },
1657
+ onError: () => {
1658
+ setOpen(false);
1659
+ field.onBlur();
1660
+ },
1661
+ format: `jDD jMMMM jYYYY ${" "} - ${" "} HH:mm`,
1662
+ minDateTime,
1663
+ timeSteps: { minutes: 1 },
1664
+ slots: {
1665
+ toolbar: (props) => {
1666
+ const currentDate = import_moment_jalaali2.default.utc(field.value || today).utcOffset(210);
1667
+ let formattedDay, formattedDate, formattedYear, formattedTime;
1668
+ if (field.value) {
1669
+ formattedDay = currentDate.format("dddd");
1670
+ formattedDate = currentDate.format("jDD jMMMM");
1671
+ formattedYear = currentDate.format("jYYYY");
1672
+ formattedTime = currentDate.format("HH:mm");
1673
+ } else {
1674
+ formattedDay = "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u0646\u062A\u062E\u0627\u0628 \u0646\u0634\u062F\u0647 \u0627\u0633\u062A", formattedDate = "", formattedYear = "", formattedTime = "";
1675
+ }
1676
+ return /* @__PURE__ */ import_react11.default.createElement(
1677
+ import_system3.Box,
1678
+ {
1679
+ sx: {
1680
+ padding: "16px",
1681
+ textAlign: "left",
1682
+ display: "flex",
1683
+ flexDirection: "row",
1684
+ justifyContent: "start",
1685
+ alignItems: "center",
1686
+ gap: 1
1687
+ }
1688
+ },
1689
+ /* @__PURE__ */ import_react11.default.createElement(
1690
+ import_material10.Typography,
1691
+ {
1692
+ fontSize: 16,
1693
+ variant: "overline",
1694
+ color: "primary"
1695
+ },
1696
+ `${formattedDay}\u060C`
1697
+ ),
1698
+ /* @__PURE__ */ import_react11.default.createElement(
1699
+ import_material10.Typography,
1700
+ {
1701
+ variant: "h4",
1702
+ fontSize: 26,
1703
+ style: { fontWeight: "bold" }
1704
+ },
1705
+ `${formattedDate}`
1706
+ ),
1707
+ /* @__PURE__ */ import_react11.default.createElement(
1708
+ import_material10.Typography,
1709
+ {
1710
+ fontSize: 16,
1711
+ variant: "body2",
1712
+ color: "textSecondary"
1713
+ },
1714
+ `${formattedYear}`
1715
+ ),
1716
+ field.value && /* @__PURE__ */ import_react11.default.createElement(import_material10.Typography, null, "-"),
1717
+ /* @__PURE__ */ import_react11.default.createElement(
1718
+ import_material10.Typography,
1719
+ {
1720
+ fontSize: 16,
1721
+ variant: "body2",
1722
+ color: "textSecondary",
1723
+ style: { fontWeight: "bold" }
1724
+ },
1725
+ `${formattedTime}`
1726
+ )
1727
+ );
1728
+ },
1729
+ monthButton: (props) => {
1730
+ return /* @__PURE__ */ import_react11.default.createElement(
1731
+ "button",
1732
+ {
1733
+ className: `${props.className}`,
1734
+ style: {
1735
+ width: "80%",
1736
+ padding: "10px",
1737
+ marginBottom: "20px",
1738
+ border: "1px solid #ccc",
1739
+ borderRadius: "12px",
1740
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
1741
+ fontSize: "14px",
1742
+ cursor: props.disabled ? "default" : "pointer"
1743
+ },
1744
+ disabled: props.disabled,
1745
+ onFocus: props.onFocus,
1746
+ onBlur: props.onBlur,
1747
+ onClick: props.onClick,
1748
+ ref: props.ref
1749
+ },
1750
+ props["aria-label"],
1751
+ " "
1752
+ );
1753
+ }
1754
+ },
1755
+ sx: {
1756
+ width: "100%",
1757
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
1758
+ "& .MuiOutlinedInput-notchedOutline": {
1759
+ borderColor: error ? "#D32F2F" : "#C4C4C4"
1760
+ }
1761
+ },
1762
+ maxDate: today,
1763
+ slotProps: {
1764
+ mobilePaper: {
1765
+ sx: {
1766
+ "& .MuiClock-root": {
1767
+ backgroundColor: "transparent",
1768
+ display: "flex",
1769
+ justifyContent: "center",
1770
+ alignItems: "center"
1771
+ },
1772
+ "& .MuiClock-clock": {
1773
+ mt: 4,
1774
+ pt: 0.5,
1775
+ width: 230,
1776
+ height: 230,
1777
+ backgroundColor: "rgba(0, 0, 0, 0.03)",
1778
+ borderRadius: "50%",
1779
+ border: "4px solid rgba(0, 0, 0, 0.04)"
1780
+ },
1781
+ "& .MuiClock-pin": {
1782
+ backgroundColor: "#085938"
1783
+ },
1784
+ "& .MuiClockPointer-root, & .MuiClockPointer-thumb": {
1785
+ backgroundColor: "#085938"
1786
+ },
1787
+ "& .MuiClockNumber-root": {
1788
+ color: "#000",
1789
+ fontSize: "16px"
1790
+ },
1791
+ "&.Mui-selected, &.Mui-focusVisible": {
1792
+ color: "#FFF"
1793
+ }
1794
+ }
1795
+ },
1796
+ textField: {
1797
+ size,
1798
+ placeholder: "",
1799
+ onClick: () => {
1800
+ if (!open) setOpen(true);
1801
+ },
1802
+ InputLabelProps: {
1803
+ shrink: true,
1804
+ style: { color: error ? "#D32F2F" : "inherit" }
1805
+ },
1806
+ InputProps: {
1807
+ ...disabled && { endAdornment: false },
1808
+ sx: {
1809
+ textAlign: centeredTime ? "center" : "left",
1810
+ // Center or left align
1811
+ "& input": {
1812
+ textAlign: centeredTime ? "center" : "left"
1813
+ // Ensure input text is centered
1814
+ }
1815
+ }
1816
+ }
1817
+ },
1818
+ popper: {
1819
+ modifiers: [
1820
+ {
1821
+ name: "preventOverflow",
1822
+ options: {
1823
+ boundary: "window"
1824
+ }
1825
+ },
1826
+ {
1827
+ name: "flip",
1828
+ options: {
1829
+ fallbackPlacements: ["right", "left", "top"]
1830
+ }
1831
+ }
1832
+ ]
1833
+ }
1834
+ }
1835
+ }
1836
+ ), error && /* @__PURE__ */ import_react11.default.createElement(import_material10.Typography, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message))
1837
+ }
1838
+ )
1839
+ );
1840
+ };
1841
+ var date_time_picker_default = JalaliDatePicker2;
1842
+
1843
+ // src/date-time-range-picker/index.tsx
1844
+ var import_material11 = require("@mui/material");
1845
+ var import_x_date_pickers3 = require("@mui/x-date-pickers");
1846
+ var import_AdapterMomentJalaali3 = require("@mui/x-date-pickers/AdapterMomentJalaali");
1847
+ var import_moment_jalaali3 = __toESM(require("moment-jalaali"));
1848
+ var import_react12 = __toESM(require("react"));
1849
+ var import_react_hook_form8 = require("react-hook-form");
1850
+ import_moment_jalaali3.default.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
1851
+ var JalaliDateTimeRangePicker = ({
1852
+ control,
1853
+ startName,
1854
+ endName,
1855
+ startLabel,
1856
+ endLabel,
1857
+ disabled = false,
1858
+ isLoading = false
1859
+ }) => {
1860
+ const startDate = (0, import_react_hook_form8.useWatch)({ control, name: startName });
1861
+ const validStartDate = startDate ? (0, import_moment_jalaali3.default)(startDate) : null;
1862
+ const defaultStartDate = (0, import_moment_jalaali3.default)().add(3.5, "hours").toDate();
1863
+ const [isStartDateChanged, setIsStartDateChanged] = (0, import_react12.useState)(false);
1864
+ (0, import_react12.useEffect)(() => {
1865
+ if (validStartDate && !validStartDate.isSame(defaultStartDate, "minute")) {
1866
+ setIsStartDateChanged(true);
1867
+ } else if (validStartDate && validStartDate.isSame(defaultStartDate, "minute")) {
1868
+ setIsStartDateChanged(false);
1869
+ }
1870
+ }, [validStartDate, defaultStartDate]);
1871
+ return /* @__PURE__ */ import_react12.default.createElement(import_x_date_pickers3.LocalizationProvider, { dateAdapter: import_AdapterMomentJalaali3.AdapterMomentJalaali }, /* @__PURE__ */ import_react12.default.createElement(
1872
+ import_material11.Box,
1873
+ {
1874
+ sx: {
1875
+ display: "flex",
1876
+ alignItems: "center",
1877
+ flexDirection: "row",
1878
+ gap: 1
1879
+ }
1880
+ },
1881
+ /* @__PURE__ */ import_react12.default.createElement(
1882
+ date_time_picker_default,
1883
+ {
1884
+ control,
1885
+ name: startName,
1886
+ label: startLabel,
1887
+ disabled: disabled || isLoading
1888
+ }
1889
+ ),
1890
+ /* @__PURE__ */ import_react12.default.createElement(import_material11.Typography, { variant: "h6" }, "-"),
1891
+ /* @__PURE__ */ import_react12.default.createElement(
1892
+ date_time_picker_default,
1893
+ {
1894
+ control,
1895
+ name: endName,
1896
+ label: endLabel,
1897
+ disabled: disabled || isLoading,
1898
+ minDateTime: isStartDateChanged ? (0, import_moment_jalaali3.default)(startDate) : void 0
1899
+ }
1900
+ )
1901
+ ));
1902
+ };
1903
+ var date_time_range_picker_default = JalaliDateTimeRangePicker;
1904
+
1905
+ // src/license-plate-search/index.tsx
1906
+ var import_utils2 = require("@mamrp/utils");
1907
+ var import_material12 = require("@mui/material");
1908
+ var import_Button4 = __toESM(require("@mui/material/Button"));
1909
+ var import_Dialog4 = __toESM(require("@mui/material/Dialog"));
1910
+ var import_DialogContent4 = __toESM(require("@mui/material/DialogContent"));
1911
+ var import_DialogTitle4 = __toESM(require("@mui/material/DialogTitle"));
1912
+ var import_image2 = __toESM(require("next/image"));
1913
+ var import_react13 = require("react");
1914
+ var import_io52 = require("react-icons/io5");
1915
+ var import_react14 = __toESM(require("react"));
1916
+ function SearchLicensePlate({
1917
+ width = "100%",
1918
+ part,
1919
+ setValue,
1920
+ data,
1921
+ readOnly = true,
1922
+ size
1923
+ }) {
1924
+ const [open, setOpen] = (0, import_react13.useState)(false);
1925
+ const [selectedValue, setSelectedValue] = (0, import_react13.useState)("");
1926
+ const [inputValues, setInputValues] = (0, import_react13.useState)({
1927
+ input1: "",
1928
+ input2: "",
1929
+ input3: "",
1930
+ input4: ""
1931
+ });
1932
+ const inputRefs = {
1933
+ input1: (0, import_react13.useRef)(null),
1934
+ input2: (0, import_react13.useRef)(null),
1935
+ input3: (0, import_react13.useRef)(null),
1936
+ input4: (0, import_react13.useRef)(null)
1937
+ };
1938
+ (0, import_react13.useEffect)(() => {
1939
+ if (data) {
1940
+ let newdata = data.split(" ").filter((word) => word !== "\u0627\u06CC\u0631\u0627\u0646");
1941
+ setInputValues({
1942
+ input1: newdata[0],
1943
+ input2: newdata[1],
1944
+ input3: newdata[2],
1945
+ input4: newdata[3]
1946
+ });
1947
+ } else if (data == "") {
1948
+ setInputValues({
1949
+ input1: "",
1950
+ input2: "",
1951
+ input3: "",
1952
+ input4: ""
1953
+ });
1954
+ }
1955
+ }, [data]);
1956
+ const handleInputChange = (enteredInput, inputName, maxlength, minLength) => {
1957
+ const newInputValues = {
1958
+ ...inputValues,
1959
+ [inputName]: enteredInput
1960
+ };
1961
+ setInputValues(newInputValues);
1962
+ const formattedPlate = (0, import_utils2.convertToEnglishDigits)(newInputValues.input1) + " " + newInputValues.input2 + " " + (0, import_utils2.convertToEnglishDigits)(newInputValues.input3) + " \u0627\u06CC\u0631\u0627\u0646 " + (0, import_utils2.convertToEnglishDigits)(newInputValues.input4);
1963
+ setValue(part[0], (0, import_utils2.convertToEnglishDigits)(newInputValues.input1));
1964
+ setValue(part[1], newInputValues.input2);
1965
+ setValue(part[2], (0, import_utils2.convertToEnglishDigits)(newInputValues.input3));
1966
+ setValue(part[3], (0, import_utils2.convertToEnglishDigits)(newInputValues.input4));
1967
+ if (enteredInput.length === maxlength || minLength === 1) {
1968
+ if (inputName === "input1") {
1969
+ setOpen(true);
1970
+ } else if (inputName === "input2") {
1971
+ setSelectedValue(enteredInput);
1972
+ setOpen(false);
1973
+ } else {
1974
+ inputRefs["input4"]?.current?.focus();
1975
+ }
1976
+ }
1977
+ };
1978
+ return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(
1979
+ import_material12.Box,
1980
+ {
1981
+ sx: {
1982
+ width,
1983
+ border: "1px solid #e5e7eb",
1984
+ borderRadius: "7px",
1985
+ display: "flex",
1986
+ alignItems: "center"
1987
+ },
1988
+ dir: "ltr"
1989
+ },
1990
+ /* @__PURE__ */ import_react14.default.createElement(
1991
+ import_material12.Box,
1992
+ {
1993
+ sx: {
1994
+ display: "flex",
1995
+ alignItems: "center"
1996
+ }
1997
+ },
1998
+ /* @__PURE__ */ import_react14.default.createElement(
1999
+ import_material12.Box,
2000
+ {
2001
+ sx: {
2002
+ backgroundColor: "#172554",
2003
+ width: size === "small" ? "30px" : "36px",
2004
+ minHeight: size === "small" ? "40px" : "52px",
2005
+ maxHeight: size === "small" ? "40px" : "52px",
2006
+ display: "flex",
2007
+ justifyContent: "center",
2008
+ alignItems: "center",
2009
+ borderRadius: "7px",
2010
+ mr: 0.4
2011
+ }
2012
+ },
2013
+ /* @__PURE__ */ import_react14.default.createElement(
2014
+ import_image2.default,
2015
+ {
2016
+ src: "/assets/images/iran-flag-dark.svg",
2017
+ alt: "Iran Flag",
2018
+ width: size === "small" ? 16 : 20,
2019
+ height: size === "small" ? 14 : 12,
2020
+ style: { cursor: "pointer" },
2021
+ onClick: () => {
2022
+ setInputValues({
2023
+ input1: "",
2024
+ input2: "",
2025
+ input3: "",
2026
+ input4: ""
2027
+ });
2028
+ setValue(part[0], "");
2029
+ setValue(part[1], "");
2030
+ setValue(part[2], "");
2031
+ setValue(part[3], "");
2032
+ }
2033
+ }
2034
+ )
2035
+ )
2036
+ ),
2037
+ /* @__PURE__ */ import_react14.default.createElement(
2038
+ import_material12.Box,
2039
+ {
2040
+ sx: {
2041
+ width: "100%",
2042
+ display: "flex",
2043
+ justifyContent: "space-around",
2044
+ fontSize: "1.125rem",
2045
+ lineHeight: "1.75rem",
2046
+ fontWeight: 600,
2047
+ color: "#1f2937",
2048
+ alignItems: "center"
2049
+ }
2050
+ },
2051
+ /* @__PURE__ */ import_react14.default.createElement(
2052
+ "input",
2053
+ {
2054
+ disabled: readOnly || !!data && readOnly,
2055
+ ref: inputRefs.input1,
2056
+ type: "text",
2057
+ maxLength: 2,
2058
+ placeholder: "- -",
2059
+ style: {
2060
+ width: "24px",
2061
+ textAlign: "center",
2062
+ backgroundColor: "transparent",
2063
+ outline: "none",
2064
+ cursor: readOnly || !!data && readOnly ? "" : "text"
2065
+ },
2066
+ value: (0, import_utils2.convertToPersianDigits)(inputValues.input1),
2067
+ onChange: (e) => handleInputChange(e.target.value, "input1", 2)
2068
+ }
2069
+ ),
2070
+ /* @__PURE__ */ import_react14.default.createElement(
2071
+ import_material12.Box,
2072
+ {
2073
+ sx: {
2074
+ display: "flex",
2075
+ alignItems: "center"
2076
+ }
2077
+ },
2078
+ !data && /* @__PURE__ */ import_react14.default.createElement(
2079
+ import_image2.default,
2080
+ {
2081
+ src: "/assets/images/solid-arrow-down.svg",
2082
+ width: 20,
2083
+ height: 20,
2084
+ alt: "arrow",
2085
+ style: { cursor: "pointer", marginRight: 4 }
2086
+ }
2087
+ ),
2088
+ /* @__PURE__ */ import_react14.default.createElement(
2089
+ "input",
2090
+ {
2091
+ disabled: readOnly || !!data && readOnly,
2092
+ ref: inputRefs.input2,
2093
+ onClick: () => {
2094
+ if (!(readOnly || !!data && readOnly)) {
2095
+ setOpen(true);
2096
+ }
2097
+ },
2098
+ type: "text",
2099
+ minLength: 1,
2100
+ maxLength: 3,
2101
+ placeholder: "-",
2102
+ style: {
2103
+ width: "28px",
2104
+ textAlign: "center",
2105
+ backgroundColor: "transparent",
2106
+ outline: "none",
2107
+ cursor: readOnly || !!data && readOnly ? "" : "pointer"
2108
+ },
2109
+ value: inputValues.input2,
2110
+ readOnly: true
2111
+ }
2112
+ )
2113
+ ),
2114
+ /* @__PURE__ */ import_react14.default.createElement(
2115
+ import_Dialog4.default,
2116
+ {
2117
+ dir: "rtl",
2118
+ open,
2119
+ onClose: () => setOpen(false),
2120
+ "aria-labelledby": "alert-dialog-title",
2121
+ "aria-describedby": "alert-dialog-description"
2122
+ },
2123
+ /* @__PURE__ */ import_react14.default.createElement(
2124
+ import_material12.Box,
2125
+ {
2126
+ sx: {
2127
+ display: "flex",
2128
+ justifyContent: "space-between",
2129
+ alignItems: "center",
2130
+ backgroundColor: "#f5f5f5"
2131
+ // bg-neutral-100
2132
+ }
2133
+ },
2134
+ /* @__PURE__ */ import_react14.default.createElement(import_DialogTitle4.default, { id: "alert-dialog-title" }, "\u0627\u0646\u062A\u062E\u0627\u0628 \u062D\u0631\u0641 \u067E\u0644\u0627\u06A9"),
2135
+ /* @__PURE__ */ import_react14.default.createElement(
2136
+ import_material12.Box,
2137
+ {
2138
+ sx: {
2139
+ cursor: "pointer",
2140
+ paddingRight: "1rem",
2141
+ color: "#737373"
2142
+ // text-neutral-500
2143
+ },
2144
+ onClick: () => setOpen(false)
2145
+ },
2146
+ /* @__PURE__ */ import_react14.default.createElement(import_material12.IconButton, null, /* @__PURE__ */ import_react14.default.createElement(import_io52.IoClose, null))
2147
+ )
2148
+ ),
2149
+ /* @__PURE__ */ import_react14.default.createElement(import_DialogContent4.default, null, /* @__PURE__ */ import_react14.default.createElement(
2150
+ import_material12.Box,
2151
+ {
2152
+ sx: {
2153
+ display: "flex",
2154
+ alignItems: "center",
2155
+ justifyContent: "center",
2156
+ flexWrap: "wrap",
2157
+ gap: 2,
2158
+ my: 2
2159
+ }
2160
+ },
2161
+ letters_default.map((letter, index) => /* @__PURE__ */ import_react14.default.createElement(
2162
+ import_Button4.default,
2163
+ {
2164
+ key: index,
2165
+ variant: "outlined",
2166
+ color: "primary",
2167
+ sx: {
2168
+ border: "none",
2169
+ backgroundColor: "#f0f0f0",
2170
+ width: "70px",
2171
+ height: "50px",
2172
+ fontWeight: "bold",
2173
+ ":hover": {
2174
+ backgroundColor: "#e3e3e3"
2175
+ }
2176
+ },
2177
+ onClick: () => handleInputChange(letter, "input2", 3, 1)
2178
+ },
2179
+ /* @__PURE__ */ import_react14.default.createElement(import_material12.Typography, { color: "#117A4F", fontWeight: "bold" }, letter)
2180
+ ))
2181
+ ), /* @__PURE__ */ import_react14.default.createElement(import_material12.Box, { sx: { display: "flex", justifyContent: "center", mt: 2.5 } }, /* @__PURE__ */ import_react14.default.createElement(
2182
+ import_Button4.default,
2183
+ {
2184
+ sx: { width: "6rem" },
2185
+ variant: "outlined",
2186
+ color: "error",
2187
+ onClick: () => {
2188
+ handleInputChange("", "input2", 3, 1);
2189
+ setOpen(false);
2190
+ }
2191
+ },
2192
+ "\u062D\u0630\u0641 \u062D\u0631\u0641"
2193
+ )))
2194
+ ),
2195
+ /* @__PURE__ */ import_react14.default.createElement(
2196
+ "input",
2197
+ {
2198
+ disabled: readOnly || !!data && readOnly,
2199
+ ref: inputRefs.input3,
2200
+ type: "text",
2201
+ maxLength: 3,
2202
+ placeholder: "- - -",
2203
+ style: {
2204
+ width: "40px",
2205
+ // w-10
2206
+ textAlign: "center",
2207
+ backgroundColor: "transparent",
2208
+ outline: "none",
2209
+ cursor: readOnly || !!data && readOnly ? "" : "text"
2210
+ },
2211
+ value: (0, import_utils2.convertToPersianDigits)(inputValues.input3),
2212
+ onChange: (e) => handleInputChange(e.target.value, "input3", 3)
2213
+ }
2214
+ ),
2215
+ /* @__PURE__ */ import_react14.default.createElement(
2216
+ import_material12.Box,
2217
+ {
2218
+ sx: {
2219
+ height: "40px",
2220
+ width: "1px",
2221
+ backgroundColor: "#e5e7eb"
2222
+ }
2223
+ }
2224
+ ),
2225
+ /* @__PURE__ */ import_react14.default.createElement(
2226
+ import_material12.Box,
2227
+ {
2228
+ sx: {
2229
+ display: "flex",
2230
+ flexDirection: "column-reverse",
2231
+ gap: size === "small" ? 0.25 : 1,
2232
+ alignItems: "center"
2233
+ }
2234
+ },
2235
+ /* @__PURE__ */ import_react14.default.createElement(
2236
+ "input",
2237
+ {
2238
+ disabled: readOnly || !!data && readOnly,
2239
+ ref: inputRefs.input4,
2240
+ type: "text",
2241
+ maxLength: 2,
2242
+ placeholder: "- -",
2243
+ style: {
2244
+ width: "24px",
2245
+ textAlign: "center",
2246
+ backgroundColor: "transparent",
2247
+ outline: "none",
2248
+ cursor: readOnly || !!data && readOnly ? "" : "text"
2249
+ },
2250
+ value: (0, import_utils2.convertToPersianDigits)(inputValues.input4),
2251
+ onChange: (e) => handleInputChange(e.target.value, "input4", 2)
2252
+ }
2253
+ ),
2254
+ /* @__PURE__ */ import_react14.default.createElement(
2255
+ import_image2.default,
2256
+ {
2257
+ src: "/assets/images/iran.svg",
2258
+ alt: "Iran",
2259
+ width: size === "small" ? 25 : 30,
2260
+ height: size === "small" ? 21 : 26
2261
+ }
2262
+ )
2263
+ )
2264
+ )
2265
+ ));
2266
+ }
2267
+
2268
+ // src/loading/index.tsx
2269
+ var import_react15 = __toESM(require("react"));
2270
+ function Loading() {
2271
+ return /* @__PURE__ */ import_react15.default.createElement("div", { className: "loading" }, /* @__PURE__ */ import_react15.default.createElement(
2272
+ "img",
2273
+ {
2274
+ src: "/assets/images/favicon.ico",
2275
+ alt: "MAM Logo",
2276
+ className: "mam-logo"
2277
+ }
2278
+ ), /* @__PURE__ */ import_react15.default.createElement("p", { className: "message" }, "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC\u060C \u0644\u0637\u0641\u0627 \u0645\u0646\u062A\u0638\u0631 \u0628\u0645\u0627\u0646\u06CC\u062F", /* @__PURE__ */ import_react15.default.createElement("span", { className: "dots" }, /* @__PURE__ */ import_react15.default.createElement("span", null, "."), /* @__PURE__ */ import_react15.default.createElement("span", null, "."), /* @__PURE__ */ import_react15.default.createElement("span", null, "."), /* @__PURE__ */ import_react15.default.createElement("span", null, "."))), /* @__PURE__ */ import_react15.default.createElement("style", null, `
2279
+ .loading {
2280
+ position: fixed;
2281
+ top: 0;
2282
+ left: 0;
2283
+ width: 100%;
2284
+ height: 100%;
2285
+ display: flex;
2286
+ flex-direction: column;
2287
+ justify-content: center;
2288
+ align-items: center;
2289
+ background-color: #065938;
2290
+ color: #fff;
2291
+ z-index: 9999;
2292
+ }
2293
+ .mam-logo {
2294
+ width: 120px;
2295
+ height: auto;
2296
+ margin-bottom: 5px;
2297
+ animation: float 3s ease-in-out infinite, glow 1.5s alternate infinite ease-in-out;
2298
+ }
2299
+ @keyframes float {
2300
+ 0%, 100% {
2301
+ transform: translateY(0);
2302
+ }
2303
+
2304
+ }
2305
+ @keyframes glow {
2306
+ 0% {
2307
+ filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
2308
+ }
2309
+ 100% {
2310
+ filter: drop-shadow(0 0 20px rgba(255, 255, 255, 1));
2311
+ }
2312
+ }
2313
+ .message {
2314
+ font-size: 1.2rem;
2315
+ font-weight: bold;
2316
+ display: flex;
2317
+ align-items: center;
2318
+ }
2319
+ .dots {
2320
+ display: inline-block;
2321
+ margin-left: 5px;
2322
+ }
2323
+ .dots span {
2324
+ animation: blink 1.5s step-start infinite;
2325
+ font-size: 1.5rem;
2326
+ }
2327
+ .dots span:nth-child(1) {
2328
+ animation-delay: 0s;
2329
+ }
2330
+ .dots span:nth-child(2) {
2331
+ animation-delay: 0.3s;
2332
+ }
2333
+ .dots span:nth-child(3) {
2334
+ animation-delay: 0.6s;
2335
+ }
2336
+ @keyframes blink {
2337
+ 0% {
2338
+ opacity: 0;
2339
+ }
2340
+ 50% {
2341
+ opacity: 1;
2342
+ }
2343
+ 100% {
2344
+ opacity: 0;
2345
+ }
2346
+ }
2347
+ `));
2348
+ }
2349
+
2350
+ // src/mobile-date-time-picker/index.tsx
2351
+ var import_material13 = require("@mui/material");
2352
+ var import_useMediaQuery2 = __toESM(require("@mui/material/useMediaQuery"));
2353
+ var import_system4 = require("@mui/system");
2354
+ var import_x_date_pickers4 = require("@mui/x-date-pickers");
2355
+ var import_AdapterMomentJalaali4 = require("@mui/x-date-pickers/AdapterMomentJalaali");
2356
+ var import_dayjs2 = __toESM(require("dayjs"));
2357
+ var import_moment_jalaali4 = __toESM(require("moment-jalaali"));
2358
+ var import_react16 = __toESM(require("react"));
2359
+ var import_react_hook_form9 = require("react-hook-form");
2360
+ import_moment_jalaali4.default.loadPersian({ dialect: "persian-modern", usePersianDigits: true });
2361
+ var JalaliDatePicker3 = ({
2362
+ name,
2363
+ control,
2364
+ label,
2365
+ isLoading
2366
+ }) => {
2367
+ const today = (0, import_moment_jalaali4.default)();
2368
+ const isMobile = (0, import_useMediaQuery2.default)("(max-width:700px)");
2369
+ const [open, setOpen] = (0, import_react16.useState)(false);
2370
+ const customLocaleText = {
2371
+ cancelButtonLabel: "\u0644\u063A\u0648",
2372
+ okButtonLabel: "\u062A\u0623\u06CC\u06CC\u062F",
2373
+ todayButtonLabel: "\u0627\u0645\u0631\u0648\u0632",
2374
+ clearButtonLabel: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646",
2375
+ start: "\u0634\u0631\u0648\u0639",
2376
+ end: "\u067E\u0627\u06CC\u0627\u0646",
2377
+ previousMonth: "\u0645\u0627\u0647 \u0642\u0628\u0644",
2378
+ nextMonth: "\u0645\u0627\u0647 \u0628\u0639\u062F",
2379
+ openDatePickerDialogue: (date, utils, formattedDate) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E ${formattedDate ? `(${formattedDate})` : ""}`,
2380
+ openTimePickerDialogue: (date, utils, formattedTime) => `\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646 ${formattedTime ? `(${formattedTime})` : ""}`,
2381
+ selectDate: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
2382
+ selectTime: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
2383
+ datePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E",
2384
+ timePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u0632\u0645\u0627\u0646",
2385
+ dateTimePickerToolbarTitle: "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646",
2386
+ hoursClockNumberText: (hours) => `${hours} \u0633\u0627\u0639\u062A`,
2387
+ minutesClockNumberText: (minutes) => `${minutes} \u062F\u0642\u06CC\u0642\u0647`,
2388
+ secondsClockNumberText: (seconds) => `${seconds} \u062B\u0627\u0646\u06CC\u0647`,
2389
+ calendarWeekNumberHeaderLabel: "\u0647\u0641\u062A\u0647",
2390
+ calendarWeekNumberHeaderText: "#",
2391
+ calendarWeekNumberAriaLabelText: (weekNumber) => `\u0647\u0641\u062A\u0647 ${weekNumber}`,
2392
+ calendarWeekNumberText: (weekNumber) => `${weekNumber}`
2393
+ };
2394
+ return /* @__PURE__ */ import_react16.default.createElement(
2395
+ import_x_date_pickers4.LocalizationProvider,
2396
+ {
2397
+ dateAdapter: import_AdapterMomentJalaali4.AdapterMomentJalaali,
2398
+ localeText: customLocaleText
2399
+ },
2400
+ /* @__PURE__ */ import_react16.default.createElement(
2401
+ import_react_hook_form9.Controller,
2402
+ {
2403
+ name,
2404
+ control,
2405
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ import_react16.default.createElement(import_system4.Box, { sx: { width: "100%" } }, /* @__PURE__ */ import_react16.default.createElement(
2406
+ import_x_date_pickers4.MobileDateTimePicker,
2407
+ {
2408
+ open,
2409
+ onClose: () => {
2410
+ setOpen(false);
2411
+ field.onBlur();
2412
+ },
2413
+ onOpen: () => setOpen(true),
2414
+ orientation: isMobile ? "portrait" : "landscape",
2415
+ disabled: isLoading,
2416
+ openTo: "day",
2417
+ views: ["year", "month", "day", "hours", "minutes"],
2418
+ label,
2419
+ value: field.value ? (0, import_moment_jalaali4.default)(field.value) : null,
2420
+ onChange: (newValue) => {
2421
+ if (newValue) {
2422
+ field.onChange((0, import_dayjs2.default)(newValue).format("YYYY-MM-DDTHH:mm:ss"));
2423
+ } else {
2424
+ field.onChange(null);
2425
+ }
2426
+ },
2427
+ onAccept: () => {
2428
+ setOpen(false);
2429
+ field.onBlur();
2430
+ },
2431
+ onError: () => {
2432
+ setOpen(false);
2433
+ field.onBlur();
2434
+ },
2435
+ format: `jDD jMMMM jYYYY ${" "} - ${" "} HH:mm`,
2436
+ slots: {
2437
+ toolbar: (props) => {
2438
+ const currentDate = (0, import_moment_jalaali4.default)(field.value || null);
2439
+ let formattedDay, formattedDate, formattedYear, formattedTime;
2440
+ if (field.value) {
2441
+ formattedDay = currentDate.format("dddd");
2442
+ formattedDate = currentDate.format("jDD jMMMM");
2443
+ formattedYear = currentDate.format("jYYYY");
2444
+ formattedTime = currentDate.format("HH:mm");
2445
+ } else {
2446
+ formattedDay = "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u0646\u062A\u062E\u0627\u0628 \u0646\u0634\u062F\u0647 \u0627\u0633\u062A", formattedDate = "", formattedYear = "", formattedTime = "";
2447
+ }
2448
+ return /* @__PURE__ */ import_react16.default.createElement(
2449
+ import_system4.Box,
2450
+ {
2451
+ sx: {
2452
+ padding: "16px",
2453
+ textAlign: "left",
2454
+ display: "flex",
2455
+ flexDirection: "row",
2456
+ justifyContent: "start",
2457
+ alignItems: "center",
2458
+ gap: 1
2459
+ }
2460
+ },
2461
+ /* @__PURE__ */ import_react16.default.createElement(
2462
+ import_material13.Typography,
2463
+ {
2464
+ fontSize: 16,
2465
+ variant: "overline",
2466
+ color: "primary"
2467
+ },
2468
+ `${formattedDay}\u060C`
2469
+ ),
2470
+ /* @__PURE__ */ import_react16.default.createElement(
2471
+ import_material13.Typography,
2472
+ {
2473
+ variant: "h4",
2474
+ fontSize: 26,
2475
+ style: { fontWeight: "bold" }
2476
+ },
2477
+ `${formattedDate}`
2478
+ ),
2479
+ /* @__PURE__ */ import_react16.default.createElement(
2480
+ import_material13.Typography,
2481
+ {
2482
+ fontSize: 16,
2483
+ variant: "body2",
2484
+ color: "textSecondary"
2485
+ },
2486
+ `${formattedYear}`
2487
+ ),
2488
+ field.value && /* @__PURE__ */ import_react16.default.createElement(import_material13.Typography, null, "-"),
2489
+ /* @__PURE__ */ import_react16.default.createElement(
2490
+ import_material13.Typography,
2491
+ {
2492
+ fontSize: 16,
2493
+ variant: "body2",
2494
+ color: "textSecondary",
2495
+ style: { fontWeight: "bold" }
2496
+ },
2497
+ `${formattedTime}`
2498
+ )
2499
+ );
2500
+ },
2501
+ monthButton: (props) => {
2502
+ return /* @__PURE__ */ import_react16.default.createElement(
2503
+ import_material13.Button,
2504
+ {
2505
+ className: props.className,
2506
+ style: {
2507
+ width: "80%",
2508
+ padding: "10px",
2509
+ marginBottom: "20px",
2510
+ border: "1px solid #ccc",
2511
+ borderRadius: "12px",
2512
+ backgroundColor: props.disabled ? "#f0f0f0" : "#f0000",
2513
+ fontSize: "14px",
2514
+ cursor: props.disabled ? "default" : "pointer"
2515
+ },
2516
+ disabled: props.disabled,
2517
+ onClick: props.onClick
2518
+ },
2519
+ props["aria-label"]
2520
+ );
2521
+ }
2522
+ },
2523
+ sx: {
2524
+ width: "100%",
2525
+ borderColor: error ? "#D32F2F" : "#C4C4C4",
2526
+ "& .MuiOutlinedInput-notchedOutline": {
2527
+ borderColor: error ? "#D32F2F" : "#C4C4C4"
2528
+ }
2529
+ },
2530
+ maxDate: today,
2531
+ slotProps: {
2532
+ mobilePaper: {
2533
+ sx: {
2534
+ "& .MuiClock-root": {
2535
+ backgroundColor: "transparent",
2536
+ display: "flex",
2537
+ justifyContent: "center",
2538
+ alignItems: "center"
2539
+ },
2540
+ "& .MuiClock-clock": {
2541
+ mt: 4,
2542
+ pt: 0.5,
2543
+ width: 230,
2544
+ height: 230,
2545
+ backgroundColor: "rgba(0, 0, 0, 0.03)",
2546
+ borderRadius: "50%",
2547
+ border: "4px solid rgba(0, 0, 0, 0.04)"
2548
+ },
2549
+ "& .MuiClock-pin": {
2550
+ backgroundColor: "#085938"
2551
+ },
2552
+ "& .MuiClockPointer-root, & .MuiClockPointer-thumb": {
2553
+ backgroundColor: "#085938"
2554
+ },
2555
+ "& .MuiClockNumber-root": {
2556
+ color: "#000",
2557
+ fontSize: "16px"
2558
+ },
2559
+ "&.Mui-selected, &.Mui-focusVisible": {
2560
+ color: "#FFF"
2561
+ }
2562
+ }
2563
+ },
2564
+ textField: {
2565
+ placeholder: field.value ? "" : "\u0627\u0646\u062A\u062E\u0627\u0628 \u062A\u0627\u0631\u06CC\u062E \u0628\u0647 \u0647\u0645\u0631\u0627\u0647 \u0632\u0645\u0627\u0646",
2566
+ onClick: () => {
2567
+ if (!open) setOpen(true);
2568
+ },
2569
+ InputLabelProps: {
2570
+ shrink: true,
2571
+ style: { color: error ? "#D32F2F" : "inherit" }
2572
+ },
2573
+ InputProps: {
2574
+ onFocus: () => {
2575
+ }
2576
+ }
2577
+ }
2578
+ }
2579
+ }
2580
+ ), error && /* @__PURE__ */ import_react16.default.createElement(import_material13.Typography, { fontSize: 13, color: "error", sx: { mt: 0.6, ml: 1 } }, error.message))
2581
+ }
2582
+ )
2583
+ );
2584
+ };
2585
+ var mobile_date_time_picker_default = JalaliDatePicker3;
2586
+
2587
+ // src/modal/index.tsx
2588
+ var React15 = __toESM(require("react"));
2589
+ var import_Dialog5 = __toESM(require("@mui/material/Dialog"));
2590
+ var import_DialogActions3 = __toESM(require("@mui/material/DialogActions"));
2591
+ var import_DialogContent5 = __toESM(require("@mui/material/DialogContent"));
2592
+ var import_DialogTitle5 = __toESM(require("@mui/material/DialogTitle"));
2593
+ var import_material14 = require("@mui/material");
2594
+ var import_fa5 = require("react-icons/fa");
2595
+ var import_md3 = require("react-icons/md");
2596
+ function ConfirmationDialog2({
2597
+ open,
2598
+ handleClose,
2599
+ callback,
2600
+ callbackParams,
2601
+ headerText,
2602
+ bodyText,
2603
+ isLoading
2604
+ }) {
2605
+ return /* @__PURE__ */ React15.createElement(import_Dialog5.default, { open, onClose: handleClose, fullWidth: true, maxWidth: "xs" }, /* @__PURE__ */ React15.createElement(import_material14.Box, null, /* @__PURE__ */ React15.createElement(
2606
+ import_DialogTitle5.default,
2607
+ {
2608
+ fontWeight: 700,
2609
+ fontSize: "1.2rem",
2610
+ display: "flex",
2611
+ alignItems: "center",
2612
+ gap: 1
2613
+ },
2614
+ /* @__PURE__ */ React15.createElement(import_fa5.FaRegTrashAlt, { style: { color: "red" }, size: 18 }),
2615
+ headerText
2616
+ ), /* @__PURE__ */ React15.createElement(
2617
+ import_material14.IconButton,
2618
+ {
2619
+ "aria-label": "close",
2620
+ onClick: handleClose,
2621
+ sx: {
2622
+ position: "absolute",
2623
+ right: 8,
2624
+ top: 8,
2625
+ color: (theme) => theme.palette.grey[500]
2626
+ }
2627
+ },
2628
+ /* @__PURE__ */ React15.createElement(import_md3.MdClose, null)
2629
+ ), /* @__PURE__ */ React15.createElement(import_material14.Divider, { sx: { my: "10px" } }), /* @__PURE__ */ React15.createElement(import_DialogContent5.default, null, bodyText), /* @__PURE__ */ React15.createElement(
2630
+ import_DialogActions3.default,
2631
+ {
2632
+ sx: {
2633
+ display: "flex",
2634
+ justifyContent: "flex-end",
2635
+ width: "100%",
2636
+ gap: "12px",
2637
+ alignItems: "center",
2638
+ padding: "2rem"
2639
+ }
2640
+ },
2641
+ /* @__PURE__ */ React15.createElement(
2642
+ import_material14.Button,
2643
+ {
2644
+ disabled: isLoading,
2645
+ onClick: () => {
2646
+ callback(callbackParams);
2647
+ handleClose();
2648
+ },
2649
+ variant: "contained",
2650
+ color: "error",
2651
+ sx: { minWidth: "120px" },
2652
+ startIcon: isLoading ? /* @__PURE__ */ React15.createElement(import_material14.CircularProgress, { sx: { color: "white" }, size: 20 }) : /* @__PURE__ */ React15.createElement(import_fa5.FaRegTrashAlt, { size: 16 })
2653
+ },
2654
+ "\u062D\u0630\u0641"
2655
+ ),
2656
+ /* @__PURE__ */ React15.createElement(
2657
+ import_material14.Button,
2658
+ {
2659
+ onClick: handleClose,
2660
+ variant: "outlined",
2661
+ color: "error",
2662
+ startIcon: /* @__PURE__ */ React15.createElement(import_md3.MdOutlineCancel, { size: 15 }),
2663
+ sx: { minWidth: "120px" }
2664
+ },
2665
+ "\u0627\u0646\u0635\u0631\u0627\u0641"
2666
+ )
2667
+ )));
2668
+ }
2669
+
2670
+ // src/no-result/index.tsx
2671
+ var import_material15 = require("@mui/material");
2672
+ var import_react17 = __toESM(require("react"));
2673
+ function NoResult({
2674
+ title = "\u062F\u0627\u062F\u0647 \u0627\u06CC \u0628\u0631\u0627\u06CC \u0646\u0645\u0627\u06CC\u0634 \u0648\u062C\u0648\u062F \u0646\u062F\u0627\u0631\u062F!",
2675
+ description,
2676
+ sx = {}
2677
+ }) {
2678
+ const theme = (0, import_material15.useTheme)();
2679
+ return /* @__PURE__ */ import_react17.default.createElement(
2680
+ import_material15.Card,
2681
+ {
2682
+ sx: {
2683
+ width: "100%",
2684
+ minWidth: 300,
2685
+ borderRadius: "12px",
2686
+ border: `1px solid ${theme.palette.secondary.light}`
2687
+ }
2688
+ },
2689
+ /* @__PURE__ */ import_react17.default.createElement(
2690
+ import_material15.Stack,
2691
+ {
2692
+ spacing: 2,
2693
+ alignItems: "center",
2694
+ sx: {
2695
+ py: 5,
2696
+ ...sx
2697
+ }
2698
+ },
2699
+ /* @__PURE__ */ import_react17.default.createElement(
2700
+ "img",
2701
+ {
2702
+ src: "/assets/images/no-data.png",
2703
+ alt: "No Data",
2704
+ height: 100,
2705
+ width: 100
2706
+ }
2707
+ ),
2708
+ /* @__PURE__ */ import_react17.default.createElement(import_material15.Stack, { spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react17.default.createElement(import_material15.Typography, { fontWeight: "600" }, title), description && /* @__PURE__ */ import_react17.default.createElement(import_material15.Typography, { fontWeight: "500" }, description))
2709
+ )
2710
+ );
2711
+ }
2712
+
2713
+ // src/pagination-list/index.tsx
2714
+ var import_utils3 = require("@mamrp/utils");
2715
+ var import_material16 = require("@mui/material");
2716
+ var import_Stack = __toESM(require("@mui/material/Stack"));
2717
+ var import_system5 = require("@mui/system");
2718
+ var React17 = __toESM(require("react"));
2719
+ var import_fa6 = require("react-icons/fa");
2720
+ function PaginationList({
2721
+ currentPage,
2722
+ setCurrentPage,
2723
+ totalPages
2724
+ }) {
2725
+ React17.useEffect(() => {
2726
+ window.scrollTo({ top: 0, behavior: "smooth" });
2727
+ }, [currentPage]);
2728
+ const handlePrevious = () => {
2729
+ if (currentPage > 1) {
2730
+ setCurrentPage(currentPage - 1);
2731
+ }
2732
+ };
2733
+ const handleNext = () => {
2734
+ if (currentPage < totalPages) {
2735
+ setCurrentPage(currentPage + 1);
2736
+ }
2737
+ };
2738
+ return /* @__PURE__ */ React17.createElement(
2739
+ import_Stack.default,
2740
+ {
2741
+ direction: "row",
2742
+ spacing: 2,
2743
+ alignItems: "center",
2744
+ justifyContent: "center"
2745
+ },
2746
+ /* @__PURE__ */ React17.createElement(
2747
+ import_material16.Button,
2748
+ {
2749
+ variant: "contained",
2750
+ onClick: handlePrevious,
2751
+ color: "warning",
2752
+ disabled: currentPage === 1,
2753
+ sx: {
2754
+ borderRadius: 2,
2755
+ width: "100px",
2756
+ height: "50px",
2757
+ minWidth: "unset",
2758
+ display: "flex",
2759
+ alignItems: "center",
2760
+ justifyContent: "center"
2761
+ },
2762
+ size: "large",
2763
+ startIcon: /* @__PURE__ */ React17.createElement(import_fa6.FaChevronRight, null)
2764
+ },
2765
+ "\u0642\u0628\u0644\u06CC",
2766
+ " "
2767
+ ),
2768
+ /* @__PURE__ */ React17.createElement(
2769
+ import_system5.Box,
2770
+ {
2771
+ sx: {
2772
+ fontWeight: "bold",
2773
+ width: "120px",
2774
+ height: "50px",
2775
+ borderRadius: 2,
2776
+ display: "flex",
2777
+ alignItems: "center",
2778
+ justifyContent: "center",
2779
+ color: "#fff",
2780
+ fontSize: "1.5rem",
2781
+ backgroundColor: "#065938"
2782
+ }
2783
+ },
2784
+ /* @__PURE__ */ React17.createElement("span", { style: { margin: "0px 6px", fontSize: "1.2rem" } }, "\u0635\u0641\u062D\u0647"),
2785
+ (0, import_utils3.convertToPersianDigits)(currentPage)
2786
+ ),
2787
+ /* @__PURE__ */ React17.createElement(
2788
+ import_material16.Button,
2789
+ {
2790
+ variant: "contained",
2791
+ onClick: handleNext,
2792
+ color: "warning",
2793
+ disabled: currentPage === totalPages,
2794
+ sx: {
2795
+ borderRadius: 2,
2796
+ width: "100px",
2797
+ height: "50px",
2798
+ minWidth: "unset",
2799
+ display: "flex",
2800
+ alignItems: "center",
2801
+ justifyContent: "center"
2802
+ },
2803
+ size: "large",
2804
+ endIcon: /* @__PURE__ */ React17.createElement(import_fa6.FaChevronLeft, null)
2805
+ },
2806
+ "\u0628\u0639\u062F\u06CC",
2807
+ " "
2808
+ )
2809
+ );
2810
+ }
2811
+
2812
+ // src/radio-button/index.tsx
2813
+ var React18 = __toESM(require("react"));
2814
+ var import_react_hook_form10 = require("react-hook-form");
2815
+ var import_Radio = __toESM(require("@mui/material/Radio"));
2816
+ var import_RadioGroup = __toESM(require("@mui/material/RadioGroup"));
2817
+ var import_FormControlLabel = __toESM(require("@mui/material/FormControlLabel"));
2818
+ var import_FormControl = __toESM(require("@mui/material/FormControl"));
2819
+ var import_FormLabel = __toESM(require("@mui/material/FormLabel"));
2820
+ function RadioButton({ name, label, options, control }) {
2821
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_FormControl.default, { sx: {
2822
+ display: "flex",
2823
+ flexDirection: "row",
2824
+ alignItems: "center",
2825
+ justifyContent: "start"
2826
+ } }, /* @__PURE__ */ React18.createElement(import_FormLabel.default, { id: `${name}-label` }, label), /* @__PURE__ */ React18.createElement(
2827
+ import_react_hook_form10.Controller,
2828
+ {
2829
+ name,
2830
+ control,
2831
+ render: ({ field }) => /* @__PURE__ */ React18.createElement(
2832
+ import_RadioGroup.default,
2833
+ {
2834
+ ...field,
2835
+ "aria-labelledby": `${name}-label`,
2836
+ value: field.value,
2837
+ sx: {
2838
+ display: "flex",
2839
+ flexDirection: "row",
2840
+ marginLeft: 5
2841
+ }
2842
+ },
2843
+ options.map((option) => /* @__PURE__ */ React18.createElement(
2844
+ import_FormControlLabel.default,
2845
+ {
2846
+ key: option.value,
2847
+ value: option.value,
2848
+ control: /* @__PURE__ */ React18.createElement(import_Radio.default, { id: option.id }),
2849
+ label: option.name
2850
+ }
2851
+ ))
2852
+ )
2853
+ }
2854
+ )));
2855
+ }
2856
+
2857
+ // src/selector/index.tsx
2858
+ var import_md4 = require("react-icons/md");
2859
+ var import_material17 = require("@mui/material");
2860
+ var import_react18 = __toESM(require("react"));
2861
+ var backendResponse = {
2862
+ value: {
2863
+ data: [
2864
+ {
2865
+ id: 287,
2866
+ title: "\u0648\u0642\u0641\u0647 \u062F\u0627\u062E\u0644 \u06A9\u0634\u062A\u0627\u0631\u06AF\u0627\u0647",
2867
+ parentId: null,
2868
+ level: 1,
2869
+ children: [
2870
+ {
2871
+ id: 292,
2872
+ title: "\u062E\u0637 \u06F2 \u06A9\u0634\u062A\u0627\u0631",
2873
+ parentId: 287,
2874
+ level: 2,
2875
+ children: [
2876
+ {
2877
+ id: 312,
2878
+ title: "\u062E\u0631\u0627\u0628\u06CC \u062F\u0633\u062A\u06AF\u0627\u0647 \u0645\u0642\u0639\u062F \u0632\u0646",
2879
+ parentId: 292,
2880
+ level: 3,
2881
+ children: []
2882
+ },
2883
+ {
2884
+ id: 313,
2885
+ title: "\u062E\u0631\u0627\u0628\u06CC \u062F\u0633\u062A\u06AF\u0627\u0647 \u0686\u0627\u06A9 \u0632\u0646",
2886
+ parentId: 292,
2887
+ level: 3,
2888
+ children: []
2889
+ }
2890
+ ]
2891
+ }
2892
+ ]
2893
+ },
2894
+ {
2895
+ id: 288,
2896
+ title: "\u0648\u0642\u0641\u0647 \u0642\u0628\u0644 \u0627\u0632 \u06A9\u0634\u062A\u0627\u0631\u06AF\u0627\u0647",
2897
+ parentId: null,
2898
+ level: 1,
2899
+ children: [
2900
+ {
2901
+ id: 289,
2902
+ title: "\u0633\u0631\u0648\u06CC\u0633 \u067E\u0631\u0633\u0646\u0644",
2903
+ parentId: 288,
2904
+ level: 2,
2905
+ children: []
2906
+ }
2907
+ ]
2908
+ }
2909
+ ]
2910
+ }
2911
+ };
2912
+ var NestedSelect = () => {
2913
+ const [selectedItem, setSelectedItem] = (0, import_react18.useState)(null);
2914
+ const [openMenus, setOpenMenus] = (0, import_react18.useState)({});
2915
+ const [menuOpen, setMenuOpen] = (0, import_react18.useState)(false);
2916
+ const handleSelect = (item) => {
2917
+ setSelectedItem((prev) => prev?.id === item.id ? null : item);
2918
+ };
2919
+ const handleToggle = (id) => {
2920
+ setOpenMenus((prev) => ({ ...prev, [id]: !prev[id] }));
2921
+ };
2922
+ const renderMenuItems = (items, level = 0) => {
2923
+ return items.map((item) => {
2924
+ const isParentSelected = selectedItem?.id === item.id;
2925
+ const isAnyChildSelected = item.children?.some(
2926
+ (child) => selectedItem?.id === child.id
2927
+ );
2928
+ return /* @__PURE__ */ import_react18.default.createElement("div", { key: item.id }, /* @__PURE__ */ import_react18.default.createElement(
2929
+ import_material17.MenuItem,
2930
+ {
2931
+ onClick: (e) => {
2932
+ e.stopPropagation();
2933
+ handleSelect(item);
2934
+ },
2935
+ disabled: isAnyChildSelected,
2936
+ sx: { pl: level * 2 }
2937
+ },
2938
+ /* @__PURE__ */ import_react18.default.createElement(import_material17.Checkbox, { checked: isParentSelected }),
2939
+ /* @__PURE__ */ import_react18.default.createElement(import_material17.ListItemText, { primary: item.title }),
2940
+ item.children && item.children.length > 0 && /* @__PURE__ */ import_react18.default.createElement(
2941
+ import_material17.IconButton,
2942
+ {
2943
+ size: "small",
2944
+ onClick: (e) => {
2945
+ e.stopPropagation();
2946
+ handleToggle(item.id);
2947
+ }
2948
+ },
2949
+ openMenus[item.id] ? /* @__PURE__ */ import_react18.default.createElement(import_md4.MdKeyboardArrowLeft, null) : /* @__PURE__ */ import_react18.default.createElement(import_md4.MdKeyboardArrowRight, null)
2950
+ )
2951
+ ), item.children && item.children.length > 0 && /* @__PURE__ */ import_react18.default.createElement(import_material17.Collapse, { in: openMenus[item.id], timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ import_react18.default.createElement(import_material17.List, { component: "div", disablePadding: true }, renderMenuItems(item.children, level + 1))));
2952
+ });
2953
+ };
2954
+ return /* @__PURE__ */ import_react18.default.createElement(import_material17.FormControl, { fullWidth: true, variant: "outlined" }, /* @__PURE__ */ import_react18.default.createElement(import_material17.InputLabel, { shrink: true }, "\u062F\u0633\u062A\u0647 \u0628\u0646\u062F\u06CC *"), /* @__PURE__ */ import_react18.default.createElement(
2955
+ import_material17.Select,
2956
+ {
2957
+ label: "\u062F\u0633\u062A\u0647 \u0628\u0646\u062F\u06CC *",
2958
+ value: selectedItem?.id || "",
2959
+ displayEmpty: true,
2960
+ open: menuOpen,
2961
+ onOpen: () => setMenuOpen(true),
2962
+ onClose: () => setMenuOpen(false),
2963
+ renderValue: (selected) => selectedItem ? /* @__PURE__ */ import_react18.default.createElement(import_material17.Typography, null, selectedItem.title) : " "
2964
+ },
2965
+ renderMenuItems(backendResponse.value.data)
2966
+ ));
2967
+ };
2968
+ var selector_default = NestedSelect;
2969
+
2970
+ // src/spinner/sonar/index.tsx
2971
+ var import_material18 = require("@mui/material");
2972
+ var import_system6 = require("@mui/system");
2973
+ var import_react19 = __toESM(require("react"));
2974
+ var radarAnimation = import_system6.keyframes`
2975
+ 0% {
2976
+ background: inherit;
2977
+ transform: scale(0);
2978
+ opacity: 0.9;
2979
+ }
2980
+ 100% {
2981
+ opacity: 0;
2982
+ transform: scale(4);
2983
+ }
2984
+ `;
2985
+ function SonarSpinner({ children }) {
2986
+ return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(import_material18.Box, { className: "absolute w-[30px] h-[30px] rounded-full bg-white z-10 flex items-center justify-center" }, children), /* @__PURE__ */ import_react19.default.createElement(
2987
+ import_material18.Box,
2988
+ {
2989
+ className: "root",
2990
+ sx: {
2991
+ position: "absolute",
2992
+ display: "flex",
2993
+ alignItems: "center",
2994
+ justifyContent: "center",
2995
+ backgroundColor: "white",
2996
+ transform: "translateZ(0)"
2997
+ }
2998
+ },
2999
+ /* @__PURE__ */ import_react19.default.createElement(
3000
+ import_material18.Box,
3001
+ {
3002
+ className: "radar",
3003
+ sx: {
3004
+ position: "absolute",
3005
+ zIndex: 1,
3006
+ width: "15px",
3007
+ height: "15px",
3008
+ borderRadius: "100%",
3009
+ display: "flex",
3010
+ alignItems: "center",
3011
+ justifyContent: "center",
3012
+ backgroundColor: "red",
3013
+ animation: `${radarAnimation} 1.2s linear infinite`,
3014
+ animationDelay: "0s"
3015
+ }
3016
+ },
3017
+ /* @__PURE__ */ import_react19.default.createElement(
3018
+ import_material18.Box,
3019
+ {
3020
+ className: "sonar",
3021
+ sx: {
3022
+ position: "absolute",
3023
+ zIndex: 1,
3024
+ width: "14px",
3025
+ height: "14px",
3026
+ borderRadius: "inherit",
3027
+ backgroundColor: "red"
3028
+ }
3029
+ }
3030
+ ),
3031
+ /* @__PURE__ */ import_react19.default.createElement(
3032
+ import_material18.Box,
3033
+ {
3034
+ className: "sonar delayed",
3035
+ sx: {
3036
+ position: "absolute",
3037
+ zIndex: 1,
3038
+ width: "7px",
3039
+ height: "7px",
3040
+ borderRadius: "100%",
3041
+ display: "flex",
3042
+ alignItems: "center",
3043
+ justifyContent: "center",
3044
+ animation: `${radarAnimation} 1.2s linear infinite`,
3045
+ animationDelay: "1s",
3046
+ backgroundColor: "red"
3047
+ }
3048
+ }
3049
+ )
3050
+ )
3051
+ ));
3052
+ }
3053
+
3054
+ // src/stepper/index.tsx
3055
+ var import_Box = __toESM(require("@mui/material/Box"));
3056
+ var import_Step = __toESM(require("@mui/material/Step"));
3057
+ var import_StepButton = __toESM(require("@mui/material/StepButton"));
3058
+ var import_Stepper = __toESM(require("@mui/material/Stepper"));
3059
+ var React21 = __toESM(require("react"));
3060
+ function HorizontalStepper({
3061
+ steps,
3062
+ currentStep,
3063
+ setCurrentStep
3064
+ }) {
3065
+ const [completed, setCompleted] = React21.useState({});
3066
+ return /* @__PURE__ */ React21.createElement(import_Box.default, { sx: { width: "100%" } }, /* @__PURE__ */ React21.createElement(import_Stepper.default, { nonLinear: true, activeStep: currentStep }, steps.map((label, index) => /* @__PURE__ */ React21.createElement(import_Step.default, { key: index, completed: completed[index] }, /* @__PURE__ */ React21.createElement(
3067
+ import_StepButton.default,
3068
+ {
3069
+ color: "inherit",
3070
+ disabled: !(index === 0 && currentStep === 1),
3071
+ onClick: () => {
3072
+ if (index === 0 && currentStep === 1) {
3073
+ setCurrentStep(0);
3074
+ }
3075
+ }
3076
+ },
3077
+ label
3078
+ )))));
3079
+ }
3080
+
3081
+ // src/switch-button/index.tsx
3082
+ var import_material19 = require("@mui/material");
3083
+ var import_system7 = require("@mui/system");
3084
+ var import_react20 = __toESM(require("react"));
3085
+ var CustomSwitch = (0, import_system7.styled)(import_material19.Switch)(({ theme }) => ({
3086
+ "& .MuiSwitch-switchBase.Mui-checked": {
3087
+ color: theme.palette.primary.main
3088
+ },
3089
+ "& .MuiSwitch-switchBase": {
3090
+ color: "#757575"
3091
+ },
3092
+ "& .MuiSwitch-track": {
3093
+ backgroundColor: "#E0E0E0"
3094
+ },
3095
+ "& .MuiSwitch-track.Mui-checked": {
3096
+ backgroundColor: theme.palette.primary.light
3097
+ }
3098
+ }));
3099
+ var BoxContainer = (0, import_system7.styled)(import_material19.Box)(({ theme }) => ({
3100
+ display: "flex",
3101
+ alignItems: "center",
3102
+ padding: "5px",
3103
+ backgroundColor: "#fafafa",
3104
+ borderRadius: "10px",
3105
+ transition: "all 0.3s ease",
3106
+ "&:hover": {
3107
+ backgroundColor: theme.palette.action.hover
3108
+ },
3109
+ // Conditionally apply smaller padding for mobile devices
3110
+ "@media (max-width:700px)": {
3111
+ padding: "0px"
3112
+ // Smaller padding for mobile
3113
+ }
3114
+ }));
3115
+ var LabelContainer = (0, import_system7.styled)("div")({
3116
+ display: "flex",
3117
+ alignItems: "center",
3118
+ justifyContent: "center",
3119
+ fontSize: "16px",
3120
+ fontWeight: "100",
3121
+ color: "#333",
3122
+ marginLeft: "8px",
3123
+ transition: "all 0.2s ease",
3124
+ // Conditionally apply smaller font size and margin for mobile devices
3125
+ "@media (max-width:700px)": {
3126
+ fontSize: "14px",
3127
+ // Smaller font size for mobile
3128
+ marginLeft: "2px",
3129
+ // Smaller margin for mobile
3130
+ marginRight: "0px"
3131
+ // Smaller
3132
+ }
3133
+ });
3134
+ var SwitchWithIcons = ({
3135
+ checked,
3136
+ handleChange,
3137
+ iconChecked,
3138
+ iconUnchecked
3139
+ }) => {
3140
+ return /* @__PURE__ */ import_react20.default.createElement(BoxContainer, null, /* @__PURE__ */ import_react20.default.createElement(
3141
+ import_material19.FormControlLabel,
3142
+ {
3143
+ control: /* @__PURE__ */ import_react20.default.createElement(
3144
+ CustomSwitch,
3145
+ {
3146
+ checked,
3147
+ onChange: handleChange,
3148
+ name: "switch"
3149
+ }
3150
+ ),
3151
+ label: /* @__PURE__ */ import_react20.default.createElement(LabelContainer, null, checked ? iconChecked ? iconChecked : /* @__PURE__ */ import_react20.default.createElement("div", { style: { fontSize: 22, color: "#4CAF50" } }, "\u2714") : iconUnchecked ? iconUnchecked : /* @__PURE__ */ import_react20.default.createElement("div", { style: { fontSize: 20, color: "#757575" } }, "\u2718"))
3152
+ }
3153
+ ));
3154
+ };
3155
+ var switch_button_default = SwitchWithIcons;
3156
+
3157
+ // src/table/index.tsx
3158
+ var import_material20 = require("@mui/material");
3159
+ var import_Skeleton = __toESM(require("@mui/material/Skeleton"));
3160
+ var import_styles = require("@mui/material/styles");
3161
+ var import_x_data_grid = require("@mui/x-data-grid");
3162
+ var import_react21 = __toESM(require("react"));
3163
+ var ScrollableContainer = (0, import_styles.styled)("div")({
3164
+ width: "100%",
3165
+ overflowX: "auto"
3166
+ // Enable horizontal scrolling
3167
+ });
3168
+ var Table = ({
3169
+ pagingmode,
3170
+ totalRows,
3171
+ rows,
3172
+ columns,
3173
+ paginationModel,
3174
+ setPaginationModel,
3175
+ loading,
3176
+ rowId,
3177
+ _tools,
3178
+ _CustomFooter,
3179
+ rowInPage,
3180
+ highlightedRowId,
3181
+ evenRowBgColor = "transparent",
3182
+ sortFieldMapping,
3183
+ setsortQuery,
3184
+ sortQuery,
3185
+ fontSize,
3186
+ ...rest
3187
+ }) => {
3188
+ const [sortModel, setSortModel] = import_react21.default.useState([]);
3189
+ const handleSetQueryOptions = (options) => {
3190
+ if (!Array.isArray(options)) return;
3191
+ const formattedOptions = options.reduce((acc, item) => {
3192
+ const field = sortFieldMapping?.[item.field] || item.field;
3193
+ acc[field] = item.sort == "ask" ? 0 : 1;
3194
+ return acc;
3195
+ }, {});
3196
+ setsortQuery && setsortQuery(formattedOptions);
3197
+ };
3198
+ (0, import_react21.useEffect)(() => {
3199
+ if (sortQuery && Object.keys(sortQuery).length > 0) {
3200
+ const queryKey = Object.keys(sortQuery)[0];
3201
+ if (sortFieldMapping) {
3202
+ const fieldName = Object.keys(sortFieldMapping).find(
3203
+ (key) => sortFieldMapping[key] === queryKey
3204
+ );
3205
+ if (fieldName) {
3206
+ const sortDirection = sortQuery[queryKey];
3207
+ setSortModel([
3208
+ { field: fieldName, sort: sortDirection == 0 ? "asc" : "desc" }
3209
+ ]);
3210
+ }
3211
+ }
3212
+ } else {
3213
+ setSortModel([]);
3214
+ }
3215
+ }, [sortQuery]);
3216
+ const handleSortModelChange = import_react21.default.useCallback(
3217
+ (sortModel2) => {
3218
+ handleSetQueryOptions(
3219
+ sortModel2.map((item) => ({
3220
+ field: item.field,
3221
+ sort: item.sort === "asc" ? "ask" : item.sort === "desc" ? "desc" : item.sort
3222
+ }))
3223
+ );
3224
+ },
3225
+ []
3226
+ );
3227
+ const option = {
3228
+ ...!!setsortQuery && {
3229
+ sortingMode: "server",
3230
+ onSortModelChange: handleSortModelChange,
3231
+ sortModel
3232
+ },
3233
+ ...!pagingmode && { paginationMode: "server" },
3234
+ ...pagingmode == "client" && { paginationMode: "client" },
3235
+ ...!pagingmode && {
3236
+ onPaginationModelChange: setPaginationModel,
3237
+ paginationModel
3238
+ },
3239
+ ...pagingmode == "client" && {
3240
+ initialState: {
3241
+ pagination: {
3242
+ paginationModel: {
3243
+ pageSize: rowInPage ? rowInPage : 5,
3244
+ // Default page size (5)
3245
+ page: paginationModel?.page || 0
3246
+ // Default to page 0 if not provided
3247
+ }
3248
+ }
3249
+ }
3250
+ },
3251
+ ...pagingmode == "client" && {
3252
+ paginationModel
3253
+ // Connect paginationModel to DataGrid
3254
+ }
3255
+ };
3256
+ return /* @__PURE__ */ import_react21.default.createElement(ScrollableContainer, null, /* @__PURE__ */ import_react21.default.createElement(
3257
+ import_x_data_grid.DataGrid,
3258
+ {
3259
+ rows,
3260
+ columns: columns.map((column) => ({ ...column })),
3261
+ disableRowSelectionOnClick: true,
3262
+ pagination: true,
3263
+ sx: {
3264
+ fontSize: fontSize ?? "0.875rem",
3265
+ "& .MuiDataGrid-columnHeaders": {
3266
+ backgroundColor: "rgba(0, 0, 0, 0.1)"
3267
+ },
3268
+ "& .MuiDataGrid-columnHeaderTitle": {
3269
+ fontSize: fontSize ?? "1rem"
3270
+ },
3271
+ "& .MuiDataGrid-row:nth-of-type(even)": {
3272
+ backgroundColor: evenRowBgColor
3273
+ },
3274
+ ...highlightedRowId && {
3275
+ "& .MuiDataGrid-row": {
3276
+ [`&[data-id="${highlightedRowId}"]`]: {
3277
+ backgroundColor: "#c5edd0"
3278
+ }
3279
+ }
3280
+ }
3281
+ },
3282
+ ...option,
3283
+ onPaginationModelChange: setPaginationModel,
3284
+ getRowId: rowId,
3285
+ disableColumnResize: true,
3286
+ autoHeight: true,
3287
+ rowCount: totalRows,
3288
+ pageSizeOptions: [5, 10, 25, 50, 75, 100],
3289
+ slotProps: {
3290
+ pagination: {
3291
+ labelRowsPerPage: "\u062A\u0639\u062F\u0627\u062F \u062F\u0631 \u0647\u0631 \u0635\u0641\u062D\u0647"
3292
+ }
3293
+ },
3294
+ disableColumnMenu: true,
3295
+ disableColumnFilter: true,
3296
+ loading,
3297
+ localeText: {
3298
+ noRowsLabel: "\u0647\u06CC\u0686 \u062F\u0627\u062F\u0647\u200C\u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F!",
3299
+ noResultsOverlayLabel: "\u0647\u06CC\u0686 \u062F\u0627\u062F\u0647\u200C\u0627\u06CC \u06CC\u0627\u0641\u062A \u0646\u0634\u062F!",
3300
+ MuiTablePagination: {
3301
+ labelDisplayedRows: ({ from, to, count }) => loading ? /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement(
3302
+ import_Skeleton.default,
3303
+ {
3304
+ variant: "text",
3305
+ width: 30,
3306
+ style: { display: "inline-block" }
3307
+ }
3308
+ ), " ", /* @__PURE__ */ import_react21.default.createElement(
3309
+ import_Skeleton.default,
3310
+ {
3311
+ variant: "text",
3312
+ width: 30,
3313
+ style: { display: "inline-block" }
3314
+ }
3315
+ )) : `${from} - ${!isNaN(to) ? to : "..."} \u0627\u0632 ${count !== void 0 ? count : "..."}`
3316
+ },
3317
+ footerRowSelected: (count) => /* @__PURE__ */ import_react21.default.createElement(import_material20.Typography, null, "\u0633\u0637\u0631 \u0647\u0627\u06CC \u0627\u0646\u062A\u062E\u0627\u0628 \u0634\u062F\u0647 : ", count)
3318
+ },
3319
+ ...rest
3320
+ }
3321
+ ));
3322
+ };
3323
+ var table_default = Table;
3324
+
3325
+ // src/text-field/number-type/index.tsx
3326
+ var import_TextField2 = __toESM(require("@mui/material/TextField"));
3327
+ var import_react22 = require("react");
3328
+ var import_react_hook_form11 = require("react-hook-form");
3329
+ var import_react_number_format = require("react-number-format");
3330
+ var import_CircularProgress2 = __toESM(require("@mui/material/CircularProgress"));
3331
+ var import_InputAdornment = __toESM(require("@mui/material/InputAdornment"));
3332
+ var import_react23 = __toESM(require("react"));
3333
+ var FormInputNumber = ({
3334
+ name,
3335
+ control,
3336
+ label,
3337
+ endAdornment,
3338
+ thousandSeparator,
3339
+ startAdornment,
3340
+ allowLeadingZeros = false,
3341
+ allowNegative = false,
3342
+ maxLength,
3343
+ isLoading,
3344
+ rules,
3345
+ data,
3346
+ borderColor,
3347
+ decimalScale = 2,
3348
+ ...rest
3349
+ }) => {
3350
+ return /* @__PURE__ */ import_react23.default.createElement(
3351
+ import_react_hook_form11.Controller,
3352
+ {
3353
+ rules,
3354
+ name,
3355
+ control,
3356
+ render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ import_react23.default.createElement(
3357
+ import_TextField2.default,
3358
+ {
3359
+ disabled: isLoading,
3360
+ helperText: error ? error.message : null,
3361
+ size: "small",
3362
+ error: !!error,
3363
+ onChange,
3364
+ value: data && !value ? data : value == null ? "" : value,
3365
+ fullWidth: true,
3366
+ sx: {
3367
+ "& .MuiOutlinedInput-notchedOutline": {
3368
+ borderColor: borderColor ? borderColor : ""
3369
+ },
3370
+ "& .MuiOutlinedInput-root": {
3371
+ borderRadius: "12px",
3372
+ "&:hover fieldset": {
3373
+ borderColor: borderColor ?? "#085938"
3374
+ },
3375
+ "&.Mui-focused fieldset": {
3376
+ borderColor: borderColor ?? "#085938"
3377
+ }
3378
+ },
3379
+ "& .MuiInputLabel-root.Mui-focused": {
3380
+ color: "#085938"
3381
+ }
3382
+ },
3383
+ label,
3384
+ inputRef: ref,
3385
+ variant: "outlined",
3386
+ InputLabelProps: { shrink: true },
3387
+ InputProps: {
3388
+ inputComponent: NumericFormatCustom,
3389
+ inputProps: {
3390
+ thousandSeparator,
3391
+ allowLeadingZeros,
3392
+ allowNegative,
3393
+ maxLength,
3394
+ decimalScale
3395
+ },
3396
+ endAdornment: isLoading ? /* @__PURE__ */ import_react23.default.createElement(import_InputAdornment.default, { position: "end" }, /* @__PURE__ */ import_react23.default.createElement(import_CircularProgress2.default, { size: 20 })) : null,
3397
+ startAdornment
3398
+ },
3399
+ ...rest
3400
+ }
3401
+ )
3402
+ }
3403
+ );
3404
+ };
3405
+ var NumericFormatCustom = (0, import_react22.forwardRef)(
3406
+ function NumericFormatCustom2(props, ref) {
3407
+ const {
3408
+ onChange,
3409
+ thousandSeparator,
3410
+ allowLeadingZeros,
3411
+ allowNegative,
3412
+ maxLength,
3413
+ decimalScale,
3414
+ ...other
3415
+ } = props;
3416
+ return /* @__PURE__ */ import_react23.default.createElement(
3417
+ import_react_number_format.NumericFormat,
3418
+ {
3419
+ ...other,
3420
+ getInputRef: ref,
3421
+ onValueChange: (values) => {
3422
+ onChange({
3423
+ target: {
3424
+ name: props.name,
3425
+ value: values.value
3426
+ }
3427
+ });
3428
+ },
3429
+ maxLength,
3430
+ allowLeadingZeros,
3431
+ thousandSeparator,
3432
+ valueIsNumericString: true,
3433
+ allowNegative,
3434
+ decimalScale,
3435
+ fixedDecimalScale: false,
3436
+ dir: "ltr"
3437
+ }
3438
+ );
3439
+ }
3440
+ );
3441
+ var number_type_default = FormInputNumber;
3442
+
3443
+ // src/text-field/text-type/index.tsx
3444
+ var import_CircularProgress3 = __toESM(require("@mui/material/CircularProgress"));
3445
+ var import_InputAdornment2 = __toESM(require("@mui/material/InputAdornment"));
3446
+ var import_TextField3 = __toESM(require("@mui/material/TextField"));
3447
+ var import_react24 = __toESM(require("react"));
3448
+ var import_react_hook_form12 = require("react-hook-form");
3449
+ var FormInputText = ({
3450
+ name,
3451
+ control,
3452
+ label,
3453
+ maxLength,
3454
+ readOnly,
3455
+ rules,
3456
+ size = "small",
3457
+ disabled = false,
3458
+ multiline,
3459
+ isLoading,
3460
+ onBlurHandler,
3461
+ rows,
3462
+ ...rest
3463
+ }) => {
3464
+ return /* @__PURE__ */ import_react24.default.createElement(
3465
+ import_react_hook_form12.Controller,
3466
+ {
3467
+ name,
3468
+ control,
3469
+ rules,
3470
+ render: ({ field: { onChange, value, ref }, fieldState: { error } }) => /* @__PURE__ */ import_react24.default.createElement(
3471
+ import_TextField3.default,
3472
+ {
3473
+ disabled: disabled || isLoading,
3474
+ helperText: error ? error.message : null,
3475
+ multiline,
3476
+ size,
3477
+ rows: rows ? rows : void 0,
3478
+ error: !!error,
3479
+ onChange,
3480
+ value,
3481
+ fullWidth: true,
3482
+ label,
3483
+ variant: "outlined",
3484
+ inputProps: {
3485
+ ...rest.inputProps,
3486
+ maxLength,
3487
+ readOnly
3488
+ },
3489
+ InputProps: {
3490
+ endAdornment: isLoading ? /* @__PURE__ */ import_react24.default.createElement(import_InputAdornment2.default, { position: "end" }, /* @__PURE__ */ import_react24.default.createElement(import_CircularProgress3.default, { size: 20 })) : null
3491
+ },
3492
+ InputLabelProps: { shrink: true },
3493
+ inputRef: ref,
3494
+ ...rest
3495
+ }
3496
+ )
3497
+ }
3498
+ );
3499
+ };
3500
+ var text_type_default = FormInputText;
3501
+
3502
+ // src/upload-image/index.tsx
3503
+ var import_react25 = __toESM(require("react"));
3504
+ var import_react_hook_form13 = require("react-hook-form");
3505
+ var import_material21 = require("@mui/material");
3506
+ var import_gr = require("react-icons/gr");
3507
+ var import_md5 = require("react-icons/md");
3508
+ var import_image3 = __toESM(require("next/image"));
3509
+ var UploadImage = ({
3510
+ placeholder,
3511
+ name,
3512
+ selectedImage,
3513
+ setSelectedImage,
3514
+ control,
3515
+ errors,
3516
+ setValue,
3517
+ height,
3518
+ allowGallery = false,
3519
+ imageFit = "cover"
3520
+ }) => {
3521
+ const compressImage = (file, quality = 0.8, maxWidth = 800, maxHeight = 800) => {
3522
+ return new Promise((resolve) => {
3523
+ const reader = new FileReader();
3524
+ reader.readAsDataURL(file);
3525
+ reader.onload = (event) => {
3526
+ const img = new window.Image();
3527
+ img.src = event.target?.result;
3528
+ img.onload = () => {
3529
+ const canvas = document.createElement("canvas");
3530
+ let width = img.width;
3531
+ let height2 = img.height;
3532
+ if (width > maxWidth) {
3533
+ height2 *= maxWidth / width;
3534
+ width = maxWidth;
3535
+ }
3536
+ if (height2 > maxHeight) {
3537
+ width *= maxHeight / height2;
3538
+ height2 = maxHeight;
3539
+ }
3540
+ canvas.width = width;
3541
+ canvas.height = height2;
3542
+ const ctx = canvas.getContext("2d");
3543
+ if (ctx) {
3544
+ ctx.drawImage(img, 0, 0, width, height2);
3545
+ canvas.toBlob(
3546
+ (blob) => {
3547
+ if (blob) {
3548
+ const compressedFile = new File([blob], file.name, {
3549
+ type: "image/jpeg",
3550
+ lastModified: Date.now()
3551
+ });
3552
+ resolve(compressedFile);
3553
+ } else {
3554
+ resolve(null);
3555
+ }
3556
+ },
3557
+ "image/jpeg",
3558
+ quality
3559
+ );
3560
+ } else {
3561
+ resolve(null);
3562
+ }
3563
+ };
3564
+ };
3565
+ });
3566
+ };
3567
+ const handleImageChange = async (event, source) => {
3568
+ const file = event.target.files?.[0];
3569
+ if (file) {
3570
+ console.log(`Original File Size: ${(file.size / 1024).toFixed(2)} KB`);
3571
+ const compressedFile = await compressImage(file);
3572
+ if (compressedFile) {
3573
+ console.log(
3574
+ `Compressed File Size: ${(compressedFile.size / 1024).toFixed(2)} KB`
3575
+ );
3576
+ const objectURL = URL.createObjectURL(compressedFile);
3577
+ setSelectedImage(objectURL);
3578
+ setValue(name, compressedFile);
3579
+ }
3580
+ }
3581
+ };
3582
+ return /* @__PURE__ */ import_react25.default.createElement(
3583
+ import_react_hook_form13.Controller,
3584
+ {
3585
+ name,
3586
+ control,
3587
+ render: ({ field }) => /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
3588
+ "label",
3589
+ {
3590
+ htmlFor: "file-upload",
3591
+ style: {
3592
+ width: "100%",
3593
+ height: height || "200px",
3594
+ maxHeight: height ? "55vh" : "",
3595
+ border: selectedImage ? "" : "2px dashed #ccc",
3596
+ borderRadius: "10px",
3597
+ display: "flex",
3598
+ alignItems: "center",
3599
+ justifyContent: "center",
3600
+ color: "#aaa",
3601
+ marginTop: "2rem",
3602
+ cursor: allowGallery ? "default" : "pointer",
3603
+ position: "relative",
3604
+ overflow: "hidden"
3605
+ }
3606
+ },
3607
+ selectedImage ? /* @__PURE__ */ import_react25.default.createElement(
3608
+ import_image3.default,
3609
+ {
3610
+ src: selectedImage,
3611
+ alt: "Preview",
3612
+ fill: true,
3613
+ objectFit: imageFit
3614
+ }
3615
+ ) : /* @__PURE__ */ import_react25.default.createElement(
3616
+ import_material21.Stack,
3617
+ {
3618
+ spacing: allowGallery ? 2 : 0,
3619
+ sx: { pt: allowGallery ? 2 : 0 }
3620
+ },
3621
+ /* @__PURE__ */ import_react25.default.createElement(
3622
+ import_material21.Box,
3623
+ {
3624
+ sx: {
3625
+ display: "flex",
3626
+ justifyContent: "center",
3627
+ alignItems: "center",
3628
+ gap: 1.5
3629
+ }
3630
+ },
3631
+ /* @__PURE__ */ import_react25.default.createElement(import_material21.Box, { sx: { paddingBottom: "0.5rem" } }, /* @__PURE__ */ import_react25.default.createElement(import_gr.GrUpload, null)),
3632
+ placeholder
3633
+ ),
3634
+ allowGallery && /* @__PURE__ */ import_react25.default.createElement(import_material21.Stack, { spacing: 1.5 }, /* @__PURE__ */ import_react25.default.createElement(
3635
+ import_material21.Button,
3636
+ {
3637
+ sx: { width: "9rem" },
3638
+ variant: "outlined",
3639
+ color: "info",
3640
+ startIcon: /* @__PURE__ */ import_react25.default.createElement(import_md5.MdOutlineCameraAlt, { size: 16 }),
3641
+ onClick: () => document.getElementById("camera-upload")?.click()
3642
+ },
3643
+ "\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0632 \u062F\u0648\u0631\u0628\u06CC\u0646"
3644
+ ), /* @__PURE__ */ import_react25.default.createElement(
3645
+ import_material21.Button,
3646
+ {
3647
+ sx: { width: "9rem" },
3648
+ variant: "outlined",
3649
+ color: "info",
3650
+ startIcon: /* @__PURE__ */ import_react25.default.createElement(import_gr.GrGallery, { size: 16 }),
3651
+ onClick: () => document.getElementById("gallery-upload")?.click()
3652
+ },
3653
+ "\u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0632 \u06AF\u0627\u0644\u0631\u06CC"
3654
+ )),
3655
+ !allowGallery && /* @__PURE__ */ import_react25.default.createElement(
3656
+ "input",
3657
+ {
3658
+ id: "file-upload",
3659
+ type: "file",
3660
+ accept: "image/*",
3661
+ capture: allowGallery ? void 0 : "environment",
3662
+ onChange: (event) => {
3663
+ handleImageChange(event, "camera");
3664
+ field.onChange(event.target.files?.[0] || null);
3665
+ },
3666
+ style: { display: "none" }
3667
+ }
3668
+ )
3669
+ )
3670
+ ), /* @__PURE__ */ import_react25.default.createElement(
3671
+ "input",
3672
+ {
3673
+ id: "gallery-upload",
3674
+ type: "file",
3675
+ accept: "image/*",
3676
+ onChange: (event) => {
3677
+ handleImageChange(event, "gallery");
3678
+ field.onChange(event.target.files?.[0] || null);
3679
+ },
3680
+ style: { display: "none" }
3681
+ }
3682
+ ), /* @__PURE__ */ import_react25.default.createElement(
3683
+ "input",
3684
+ {
3685
+ id: "camera-upload",
3686
+ type: "file",
3687
+ accept: "image/*",
3688
+ capture: "environment",
3689
+ onChange: (event) => {
3690
+ handleImageChange(event, "camera");
3691
+ field.onChange(event.target.files?.[0] || null);
3692
+ },
3693
+ style: { display: "none" }
3694
+ }
3695
+ ), selectedImage && /* @__PURE__ */ import_react25.default.createElement(
3696
+ import_material21.Box,
3697
+ {
3698
+ sx: { display: "flex", justifyContent: "center", marginTop: 2 }
3699
+ },
3700
+ /* @__PURE__ */ import_react25.default.createElement(
3701
+ import_material21.Button,
3702
+ {
3703
+ onClick: () => {
3704
+ setSelectedImage(null);
3705
+ setValue(name, null);
3706
+ document.getElementById(
3707
+ "gallery-upload"
3708
+ ).value = "";
3709
+ document.getElementById("camera-upload").value = "";
3710
+ },
3711
+ variant: "outlined",
3712
+ color: "error",
3713
+ sx: {
3714
+ padding: "0.25rem 1rem",
3715
+ fontSize: 14
3716
+ }
3717
+ },
3718
+ "\u062D\u0630\u0641 \u062A\u0635\u0648\u06CC\u0631"
3719
+ )
3720
+ ), errors[name] && /* @__PURE__ */ import_react25.default.createElement(import_material21.Typography, { color: "error", variant: "body2", sx: { mt: 1.5, ml: 1 } }, String(errors[name]?.message || "")))
3721
+ }
3722
+ );
3723
+ };
3724
+ var upload_image_default = UploadImage;
3725
+
3726
+ // src/accordion/index.tsx
3727
+ var import_styles2 = require("@mui/material/styles");
3728
+ var import_io2 = require("react-icons/io");
3729
+ var import_Accordion = __toESM(require("@mui/material/Accordion"));
3730
+ var import_AccordionSummary = __toESM(require("@mui/material/AccordionSummary"));
3731
+ var import_AccordionDetails = __toESM(require("@mui/material/AccordionDetails"));
3732
+ var import_material22 = require("@mui/material");
3733
+ var import_react26 = require("react");
3734
+ function Page({
3735
+ data
3736
+ }) {
3737
+ const Accordion = (0, import_styles2.styled)((props) => /* @__PURE__ */ React.createElement(import_Accordion.default, { disableGutters: true, elevation: 0, square: true, ...props }))(({ theme }) => ({
3738
+ border: `1px solid ${theme.palette.divider}`,
3739
+ "&:not(:last-child)": {
3740
+ borderBottom: 0
3741
+ },
3742
+ "&::before": {
3743
+ display: "none"
3744
+ }
3745
+ }));
3746
+ const AccordionSummary = (0, import_styles2.styled)((props) => /* @__PURE__ */ React.createElement(import_AccordionSummary.default, { expandIcon: /* @__PURE__ */ React.createElement(import_io2.IoIosArrowForward, null), ...props }))(({ theme }) => ({
3747
+ backgroundColor: "rgba(0, 0, 0, .03)",
3748
+ flexDirection: "row-reverse",
3749
+ [`& .${import_AccordionSummary.accordionSummaryClasses.expandIconWrapper}.${import_AccordionSummary.accordionSummaryClasses.expanded}`]: {
3750
+ transform: "rotate(90deg)"
3751
+ },
3752
+ [`& .${import_AccordionSummary.accordionSummaryClasses.content}`]: {
3753
+ marginLeft: theme.spacing(1)
3754
+ },
3755
+ ...theme.applyStyles("dark", {
3756
+ backgroundColor: "rgba(255, 255, 255, .05)"
3757
+ })
3758
+ }));
3759
+ const AccordionDetails = (0, import_styles2.styled)(import_AccordionDetails.default)(({ theme }) => ({
3760
+ padding: theme.spacing(2),
3761
+ borderTop: "1px solid rgba(0, 0, 0, .125)"
3762
+ }));
3763
+ const [expanded, setExpanded] = (0, import_react26.useState)("");
3764
+ const handleChange = (panel) => (event, newExpanded) => {
3765
+ setExpanded(newExpanded ? panel : false);
3766
+ };
3767
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, data.map((item, index) => {
3768
+ const panelId = `panel${index}`;
3769
+ return /* @__PURE__ */ React.createElement(
3770
+ Accordion,
3771
+ {
3772
+ key: panelId,
3773
+ expanded: expanded === panelId,
3774
+ onChange: handleChange(panelId)
3775
+ },
3776
+ /* @__PURE__ */ React.createElement(
3777
+ AccordionSummary,
3778
+ {
3779
+ "aria-controls": `${panelId}-content`,
3780
+ id: `${panelId}-header`,
3781
+ sx: {
3782
+ "& .MuiAccordionSummary-expandIconWrapper": {
3783
+ color: "inherit"
3784
+ }
3785
+ }
3786
+ },
3787
+ /* @__PURE__ */ React.createElement(import_material22.Typography, { component: "span" }, item.title)
3788
+ ),
3789
+ /* @__PURE__ */ React.createElement(AccordionDetails, null, item.body)
3790
+ );
3791
+ }));
3792
+ }
3793
+ // Annotate the CommonJS export names for ESM import in node:
3794
+ 0 && (module.exports = {
3795
+ Accordion,
3796
+ AdvancedSearchButton,
3797
+ ConfirmationDialog,
3798
+ CustomCheckbox,
3799
+ CustomTimePicker,
3800
+ DateFilter,
3801
+ DateFilterRange,
3802
+ DatePicker,
3803
+ DateTimePicker,
3804
+ DateTimeRangePicker,
3805
+ FormInputNumber,
3806
+ FormInputText,
3807
+ HorizontalStepper,
3808
+ LicensePlate,
3809
+ Loading,
3810
+ MobileDateTimePicker,
3811
+ Modal,
3812
+ NestedSelectort,
3813
+ NoResult,
3814
+ PaginationList,
3815
+ RadioButton,
3816
+ SearchLicensePlate,
3817
+ Selector,
3818
+ SkeletonCard,
3819
+ SonarSpinner,
3820
+ SwitchButton,
3821
+ Table,
3822
+ UploadImage
3823
+ });
3824
+ //# sourceMappingURL=index.js.map