warqadui 0.0.93 → 0.0.96

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 CHANGED
@@ -63,6 +63,8 @@ __export(index_exports, {
63
63
  Guard: () => Guard,
64
64
  InfoGrid: () => InfoGrid,
65
65
  Input: () => Input,
66
+ JournalForm: () => JournalForm_default,
67
+ Journals: () => Journals_default,
66
68
  LinkUser: () => linkUser_default,
67
69
  LoadingBox: () => LoadingBox,
68
70
  LoadingSpin: () => LoadingSpin,
@@ -115,6 +117,7 @@ __export(index_exports, {
115
117
  createUserSchema: () => createUserSchema,
116
118
  createWalletSchema: () => createWalletSchema,
117
119
  generatePdf: () => generatePdf,
120
+ journalSchema: () => journalSchema,
118
121
  linkUserSchema: () => linkUserSchema,
119
122
  packProductItemSchema: () => packProductItemSchema,
120
123
  packTypes: () => packTypes,
@@ -435,12 +438,21 @@ var useTheme = () => {
435
438
  var Enums = {
436
439
  roles: ["admin", "staff"],
437
440
  sex: ["male", "female"],
438
- accountTypes: ["employee", "supplier", "customer", "amaanah"],
441
+ accountTypes: [
442
+ "employee",
443
+ "supplier",
444
+ "customer",
445
+ "amaanah",
446
+ "account"
447
+ ],
439
448
  verificationTypes: ["email_verification", "password_reset"],
440
449
  auditActions: ["create", "update", "delete", "login", "logout"],
441
450
  walletTypes: ["bank", "cash", "mobile"],
442
451
  currencies: ["USD", "TZS", "KES", "CNY"],
443
- packTypes: ["pressure", "bag", "boxes"]
452
+ packTypes: ["pressure", "bag", "boxes"],
453
+ journalTypes: ["journal"],
454
+ viaTypes: ["direct", "via account"],
455
+ actionTypes: ["credit", "debit"]
444
456
  };
445
457
  var Enums_default = Enums;
446
458
 
@@ -1465,13 +1477,13 @@ var Input = (0, import_react10.forwardRef)(
1465
1477
  }
1466
1478
  }
1467
1479
  }, [props.value, name, form]);
1468
- let message24 = error;
1480
+ let message26 = error;
1469
1481
  if (form && name) {
1470
1482
  const {
1471
1483
  formState: { errors }
1472
1484
  } = form;
1473
1485
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
1474
- message24 = errorObj?.message;
1486
+ message26 = errorObj?.message;
1475
1487
  }
1476
1488
  const watchedValue = form?.watch(name);
1477
1489
  (0, import_react10.useEffect)(() => {
@@ -1540,7 +1552,7 @@ var Input = (0, import_react10.forwardRef)(
1540
1552
  }
1541
1553
  )
1542
1554
  ] }),
1543
- message24 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
1555
+ message26 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
1544
1556
  ]
1545
1557
  }
1546
1558
  );
@@ -1863,7 +1875,7 @@ var PhoneInput = (0, import_react13.forwardRef)(
1863
1875
  const [isFocused, setIsFocused] = (0, import_react13.useState)(false);
1864
1876
  const { theme } = useWarqadConfig();
1865
1877
  const primaryColor = theme?.primaryColor;
1866
- let message24 = error;
1878
+ let message26 = error;
1867
1879
  if (form && name) {
1868
1880
  const {
1869
1881
  formState: { errors }
@@ -1873,7 +1885,7 @@ var PhoneInput = (0, import_react13.forwardRef)(
1873
1885
  for (const part of nameParts) {
1874
1886
  currentError = currentError?.[part];
1875
1887
  }
1876
- message24 = currentError?.message || message24;
1888
+ message26 = currentError?.message || message26;
1877
1889
  }
1878
1890
  const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
1879
1891
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
@@ -1924,7 +1936,7 @@ var PhoneInput = (0, import_react13.forwardRef)(
1924
1936
  }
1925
1937
  )
1926
1938
  ] }),
1927
- message24 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
1939
+ message26 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
1928
1940
  ] });
1929
1941
  if (form && name) {
1930
1942
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
@@ -1968,7 +1980,8 @@ var Select = (0, import_react14.forwardRef)((props, ref) => {
1968
1980
  children,
1969
1981
  options: initialOptions = [],
1970
1982
  enum: enumData,
1971
- enumName
1983
+ enumName,
1984
+ ...rest
1972
1985
  } = props;
1973
1986
  const options = (0, import_react14.useMemo)(() => {
1974
1987
  if (initialOptions.length > 0) return initialOptions;
@@ -2005,7 +2018,7 @@ var Select = (0, import_react14.forwardRef)((props, ref) => {
2005
2018
  }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2006
2019
  SelectRoot,
2007
2020
  {
2008
- ...props,
2021
+ ...rest,
2009
2022
  options,
2010
2023
  currentValue: formValue,
2011
2024
  onChangeHandler: (val) => {
@@ -2022,7 +2035,7 @@ var Select = (0, import_react14.forwardRef)((props, ref) => {
2022
2035
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2023
2036
  SelectRoot,
2024
2037
  {
2025
- ...props,
2038
+ ...rest,
2026
2039
  options,
2027
2040
  currentValue: value,
2028
2041
  onChangeHandler: onChange || (() => {
@@ -2050,6 +2063,8 @@ var SelectRoot = ({
2050
2063
  disabled,
2051
2064
  id,
2052
2065
  className = "",
2066
+ enum: enumData,
2067
+ enumName,
2053
2068
  ...props
2054
2069
  }) => {
2055
2070
  const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
@@ -2094,7 +2109,7 @@ var SelectRoot = ({
2094
2109
  document.addEventListener("mousedown", handleClickOutside);
2095
2110
  return () => document.removeEventListener("mousedown", handleClickOutside);
2096
2111
  }, [fieldInternalProps]);
2097
- let message24 = error;
2112
+ let message26 = error;
2098
2113
  if (form && name) {
2099
2114
  const {
2100
2115
  formState: { errors }
@@ -2104,7 +2119,7 @@ var SelectRoot = ({
2104
2119
  for (const part of nameParts) {
2105
2120
  currentError = currentError?.[part];
2106
2121
  }
2107
- message24 = currentError?.message || message24;
2122
+ message26 = currentError?.message || message26;
2108
2123
  }
2109
2124
  const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
2110
2125
  const valueCtx = {
@@ -2165,7 +2180,7 @@ var SelectRoot = ({
2165
2180
  String(opt.value) || index
2166
2181
  )) })
2167
2182
  ] }),
2168
- message24 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
2183
+ message26 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
2169
2184
  ]
2170
2185
  }
2171
2186
  ) });
@@ -2401,13 +2416,13 @@ var Textarea = (0, import_react15.forwardRef)(
2401
2416
  const [isFocused, setIsFocused] = (0, import_react15.useState)(false);
2402
2417
  const { theme } = useWarqadConfig();
2403
2418
  const primaryColor = theme?.primaryColor;
2404
- let message24 = error;
2419
+ let message26 = error;
2405
2420
  if (form && name) {
2406
2421
  const {
2407
2422
  formState: { errors }
2408
2423
  } = form;
2409
2424
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
2410
- message24 = errorObj?.message;
2425
+ message26 = errorObj?.message;
2411
2426
  }
2412
2427
  const renderInput = (inputProps, ref2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
2413
2428
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
@@ -2445,7 +2460,7 @@ var Textarea = (0, import_react15.forwardRef)(
2445
2460
  }
2446
2461
  }
2447
2462
  ) }),
2448
- message24 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
2463
+ message26 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
2449
2464
  ] });
2450
2465
  (0, import_react15.useEffect)(() => {
2451
2466
  if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
@@ -2764,7 +2779,7 @@ var SearchApiRoot = ({
2764
2779
  const filteredOptions = options.filter(
2765
2780
  (option) => !filter.includes(getOptionValue(option))
2766
2781
  );
2767
- let message24 = error || errorMessage;
2782
+ let message26 = error || errorMessage;
2768
2783
  if (form && name) {
2769
2784
  const {
2770
2785
  formState: { errors }
@@ -2774,7 +2789,7 @@ var SearchApiRoot = ({
2774
2789
  for (const part of nameParts) {
2775
2790
  currentError = currentError?.[part];
2776
2791
  }
2777
- message24 = currentError?.message || message24;
2792
+ message26 = currentError?.message || message26;
2778
2793
  }
2779
2794
  const valueCtx = {
2780
2795
  isOpen,
@@ -2808,7 +2823,7 @@ var SearchApiRoot = ({
2808
2823
  form,
2809
2824
  name,
2810
2825
  obj,
2811
- error: message24,
2826
+ error: message26,
2812
2827
  onSelect,
2813
2828
  onClear
2814
2829
  };
@@ -3175,19 +3190,19 @@ var DateInput = (0, import_react17.forwardRef)(
3175
3190
  const { theme } = useWarqadConfig();
3176
3191
  const primaryColor = theme?.primaryColor;
3177
3192
  const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
3178
- let message24 = error;
3193
+ let message26 = error;
3179
3194
  if (form && name) {
3180
3195
  const {
3181
3196
  formState: { errors }
3182
3197
  } = form;
3183
3198
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
3184
- message24 = errorObj?.message;
3199
+ message26 = errorObj?.message;
3185
3200
  }
3186
3201
  const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
3187
3202
  bg-white! dark:bg-zinc-900!
3188
3203
  text-gray-900! dark:text-zinc-100!
3189
3204
  hover:bg-white! dark:hover:bg-zinc-900!
3190
- ${message24 ? "border-red-500 hover:border-red-500 [&.ant-picker-focused]:border-red-500 [&.ant-picker-focused]:ring-red-500/20" : "border-gray-200 dark:border-zinc-700 hover:border-gray-200 dark:hover:border-zinc-700 [&.ant-picker-focused]:ring-2"}
3205
+ ${message26 ? "border-red-500 hover:border-red-500 [&.ant-picker-focused]:border-red-500 [&.ant-picker-focused]:ring-red-500/20" : "border-gray-200 dark:border-zinc-700 hover:border-gray-200 dark:hover:border-zinc-700 [&.ant-picker-focused]:ring-2"}
3191
3206
  [&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
3192
3207
  ${className}`;
3193
3208
  const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
@@ -3210,8 +3225,8 @@ var DateInput = (0, import_react17.forwardRef)(
3210
3225
  needConfirm: false,
3211
3226
  style: {
3212
3227
  height: "var(--input-height, 40px)",
3213
- borderColor: isFocused && !message24 ? primaryColor : void 0,
3214
- boxShadow: isFocused && !message24 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3228
+ borderColor: isFocused && !message26 ? primaryColor : void 0,
3229
+ boxShadow: isFocused && !message26 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3215
3230
  },
3216
3231
  classNames: { popup: { root: "z-50" } },
3217
3232
  suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
@@ -3241,7 +3256,7 @@ var DateInput = (0, import_react17.forwardRef)(
3241
3256
  {
3242
3257
  className: "block text-xs font-medium transition-colors duration-200",
3243
3258
  style: {
3244
- color: message24 ? "#ef4444" : isFocused ? primaryColor : void 0
3259
+ color: message26 ? "#ef4444" : isFocused ? primaryColor : void 0
3245
3260
  },
3246
3261
  children: [
3247
3262
  label,
@@ -3262,7 +3277,7 @@ var DateInput = (0, import_react17.forwardRef)(
3262
3277
  )
3263
3278
  }
3264
3279
  ) : renderDatePicker(value, onChange, onBlur, ref),
3265
- message24 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
3280
+ message26 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
3266
3281
  ] });
3267
3282
  }
3268
3283
  );
@@ -3287,6 +3302,7 @@ var Fields_default = Fields;
3287
3302
 
3288
3303
  // src/components/tables/DataTable.tsx
3289
3304
  var import_react18 = __toESM(require("react"));
3305
+ var import_react_dom4 = require("react-dom");
3290
3306
  var import_react_table = require("@tanstack/react-table");
3291
3307
  var import_lucide_react12 = require("lucide-react");
3292
3308
  var import_jsx_runtime25 = require("react/jsx-runtime");
@@ -3338,6 +3354,43 @@ function DataTable({
3338
3354
  setPagination((prev) => ({ ...prev, pageSize: pageRows }));
3339
3355
  }
3340
3356
  }, [pageRows]);
3357
+ const [isVisibilityOpen, setIsVisibilityOpen] = (0, import_react18.useState)(false);
3358
+ const visibilityAnchorRef = (0, import_react18.useRef)(null);
3359
+ const visibilityContentRef = (0, import_react18.useRef)(null);
3360
+ const [visibilityCoords, setVisibilityCoords] = (0, import_react18.useState)({
3361
+ top: 0,
3362
+ left: 0,
3363
+ width: 0
3364
+ });
3365
+ const updateVisibilityPosition = () => {
3366
+ if (visibilityAnchorRef.current) {
3367
+ const rect = visibilityAnchorRef.current.getBoundingClientRect();
3368
+ setVisibilityCoords({
3369
+ top: rect.bottom,
3370
+ left: rect.left,
3371
+ width: rect.width
3372
+ });
3373
+ }
3374
+ };
3375
+ (0, import_react18.useEffect)(() => {
3376
+ if (isVisibilityOpen) {
3377
+ updateVisibilityPosition();
3378
+ const handleScroll = () => updateVisibilityPosition();
3379
+ window.addEventListener("scroll", handleScroll, true);
3380
+ window.addEventListener("resize", handleScroll);
3381
+ const handleClickOutside = (event) => {
3382
+ if (visibilityAnchorRef.current && !visibilityAnchorRef.current.contains(event.target) && visibilityContentRef.current && !visibilityContentRef.current.contains(event.target)) {
3383
+ setIsVisibilityOpen(false);
3384
+ }
3385
+ };
3386
+ document.addEventListener("mousedown", handleClickOutside);
3387
+ return () => {
3388
+ window.removeEventListener("scroll", handleScroll, true);
3389
+ window.removeEventListener("resize", handleScroll);
3390
+ document.removeEventListener("mousedown", handleClickOutside);
3391
+ };
3392
+ }
3393
+ }, [isVisibilityOpen]);
3341
3394
  const [expanded, setExpanded] = (0, import_react18.useState)(() => {
3342
3395
  const initialState = {};
3343
3396
  if (defaultExpanded && renderSubComponent && data) {
@@ -3436,31 +3489,59 @@ function DataTable({
3436
3489
  className: "h-9!"
3437
3490
  }
3438
3491
  ) }),
3439
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "relative group", children: [
3440
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("button", { className: "flex items-center gap-2 px-3 h-9 rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 transition-colors", children: [
3441
- "Columns",
3442
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.ChevronDown, { size: 14, className: "text-gray-400" })
3443
- ] }),
3444
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute right-0 top-full mt-2 w-48 py-1 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50", children: table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3445
- "label",
3492
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "relative", ref: visibilityAnchorRef, children: [
3493
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3494
+ "button",
3446
3495
  {
3447
- className: "flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 cursor-pointer capitalize",
3496
+ onClick: () => setIsVisibilityOpen(!isVisibilityOpen),
3497
+ className: "flex items-center gap-2 px-3 h-9 rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 transition-colors",
3448
3498
  children: [
3499
+ "Columns",
3449
3500
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3450
- "input",
3501
+ import_lucide_react12.ChevronDown,
3451
3502
  {
3452
- type: "checkbox",
3453
- checked: column.getIsVisible(),
3454
- onChange: (e) => column.toggleVisibility(!!e.target.checked),
3455
- className: "rounded border-gray-300 text-blue-600 focus:ring-blue-500",
3456
- style: { accentColor: primaryColor }
3503
+ size: 14,
3504
+ className: `text-gray-400 transition-transform ${isVisibilityOpen ? "rotate-180" : ""}`
3457
3505
  }
3458
- ),
3459
- column.id
3506
+ )
3460
3507
  ]
3461
- },
3462
- column.id
3463
- )) })
3508
+ }
3509
+ ),
3510
+ isVisibilityOpen && (0, import_react_dom4.createPortal)(
3511
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3512
+ "div",
3513
+ {
3514
+ ref: visibilityContentRef,
3515
+ className: "fixed mt-2 w-48 py-1 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-xl z-[9999]",
3516
+ style: {
3517
+ top: `${visibilityCoords.top}px`,
3518
+ left: `${visibilityCoords.left + visibilityCoords.width - 192}px`
3519
+ // 192px is w-48
3520
+ },
3521
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "max-h-64 overflow-y-auto", children: table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3522
+ "label",
3523
+ {
3524
+ className: "flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 cursor-pointer capitalize",
3525
+ children: [
3526
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3527
+ "input",
3528
+ {
3529
+ type: "checkbox",
3530
+ checked: column.getIsVisible(),
3531
+ onChange: (e) => column.toggleVisibility(!!e.target.checked),
3532
+ className: "rounded border-gray-300 text-blue-600 focus:ring-blue-500",
3533
+ style: { accentColor: primaryColor }
3534
+ }
3535
+ ),
3536
+ column.id
3537
+ ]
3538
+ },
3539
+ column.id
3540
+ )) })
3541
+ }
3542
+ ),
3543
+ document.body
3544
+ )
3464
3545
  ] }) })
3465
3546
  ] }),
3466
3547
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 overflow-hidden relative", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
@@ -5123,7 +5204,7 @@ var import_react26 = require("react");
5123
5204
 
5124
5205
  // src/components/Dropdown.tsx
5125
5206
  var import_react25 = require("react");
5126
- var import_react_dom4 = require("react-dom");
5207
+ var import_react_dom5 = require("react-dom");
5127
5208
  var import_jsx_runtime34 = require("react/jsx-runtime");
5128
5209
  var Dropdown = ({
5129
5210
  children,
@@ -5223,7 +5304,7 @@ var Dropdown = ({
5223
5304
  children
5224
5305
  }
5225
5306
  ),
5226
- isOpen && (0, import_react_dom4.createPortal)(
5307
+ isOpen && (0, import_react_dom5.createPortal)(
5227
5308
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5228
5309
  "div",
5229
5310
  {
@@ -7531,17 +7612,17 @@ var preWarningFns = [];
7531
7612
  var preMessage = (fn) => {
7532
7613
  preWarningFns.push(fn);
7533
7614
  };
7534
- function warning(valid, message24) {
7615
+ function warning(valid, message26) {
7535
7616
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
7536
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message24);
7617
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message26);
7537
7618
  if (finalMessage) {
7538
7619
  console.error(`Warning: ${finalMessage}`);
7539
7620
  }
7540
7621
  }
7541
7622
  }
7542
- function note(valid, message24) {
7623
+ function note(valid, message26) {
7543
7624
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
7544
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message24);
7625
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message26);
7545
7626
  if (finalMessage) {
7546
7627
  console.warn(`Note: ${finalMessage}`);
7547
7628
  }
@@ -7550,17 +7631,17 @@ function note(valid, message24) {
7550
7631
  function resetWarned() {
7551
7632
  warned = {};
7552
7633
  }
7553
- function call(method, valid, message24) {
7554
- if (!valid && !warned[message24]) {
7555
- method(false, message24);
7556
- warned[message24] = true;
7634
+ function call(method, valid, message26) {
7635
+ if (!valid && !warned[message26]) {
7636
+ method(false, message26);
7637
+ warned[message26] = true;
7557
7638
  }
7558
7639
  }
7559
- function warningOnce(valid, message24) {
7560
- call(warning, valid, message24);
7640
+ function warningOnce(valid, message26) {
7641
+ call(warning, valid, message26);
7561
7642
  }
7562
- function noteOnce(valid, message24) {
7563
- call(note, valid, message24);
7643
+ function noteOnce(valid, message26) {
7644
+ call(note, valid, message26);
7564
7645
  }
7565
7646
  warningOnce.preMessage = preMessage;
7566
7647
  warningOnce.resetWarned = resetWarned;
@@ -7571,8 +7652,8 @@ var import_react31 = __toESM(require("react"));
7571
7652
  function camelCase(input) {
7572
7653
  return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
7573
7654
  }
7574
- function warning2(valid, message24) {
7575
- warningOnce(valid, `[@ant-design/icons] ${message24}`);
7655
+ function warning2(valid, message26) {
7656
+ warningOnce(valid, `[@ant-design/icons] ${message26}`);
7576
7657
  }
7577
7658
  function isIconDefinition(target) {
7578
7659
  return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
@@ -8311,7 +8392,8 @@ var createAccountSchema = import_zod2.z.object({
8311
8392
  }).transform((val) => val?.toLowerCase()),
8312
8393
  phoneNumber: import_zod2.z.string().optional(),
8313
8394
  sex: import_zod2.z.enum(Enums_default.sex),
8314
- branch: import_zod2.z.string().optional()
8395
+ branch: import_zod2.z.string().optional(),
8396
+ currency: import_zod2.z.string().optional()
8315
8397
  });
8316
8398
 
8317
8399
  // src/components/accounts/AccountForm.tsx
@@ -8368,10 +8450,10 @@ var useAccountbalance = ({
8368
8450
  try {
8369
8451
  const res = await get({
8370
8452
  url,
8371
- v: 2
8453
+ v: 1
8372
8454
  });
8373
- const data = res;
8374
- setBalance(Formats_default.Price(data?.balance, data?.currency));
8455
+ const data = res?.data;
8456
+ setBalance(Formats_default.Price(data?.balance ?? 0, data?.currency ?? "N/A"));
8375
8457
  } catch (error2) {
8376
8458
  setError(error2.message);
8377
8459
  }
@@ -8425,7 +8507,8 @@ function Account({
8425
8507
  v = 1,
8426
8508
  showBalance,
8427
8509
  required,
8428
- disabled
8510
+ disabled,
8511
+ obj
8429
8512
  }) {
8430
8513
  const { branchId } = (0, import_react_router_dom8.useParams)();
8431
8514
  const accountId = form?.watch(name);
@@ -8449,7 +8532,8 @@ function Account({
8449
8532
  labelKey: "name",
8450
8533
  valueKey: "_id",
8451
8534
  required,
8452
- disabled
8535
+ disabled,
8536
+ obj
8453
8537
  }
8454
8538
  ),
8455
8539
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BalanceView, {})
@@ -8469,7 +8553,8 @@ function Customer({
8469
8553
  showBalance,
8470
8554
  required,
8471
8555
  disabled,
8472
- v
8556
+ v,
8557
+ obj
8473
8558
  }) {
8474
8559
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
8475
8560
  Account_default,
@@ -8483,7 +8568,8 @@ function Customer({
8483
8568
  filter,
8484
8569
  showBalance,
8485
8570
  required,
8486
- disabled
8571
+ disabled,
8572
+ obj
8487
8573
  }
8488
8574
  );
8489
8575
  }
@@ -8501,6 +8587,7 @@ function Employee({
8501
8587
  showBalance,
8502
8588
  required,
8503
8589
  disabled,
8590
+ obj,
8504
8591
  v
8505
8592
  }) {
8506
8593
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
@@ -8515,7 +8602,8 @@ function Employee({
8515
8602
  filter,
8516
8603
  required,
8517
8604
  disabled,
8518
- showBalance
8605
+ showBalance,
8606
+ obj
8519
8607
  }
8520
8608
  );
8521
8609
  }
@@ -8583,7 +8671,8 @@ function AccountForm() {
8583
8671
  name: "",
8584
8672
  email: "",
8585
8673
  phoneNumber: "",
8586
- sex: "male"
8674
+ sex: "male",
8675
+ currency: ""
8587
8676
  },
8588
8677
  shouldUnregister: false
8589
8678
  });
@@ -8693,6 +8782,15 @@ function AccountForm() {
8693
8782
  placeholder: "Select Branch",
8694
8783
  api: "/branches/get?noStore=true"
8695
8784
  }
8785
+ ),
8786
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
8787
+ Fields_default.Select,
8788
+ {
8789
+ label: "Currency",
8790
+ form: methods,
8791
+ name: "currency",
8792
+ enumName: "currencies"
8793
+ }
8696
8794
  )
8697
8795
  ] }),
8698
8796
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
@@ -10155,11 +10253,10 @@ var import_react45 = require("react");
10155
10253
  var import_antd18 = require("antd");
10156
10254
  var import_jsx_runtime63 = require("react/jsx-runtime");
10157
10255
  function Brands({ v, url }) {
10158
- const { branchId } = (0, import_react_router_dom17.useParams)();
10159
10256
  const [deleteBrand, setDeleteBrand] = (0, import_react45.useState)(null);
10160
10257
  const { isLoading, remove } = useApis_default();
10161
10258
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10162
- url: url || `/brands/get${branchId ? `?branch=${branchId}` : ""}`,
10259
+ url: url || `/brands/get`,
10163
10260
  v,
10164
10261
  dateFilter: false
10165
10262
  });
@@ -10251,8 +10348,7 @@ var Brands_default = Brands;
10251
10348
  // src/components/brands/schema.ts
10252
10349
  var import_zod12 = require("zod");
10253
10350
  var createBrandSchema = import_zod12.z.object({
10254
- name: import_zod12.z.string().min(2, { message: "Name must be at least 2 characters" }),
10255
- branch: import_zod12.z.string().optional()
10351
+ name: import_zod12.z.string().min(2, { message: "Name must be at least 2 characters" })
10256
10352
  });
10257
10353
 
10258
10354
  // src/components/brands/BrandForm.tsx
@@ -10260,10 +10356,8 @@ var import_react_hook_form16 = require("react-hook-form");
10260
10356
  var import_zod13 = require("@hookform/resolvers/zod");
10261
10357
  var import_antd19 = require("antd");
10262
10358
  var import_react46 = require("react");
10263
- var import_react_router_dom18 = require("react-router-dom");
10264
10359
  var import_jsx_runtime64 = require("react/jsx-runtime");
10265
10360
  function BrandForm() {
10266
- const { branchId } = (0, import_react_router_dom18.useParams)();
10267
10361
  const { getQuery, navigate } = useApp_default();
10268
10362
  const id = getQuery("id");
10269
10363
  const isEdit = !!id;
@@ -10282,18 +10376,12 @@ function BrandForm() {
10282
10376
  if (isEdit) {
10283
10377
  await put({
10284
10378
  url: `/brands/update/${id}`,
10285
- body: {
10286
- ...data,
10287
- branch: branchId ? branchId : data.branch
10288
- }
10379
+ body: data
10289
10380
  });
10290
10381
  } else {
10291
10382
  await post({
10292
10383
  url: "/brands/create",
10293
- body: {
10294
- ...data,
10295
- branch: branchId ? branchId : data.branch
10296
- }
10384
+ body: data
10297
10385
  });
10298
10386
  }
10299
10387
  import_antd19.message.success(`Brand ${isEdit ? "updated" : "created"} successfully`);
@@ -10305,7 +10393,7 @@ function BrandForm() {
10305
10393
  const fetches = async () => {
10306
10394
  try {
10307
10395
  const res = await get({
10308
- url: `/brands/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10396
+ url: `/brands/get?id=${id}`
10309
10397
  });
10310
10398
  const data = res.data;
10311
10399
  methods.reset(data);
@@ -10334,29 +10422,17 @@ function BrandForm() {
10334
10422
  {
10335
10423
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10336
10424
  children: [
10337
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10338
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10339
- Fields_default.Input,
10340
- {
10341
- label: "Name",
10342
- form: methods,
10343
- name: "name",
10344
- type: "text",
10345
- placeholder: "Enter Brand Name",
10346
- required: true
10347
- }
10348
- ),
10349
- !branchId && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10350
- Feilds_default.Branches,
10351
- {
10352
- label: "Branch",
10353
- form: methods,
10354
- name: "branch",
10355
- placeholder: "Select Branch",
10356
- api: "/branches/get?noStore=true"
10357
- }
10358
- )
10359
- ] }),
10425
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10426
+ Fields_default.Input,
10427
+ {
10428
+ label: "Name",
10429
+ form: methods,
10430
+ name: "name",
10431
+ type: "text",
10432
+ placeholder: "Enter Brand Name",
10433
+ required: true
10434
+ }
10435
+ ) }),
10360
10436
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
10361
10437
  Button,
10362
10438
  {
@@ -10378,7 +10454,7 @@ function BrandForm() {
10378
10454
  var BrandForm_default = BrandForm;
10379
10455
 
10380
10456
  // src/components/brands/Feilds/Brand.tsx
10381
- var import_react_router_dom19 = require("react-router-dom");
10457
+ var import_react_router_dom18 = require("react-router-dom");
10382
10458
  var import_jsx_runtime65 = require("react/jsx-runtime");
10383
10459
  function Brand({
10384
10460
  name,
@@ -10391,7 +10467,7 @@ function Brand({
10391
10467
  required,
10392
10468
  disabled
10393
10469
  }) {
10394
- const { branchId } = (0, import_react_router_dom19.useParams)();
10470
+ const { branchId } = (0, import_react_router_dom18.useParams)();
10395
10471
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
10396
10472
  Fields_default.SearchApi,
10397
10473
  {
@@ -10419,22 +10495,21 @@ var BrandField = {
10419
10495
  var Feilds_default3 = BrandField;
10420
10496
 
10421
10497
  // src/components/categories/Categories.tsx
10422
- var import_react_router_dom20 = require("react-router-dom");
10498
+ var import_react_router_dom19 = require("react-router-dom");
10423
10499
  var import_lucide_react27 = require("lucide-react");
10424
10500
  var import_react47 = require("react");
10425
10501
  var import_antd20 = require("antd");
10426
10502
  var import_jsx_runtime66 = require("react/jsx-runtime");
10427
10503
  function Categories({ v, url }) {
10428
- const { branchId } = (0, import_react_router_dom20.useParams)();
10429
10504
  const [deleteCategory, setDeleteCategory] = (0, import_react47.useState)(null);
10430
10505
  const { isLoading, remove } = useApis_default();
10431
10506
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10432
- url: url || `/categories/get${branchId ? `?branch=${branchId}` : ""}`,
10507
+ url: url || `/categories/get`,
10433
10508
  v,
10434
10509
  dateFilter: false
10435
10510
  });
10436
10511
  const { Modal: Modal2 } = useModal();
10437
- const navigate = (0, import_react_router_dom20.useNavigate)();
10512
+ const navigate = (0, import_react_router_dom19.useNavigate)();
10438
10513
  const items = (data2) => [
10439
10514
  {
10440
10515
  label: `Edit Category`,
@@ -10521,8 +10596,7 @@ var Categories_default = Categories;
10521
10596
  // src/components/categories/schema.ts
10522
10597
  var import_zod14 = require("zod");
10523
10598
  var createCategorySchema = import_zod14.z.object({
10524
- name: import_zod14.z.string().min(2, { message: "Name must be at least 2 characters" }),
10525
- branch: import_zod14.z.string().optional()
10599
+ name: import_zod14.z.string().min(2, { message: "Name must be at least 2 characters" })
10526
10600
  });
10527
10601
 
10528
10602
  // src/components/categories/CategoryForm.tsx
@@ -10530,10 +10604,8 @@ var import_react_hook_form17 = require("react-hook-form");
10530
10604
  var import_zod15 = require("@hookform/resolvers/zod");
10531
10605
  var import_antd21 = require("antd");
10532
10606
  var import_react48 = require("react");
10533
- var import_react_router_dom21 = require("react-router-dom");
10534
10607
  var import_jsx_runtime67 = require("react/jsx-runtime");
10535
10608
  function CategoryForm() {
10536
- const { branchId } = (0, import_react_router_dom21.useParams)();
10537
10609
  const { getQuery, navigate } = useApp_default();
10538
10610
  const id = getQuery("id");
10539
10611
  const isEdit = !!id;
@@ -10552,18 +10624,12 @@ function CategoryForm() {
10552
10624
  if (isEdit) {
10553
10625
  await put({
10554
10626
  url: `/categories/update/${id}`,
10555
- body: {
10556
- ...data,
10557
- branch: branchId ? branchId : data.branch
10558
- }
10627
+ body: data
10559
10628
  });
10560
10629
  } else {
10561
10630
  await post({
10562
10631
  url: "/categories/create",
10563
- body: {
10564
- ...data,
10565
- branch: branchId ? branchId : data.branch
10566
- }
10632
+ body: data
10567
10633
  });
10568
10634
  }
10569
10635
  import_antd21.message.success(`Category ${isEdit ? "updated" : "created"} successfully`);
@@ -10575,7 +10641,7 @@ function CategoryForm() {
10575
10641
  const fetches = async () => {
10576
10642
  try {
10577
10643
  const res = await get({
10578
- url: `/categories/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10644
+ url: `/categories/get?id=${id}`
10579
10645
  });
10580
10646
  const data = res.data;
10581
10647
  methods.reset(data);
@@ -10604,29 +10670,17 @@ function CategoryForm() {
10604
10670
  {
10605
10671
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10606
10672
  children: [
10607
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10608
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10609
- Fields_default.Input,
10610
- {
10611
- label: "Name",
10612
- form: methods,
10613
- name: "name",
10614
- type: "text",
10615
- placeholder: "Enter Category Name",
10616
- required: true
10617
- }
10618
- ),
10619
- !branchId && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10620
- Feilds_default.Branches,
10621
- {
10622
- label: "Branch",
10623
- form: methods,
10624
- name: "branch",
10625
- placeholder: "Select Branch",
10626
- api: "/branches/get?noStore=true"
10627
- }
10628
- )
10629
- ] }),
10673
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10674
+ Fields_default.Input,
10675
+ {
10676
+ label: "Name",
10677
+ form: methods,
10678
+ name: "name",
10679
+ type: "text",
10680
+ placeholder: "Enter Category Name",
10681
+ required: true
10682
+ }
10683
+ ) }),
10630
10684
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
10631
10685
  Button,
10632
10686
  {
@@ -10648,7 +10702,7 @@ function CategoryForm() {
10648
10702
  var CategoryForm_default = CategoryForm;
10649
10703
 
10650
10704
  // src/components/categories/Feilds/Category.tsx
10651
- var import_react_router_dom22 = require("react-router-dom");
10705
+ var import_react_router_dom20 = require("react-router-dom");
10652
10706
  var import_jsx_runtime68 = require("react/jsx-runtime");
10653
10707
  function Category({
10654
10708
  name,
@@ -10661,7 +10715,7 @@ function Category({
10661
10715
  required,
10662
10716
  disabled
10663
10717
  }) {
10664
- const { branchId } = (0, import_react_router_dom22.useParams)();
10718
+ const { branchId } = (0, import_react_router_dom20.useParams)();
10665
10719
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
10666
10720
  Fields_default.SearchApi,
10667
10721
  {
@@ -10689,22 +10743,21 @@ var CategoryField = {
10689
10743
  var Feilds_default4 = CategoryField;
10690
10744
 
10691
10745
  // src/components/products/Products.tsx
10692
- var import_react_router_dom23 = require("react-router-dom");
10746
+ var import_react_router_dom21 = require("react-router-dom");
10693
10747
  var import_lucide_react28 = require("lucide-react");
10694
10748
  var import_react49 = require("react");
10695
10749
  var import_antd22 = require("antd");
10696
10750
  var import_jsx_runtime69 = require("react/jsx-runtime");
10697
10751
  function Products({ v, url }) {
10698
- const { branchId } = (0, import_react_router_dom23.useParams)();
10699
10752
  const [deleteProduct, setDeleteProduct] = (0, import_react49.useState)(null);
10700
10753
  const { isLoading, remove } = useApis_default();
10701
10754
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10702
- url: url || `/products/get${branchId ? `?branch=${branchId}` : ""}`,
10755
+ url: url || `/products/get`,
10703
10756
  v,
10704
10757
  dateFilter: false
10705
10758
  });
10706
10759
  const { Modal: Modal2 } = useModal();
10707
- const navigate = (0, import_react_router_dom23.useNavigate)();
10760
+ const navigate = (0, import_react_router_dom21.useNavigate)();
10708
10761
  const items = (data2) => [
10709
10762
  {
10710
10763
  label: `Edit Product`,
@@ -10821,8 +10874,7 @@ var createProductSchema = import_zod16.z.object({
10821
10874
  name: import_zod16.z.string().min(2, { message: "Name must be at least 2 characters" }),
10822
10875
  category: import_zod16.z.string().optional(),
10823
10876
  brand: import_zod16.z.string().optional(),
10824
- cost: import_zod16.z.number({ message: "Cost is required" }).min(0),
10825
- branch: import_zod16.z.string().optional()
10877
+ cost: import_zod16.z.number({ message: "Cost is required" }).min(0)
10826
10878
  });
10827
10879
 
10828
10880
  // src/components/products/ProductForm.tsx
@@ -10830,10 +10882,8 @@ var import_react_hook_form18 = require("react-hook-form");
10830
10882
  var import_zod17 = require("@hookform/resolvers/zod");
10831
10883
  var import_antd23 = require("antd");
10832
10884
  var import_react50 = require("react");
10833
- var import_react_router_dom24 = require("react-router-dom");
10834
10885
  var import_jsx_runtime70 = require("react/jsx-runtime");
10835
10886
  function ProductForm() {
10836
- const { branchId } = (0, import_react_router_dom24.useParams)();
10837
10887
  const { getQuery, navigate } = useApp_default();
10838
10888
  const id = getQuery("id");
10839
10889
  const isEdit = !!id;
@@ -10855,18 +10905,12 @@ function ProductForm() {
10855
10905
  if (isEdit) {
10856
10906
  await put({
10857
10907
  url: `/products/update/${id}`,
10858
- body: {
10859
- ...data,
10860
- branch: branchId ? branchId : data.branch
10861
- }
10908
+ body: data
10862
10909
  });
10863
10910
  } else {
10864
10911
  await post({
10865
10912
  url: "/products/create",
10866
- body: {
10867
- ...data,
10868
- branch: branchId ? branchId : data.branch
10869
- }
10913
+ body: data
10870
10914
  });
10871
10915
  }
10872
10916
  import_antd23.message.success(`Product ${isEdit ? "updated" : "created"} successfully`);
@@ -10878,7 +10922,7 @@ function ProductForm() {
10878
10922
  const fetches = async () => {
10879
10923
  try {
10880
10924
  const res = await get({
10881
- url: `/products/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10925
+ url: `/products/get?id=${id}`
10882
10926
  });
10883
10927
  const data = res.data;
10884
10928
  methods.reset(data);
@@ -10947,16 +10991,6 @@ function ProductForm() {
10947
10991
  name: "brand",
10948
10992
  api: "/brands/get"
10949
10993
  }
10950
- ),
10951
- !branchId && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
10952
- Feilds_default.Branches,
10953
- {
10954
- label: "Branch",
10955
- form: methods,
10956
- name: "branch",
10957
- placeholder: "Select Branch",
10958
- api: "/branches/get?noStore=true"
10959
- }
10960
10994
  )
10961
10995
  ] }),
10962
10996
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
@@ -10980,7 +11014,7 @@ function ProductForm() {
10980
11014
  var ProductForm_default = ProductForm;
10981
11015
 
10982
11016
  // src/components/products/Feilds/Product.tsx
10983
- var import_react_router_dom25 = require("react-router-dom");
11017
+ var import_react_router_dom22 = require("react-router-dom");
10984
11018
  var import_jsx_runtime71 = require("react/jsx-runtime");
10985
11019
  function Product({
10986
11020
  name,
@@ -10995,7 +11029,7 @@ function Product({
10995
11029
  onChange,
10996
11030
  obj
10997
11031
  }) {
10998
- const { branchId } = (0, import_react_router_dom25.useParams)();
11032
+ const { branchId } = (0, import_react_router_dom22.useParams)();
10999
11033
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11000
11034
  Fields_default.SearchApi,
11001
11035
  {
@@ -11025,22 +11059,21 @@ var ProductField = {
11025
11059
  var Feilds_default5 = ProductField;
11026
11060
 
11027
11061
  // src/components/packs/Packs.tsx
11028
- var import_react_router_dom26 = require("react-router-dom");
11062
+ var import_react_router_dom23 = require("react-router-dom");
11029
11063
  var import_lucide_react29 = require("lucide-react");
11030
11064
  var import_react51 = require("react");
11031
11065
  var import_antd24 = require("antd");
11032
11066
  var import_jsx_runtime72 = require("react/jsx-runtime");
11033
11067
  function Packs({ v, url }) {
11034
- const { branchId } = (0, import_react_router_dom26.useParams)();
11035
11068
  const [deletePack, setDeletePack] = (0, import_react51.useState)(null);
11036
11069
  const { isLoading, remove } = useApis_default();
11037
11070
  const { data, TransactionViewComponent, reload } = useTransaction_default({
11038
- url: url || `/packs/get${branchId ? `?branch=${branchId}` : ""}`,
11071
+ url: url || `/packs/get`,
11039
11072
  v,
11040
11073
  dateFilter: false
11041
11074
  });
11042
11075
  const { Modal: Modal2 } = useModal();
11043
- const navigate = (0, import_react_router_dom26.useNavigate)();
11076
+ const navigate = (0, import_react_router_dom23.useNavigate)();
11044
11077
  const items = (data2) => [
11045
11078
  {
11046
11079
  label: `Edit Pack`,
@@ -11157,7 +11190,6 @@ var createPackSchema = import_zod18.z.object({
11157
11190
  type: packTypes,
11158
11191
  name: import_zod18.z.string().min(2, { message: "Name must be at least 2 characters" }),
11159
11192
  products: import_zod18.z.array(packProductItemSchema).min(1, "At least one product is required"),
11160
- branch: import_zod18.z.string().optional(),
11161
11193
  tempProduct: import_zod18.z.string().optional(),
11162
11194
  tempQty: import_zod18.z.number().optional(),
11163
11195
  tempCost: import_zod18.z.number().optional(),
@@ -11169,11 +11201,9 @@ var import_react_hook_form19 = require("react-hook-form");
11169
11201
  var import_zod19 = require("@hookform/resolvers/zod");
11170
11202
  var import_antd25 = require("antd");
11171
11203
  var import_react52 = require("react");
11172
- var import_react_router_dom27 = require("react-router-dom");
11173
11204
  var import_lucide_react30 = require("lucide-react");
11174
11205
  var import_jsx_runtime73 = require("react/jsx-runtime");
11175
11206
  function PackForm() {
11176
- const { branchId } = (0, import_react_router_dom27.useParams)();
11177
11207
  const { getQuery, navigate } = useApp_default();
11178
11208
  const id = getQuery("id");
11179
11209
  const isEdit = !!id;
@@ -11229,10 +11259,7 @@ function PackForm() {
11229
11259
  } else {
11230
11260
  await post({
11231
11261
  url: "/packs/create",
11232
- body: {
11233
- ...formattedData,
11234
- branch: branchId ? branchId : data.branch
11235
- }
11262
+ body: formattedData
11236
11263
  });
11237
11264
  }
11238
11265
  import_antd25.message.success(`Pack ${isEdit ? "updated" : "created"} successfully`);
@@ -11244,7 +11271,7 @@ function PackForm() {
11244
11271
  const fetches = async () => {
11245
11272
  try {
11246
11273
  const res = await get({
11247
- url: `/packs/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
11274
+ url: `/packs/get?id=${id}`
11248
11275
  });
11249
11276
  const data = res.data;
11250
11277
  data.products = data.products.map((p, index) => ({
@@ -11304,16 +11331,6 @@ function PackForm() {
11304
11331
  enumName: "packTypes",
11305
11332
  required: true
11306
11333
  }
11307
- ),
11308
- !branchId && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
11309
- Feilds_default.Branches,
11310
- {
11311
- label: "Branch",
11312
- form: methods,
11313
- name: "branch",
11314
- placeholder: "Select Branch",
11315
- api: "/branches/get?noStore=true"
11316
- }
11317
11334
  )
11318
11335
  ] }),
11319
11336
  /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "border rounded-lg p-4 bg-gray-50/50 dark:bg-gray-800/20", children: [
@@ -11500,29 +11517,527 @@ function Pack({
11500
11517
  }
11501
11518
  var Pack_default = { Pack };
11502
11519
 
11503
- // src/components/ErrorPage/ErrorPage.tsx
11520
+ // src/components/journals/Journals.tsx
11521
+ var import_react_router_dom24 = require("react-router-dom");
11522
+ var import_lucide_react31 = require("lucide-react");
11523
+ var import_react53 = require("react");
11524
+ var import_antd26 = require("antd");
11504
11525
  var import_jsx_runtime75 = require("react/jsx-runtime");
11526
+ function Journals({ url }) {
11527
+ const { branchId } = (0, import_react_router_dom24.useParams)();
11528
+ const navigate = (0, import_react_router_dom24.useNavigate)();
11529
+ const [deleteJournal, setDeleteJournal] = (0, import_react53.useState)(null);
11530
+ const { isLoading, remove } = useApis_default();
11531
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
11532
+ url: url || `/transactions/get?type=journal${branchId ? `&branch=${branchId}` : ""}`,
11533
+ dateFilter: true
11534
+ });
11535
+ const { Modal: Modal2 } = useModal();
11536
+ const items = (data2) => [
11537
+ {
11538
+ label: `Edit Journal`,
11539
+ icon: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react31.FilePenLine, { size: 16 }),
11540
+ onClick: () => navigate(`update?id=${data2?._id}`)
11541
+ },
11542
+ {
11543
+ label: `Delete Journal`,
11544
+ icon: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react31.Trash2, { className: "text-red-500", size: 16 }),
11545
+ onClick: () => setDeleteJournal(data2)
11546
+ }
11547
+ ].filter(Boolean);
11548
+ const columns = [
11549
+ {
11550
+ accessorKey: "date",
11551
+ header: "Date",
11552
+ cell: ({ row }) => {
11553
+ const journal = row.original;
11554
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { children: journal?.date });
11555
+ }
11556
+ },
11557
+ {
11558
+ accessorKey: "account",
11559
+ header: "Account",
11560
+ cell: ({ row }) => {
11561
+ const journal = row.original;
11562
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { children: journal?.accountData?.name || "N/A" });
11563
+ }
11564
+ },
11565
+ {
11566
+ accessorKey: "amount",
11567
+ header: "Amount",
11568
+ cell: ({ row }) => {
11569
+ const journal = row.original;
11570
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex flex-col", children: [
11571
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { children: Formats_default.Price(journal?.amount, journal?.currency) }),
11572
+ journal?.fee && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("span", { className: "text-xs text-green-600", children: [
11573
+ "with fee: ",
11574
+ Formats_default.Price(journal?.feeAmount, journal?.currency)
11575
+ ] }),
11576
+ journal?.exchange?.rate && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("span", { className: "text-xs text-green-600", children: [
11577
+ "Exchanged:",
11578
+ " ",
11579
+ Formats_default.Price(
11580
+ journal?.exchange?.amount,
11581
+ journal?.exchange?.currency
11582
+ )
11583
+ ] })
11584
+ ] });
11585
+ }
11586
+ },
11587
+ {
11588
+ accessorKey: "journal",
11589
+ header: "Type",
11590
+ cell: ({ row }) => {
11591
+ const journal = row.original;
11592
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "capitalize", children: journal?.journal });
11593
+ }
11594
+ },
11595
+ {
11596
+ accessorKey: "journalVia",
11597
+ header: "Via",
11598
+ cell: ({ row }) => {
11599
+ const journal = row.original;
11600
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "", children: [
11601
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "capitalize", children: journal?.journalVia }),
11602
+ journal?.journalVia === "via account" && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "capitalize text-xs text-gray-600", children: journal?.viaAccountData?.name })
11603
+ ] });
11604
+ }
11605
+ },
11606
+ {
11607
+ accessorKey: "action",
11608
+ header: "Action",
11609
+ cell: ({ row }) => {
11610
+ const journal = row.original;
11611
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "capitalize", children: journal?.action });
11612
+ }
11613
+ },
11614
+ {
11615
+ accessorKey: "actions",
11616
+ header: "Actions",
11617
+ cell: ({ row }) => {
11618
+ const data2 = row.original;
11619
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
11620
+ Dropdown,
11621
+ {
11622
+ className: "cursor-pointer w-[150px]",
11623
+ items: items(data2),
11624
+ triggerMode: "hover",
11625
+ children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react31.EllipsisVertical, {})
11626
+ }
11627
+ );
11628
+ }
11629
+ }
11630
+ ];
11631
+ const journals = data?.data || [];
11632
+ const onDelete = async (id) => {
11633
+ try {
11634
+ await remove({ url: `/journals/delete/${id}` });
11635
+ import_antd26.message.success("Journal deleted successfully");
11636
+ reload();
11637
+ setDeleteJournal(null);
11638
+ } catch (error) {
11639
+ import_antd26.message.error(error.message || "Something went wrong");
11640
+ return error;
11641
+ }
11642
+ };
11643
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
11644
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Modal2, {}),
11645
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
11646
+ ConfirmModal,
11647
+ {
11648
+ isOpen: !!deleteJournal,
11649
+ isLoading,
11650
+ onClose: () => setDeleteJournal(null),
11651
+ title: `Delete Journal`,
11652
+ description: `Are you sure you want to delete this journal entry of "${deleteJournal?.amount}"? This action cannot be undone.`,
11653
+ confirmationWord: "delete",
11654
+ onSubmit: () => onDelete(deleteJournal?._id),
11655
+ children: null
11656
+ }
11657
+ ),
11658
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
11659
+ TransactionViewComponent,
11660
+ {
11661
+ columns,
11662
+ data: journals,
11663
+ title: "Journals",
11664
+ description: "Manage your journal entries",
11665
+ index: true,
11666
+ createTitle: "Add Journal",
11667
+ onCreate: () => {
11668
+ navigate("create");
11669
+ }
11670
+ }
11671
+ )
11672
+ ] });
11673
+ }
11674
+ var Journals_default = Journals;
11675
+
11676
+ // src/utils/zod.ts
11677
+ var import_moment2 = __toESM(require("moment"));
11678
+ var import_zod20 = require("zod");
11679
+ var zodFields = {
11680
+ date: import_zod20.z.string().regex(
11681
+ /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/,
11682
+ "Date must be in format DD/MM/YYYY"
11683
+ ).refine((val) => (0, import_moment2.default)(val, "DD/MM/YYYY", true).isValid(), {
11684
+ message: "Date is not a valid calendar date"
11685
+ })
11686
+ };
11687
+
11688
+ // src/components/journals/schema.ts
11689
+ var import_zod22 = require("zod");
11690
+ var journalSchema = import_zod22.z.object({
11691
+ date: zodFields.date,
11692
+ amount: import_zod22.z.number().gt(0, "Amount must be greater than 0"),
11693
+ account: import_zod22.z.string(),
11694
+ description: import_zod22.z.string(),
11695
+ journalVia: import_zod22.z.enum(Enums_default.viaTypes),
11696
+ action: import_zod22.z.enum(Enums_default.actionTypes).optional(),
11697
+ viaAccount: import_zod22.z.string().optional(),
11698
+ viaAccountObject: import_zod22.z.any().optional(),
11699
+ accountObject: import_zod22.z.any().optional(),
11700
+ //exchange
11701
+ rate: import_zod22.z.coerce.number().gte(0).optional(),
11702
+ exchangedAmount: import_zod22.z.coerce.number().gte(0).optional(),
11703
+ fee: import_zod22.z.coerce.number().gte(0)
11704
+ });
11705
+
11706
+ // src/components/journals/JournalForm.tsx
11707
+ var import_react_hook_form20 = require("react-hook-form");
11708
+ var import_zod23 = require("@hookform/resolvers/zod");
11709
+ var import_antd27 = require("antd");
11710
+ var import_react54 = require("react");
11711
+ var import_react_router_dom25 = require("react-router-dom");
11712
+
11713
+ // src/utils/forex.ts
11714
+ function exchangedAmount({
11715
+ accountCurrency,
11716
+ amount,
11717
+ exchangeRate,
11718
+ transactionCurrency,
11719
+ trunc = false
11720
+ }) {
11721
+ if (!Enums_default.currencies.includes(accountCurrency)) {
11722
+ throw new Error("Invalid account currency");
11723
+ }
11724
+ if (!Enums_default.currencies.includes(transactionCurrency)) {
11725
+ throw new Error("Invalid transaction currency");
11726
+ }
11727
+ let result;
11728
+ if (accountCurrency === transactionCurrency) {
11729
+ result = amount;
11730
+ } else if (accountCurrency === "USD") {
11731
+ result = amount / exchangeRate;
11732
+ } else if (accountCurrency === "CNY") {
11733
+ result = transactionCurrency === "USD" ? amount * exchangeRate : amount / exchangeRate;
11734
+ } else if (accountCurrency === "KES") {
11735
+ result = transactionCurrency === "TZS" ? amount / exchangeRate : amount * exchangeRate;
11736
+ } else if (accountCurrency === "TZS") {
11737
+ result = amount * exchangeRate;
11738
+ } else {
11739
+ throw new Error("Unsupported currency conversion");
11740
+ }
11741
+ return trunc ? Math.trunc(result) : result;
11742
+ }
11743
+ var Forex = {
11744
+ exchangedAmount
11745
+ };
11746
+ var forex_default = Forex;
11747
+
11748
+ // src/components/journals/JournalForm.tsx
11749
+ var import_jsx_runtime76 = require("react/jsx-runtime");
11750
+ function JournalForm({
11751
+ isFee = true,
11752
+ accountType = "all"
11753
+ }) {
11754
+ const { branchId } = (0, import_react_router_dom25.useParams)();
11755
+ const { getQuery, navigate } = useApp_default();
11756
+ const id = getQuery("id");
11757
+ const isEdit = !!id;
11758
+ const [ref, setRef] = (0, import_react54.useState)("");
11759
+ const { post, isLoading } = useApis_default();
11760
+ const { isLoading: isLoadingGet, get } = useApis_default();
11761
+ const methods = (0, import_react_hook_form20.useForm)({
11762
+ resolver: (0, import_zod23.zodResolver)(journalSchema),
11763
+ defaultValues: {
11764
+ date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
11765
+ amount: 0,
11766
+ account: "",
11767
+ fee: 0,
11768
+ action: "debit",
11769
+ journalVia: "direct"
11770
+ }
11771
+ });
11772
+ const { handleSubmit } = methods;
11773
+ const journalVia = methods.watch("journalVia");
11774
+ const account = methods.watch("account");
11775
+ const viaAccount = methods.watch("viaAccount");
11776
+ const viaAccountObj = methods.watch("viaAccountObject");
11777
+ const accountObj = methods.watch("accountObject");
11778
+ const amount = methods.watch("amount");
11779
+ const fee = methods.watch("fee");
11780
+ const rate = methods.watch("rate");
11781
+ const isRate = accountObj?.currency && viaAccountObj?.currency && accountObj?.currency !== viaAccountObj?.currency;
11782
+ const onSubmit = async (data) => {
11783
+ try {
11784
+ const payload = {
11785
+ ...data,
11786
+ journal: "journal",
11787
+ type: "journal",
11788
+ action: data.journalVia === "via account" ? "debit" : data.action,
11789
+ branch: branchId ?? void 0
11790
+ };
11791
+ await post({
11792
+ url: `/transactions/add${isEdit ? `?ref=${ref}` : ""}`,
11793
+ body: payload
11794
+ });
11795
+ import_antd27.message.success(`Journal saved successfully`);
11796
+ navigate(-1);
11797
+ } catch (error) {
11798
+ import_antd27.message.error(error?.message || "Something went wrong");
11799
+ }
11800
+ };
11801
+ const fetches = async () => {
11802
+ try {
11803
+ const res = await get({
11804
+ url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
11805
+ });
11806
+ const data = res.data;
11807
+ console.log(data);
11808
+ methods.reset({
11809
+ ...data,
11810
+ rate: data?.exchange?.rate
11811
+ });
11812
+ setRef(data?.ref);
11813
+ } catch (error) {
11814
+ import_antd27.message.error(error?.message || "Something went wrong");
11815
+ navigate(-1);
11816
+ }
11817
+ };
11818
+ const exchangedAmount2 = (0, import_react54.useMemo)(() => {
11819
+ if (isRate) {
11820
+ const am = forex_default.exchangedAmount({
11821
+ accountCurrency: accountObj?.currency,
11822
+ amount,
11823
+ exchangeRate: rate ?? 1,
11824
+ transactionCurrency: viaAccountObj?.currency
11825
+ });
11826
+ return Formats_default.Price(am, accountObj?.currency ?? "N/A");
11827
+ }
11828
+ }, [
11829
+ amount,
11830
+ viaAccountObj?.rate,
11831
+ accountObj?.currency,
11832
+ viaAccountObj?.currency,
11833
+ rate
11834
+ ]);
11835
+ const viaAccountAmount = (0, import_react54.useMemo)(() => {
11836
+ if (fee) {
11837
+ const am = amount + fee / 100 * amount;
11838
+ return Formats_default.Price(
11839
+ am,
11840
+ viaAccountObj?.currency ?? accountObj?.currency ?? "N/A"
11841
+ );
11842
+ } else {
11843
+ return Formats_default.Price(
11844
+ amount,
11845
+ viaAccountObj?.currency ?? accountObj?.currency ?? "N/A"
11846
+ );
11847
+ }
11848
+ }, [fee, amount, viaAccountObj?.currency, accountObj?.currency]);
11849
+ (0, import_react54.useEffect)(() => {
11850
+ if (isEdit) {
11851
+ fetches();
11852
+ }
11853
+ }, [id]);
11854
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
11855
+ Card,
11856
+ {
11857
+ className: "max-w-4xl mx-auto mt-10 relative",
11858
+ isLoading: isLoadingGet,
11859
+ loadingText: "Processing...",
11860
+ children: [
11861
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Card.Header, { children: [
11862
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Journal` }),
11863
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Card.Description, { children: isEdit ? `Update the details for this journal entry` : `Create a new journal entry` })
11864
+ ] }),
11865
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
11866
+ "form",
11867
+ {
11868
+ className: "space-y-4",
11869
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
11870
+ children: [
11871
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
11872
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11873
+ Fields_default.Input,
11874
+ {
11875
+ label: "Description",
11876
+ form: methods,
11877
+ name: "description",
11878
+ placeholder: "Enter description",
11879
+ required: true
11880
+ }
11881
+ ),
11882
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11883
+ Fields_default.Select,
11884
+ {
11885
+ label: "Journal Via",
11886
+ form: methods,
11887
+ name: "journalVia",
11888
+ enumName: "viaTypes",
11889
+ required: true
11890
+ }
11891
+ )
11892
+ ] }),
11893
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
11894
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11895
+ Fields_default.DateInput,
11896
+ {
11897
+ label: "Date",
11898
+ form: methods,
11899
+ name: "date",
11900
+ required: true
11901
+ }
11902
+ ),
11903
+ journalVia === "via account" && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11904
+ Feilds_default.Account,
11905
+ {
11906
+ label: "Via Account",
11907
+ form: methods,
11908
+ name: "viaAccount",
11909
+ api: "/accounts/get/all",
11910
+ placeholder: "Search for account...",
11911
+ filter: [account],
11912
+ required: true,
11913
+ obj: "viaAccountObject",
11914
+ showBalance: true
11915
+ }
11916
+ ),
11917
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11918
+ Feilds_default.Account,
11919
+ {
11920
+ label: accountType === "all" ? "Account" : accountType,
11921
+ form: methods,
11922
+ name: "account",
11923
+ api: `/accounts/get/${accountType}`,
11924
+ placeholder: "Search for account...",
11925
+ filter: [viaAccount],
11926
+ required: true,
11927
+ showBalance: true,
11928
+ obj: "accountObject"
11929
+ }
11930
+ ),
11931
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11932
+ Fields_default.Input,
11933
+ {
11934
+ label: "Amount",
11935
+ form: methods,
11936
+ name: "amount",
11937
+ type: "number",
11938
+ placeholder: "0.00",
11939
+ required: true
11940
+ }
11941
+ ),
11942
+ journalVia !== "via account" && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11943
+ Fields_default.Select,
11944
+ {
11945
+ label: "Action",
11946
+ form: methods,
11947
+ name: "action",
11948
+ enumName: "actionTypes",
11949
+ required: true
11950
+ }
11951
+ ),
11952
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
11953
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11954
+ Fields_default.Input,
11955
+ {
11956
+ label: "Rate",
11957
+ type: "number",
11958
+ name: "rate",
11959
+ form: methods,
11960
+ required: true
11961
+ }
11962
+ ),
11963
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11964
+ Fields_default.Input,
11965
+ {
11966
+ label: "Exchanged Amount",
11967
+ type: "text",
11968
+ readOnly: true,
11969
+ disabled: true,
11970
+ value: exchangedAmount2
11971
+ }
11972
+ ),
11973
+ " "
11974
+ ] }),
11975
+ isFee && /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
11976
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11977
+ Fields_default.Input,
11978
+ {
11979
+ label: "Fee",
11980
+ type: "number",
11981
+ name: "fee",
11982
+ form: methods,
11983
+ required: true
11984
+ }
11985
+ ),
11986
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11987
+ Fields_default.Input,
11988
+ {
11989
+ label: "Amount After Fee",
11990
+ type: "text",
11991
+ readOnly: true,
11992
+ disabled: true,
11993
+ value: viaAccountAmount
11994
+ }
11995
+ )
11996
+ ] })
11997
+ ] }),
11998
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
11999
+ Button,
12000
+ {
12001
+ isLoading,
12002
+ disabled: isLoading,
12003
+ type: "submit",
12004
+ className: "min-w-[100px]",
12005
+ variant: !isEdit ? "primary" : "warning",
12006
+ children: isEdit ? "Update" : "Add"
12007
+ }
12008
+ ) })
12009
+ ]
12010
+ }
12011
+ ) })
12012
+ ]
12013
+ }
12014
+ );
12015
+ }
12016
+ var JournalForm_default = JournalForm;
12017
+
12018
+ // src/components/ErrorPage/ErrorPage.tsx
12019
+ var import_jsx_runtime77 = require("react/jsx-runtime");
11505
12020
  var ErrorPageBase = ({
11506
12021
  title,
11507
- message: message24,
12022
+ message: message26,
11508
12023
  statusCode,
11509
12024
  action,
11510
12025
  className = ""
11511
12026
  }) => {
11512
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
12027
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11513
12028
  "div",
11514
12029
  {
11515
12030
  className: `flex-1 m-auto h-full w-full min-h-[50vh] flex flex-col items-center justify-center p-6 text-zinc-900 dark:text-zinc-100 ${className}`,
11516
- children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
11517
- statusCode && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-0 select-none pointer-events-none opacity-[0.03] dark:opacity-5", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
11518
- /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "relative z-10 space-y-6", children: [
11519
- statusCode && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
12031
+ children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
12032
+ statusCode && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-0 select-none pointer-events-none opacity-[0.03] dark:opacity-5", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
12033
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "relative z-10 space-y-6", children: [
12034
+ statusCode && /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
11520
12035
  "Error ",
11521
12036
  statusCode
11522
12037
  ] }),
11523
- title && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
11524
- message24 && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message24 }),
11525
- action && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "pt-8", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
12038
+ title && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
12039
+ message26 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message26 }),
12040
+ action && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "pt-8", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11526
12041
  "button",
11527
12042
  {
11528
12043
  onClick: action.onClick,
@@ -11538,9 +12053,9 @@ var ErrorPageBase = ({
11538
12053
  };
11539
12054
 
11540
12055
  // src/components/ErrorPage/ErrorPage.500.tsx
11541
- var import_jsx_runtime76 = require("react/jsx-runtime");
12056
+ var import_jsx_runtime78 = require("react/jsx-runtime");
11542
12057
  var ErrorPage500 = (props) => {
11543
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
12058
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
11544
12059
  ErrorPageBase,
11545
12060
  {
11546
12061
  statusCode: 500,
@@ -11553,9 +12068,9 @@ var ErrorPage500 = (props) => {
11553
12068
  };
11554
12069
 
11555
12070
  // src/components/ErrorPage/ErrorPage.404.tsx
11556
- var import_jsx_runtime77 = require("react/jsx-runtime");
12071
+ var import_jsx_runtime79 = require("react/jsx-runtime");
11557
12072
  var ErrorPage404 = (props) => {
11558
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
12073
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
11559
12074
  ErrorPageBase,
11560
12075
  {
11561
12076
  statusCode: 404,
@@ -11568,9 +12083,9 @@ var ErrorPage404 = (props) => {
11568
12083
  };
11569
12084
 
11570
12085
  // src/components/ErrorPage/ErrorPage.401.tsx
11571
- var import_jsx_runtime78 = require("react/jsx-runtime");
12086
+ var import_jsx_runtime80 = require("react/jsx-runtime");
11572
12087
  var ErrorPage401 = (props) => {
11573
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
12088
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
11574
12089
  ErrorPageBase,
11575
12090
  {
11576
12091
  statusCode: 401,
@@ -11583,9 +12098,9 @@ var ErrorPage401 = (props) => {
11583
12098
  };
11584
12099
 
11585
12100
  // src/components/ErrorPage/ErrorPage.400.tsx
11586
- var import_jsx_runtime79 = require("react/jsx-runtime");
12101
+ var import_jsx_runtime81 = require("react/jsx-runtime");
11587
12102
  var ErrorPage400 = (props) => {
11588
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
12103
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
11589
12104
  ErrorPageBase,
11590
12105
  {
11591
12106
  statusCode: 400,
@@ -11639,6 +12154,8 @@ var ErrorPage = Object.assign(ErrorPageBase, {
11639
12154
  Guard,
11640
12155
  InfoGrid,
11641
12156
  Input,
12157
+ JournalForm,
12158
+ Journals,
11642
12159
  LinkUser,
11643
12160
  LoadingBox,
11644
12161
  LoadingSpin,
@@ -11691,6 +12208,7 @@ var ErrorPage = Object.assign(ErrorPageBase, {
11691
12208
  createUserSchema,
11692
12209
  createWalletSchema,
11693
12210
  generatePdf,
12211
+ journalSchema,
11694
12212
  linkUserSchema,
11695
12213
  packProductItemSchema,
11696
12214
  packTypes,