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.mjs CHANGED
@@ -299,12 +299,21 @@ var useTheme = () => {
299
299
  var Enums = {
300
300
  roles: ["admin", "staff"],
301
301
  sex: ["male", "female"],
302
- accountTypes: ["employee", "supplier", "customer", "amaanah"],
302
+ accountTypes: [
303
+ "employee",
304
+ "supplier",
305
+ "customer",
306
+ "amaanah",
307
+ "account"
308
+ ],
303
309
  verificationTypes: ["email_verification", "password_reset"],
304
310
  auditActions: ["create", "update", "delete", "login", "logout"],
305
311
  walletTypes: ["bank", "cash", "mobile"],
306
312
  currencies: ["USD", "TZS", "KES", "CNY"],
307
- packTypes: ["pressure", "bag", "boxes"]
313
+ packTypes: ["pressure", "bag", "boxes"],
314
+ journalTypes: ["journal"],
315
+ viaTypes: ["direct", "via account"],
316
+ actionTypes: ["credit", "debit"]
308
317
  };
309
318
  var Enums_default = Enums;
310
319
 
@@ -1331,13 +1340,13 @@ var Input = forwardRef(
1331
1340
  }
1332
1341
  }
1333
1342
  }, [props.value, name, form]);
1334
- let message24 = error;
1343
+ let message26 = error;
1335
1344
  if (form && name) {
1336
1345
  const {
1337
1346
  formState: { errors }
1338
1347
  } = form;
1339
1348
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
1340
- message24 = errorObj?.message;
1349
+ message26 = errorObj?.message;
1341
1350
  }
1342
1351
  const watchedValue = form?.watch(name);
1343
1352
  useEffect7(() => {
@@ -1406,7 +1415,7 @@ var Input = forwardRef(
1406
1415
  }
1407
1416
  )
1408
1417
  ] }),
1409
- message24 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
1418
+ message26 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
1410
1419
  ]
1411
1420
  }
1412
1421
  );
@@ -1731,7 +1740,7 @@ var PhoneInput = forwardRef2(
1731
1740
  const [isFocused, setIsFocused] = useState12(false);
1732
1741
  const { theme } = useWarqadConfig();
1733
1742
  const primaryColor = theme?.primaryColor;
1734
- let message24 = error;
1743
+ let message26 = error;
1735
1744
  if (form && name) {
1736
1745
  const {
1737
1746
  formState: { errors }
@@ -1741,7 +1750,7 @@ var PhoneInput = forwardRef2(
1741
1750
  for (const part of nameParts) {
1742
1751
  currentError = currentError?.[part];
1743
1752
  }
1744
- message24 = currentError?.message || message24;
1753
+ message26 = currentError?.message || message26;
1745
1754
  }
1746
1755
  const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs15("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
1747
1756
  /* @__PURE__ */ jsxs15(
@@ -1792,7 +1801,7 @@ var PhoneInput = forwardRef2(
1792
1801
  }
1793
1802
  )
1794
1803
  ] }),
1795
- message24 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
1804
+ message26 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
1796
1805
  ] });
1797
1806
  if (form && name) {
1798
1807
  return /* @__PURE__ */ jsx20(
@@ -1844,7 +1853,8 @@ var Select = forwardRef3((props, ref) => {
1844
1853
  children,
1845
1854
  options: initialOptions = [],
1846
1855
  enum: enumData,
1847
- enumName
1856
+ enumName,
1857
+ ...rest
1848
1858
  } = props;
1849
1859
  const options = useMemo4(() => {
1850
1860
  if (initialOptions.length > 0) return initialOptions;
@@ -1881,7 +1891,7 @@ var Select = forwardRef3((props, ref) => {
1881
1891
  }) => /* @__PURE__ */ jsx21(
1882
1892
  SelectRoot,
1883
1893
  {
1884
- ...props,
1894
+ ...rest,
1885
1895
  options,
1886
1896
  currentValue: formValue,
1887
1897
  onChangeHandler: (val) => {
@@ -1898,7 +1908,7 @@ var Select = forwardRef3((props, ref) => {
1898
1908
  return /* @__PURE__ */ jsx21(
1899
1909
  SelectRoot,
1900
1910
  {
1901
- ...props,
1911
+ ...rest,
1902
1912
  options,
1903
1913
  currentValue: value,
1904
1914
  onChangeHandler: onChange || (() => {
@@ -1926,6 +1936,8 @@ var SelectRoot = ({
1926
1936
  disabled,
1927
1937
  id,
1928
1938
  className = "",
1939
+ enum: enumData,
1940
+ enumName,
1929
1941
  ...props
1930
1942
  }) => {
1931
1943
  const [isOpen, setIsOpen] = useState13(false);
@@ -1970,7 +1982,7 @@ var SelectRoot = ({
1970
1982
  document.addEventListener("mousedown", handleClickOutside);
1971
1983
  return () => document.removeEventListener("mousedown", handleClickOutside);
1972
1984
  }, [fieldInternalProps]);
1973
- let message24 = error;
1985
+ let message26 = error;
1974
1986
  if (form && name) {
1975
1987
  const {
1976
1988
  formState: { errors }
@@ -1980,7 +1992,7 @@ var SelectRoot = ({
1980
1992
  for (const part of nameParts) {
1981
1993
  currentError = currentError?.[part];
1982
1994
  }
1983
- message24 = currentError?.message || message24;
1995
+ message26 = currentError?.message || message26;
1984
1996
  }
1985
1997
  const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
1986
1998
  const valueCtx = {
@@ -2041,7 +2053,7 @@ var SelectRoot = ({
2041
2053
  String(opt.value) || index
2042
2054
  )) })
2043
2055
  ] }),
2044
- message24 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
2056
+ message26 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
2045
2057
  ]
2046
2058
  }
2047
2059
  ) });
@@ -2279,13 +2291,13 @@ var Textarea = forwardRef4(
2279
2291
  const [isFocused, setIsFocused] = useState14(false);
2280
2292
  const { theme } = useWarqadConfig();
2281
2293
  const primaryColor = theme?.primaryColor;
2282
- let message24 = error;
2294
+ let message26 = error;
2283
2295
  if (form && name) {
2284
2296
  const {
2285
2297
  formState: { errors }
2286
2298
  } = form;
2287
2299
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
2288
- message24 = errorObj?.message;
2300
+ message26 = errorObj?.message;
2289
2301
  }
2290
2302
  const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs17("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
2291
2303
  /* @__PURE__ */ jsxs17(
@@ -2323,7 +2335,7 @@ var Textarea = forwardRef4(
2323
2335
  }
2324
2336
  }
2325
2337
  ) }),
2326
- message24 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
2338
+ message26 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
2327
2339
  ] });
2328
2340
  useEffect9(() => {
2329
2341
  if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
@@ -2649,7 +2661,7 @@ var SearchApiRoot = ({
2649
2661
  const filteredOptions = options.filter(
2650
2662
  (option) => !filter.includes(getOptionValue(option))
2651
2663
  );
2652
- let message24 = error || errorMessage;
2664
+ let message26 = error || errorMessage;
2653
2665
  if (form && name) {
2654
2666
  const {
2655
2667
  formState: { errors }
@@ -2659,7 +2671,7 @@ var SearchApiRoot = ({
2659
2671
  for (const part of nameParts) {
2660
2672
  currentError = currentError?.[part];
2661
2673
  }
2662
- message24 = currentError?.message || message24;
2674
+ message26 = currentError?.message || message26;
2663
2675
  }
2664
2676
  const valueCtx = {
2665
2677
  isOpen,
@@ -2693,7 +2705,7 @@ var SearchApiRoot = ({
2693
2705
  form,
2694
2706
  name,
2695
2707
  obj,
2696
- error: message24,
2708
+ error: message26,
2697
2709
  onSelect,
2698
2710
  onClear
2699
2711
  };
@@ -3062,19 +3074,19 @@ var DateInput = forwardRef6(
3062
3074
  const { theme } = useWarqadConfig();
3063
3075
  const primaryColor = theme?.primaryColor;
3064
3076
  const [isFocused, setIsFocused] = useState16(false);
3065
- let message24 = error;
3077
+ let message26 = error;
3066
3078
  if (form && name) {
3067
3079
  const {
3068
3080
  formState: { errors }
3069
3081
  } = form;
3070
3082
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
3071
- message24 = errorObj?.message;
3083
+ message26 = errorObj?.message;
3072
3084
  }
3073
3085
  const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
3074
3086
  bg-white! dark:bg-zinc-900!
3075
3087
  text-gray-900! dark:text-zinc-100!
3076
3088
  hover:bg-white! dark:hover:bg-zinc-900!
3077
- ${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"}
3089
+ ${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"}
3078
3090
  [&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
3079
3091
  ${className}`;
3080
3092
  const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
@@ -3097,8 +3109,8 @@ var DateInput = forwardRef6(
3097
3109
  needConfirm: false,
3098
3110
  style: {
3099
3111
  height: "var(--input-height, 40px)",
3100
- borderColor: isFocused && !message24 ? primaryColor : void 0,
3101
- boxShadow: isFocused && !message24 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3112
+ borderColor: isFocused && !message26 ? primaryColor : void 0,
3113
+ boxShadow: isFocused && !message26 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3102
3114
  },
3103
3115
  classNames: { popup: { root: "z-50" } },
3104
3116
  suffixIcon: /* @__PURE__ */ jsx24(
@@ -3128,7 +3140,7 @@ var DateInput = forwardRef6(
3128
3140
  {
3129
3141
  className: "block text-xs font-medium transition-colors duration-200",
3130
3142
  style: {
3131
- color: message24 ? "#ef4444" : isFocused ? primaryColor : void 0
3143
+ color: message26 ? "#ef4444" : isFocused ? primaryColor : void 0
3132
3144
  },
3133
3145
  children: [
3134
3146
  label,
@@ -3149,7 +3161,7 @@ var DateInput = forwardRef6(
3149
3161
  )
3150
3162
  }
3151
3163
  ) : renderDatePicker(value, onChange, onBlur, ref),
3152
- message24 && /* @__PURE__ */ jsx24("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
3164
+ message26 && /* @__PURE__ */ jsx24("p", { className: "text-sm text-red-600 dark:text-red-400", children: message26 })
3153
3165
  ] });
3154
3166
  }
3155
3167
  );
@@ -3173,7 +3185,8 @@ var Fields = {
3173
3185
  var Fields_default = Fields;
3174
3186
 
3175
3187
  // src/components/tables/DataTable.tsx
3176
- import React10, { useState as useState17, useMemo as useMemo5, useEffect as useEffect11 } from "react";
3188
+ import React10, { useState as useState17, useMemo as useMemo5, useEffect as useEffect11, useRef as useRef5 } from "react";
3189
+ import { createPortal as createPortal4 } from "react-dom";
3177
3190
  import {
3178
3191
  useReactTable,
3179
3192
  getCoreRowModel,
@@ -3233,6 +3246,43 @@ function DataTable({
3233
3246
  setPagination((prev) => ({ ...prev, pageSize: pageRows }));
3234
3247
  }
3235
3248
  }, [pageRows]);
3249
+ const [isVisibilityOpen, setIsVisibilityOpen] = useState17(false);
3250
+ const visibilityAnchorRef = useRef5(null);
3251
+ const visibilityContentRef = useRef5(null);
3252
+ const [visibilityCoords, setVisibilityCoords] = useState17({
3253
+ top: 0,
3254
+ left: 0,
3255
+ width: 0
3256
+ });
3257
+ const updateVisibilityPosition = () => {
3258
+ if (visibilityAnchorRef.current) {
3259
+ const rect = visibilityAnchorRef.current.getBoundingClientRect();
3260
+ setVisibilityCoords({
3261
+ top: rect.bottom,
3262
+ left: rect.left,
3263
+ width: rect.width
3264
+ });
3265
+ }
3266
+ };
3267
+ useEffect11(() => {
3268
+ if (isVisibilityOpen) {
3269
+ updateVisibilityPosition();
3270
+ const handleScroll = () => updateVisibilityPosition();
3271
+ window.addEventListener("scroll", handleScroll, true);
3272
+ window.addEventListener("resize", handleScroll);
3273
+ const handleClickOutside = (event) => {
3274
+ if (visibilityAnchorRef.current && !visibilityAnchorRef.current.contains(event.target) && visibilityContentRef.current && !visibilityContentRef.current.contains(event.target)) {
3275
+ setIsVisibilityOpen(false);
3276
+ }
3277
+ };
3278
+ document.addEventListener("mousedown", handleClickOutside);
3279
+ return () => {
3280
+ window.removeEventListener("scroll", handleScroll, true);
3281
+ window.removeEventListener("resize", handleScroll);
3282
+ document.removeEventListener("mousedown", handleClickOutside);
3283
+ };
3284
+ }
3285
+ }, [isVisibilityOpen]);
3236
3286
  const [expanded, setExpanded] = useState17(() => {
3237
3287
  const initialState = {};
3238
3288
  if (defaultExpanded && renderSubComponent && data) {
@@ -3331,31 +3381,59 @@ function DataTable({
3331
3381
  className: "h-9!"
3332
3382
  }
3333
3383
  ) }),
3334
- /* @__PURE__ */ jsx25("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs20("div", { className: "relative group", children: [
3335
- /* @__PURE__ */ jsxs20("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: [
3336
- "Columns",
3337
- /* @__PURE__ */ jsx25(ChevronDown4, { size: 14, className: "text-gray-400" })
3338
- ] }),
3339
- /* @__PURE__ */ jsx25("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__ */ jsxs20(
3340
- "label",
3384
+ /* @__PURE__ */ jsx25("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs20("div", { className: "relative", ref: visibilityAnchorRef, children: [
3385
+ /* @__PURE__ */ jsxs20(
3386
+ "button",
3341
3387
  {
3342
- 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",
3388
+ onClick: () => setIsVisibilityOpen(!isVisibilityOpen),
3389
+ 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",
3343
3390
  children: [
3391
+ "Columns",
3344
3392
  /* @__PURE__ */ jsx25(
3345
- "input",
3393
+ ChevronDown4,
3346
3394
  {
3347
- type: "checkbox",
3348
- checked: column.getIsVisible(),
3349
- onChange: (e) => column.toggleVisibility(!!e.target.checked),
3350
- className: "rounded border-gray-300 text-blue-600 focus:ring-blue-500",
3351
- style: { accentColor: primaryColor }
3395
+ size: 14,
3396
+ className: `text-gray-400 transition-transform ${isVisibilityOpen ? "rotate-180" : ""}`
3352
3397
  }
3353
- ),
3354
- column.id
3398
+ )
3355
3399
  ]
3356
- },
3357
- column.id
3358
- )) })
3400
+ }
3401
+ ),
3402
+ isVisibilityOpen && createPortal4(
3403
+ /* @__PURE__ */ jsx25(
3404
+ "div",
3405
+ {
3406
+ ref: visibilityContentRef,
3407
+ 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]",
3408
+ style: {
3409
+ top: `${visibilityCoords.top}px`,
3410
+ left: `${visibilityCoords.left + visibilityCoords.width - 192}px`
3411
+ // 192px is w-48
3412
+ },
3413
+ children: /* @__PURE__ */ jsx25("div", { className: "max-h-64 overflow-y-auto", children: table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ jsxs20(
3414
+ "label",
3415
+ {
3416
+ 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",
3417
+ children: [
3418
+ /* @__PURE__ */ jsx25(
3419
+ "input",
3420
+ {
3421
+ type: "checkbox",
3422
+ checked: column.getIsVisible(),
3423
+ onChange: (e) => column.toggleVisibility(!!e.target.checked),
3424
+ className: "rounded border-gray-300 text-blue-600 focus:ring-blue-500",
3425
+ style: { accentColor: primaryColor }
3426
+ }
3427
+ ),
3428
+ column.id
3429
+ ]
3430
+ },
3431
+ column.id
3432
+ )) })
3433
+ }
3434
+ ),
3435
+ document.body
3436
+ )
3359
3437
  ] }) })
3360
3438
  ] }),
3361
3439
  /* @__PURE__ */ jsx25("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 overflow-hidden relative", children: /* @__PURE__ */ jsx25("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs20(
@@ -3496,7 +3574,7 @@ import React11, {
3496
3574
  useState as useState18,
3497
3575
  useMemo as useMemo6,
3498
3576
  useEffect as useEffect12,
3499
- useRef as useRef5,
3577
+ useRef as useRef6,
3500
3578
  useCallback as useCallback3
3501
3579
  } from "react";
3502
3580
  import {
@@ -3628,7 +3706,7 @@ function PostTable({
3628
3706
  const [internalData, setInternalData] = useState18(controlledData || []);
3629
3707
  const isControlled = controlledData !== void 0;
3630
3708
  const data = isControlled ? controlledData : internalData;
3631
- const entryRowRef = useRef5(null);
3709
+ const entryRowRef = useRef6(null);
3632
3710
  useEffect12(() => {
3633
3711
  if (defaultExpanded && renderSubComponent && (data || []).length > 0) {
3634
3712
  setExpanded((prev) => {
@@ -3670,7 +3748,7 @@ function PostTable({
3670
3748
  const [editingIndex, setEditingIndex] = useState18(null);
3671
3749
  const [isSavingAsync, setIsSavingAsync] = useState18(false);
3672
3750
  const [fieldErrors, setFieldErrors] = useState18({});
3673
- const latestStateRef = useRef5({
3751
+ const latestStateRef = useRef6({
3674
3752
  data,
3675
3753
  entryData,
3676
3754
  editingIndex,
@@ -5051,8 +5129,8 @@ var useLogin = (props) => {
5051
5129
  import { useState as useState21 } from "react";
5052
5130
 
5053
5131
  // src/components/Dropdown.tsx
5054
- import { useState as useState20, useRef as useRef6, useEffect as useEffect13, useLayoutEffect } from "react";
5055
- import { createPortal as createPortal4 } from "react-dom";
5132
+ import { useState as useState20, useRef as useRef7, useEffect as useEffect13, useLayoutEffect } from "react";
5133
+ import { createPortal as createPortal5 } from "react-dom";
5056
5134
  import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
5057
5135
  var Dropdown = ({
5058
5136
  children,
@@ -5065,7 +5143,7 @@ var Dropdown = ({
5065
5143
  onOpenChange
5066
5144
  }) => {
5067
5145
  const [isOpen, setIsOpen] = useState20(false);
5068
- const triggerRef = useRef6(null);
5146
+ const triggerRef = useRef7(null);
5069
5147
  const [coords, setCoords] = useState20({ top: 0, left: 0, right: 0 });
5070
5148
  const [loadingItems, setLoadingItems] = useState20({});
5071
5149
  const updateCoords = () => {
@@ -5152,7 +5230,7 @@ var Dropdown = ({
5152
5230
  children
5153
5231
  }
5154
5232
  ),
5155
- isOpen && createPortal4(
5233
+ isOpen && createPortal5(
5156
5234
  /* @__PURE__ */ jsx34(
5157
5235
  "div",
5158
5236
  {
@@ -5337,7 +5415,7 @@ var ProfileDropdown = ({
5337
5415
  };
5338
5416
 
5339
5417
  // src/hooks/Fetches/useA4DataView.tsx
5340
- import { useEffect as useEffect14, useRef as useRef7, useState as useState22 } from "react";
5418
+ import { useEffect as useEffect14, useRef as useRef8, useState as useState22 } from "react";
5341
5419
  import { useReactToPrint } from "react-to-print";
5342
5420
  import {
5343
5421
  RefreshCw,
@@ -5356,7 +5434,7 @@ var useA4StatementView = ({
5356
5434
  startPage = 1
5357
5435
  } = {}) => {
5358
5436
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
5359
- const contentRef = useRef7(null);
5437
+ const contentRef = useRef8(null);
5360
5438
  const reactToPrintFn = useReactToPrint({
5361
5439
  contentRef
5362
5440
  });
@@ -5397,7 +5475,7 @@ var useA4StatementView = ({
5397
5475
  }) => {
5398
5476
  const { store } = useWarqadConfig();
5399
5477
  const isActuallyLoading = externalLoading ?? isLoading;
5400
- const measureContainerRef = useRef7(null);
5478
+ const measureContainerRef = useRef8(null);
5401
5479
  const [pages, setPages] = useState22([]);
5402
5480
  const [isMeasuring, setIsMeasuring] = useState22(true);
5403
5481
  const [globalFilter, setGlobalFilter] = useState22("");
@@ -5765,7 +5843,7 @@ var useA4StatementView = ({
5765
5843
  var useA4DataView_default = useA4StatementView;
5766
5844
 
5767
5845
  // src/hooks/Fetches/useA4CategoryView.tsx
5768
- import { useEffect as useEffect15, useRef as useRef8, useState as useState23 } from "react";
5846
+ import { useEffect as useEffect15, useRef as useRef9, useState as useState23 } from "react";
5769
5847
  import { useReactToPrint as useReactToPrint2 } from "react-to-print";
5770
5848
  import {
5771
5849
  RefreshCw as RefreshCw2,
@@ -5784,7 +5862,7 @@ var useA4CategoryView = ({
5784
5862
  startPage = 1
5785
5863
  } = {}) => {
5786
5864
  const { data: apiData, isLoading, get, error: apiError } = useApis_default();
5787
- const contentRef = useRef8(null);
5865
+ const contentRef = useRef9(null);
5788
5866
  const reactToPrintFn = useReactToPrint2({
5789
5867
  contentRef
5790
5868
  });
@@ -5812,7 +5890,7 @@ var useA4CategoryView = ({
5812
5890
  }) => {
5813
5891
  const { store } = useWarqadConfig();
5814
5892
  const isActuallyLoading = externalLoading ?? isLoading;
5815
- const measureContainerRef = useRef8(null);
5893
+ const measureContainerRef = useRef9(null);
5816
5894
  const [pages, setPages] = useState23([]);
5817
5895
  const [isMeasuring, setIsMeasuring] = useState23(true);
5818
5896
  const [globalFilter, setGlobalFilter] = useState23("");
@@ -7474,17 +7552,17 @@ var preWarningFns = [];
7474
7552
  var preMessage = (fn) => {
7475
7553
  preWarningFns.push(fn);
7476
7554
  };
7477
- function warning(valid, message24) {
7555
+ function warning(valid, message26) {
7478
7556
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
7479
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message24);
7557
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message26);
7480
7558
  if (finalMessage) {
7481
7559
  console.error(`Warning: ${finalMessage}`);
7482
7560
  }
7483
7561
  }
7484
7562
  }
7485
- function note(valid, message24) {
7563
+ function note(valid, message26) {
7486
7564
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
7487
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message24);
7565
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message26);
7488
7566
  if (finalMessage) {
7489
7567
  console.warn(`Note: ${finalMessage}`);
7490
7568
  }
@@ -7493,17 +7571,17 @@ function note(valid, message24) {
7493
7571
  function resetWarned() {
7494
7572
  warned = {};
7495
7573
  }
7496
- function call(method, valid, message24) {
7497
- if (!valid && !warned[message24]) {
7498
- method(false, message24);
7499
- warned[message24] = true;
7574
+ function call(method, valid, message26) {
7575
+ if (!valid && !warned[message26]) {
7576
+ method(false, message26);
7577
+ warned[message26] = true;
7500
7578
  }
7501
7579
  }
7502
- function warningOnce(valid, message24) {
7503
- call(warning, valid, message24);
7580
+ function warningOnce(valid, message26) {
7581
+ call(warning, valid, message26);
7504
7582
  }
7505
- function noteOnce(valid, message24) {
7506
- call(note, valid, message24);
7583
+ function noteOnce(valid, message26) {
7584
+ call(note, valid, message26);
7507
7585
  }
7508
7586
  warningOnce.preMessage = preMessage;
7509
7587
  warningOnce.resetWarned = resetWarned;
@@ -7514,8 +7592,8 @@ import React19, { useContext as useContext5, useEffect as useEffect17 } from "re
7514
7592
  function camelCase(input) {
7515
7593
  return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
7516
7594
  }
7517
- function warning2(valid, message24) {
7518
- warningOnce(valid, `[@ant-design/icons] ${message24}`);
7595
+ function warning2(valid, message26) {
7596
+ warningOnce(valid, `[@ant-design/icons] ${message26}`);
7519
7597
  }
7520
7598
  function isIconDefinition(target) {
7521
7599
  return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
@@ -8254,7 +8332,8 @@ var createAccountSchema = z2.object({
8254
8332
  }).transform((val) => val?.toLowerCase()),
8255
8333
  phoneNumber: z2.string().optional(),
8256
8334
  sex: z2.enum(Enums_default.sex),
8257
- branch: z2.string().optional()
8335
+ branch: z2.string().optional(),
8336
+ currency: z2.string().optional()
8258
8337
  });
8259
8338
 
8260
8339
  // src/components/accounts/AccountForm.tsx
@@ -8311,10 +8390,10 @@ var useAccountbalance = ({
8311
8390
  try {
8312
8391
  const res = await get({
8313
8392
  url,
8314
- v: 2
8393
+ v: 1
8315
8394
  });
8316
- const data = res;
8317
- setBalance(Formats_default.Price(data?.balance, data?.currency));
8395
+ const data = res?.data;
8396
+ setBalance(Formats_default.Price(data?.balance ?? 0, data?.currency ?? "N/A"));
8318
8397
  } catch (error2) {
8319
8398
  setError(error2.message);
8320
8399
  }
@@ -8368,7 +8447,8 @@ function Account({
8368
8447
  v = 1,
8369
8448
  showBalance,
8370
8449
  required,
8371
- disabled
8450
+ disabled,
8451
+ obj
8372
8452
  }) {
8373
8453
  const { branchId } = useParams3();
8374
8454
  const accountId = form?.watch(name);
@@ -8392,7 +8472,8 @@ function Account({
8392
8472
  labelKey: "name",
8393
8473
  valueKey: "_id",
8394
8474
  required,
8395
- disabled
8475
+ disabled,
8476
+ obj
8396
8477
  }
8397
8478
  ),
8398
8479
  /* @__PURE__ */ jsx45(BalanceView, {})
@@ -8412,7 +8493,8 @@ function Customer({
8412
8493
  showBalance,
8413
8494
  required,
8414
8495
  disabled,
8415
- v
8496
+ v,
8497
+ obj
8416
8498
  }) {
8417
8499
  return /* @__PURE__ */ jsx46(
8418
8500
  Account_default,
@@ -8426,7 +8508,8 @@ function Customer({
8426
8508
  filter,
8427
8509
  showBalance,
8428
8510
  required,
8429
- disabled
8511
+ disabled,
8512
+ obj
8430
8513
  }
8431
8514
  );
8432
8515
  }
@@ -8444,6 +8527,7 @@ function Employee({
8444
8527
  showBalance,
8445
8528
  required,
8446
8529
  disabled,
8530
+ obj,
8447
8531
  v
8448
8532
  }) {
8449
8533
  return /* @__PURE__ */ jsx47(
@@ -8458,7 +8542,8 @@ function Employee({
8458
8542
  filter,
8459
8543
  required,
8460
8544
  disabled,
8461
- showBalance
8545
+ showBalance,
8546
+ obj
8462
8547
  }
8463
8548
  );
8464
8549
  }
@@ -8526,7 +8611,8 @@ function AccountForm() {
8526
8611
  name: "",
8527
8612
  email: "",
8528
8613
  phoneNumber: "",
8529
- sex: "male"
8614
+ sex: "male",
8615
+ currency: ""
8530
8616
  },
8531
8617
  shouldUnregister: false
8532
8618
  });
@@ -8636,6 +8722,15 @@ function AccountForm() {
8636
8722
  placeholder: "Select Branch",
8637
8723
  api: "/branches/get?noStore=true"
8638
8724
  }
8725
+ ),
8726
+ /* @__PURE__ */ jsx49(
8727
+ Fields_default.Select,
8728
+ {
8729
+ label: "Currency",
8730
+ form: methods,
8731
+ name: "currency",
8732
+ enumName: "currencies"
8733
+ }
8639
8734
  )
8640
8735
  ] }),
8641
8736
  /* @__PURE__ */ jsx49("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx49(
@@ -10092,17 +10187,16 @@ var WalletField = {
10092
10187
  var Feilds_default2 = WalletField;
10093
10188
 
10094
10189
  // src/components/brands/Brands.tsx
10095
- import { useNavigate as useNavigate11, useParams as useParams9 } from "react-router-dom";
10190
+ import { useNavigate as useNavigate11 } from "react-router-dom";
10096
10191
  import { EllipsisVertical as EllipsisVertical4, FilePenLine as FilePenLine3, Trash2 as Trash24 } from "lucide-react";
10097
10192
  import { useState as useState33 } from "react";
10098
10193
  import { message as message16 } from "antd";
10099
10194
  import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
10100
10195
  function Brands({ v, url }) {
10101
- const { branchId } = useParams9();
10102
10196
  const [deleteBrand, setDeleteBrand] = useState33(null);
10103
10197
  const { isLoading, remove } = useApis_default();
10104
10198
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10105
- url: url || `/brands/get${branchId ? `?branch=${branchId}` : ""}`,
10199
+ url: url || `/brands/get`,
10106
10200
  v,
10107
10201
  dateFilter: false
10108
10202
  });
@@ -10194,8 +10288,7 @@ var Brands_default = Brands;
10194
10288
  // src/components/brands/schema.ts
10195
10289
  import { z as z6 } from "zod";
10196
10290
  var createBrandSchema = z6.object({
10197
- name: z6.string().min(2, { message: "Name must be at least 2 characters" }),
10198
- branch: z6.string().optional()
10291
+ name: z6.string().min(2, { message: "Name must be at least 2 characters" })
10199
10292
  });
10200
10293
 
10201
10294
  // src/components/brands/BrandForm.tsx
@@ -10203,10 +10296,8 @@ import { useForm as useForm10 } from "react-hook-form";
10203
10296
  import { zodResolver as zodResolver9 } from "@hookform/resolvers/zod";
10204
10297
  import { message as message17 } from "antd";
10205
10298
  import { useEffect as useEffect26 } from "react";
10206
- import { useParams as useParams10 } from "react-router-dom";
10207
10299
  import { jsx as jsx64, jsxs as jsxs50 } from "react/jsx-runtime";
10208
10300
  function BrandForm() {
10209
- const { branchId } = useParams10();
10210
10301
  const { getQuery, navigate } = useApp_default();
10211
10302
  const id = getQuery("id");
10212
10303
  const isEdit = !!id;
@@ -10225,18 +10316,12 @@ function BrandForm() {
10225
10316
  if (isEdit) {
10226
10317
  await put({
10227
10318
  url: `/brands/update/${id}`,
10228
- body: {
10229
- ...data,
10230
- branch: branchId ? branchId : data.branch
10231
- }
10319
+ body: data
10232
10320
  });
10233
10321
  } else {
10234
10322
  await post({
10235
10323
  url: "/brands/create",
10236
- body: {
10237
- ...data,
10238
- branch: branchId ? branchId : data.branch
10239
- }
10324
+ body: data
10240
10325
  });
10241
10326
  }
10242
10327
  message17.success(`Brand ${isEdit ? "updated" : "created"} successfully`);
@@ -10248,7 +10333,7 @@ function BrandForm() {
10248
10333
  const fetches = async () => {
10249
10334
  try {
10250
10335
  const res = await get({
10251
- url: `/brands/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10336
+ url: `/brands/get?id=${id}`
10252
10337
  });
10253
10338
  const data = res.data;
10254
10339
  methods.reset(data);
@@ -10277,29 +10362,17 @@ function BrandForm() {
10277
10362
  {
10278
10363
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10279
10364
  children: [
10280
- /* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10281
- /* @__PURE__ */ jsx64(
10282
- Fields_default.Input,
10283
- {
10284
- label: "Name",
10285
- form: methods,
10286
- name: "name",
10287
- type: "text",
10288
- placeholder: "Enter Brand Name",
10289
- required: true
10290
- }
10291
- ),
10292
- !branchId && /* @__PURE__ */ jsx64(
10293
- Feilds_default.Branches,
10294
- {
10295
- label: "Branch",
10296
- form: methods,
10297
- name: "branch",
10298
- placeholder: "Select Branch",
10299
- api: "/branches/get?noStore=true"
10300
- }
10301
- )
10302
- ] }),
10365
+ /* @__PURE__ */ jsx64("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ jsx64(
10366
+ Fields_default.Input,
10367
+ {
10368
+ label: "Name",
10369
+ form: methods,
10370
+ name: "name",
10371
+ type: "text",
10372
+ placeholder: "Enter Brand Name",
10373
+ required: true
10374
+ }
10375
+ ) }),
10303
10376
  /* @__PURE__ */ jsx64("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx64(
10304
10377
  Button,
10305
10378
  {
@@ -10321,7 +10394,7 @@ function BrandForm() {
10321
10394
  var BrandForm_default = BrandForm;
10322
10395
 
10323
10396
  // src/components/brands/Feilds/Brand.tsx
10324
- import { useParams as useParams11 } from "react-router-dom";
10397
+ import { useParams as useParams10 } from "react-router-dom";
10325
10398
  import { jsx as jsx65 } from "react/jsx-runtime";
10326
10399
  function Brand({
10327
10400
  name,
@@ -10334,7 +10407,7 @@ function Brand({
10334
10407
  required,
10335
10408
  disabled
10336
10409
  }) {
10337
- const { branchId } = useParams11();
10410
+ const { branchId } = useParams10();
10338
10411
  return /* @__PURE__ */ jsx65("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx65(
10339
10412
  Fields_default.SearchApi,
10340
10413
  {
@@ -10362,17 +10435,16 @@ var BrandField = {
10362
10435
  var Feilds_default3 = BrandField;
10363
10436
 
10364
10437
  // src/components/categories/Categories.tsx
10365
- import { useNavigate as useNavigate12, useParams as useParams12 } from "react-router-dom";
10438
+ import { useNavigate as useNavigate12 } from "react-router-dom";
10366
10439
  import { EllipsisVertical as EllipsisVertical5, FilePenLine as FilePenLine4, Trash2 as Trash25 } from "lucide-react";
10367
10440
  import { useState as useState34 } from "react";
10368
10441
  import { message as message18 } from "antd";
10369
10442
  import { Fragment as Fragment15, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
10370
10443
  function Categories({ v, url }) {
10371
- const { branchId } = useParams12();
10372
10444
  const [deleteCategory, setDeleteCategory] = useState34(null);
10373
10445
  const { isLoading, remove } = useApis_default();
10374
10446
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10375
- url: url || `/categories/get${branchId ? `?branch=${branchId}` : ""}`,
10447
+ url: url || `/categories/get`,
10376
10448
  v,
10377
10449
  dateFilter: false
10378
10450
  });
@@ -10464,8 +10536,7 @@ var Categories_default = Categories;
10464
10536
  // src/components/categories/schema.ts
10465
10537
  import { z as z7 } from "zod";
10466
10538
  var createCategorySchema = z7.object({
10467
- name: z7.string().min(2, { message: "Name must be at least 2 characters" }),
10468
- branch: z7.string().optional()
10539
+ name: z7.string().min(2, { message: "Name must be at least 2 characters" })
10469
10540
  });
10470
10541
 
10471
10542
  // src/components/categories/CategoryForm.tsx
@@ -10473,10 +10544,8 @@ import { useForm as useForm11 } from "react-hook-form";
10473
10544
  import { zodResolver as zodResolver10 } from "@hookform/resolvers/zod";
10474
10545
  import { message as message19 } from "antd";
10475
10546
  import { useEffect as useEffect27 } from "react";
10476
- import { useParams as useParams13 } from "react-router-dom";
10477
10547
  import { jsx as jsx67, jsxs as jsxs52 } from "react/jsx-runtime";
10478
10548
  function CategoryForm() {
10479
- const { branchId } = useParams13();
10480
10549
  const { getQuery, navigate } = useApp_default();
10481
10550
  const id = getQuery("id");
10482
10551
  const isEdit = !!id;
@@ -10495,18 +10564,12 @@ function CategoryForm() {
10495
10564
  if (isEdit) {
10496
10565
  await put({
10497
10566
  url: `/categories/update/${id}`,
10498
- body: {
10499
- ...data,
10500
- branch: branchId ? branchId : data.branch
10501
- }
10567
+ body: data
10502
10568
  });
10503
10569
  } else {
10504
10570
  await post({
10505
10571
  url: "/categories/create",
10506
- body: {
10507
- ...data,
10508
- branch: branchId ? branchId : data.branch
10509
- }
10572
+ body: data
10510
10573
  });
10511
10574
  }
10512
10575
  message19.success(`Category ${isEdit ? "updated" : "created"} successfully`);
@@ -10518,7 +10581,7 @@ function CategoryForm() {
10518
10581
  const fetches = async () => {
10519
10582
  try {
10520
10583
  const res = await get({
10521
- url: `/categories/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10584
+ url: `/categories/get?id=${id}`
10522
10585
  });
10523
10586
  const data = res.data;
10524
10587
  methods.reset(data);
@@ -10547,29 +10610,17 @@ function CategoryForm() {
10547
10610
  {
10548
10611
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10549
10612
  children: [
10550
- /* @__PURE__ */ jsxs52("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10551
- /* @__PURE__ */ jsx67(
10552
- Fields_default.Input,
10553
- {
10554
- label: "Name",
10555
- form: methods,
10556
- name: "name",
10557
- type: "text",
10558
- placeholder: "Enter Category Name",
10559
- required: true
10560
- }
10561
- ),
10562
- !branchId && /* @__PURE__ */ jsx67(
10563
- Feilds_default.Branches,
10564
- {
10565
- label: "Branch",
10566
- form: methods,
10567
- name: "branch",
10568
- placeholder: "Select Branch",
10569
- api: "/branches/get?noStore=true"
10570
- }
10571
- )
10572
- ] }),
10613
+ /* @__PURE__ */ jsx67("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ jsx67(
10614
+ Fields_default.Input,
10615
+ {
10616
+ label: "Name",
10617
+ form: methods,
10618
+ name: "name",
10619
+ type: "text",
10620
+ placeholder: "Enter Category Name",
10621
+ required: true
10622
+ }
10623
+ ) }),
10573
10624
  /* @__PURE__ */ jsx67("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx67(
10574
10625
  Button,
10575
10626
  {
@@ -10591,7 +10642,7 @@ function CategoryForm() {
10591
10642
  var CategoryForm_default = CategoryForm;
10592
10643
 
10593
10644
  // src/components/categories/Feilds/Category.tsx
10594
- import { useParams as useParams14 } from "react-router-dom";
10645
+ import { useParams as useParams12 } from "react-router-dom";
10595
10646
  import { jsx as jsx68 } from "react/jsx-runtime";
10596
10647
  function Category({
10597
10648
  name,
@@ -10604,7 +10655,7 @@ function Category({
10604
10655
  required,
10605
10656
  disabled
10606
10657
  }) {
10607
- const { branchId } = useParams14();
10658
+ const { branchId } = useParams12();
10608
10659
  return /* @__PURE__ */ jsx68("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx68(
10609
10660
  Fields_default.SearchApi,
10610
10661
  {
@@ -10632,17 +10683,16 @@ var CategoryField = {
10632
10683
  var Feilds_default4 = CategoryField;
10633
10684
 
10634
10685
  // src/components/products/Products.tsx
10635
- import { useNavigate as useNavigate13, useParams as useParams15 } from "react-router-dom";
10686
+ import { useNavigate as useNavigate13 } from "react-router-dom";
10636
10687
  import { EllipsisVertical as EllipsisVertical6, FilePenLine as FilePenLine5, Trash2 as Trash26 } from "lucide-react";
10637
10688
  import { useState as useState35 } from "react";
10638
10689
  import { message as message20 } from "antd";
10639
10690
  import { Fragment as Fragment16, jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
10640
10691
  function Products({ v, url }) {
10641
- const { branchId } = useParams15();
10642
10692
  const [deleteProduct, setDeleteProduct] = useState35(null);
10643
10693
  const { isLoading, remove } = useApis_default();
10644
10694
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10645
- url: url || `/products/get${branchId ? `?branch=${branchId}` : ""}`,
10695
+ url: url || `/products/get`,
10646
10696
  v,
10647
10697
  dateFilter: false
10648
10698
  });
@@ -10764,8 +10814,7 @@ var createProductSchema = z8.object({
10764
10814
  name: z8.string().min(2, { message: "Name must be at least 2 characters" }),
10765
10815
  category: z8.string().optional(),
10766
10816
  brand: z8.string().optional(),
10767
- cost: z8.number({ message: "Cost is required" }).min(0),
10768
- branch: z8.string().optional()
10817
+ cost: z8.number({ message: "Cost is required" }).min(0)
10769
10818
  });
10770
10819
 
10771
10820
  // src/components/products/ProductForm.tsx
@@ -10773,10 +10822,8 @@ import { useForm as useForm12 } from "react-hook-form";
10773
10822
  import { zodResolver as zodResolver11 } from "@hookform/resolvers/zod";
10774
10823
  import { message as message21 } from "antd";
10775
10824
  import { useEffect as useEffect28 } from "react";
10776
- import { useParams as useParams16 } from "react-router-dom";
10777
10825
  import { jsx as jsx70, jsxs as jsxs54 } from "react/jsx-runtime";
10778
10826
  function ProductForm() {
10779
- const { branchId } = useParams16();
10780
10827
  const { getQuery, navigate } = useApp_default();
10781
10828
  const id = getQuery("id");
10782
10829
  const isEdit = !!id;
@@ -10798,18 +10845,12 @@ function ProductForm() {
10798
10845
  if (isEdit) {
10799
10846
  await put({
10800
10847
  url: `/products/update/${id}`,
10801
- body: {
10802
- ...data,
10803
- branch: branchId ? branchId : data.branch
10804
- }
10848
+ body: data
10805
10849
  });
10806
10850
  } else {
10807
10851
  await post({
10808
10852
  url: "/products/create",
10809
- body: {
10810
- ...data,
10811
- branch: branchId ? branchId : data.branch
10812
- }
10853
+ body: data
10813
10854
  });
10814
10855
  }
10815
10856
  message21.success(`Product ${isEdit ? "updated" : "created"} successfully`);
@@ -10821,7 +10862,7 @@ function ProductForm() {
10821
10862
  const fetches = async () => {
10822
10863
  try {
10823
10864
  const res = await get({
10824
- url: `/products/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10865
+ url: `/products/get?id=${id}`
10825
10866
  });
10826
10867
  const data = res.data;
10827
10868
  methods.reset(data);
@@ -10890,16 +10931,6 @@ function ProductForm() {
10890
10931
  name: "brand",
10891
10932
  api: "/brands/get"
10892
10933
  }
10893
- ),
10894
- !branchId && /* @__PURE__ */ jsx70(
10895
- Feilds_default.Branches,
10896
- {
10897
- label: "Branch",
10898
- form: methods,
10899
- name: "branch",
10900
- placeholder: "Select Branch",
10901
- api: "/branches/get?noStore=true"
10902
- }
10903
10934
  )
10904
10935
  ] }),
10905
10936
  /* @__PURE__ */ jsx70("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx70(
@@ -10923,7 +10954,7 @@ function ProductForm() {
10923
10954
  var ProductForm_default = ProductForm;
10924
10955
 
10925
10956
  // src/components/products/Feilds/Product.tsx
10926
- import { useParams as useParams17 } from "react-router-dom";
10957
+ import { useParams as useParams14 } from "react-router-dom";
10927
10958
  import { jsx as jsx71 } from "react/jsx-runtime";
10928
10959
  function Product({
10929
10960
  name,
@@ -10938,7 +10969,7 @@ function Product({
10938
10969
  onChange,
10939
10970
  obj
10940
10971
  }) {
10941
- const { branchId } = useParams17();
10972
+ const { branchId } = useParams14();
10942
10973
  return /* @__PURE__ */ jsx71("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx71(
10943
10974
  Fields_default.SearchApi,
10944
10975
  {
@@ -10968,17 +10999,16 @@ var ProductField = {
10968
10999
  var Feilds_default5 = ProductField;
10969
11000
 
10970
11001
  // src/components/packs/Packs.tsx
10971
- import { useNavigate as useNavigate14, useParams as useParams18 } from "react-router-dom";
11002
+ import { useNavigate as useNavigate14 } from "react-router-dom";
10972
11003
  import { EllipsisVertical as EllipsisVertical7, FilePenLine as FilePenLine6, Trash2 as Trash27 } from "lucide-react";
10973
11004
  import { useState as useState36 } from "react";
10974
11005
  import { message as message22 } from "antd";
10975
11006
  import { Fragment as Fragment17, jsx as jsx72, jsxs as jsxs55 } from "react/jsx-runtime";
10976
11007
  function Packs({ v, url }) {
10977
- const { branchId } = useParams18();
10978
11008
  const [deletePack, setDeletePack] = useState36(null);
10979
11009
  const { isLoading, remove } = useApis_default();
10980
11010
  const { data, TransactionViewComponent, reload } = useTransaction_default({
10981
- url: url || `/packs/get${branchId ? `?branch=${branchId}` : ""}`,
11011
+ url: url || `/packs/get`,
10982
11012
  v,
10983
11013
  dateFilter: false
10984
11014
  });
@@ -11100,7 +11130,6 @@ var createPackSchema = z9.object({
11100
11130
  type: packTypes,
11101
11131
  name: z9.string().min(2, { message: "Name must be at least 2 characters" }),
11102
11132
  products: z9.array(packProductItemSchema).min(1, "At least one product is required"),
11103
- branch: z9.string().optional(),
11104
11133
  tempProduct: z9.string().optional(),
11105
11134
  tempQty: z9.number().optional(),
11106
11135
  tempCost: z9.number().optional(),
@@ -11112,11 +11141,9 @@ import { useForm as useForm13, useFieldArray } from "react-hook-form";
11112
11141
  import { zodResolver as zodResolver12 } from "@hookform/resolvers/zod";
11113
11142
  import { message as message23 } from "antd";
11114
11143
  import { useEffect as useEffect29 } from "react";
11115
- import { useParams as useParams19 } from "react-router-dom";
11116
11144
  import { Plus as Plus3, Trash2 as Trash28 } from "lucide-react";
11117
11145
  import { jsx as jsx73, jsxs as jsxs56 } from "react/jsx-runtime";
11118
11146
  function PackForm() {
11119
- const { branchId } = useParams19();
11120
11147
  const { getQuery, navigate } = useApp_default();
11121
11148
  const id = getQuery("id");
11122
11149
  const isEdit = !!id;
@@ -11172,10 +11199,7 @@ function PackForm() {
11172
11199
  } else {
11173
11200
  await post({
11174
11201
  url: "/packs/create",
11175
- body: {
11176
- ...formattedData,
11177
- branch: branchId ? branchId : data.branch
11178
- }
11202
+ body: formattedData
11179
11203
  });
11180
11204
  }
11181
11205
  message23.success(`Pack ${isEdit ? "updated" : "created"} successfully`);
@@ -11187,7 +11211,7 @@ function PackForm() {
11187
11211
  const fetches = async () => {
11188
11212
  try {
11189
11213
  const res = await get({
11190
- url: `/packs/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
11214
+ url: `/packs/get?id=${id}`
11191
11215
  });
11192
11216
  const data = res.data;
11193
11217
  data.products = data.products.map((p, index) => ({
@@ -11247,16 +11271,6 @@ function PackForm() {
11247
11271
  enumName: "packTypes",
11248
11272
  required: true
11249
11273
  }
11250
- ),
11251
- !branchId && /* @__PURE__ */ jsx73(
11252
- Feilds_default.Branches,
11253
- {
11254
- label: "Branch",
11255
- form: methods,
11256
- name: "branch",
11257
- placeholder: "Select Branch",
11258
- api: "/branches/get?noStore=true"
11259
- }
11260
11274
  )
11261
11275
  ] }),
11262
11276
  /* @__PURE__ */ jsxs56("div", { className: "border rounded-lg p-4 bg-gray-50/50 dark:bg-gray-800/20", children: [
@@ -11443,29 +11457,527 @@ function Pack({
11443
11457
  }
11444
11458
  var Pack_default = { Pack };
11445
11459
 
11460
+ // src/components/journals/Journals.tsx
11461
+ import { useNavigate as useNavigate15, useParams as useParams16 } from "react-router-dom";
11462
+ import { EllipsisVertical as EllipsisVertical8, FilePenLine as FilePenLine7, Trash2 as Trash29 } from "lucide-react";
11463
+ import { useState as useState38 } from "react";
11464
+ import { message as message24 } from "antd";
11465
+ import { Fragment as Fragment18, jsx as jsx75, jsxs as jsxs57 } from "react/jsx-runtime";
11466
+ function Journals({ url }) {
11467
+ const { branchId } = useParams16();
11468
+ const navigate = useNavigate15();
11469
+ const [deleteJournal, setDeleteJournal] = useState38(null);
11470
+ const { isLoading, remove } = useApis_default();
11471
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
11472
+ url: url || `/transactions/get?type=journal${branchId ? `&branch=${branchId}` : ""}`,
11473
+ dateFilter: true
11474
+ });
11475
+ const { Modal: Modal2 } = useModal();
11476
+ const items = (data2) => [
11477
+ {
11478
+ label: `Edit Journal`,
11479
+ icon: /* @__PURE__ */ jsx75(FilePenLine7, { size: 16 }),
11480
+ onClick: () => navigate(`update?id=${data2?._id}`)
11481
+ },
11482
+ {
11483
+ label: `Delete Journal`,
11484
+ icon: /* @__PURE__ */ jsx75(Trash29, { className: "text-red-500", size: 16 }),
11485
+ onClick: () => setDeleteJournal(data2)
11486
+ }
11487
+ ].filter(Boolean);
11488
+ const columns = [
11489
+ {
11490
+ accessorKey: "date",
11491
+ header: "Date",
11492
+ cell: ({ row }) => {
11493
+ const journal = row.original;
11494
+ return /* @__PURE__ */ jsx75("span", { children: journal?.date });
11495
+ }
11496
+ },
11497
+ {
11498
+ accessorKey: "account",
11499
+ header: "Account",
11500
+ cell: ({ row }) => {
11501
+ const journal = row.original;
11502
+ return /* @__PURE__ */ jsx75("span", { children: journal?.accountData?.name || "N/A" });
11503
+ }
11504
+ },
11505
+ {
11506
+ accessorKey: "amount",
11507
+ header: "Amount",
11508
+ cell: ({ row }) => {
11509
+ const journal = row.original;
11510
+ return /* @__PURE__ */ jsxs57("div", { className: "flex flex-col", children: [
11511
+ /* @__PURE__ */ jsx75("span", { children: Formats_default.Price(journal?.amount, journal?.currency) }),
11512
+ journal?.fee && /* @__PURE__ */ jsxs57("span", { className: "text-xs text-green-600", children: [
11513
+ "with fee: ",
11514
+ Formats_default.Price(journal?.feeAmount, journal?.currency)
11515
+ ] }),
11516
+ journal?.exchange?.rate && /* @__PURE__ */ jsxs57("span", { className: "text-xs text-green-600", children: [
11517
+ "Exchanged:",
11518
+ " ",
11519
+ Formats_default.Price(
11520
+ journal?.exchange?.amount,
11521
+ journal?.exchange?.currency
11522
+ )
11523
+ ] })
11524
+ ] });
11525
+ }
11526
+ },
11527
+ {
11528
+ accessorKey: "journal",
11529
+ header: "Type",
11530
+ cell: ({ row }) => {
11531
+ const journal = row.original;
11532
+ return /* @__PURE__ */ jsx75("span", { className: "capitalize", children: journal?.journal });
11533
+ }
11534
+ },
11535
+ {
11536
+ accessorKey: "journalVia",
11537
+ header: "Via",
11538
+ cell: ({ row }) => {
11539
+ const journal = row.original;
11540
+ return /* @__PURE__ */ jsxs57("div", { className: "", children: [
11541
+ /* @__PURE__ */ jsx75("p", { className: "capitalize", children: journal?.journalVia }),
11542
+ journal?.journalVia === "via account" && /* @__PURE__ */ jsx75("p", { className: "capitalize text-xs text-gray-600", children: journal?.viaAccountData?.name })
11543
+ ] });
11544
+ }
11545
+ },
11546
+ {
11547
+ accessorKey: "action",
11548
+ header: "Action",
11549
+ cell: ({ row }) => {
11550
+ const journal = row.original;
11551
+ return /* @__PURE__ */ jsx75("span", { className: "capitalize", children: journal?.action });
11552
+ }
11553
+ },
11554
+ {
11555
+ accessorKey: "actions",
11556
+ header: "Actions",
11557
+ cell: ({ row }) => {
11558
+ const data2 = row.original;
11559
+ return /* @__PURE__ */ jsx75(
11560
+ Dropdown,
11561
+ {
11562
+ className: "cursor-pointer w-[150px]",
11563
+ items: items(data2),
11564
+ triggerMode: "hover",
11565
+ children: /* @__PURE__ */ jsx75(EllipsisVertical8, {})
11566
+ }
11567
+ );
11568
+ }
11569
+ }
11570
+ ];
11571
+ const journals = data?.data || [];
11572
+ const onDelete = async (id) => {
11573
+ try {
11574
+ await remove({ url: `/journals/delete/${id}` });
11575
+ message24.success("Journal deleted successfully");
11576
+ reload();
11577
+ setDeleteJournal(null);
11578
+ } catch (error) {
11579
+ message24.error(error.message || "Something went wrong");
11580
+ return error;
11581
+ }
11582
+ };
11583
+ return /* @__PURE__ */ jsxs57(Fragment18, { children: [
11584
+ /* @__PURE__ */ jsx75(Modal2, {}),
11585
+ /* @__PURE__ */ jsx75(
11586
+ ConfirmModal,
11587
+ {
11588
+ isOpen: !!deleteJournal,
11589
+ isLoading,
11590
+ onClose: () => setDeleteJournal(null),
11591
+ title: `Delete Journal`,
11592
+ description: `Are you sure you want to delete this journal entry of "${deleteJournal?.amount}"? This action cannot be undone.`,
11593
+ confirmationWord: "delete",
11594
+ onSubmit: () => onDelete(deleteJournal?._id),
11595
+ children: null
11596
+ }
11597
+ ),
11598
+ /* @__PURE__ */ jsx75(
11599
+ TransactionViewComponent,
11600
+ {
11601
+ columns,
11602
+ data: journals,
11603
+ title: "Journals",
11604
+ description: "Manage your journal entries",
11605
+ index: true,
11606
+ createTitle: "Add Journal",
11607
+ onCreate: () => {
11608
+ navigate("create");
11609
+ }
11610
+ }
11611
+ )
11612
+ ] });
11613
+ }
11614
+ var Journals_default = Journals;
11615
+
11616
+ // src/utils/zod.ts
11617
+ import moment2 from "moment";
11618
+ import { z as z10 } from "zod";
11619
+ var zodFields = {
11620
+ date: z10.string().regex(
11621
+ /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/,
11622
+ "Date must be in format DD/MM/YYYY"
11623
+ ).refine((val) => moment2(val, "DD/MM/YYYY", true).isValid(), {
11624
+ message: "Date is not a valid calendar date"
11625
+ })
11626
+ };
11627
+
11628
+ // src/components/journals/schema.ts
11629
+ import { z as z11 } from "zod";
11630
+ var journalSchema = z11.object({
11631
+ date: zodFields.date,
11632
+ amount: z11.number().gt(0, "Amount must be greater than 0"),
11633
+ account: z11.string(),
11634
+ description: z11.string(),
11635
+ journalVia: z11.enum(Enums_default.viaTypes),
11636
+ action: z11.enum(Enums_default.actionTypes).optional(),
11637
+ viaAccount: z11.string().optional(),
11638
+ viaAccountObject: z11.any().optional(),
11639
+ accountObject: z11.any().optional(),
11640
+ //exchange
11641
+ rate: z11.coerce.number().gte(0).optional(),
11642
+ exchangedAmount: z11.coerce.number().gte(0).optional(),
11643
+ fee: z11.coerce.number().gte(0)
11644
+ });
11645
+
11646
+ // src/components/journals/JournalForm.tsx
11647
+ import { useForm as useForm14 } from "react-hook-form";
11648
+ import { zodResolver as zodResolver13 } from "@hookform/resolvers/zod";
11649
+ import { message as message25 } from "antd";
11650
+ import { useEffect as useEffect30, useMemo as useMemo10, useState as useState39 } from "react";
11651
+ import { useParams as useParams17 } from "react-router-dom";
11652
+
11653
+ // src/utils/forex.ts
11654
+ function exchangedAmount({
11655
+ accountCurrency,
11656
+ amount,
11657
+ exchangeRate,
11658
+ transactionCurrency,
11659
+ trunc = false
11660
+ }) {
11661
+ if (!Enums_default.currencies.includes(accountCurrency)) {
11662
+ throw new Error("Invalid account currency");
11663
+ }
11664
+ if (!Enums_default.currencies.includes(transactionCurrency)) {
11665
+ throw new Error("Invalid transaction currency");
11666
+ }
11667
+ let result;
11668
+ if (accountCurrency === transactionCurrency) {
11669
+ result = amount;
11670
+ } else if (accountCurrency === "USD") {
11671
+ result = amount / exchangeRate;
11672
+ } else if (accountCurrency === "CNY") {
11673
+ result = transactionCurrency === "USD" ? amount * exchangeRate : amount / exchangeRate;
11674
+ } else if (accountCurrency === "KES") {
11675
+ result = transactionCurrency === "TZS" ? amount / exchangeRate : amount * exchangeRate;
11676
+ } else if (accountCurrency === "TZS") {
11677
+ result = amount * exchangeRate;
11678
+ } else {
11679
+ throw new Error("Unsupported currency conversion");
11680
+ }
11681
+ return trunc ? Math.trunc(result) : result;
11682
+ }
11683
+ var Forex = {
11684
+ exchangedAmount
11685
+ };
11686
+ var forex_default = Forex;
11687
+
11688
+ // src/components/journals/JournalForm.tsx
11689
+ import { Fragment as Fragment19, jsx as jsx76, jsxs as jsxs58 } from "react/jsx-runtime";
11690
+ function JournalForm({
11691
+ isFee = true,
11692
+ accountType = "all"
11693
+ }) {
11694
+ const { branchId } = useParams17();
11695
+ const { getQuery, navigate } = useApp_default();
11696
+ const id = getQuery("id");
11697
+ const isEdit = !!id;
11698
+ const [ref, setRef] = useState39("");
11699
+ const { post, isLoading } = useApis_default();
11700
+ const { isLoading: isLoadingGet, get } = useApis_default();
11701
+ const methods = useForm14({
11702
+ resolver: zodResolver13(journalSchema),
11703
+ defaultValues: {
11704
+ date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
11705
+ amount: 0,
11706
+ account: "",
11707
+ fee: 0,
11708
+ action: "debit",
11709
+ journalVia: "direct"
11710
+ }
11711
+ });
11712
+ const { handleSubmit } = methods;
11713
+ const journalVia = methods.watch("journalVia");
11714
+ const account = methods.watch("account");
11715
+ const viaAccount = methods.watch("viaAccount");
11716
+ const viaAccountObj = methods.watch("viaAccountObject");
11717
+ const accountObj = methods.watch("accountObject");
11718
+ const amount = methods.watch("amount");
11719
+ const fee = methods.watch("fee");
11720
+ const rate = methods.watch("rate");
11721
+ const isRate = accountObj?.currency && viaAccountObj?.currency && accountObj?.currency !== viaAccountObj?.currency;
11722
+ const onSubmit = async (data) => {
11723
+ try {
11724
+ const payload = {
11725
+ ...data,
11726
+ journal: "journal",
11727
+ type: "journal",
11728
+ action: data.journalVia === "via account" ? "debit" : data.action,
11729
+ branch: branchId ?? void 0
11730
+ };
11731
+ await post({
11732
+ url: `/transactions/add${isEdit ? `?ref=${ref}` : ""}`,
11733
+ body: payload
11734
+ });
11735
+ message25.success(`Journal saved successfully`);
11736
+ navigate(-1);
11737
+ } catch (error) {
11738
+ message25.error(error?.message || "Something went wrong");
11739
+ }
11740
+ };
11741
+ const fetches = async () => {
11742
+ try {
11743
+ const res = await get({
11744
+ url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
11745
+ });
11746
+ const data = res.data;
11747
+ console.log(data);
11748
+ methods.reset({
11749
+ ...data,
11750
+ rate: data?.exchange?.rate
11751
+ });
11752
+ setRef(data?.ref);
11753
+ } catch (error) {
11754
+ message25.error(error?.message || "Something went wrong");
11755
+ navigate(-1);
11756
+ }
11757
+ };
11758
+ const exchangedAmount2 = useMemo10(() => {
11759
+ if (isRate) {
11760
+ const am = forex_default.exchangedAmount({
11761
+ accountCurrency: accountObj?.currency,
11762
+ amount,
11763
+ exchangeRate: rate ?? 1,
11764
+ transactionCurrency: viaAccountObj?.currency
11765
+ });
11766
+ return Formats_default.Price(am, accountObj?.currency ?? "N/A");
11767
+ }
11768
+ }, [
11769
+ amount,
11770
+ viaAccountObj?.rate,
11771
+ accountObj?.currency,
11772
+ viaAccountObj?.currency,
11773
+ rate
11774
+ ]);
11775
+ const viaAccountAmount = useMemo10(() => {
11776
+ if (fee) {
11777
+ const am = amount + fee / 100 * amount;
11778
+ return Formats_default.Price(
11779
+ am,
11780
+ viaAccountObj?.currency ?? accountObj?.currency ?? "N/A"
11781
+ );
11782
+ } else {
11783
+ return Formats_default.Price(
11784
+ amount,
11785
+ viaAccountObj?.currency ?? accountObj?.currency ?? "N/A"
11786
+ );
11787
+ }
11788
+ }, [fee, amount, viaAccountObj?.currency, accountObj?.currency]);
11789
+ useEffect30(() => {
11790
+ if (isEdit) {
11791
+ fetches();
11792
+ }
11793
+ }, [id]);
11794
+ return /* @__PURE__ */ jsxs58(
11795
+ Card,
11796
+ {
11797
+ className: "max-w-4xl mx-auto mt-10 relative",
11798
+ isLoading: isLoadingGet,
11799
+ loadingText: "Processing...",
11800
+ children: [
11801
+ /* @__PURE__ */ jsxs58(Card.Header, { children: [
11802
+ /* @__PURE__ */ jsx76(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Journal` }),
11803
+ /* @__PURE__ */ jsx76(Card.Description, { children: isEdit ? `Update the details for this journal entry` : `Create a new journal entry` })
11804
+ ] }),
11805
+ /* @__PURE__ */ jsx76(Card.Content, { children: /* @__PURE__ */ jsxs58(
11806
+ "form",
11807
+ {
11808
+ className: "space-y-4",
11809
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
11810
+ children: [
11811
+ /* @__PURE__ */ jsxs58("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
11812
+ /* @__PURE__ */ jsx76(
11813
+ Fields_default.Input,
11814
+ {
11815
+ label: "Description",
11816
+ form: methods,
11817
+ name: "description",
11818
+ placeholder: "Enter description",
11819
+ required: true
11820
+ }
11821
+ ),
11822
+ /* @__PURE__ */ jsx76(
11823
+ Fields_default.Select,
11824
+ {
11825
+ label: "Journal Via",
11826
+ form: methods,
11827
+ name: "journalVia",
11828
+ enumName: "viaTypes",
11829
+ required: true
11830
+ }
11831
+ )
11832
+ ] }),
11833
+ /* @__PURE__ */ jsxs58("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
11834
+ /* @__PURE__ */ jsx76(
11835
+ Fields_default.DateInput,
11836
+ {
11837
+ label: "Date",
11838
+ form: methods,
11839
+ name: "date",
11840
+ required: true
11841
+ }
11842
+ ),
11843
+ journalVia === "via account" && /* @__PURE__ */ jsx76(
11844
+ Feilds_default.Account,
11845
+ {
11846
+ label: "Via Account",
11847
+ form: methods,
11848
+ name: "viaAccount",
11849
+ api: "/accounts/get/all",
11850
+ placeholder: "Search for account...",
11851
+ filter: [account],
11852
+ required: true,
11853
+ obj: "viaAccountObject",
11854
+ showBalance: true
11855
+ }
11856
+ ),
11857
+ /* @__PURE__ */ jsx76(
11858
+ Feilds_default.Account,
11859
+ {
11860
+ label: accountType === "all" ? "Account" : accountType,
11861
+ form: methods,
11862
+ name: "account",
11863
+ api: `/accounts/get/${accountType}`,
11864
+ placeholder: "Search for account...",
11865
+ filter: [viaAccount],
11866
+ required: true,
11867
+ showBalance: true,
11868
+ obj: "accountObject"
11869
+ }
11870
+ ),
11871
+ /* @__PURE__ */ jsx76(
11872
+ Fields_default.Input,
11873
+ {
11874
+ label: "Amount",
11875
+ form: methods,
11876
+ name: "amount",
11877
+ type: "number",
11878
+ placeholder: "0.00",
11879
+ required: true
11880
+ }
11881
+ ),
11882
+ journalVia !== "via account" && /* @__PURE__ */ jsx76(
11883
+ Fields_default.Select,
11884
+ {
11885
+ label: "Action",
11886
+ form: methods,
11887
+ name: "action",
11888
+ enumName: "actionTypes",
11889
+ required: true
11890
+ }
11891
+ ),
11892
+ isRate && /* @__PURE__ */ jsxs58(Fragment19, { children: [
11893
+ /* @__PURE__ */ jsx76(
11894
+ Fields_default.Input,
11895
+ {
11896
+ label: "Rate",
11897
+ type: "number",
11898
+ name: "rate",
11899
+ form: methods,
11900
+ required: true
11901
+ }
11902
+ ),
11903
+ /* @__PURE__ */ jsx76(
11904
+ Fields_default.Input,
11905
+ {
11906
+ label: "Exchanged Amount",
11907
+ type: "text",
11908
+ readOnly: true,
11909
+ disabled: true,
11910
+ value: exchangedAmount2
11911
+ }
11912
+ ),
11913
+ " "
11914
+ ] }),
11915
+ isFee && /* @__PURE__ */ jsxs58(Fragment19, { children: [
11916
+ /* @__PURE__ */ jsx76(
11917
+ Fields_default.Input,
11918
+ {
11919
+ label: "Fee",
11920
+ type: "number",
11921
+ name: "fee",
11922
+ form: methods,
11923
+ required: true
11924
+ }
11925
+ ),
11926
+ /* @__PURE__ */ jsx76(
11927
+ Fields_default.Input,
11928
+ {
11929
+ label: "Amount After Fee",
11930
+ type: "text",
11931
+ readOnly: true,
11932
+ disabled: true,
11933
+ value: viaAccountAmount
11934
+ }
11935
+ )
11936
+ ] })
11937
+ ] }),
11938
+ /* @__PURE__ */ jsx76("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx76(
11939
+ Button,
11940
+ {
11941
+ isLoading,
11942
+ disabled: isLoading,
11943
+ type: "submit",
11944
+ className: "min-w-[100px]",
11945
+ variant: !isEdit ? "primary" : "warning",
11946
+ children: isEdit ? "Update" : "Add"
11947
+ }
11948
+ ) })
11949
+ ]
11950
+ }
11951
+ ) })
11952
+ ]
11953
+ }
11954
+ );
11955
+ }
11956
+ var JournalForm_default = JournalForm;
11957
+
11446
11958
  // src/components/ErrorPage/ErrorPage.tsx
11447
- import { jsx as jsx75, jsxs as jsxs57 } from "react/jsx-runtime";
11959
+ import { jsx as jsx77, jsxs as jsxs59 } from "react/jsx-runtime";
11448
11960
  var ErrorPageBase = ({
11449
11961
  title,
11450
- message: message24,
11962
+ message: message26,
11451
11963
  statusCode,
11452
11964
  action,
11453
11965
  className = ""
11454
11966
  }) => {
11455
- return /* @__PURE__ */ jsx75(
11967
+ return /* @__PURE__ */ jsx77(
11456
11968
  "div",
11457
11969
  {
11458
11970
  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}`,
11459
- children: /* @__PURE__ */ jsxs57("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
11460
- statusCode && /* @__PURE__ */ jsx75("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__ */ jsx75("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
11461
- /* @__PURE__ */ jsxs57("div", { className: "relative z-10 space-y-6", children: [
11462
- statusCode && /* @__PURE__ */ jsxs57("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
11971
+ children: /* @__PURE__ */ jsxs59("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
11972
+ statusCode && /* @__PURE__ */ jsx77("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__ */ jsx77("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
11973
+ /* @__PURE__ */ jsxs59("div", { className: "relative z-10 space-y-6", children: [
11974
+ statusCode && /* @__PURE__ */ jsxs59("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
11463
11975
  "Error ",
11464
11976
  statusCode
11465
11977
  ] }),
11466
- title && /* @__PURE__ */ jsx75("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
11467
- message24 && /* @__PURE__ */ jsx75("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message24 }),
11468
- action && /* @__PURE__ */ jsx75("div", { className: "pt-8", children: /* @__PURE__ */ jsx75(
11978
+ title && /* @__PURE__ */ jsx77("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
11979
+ message26 && /* @__PURE__ */ jsx77("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message26 }),
11980
+ action && /* @__PURE__ */ jsx77("div", { className: "pt-8", children: /* @__PURE__ */ jsx77(
11469
11981
  "button",
11470
11982
  {
11471
11983
  onClick: action.onClick,
@@ -11481,9 +11993,9 @@ var ErrorPageBase = ({
11481
11993
  };
11482
11994
 
11483
11995
  // src/components/ErrorPage/ErrorPage.500.tsx
11484
- import { jsx as jsx76 } from "react/jsx-runtime";
11996
+ import { jsx as jsx78 } from "react/jsx-runtime";
11485
11997
  var ErrorPage500 = (props) => {
11486
- return /* @__PURE__ */ jsx76(
11998
+ return /* @__PURE__ */ jsx78(
11487
11999
  ErrorPageBase,
11488
12000
  {
11489
12001
  statusCode: 500,
@@ -11496,9 +12008,9 @@ var ErrorPage500 = (props) => {
11496
12008
  };
11497
12009
 
11498
12010
  // src/components/ErrorPage/ErrorPage.404.tsx
11499
- import { jsx as jsx77 } from "react/jsx-runtime";
12011
+ import { jsx as jsx79 } from "react/jsx-runtime";
11500
12012
  var ErrorPage404 = (props) => {
11501
- return /* @__PURE__ */ jsx77(
12013
+ return /* @__PURE__ */ jsx79(
11502
12014
  ErrorPageBase,
11503
12015
  {
11504
12016
  statusCode: 404,
@@ -11511,9 +12023,9 @@ var ErrorPage404 = (props) => {
11511
12023
  };
11512
12024
 
11513
12025
  // src/components/ErrorPage/ErrorPage.401.tsx
11514
- import { jsx as jsx78 } from "react/jsx-runtime";
12026
+ import { jsx as jsx80 } from "react/jsx-runtime";
11515
12027
  var ErrorPage401 = (props) => {
11516
- return /* @__PURE__ */ jsx78(
12028
+ return /* @__PURE__ */ jsx80(
11517
12029
  ErrorPageBase,
11518
12030
  {
11519
12031
  statusCode: 401,
@@ -11526,9 +12038,9 @@ var ErrorPage401 = (props) => {
11526
12038
  };
11527
12039
 
11528
12040
  // src/components/ErrorPage/ErrorPage.400.tsx
11529
- import { jsx as jsx79 } from "react/jsx-runtime";
12041
+ import { jsx as jsx81 } from "react/jsx-runtime";
11530
12042
  var ErrorPage400 = (props) => {
11531
- return /* @__PURE__ */ jsx79(
12043
+ return /* @__PURE__ */ jsx81(
11532
12044
  ErrorPageBase,
11533
12045
  {
11534
12046
  statusCode: 400,
@@ -11581,6 +12093,8 @@ export {
11581
12093
  Guard,
11582
12094
  InfoGrid,
11583
12095
  Input,
12096
+ JournalForm_default as JournalForm,
12097
+ Journals_default as Journals,
11584
12098
  linkUser_default as LinkUser,
11585
12099
  LoadingBox,
11586
12100
  LoadingSpin,
@@ -11633,6 +12147,7 @@ export {
11633
12147
  createUserSchema,
11634
12148
  createWalletSchema,
11635
12149
  generatePdf,
12150
+ journalSchema,
11636
12151
  linkUserSchema,
11637
12152
  packProductItemSchema,
11638
12153
  packTypes,