warqadui 0.0.273 → 0.0.276

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
@@ -124,6 +124,7 @@ __export(index_exports, {
124
124
  Posts: () => posts_default,
125
125
  ProductField: () => Feilds_default5,
126
126
  ProductForm: () => ProductForm_default,
127
+ ProductImage: () => ProductImage_default,
127
128
  ProductList: () => ProductList_default,
128
129
  Products: () => Products_default,
129
130
  ProfileAccount: () => profileAccount_default,
@@ -315,7 +316,8 @@ var Enums = {
315
316
  "invoice-manager",
316
317
  "payment-3",
317
318
  "journal-3",
318
- "forex-2"
319
+ "forex-2",
320
+ "expense-3"
319
321
  ],
320
322
  stockTypes: ["pack", "product"],
321
323
  saleStockTypes: ["pack", "product"],
@@ -1807,13 +1809,13 @@ var Input = (0, import_react11.forwardRef)(
1807
1809
  }
1808
1810
  }
1809
1811
  }, [props.value, name, form]);
1810
- let message90 = error;
1812
+ let message91 = error;
1811
1813
  if (form && name) {
1812
1814
  const {
1813
1815
  formState: { errors }
1814
1816
  } = form;
1815
1817
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
1816
- message90 = errorObj?.message;
1818
+ message91 = errorObj?.message;
1817
1819
  }
1818
1820
  const watchedValue = form?.watch(name);
1819
1821
  (0, import_react11.useEffect)(() => {
@@ -1882,7 +1884,7 @@ var Input = (0, import_react11.forwardRef)(
1882
1884
  }
1883
1885
  )
1884
1886
  ] }),
1885
- message90 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message90 })
1887
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message91 })
1886
1888
  ]
1887
1889
  }
1888
1890
  );
@@ -2230,7 +2232,7 @@ var PhoneInput = (0, import_react14.forwardRef)(
2230
2232
  const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
2231
2233
  const { theme } = useWarqadConfig();
2232
2234
  const primaryColor = theme?.primaryColor;
2233
- let message90 = error;
2235
+ let message91 = error;
2234
2236
  if (form && name) {
2235
2237
  const {
2236
2238
  formState: { errors }
@@ -2240,7 +2242,7 @@ var PhoneInput = (0, import_react14.forwardRef)(
2240
2242
  for (const part of nameParts) {
2241
2243
  currentError = currentError?.[part];
2242
2244
  }
2243
- message90 = currentError?.message || message90;
2245
+ message91 = currentError?.message || message91;
2244
2246
  }
2245
2247
  const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
2246
2248
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
@@ -2291,7 +2293,7 @@ var PhoneInput = (0, import_react14.forwardRef)(
2291
2293
  }
2292
2294
  )
2293
2295
  ] }),
2294
- message90 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message90 })
2296
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message91 })
2295
2297
  ] });
2296
2298
  if (form && name) {
2297
2299
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
@@ -2344,7 +2346,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
2344
2346
  if (targetEnum) {
2345
2347
  return targetEnum.map((val) => ({
2346
2348
  value: val,
2347
- label: String(val).charAt(0).toUpperCase() + String(val).slice(1)
2349
+ label: `${String(val).charAt(0).toUpperCase() + String(val).slice(1)} ${enumName === "actionTypes" ? val === "credit" ? "(+)" : "(-)" : ""}`
2348
2350
  }));
2349
2351
  }
2350
2352
  return [];
@@ -2472,7 +2474,7 @@ var SelectRoot = ({
2472
2474
  setSearchQuery("");
2473
2475
  }
2474
2476
  }, [isOpen]);
2475
- let message90 = error;
2477
+ let message91 = error;
2476
2478
  if (form && name) {
2477
2479
  const {
2478
2480
  formState: { errors }
@@ -2482,7 +2484,7 @@ var SelectRoot = ({
2482
2484
  for (const part of nameParts) {
2483
2485
  currentError = currentError?.[part];
2484
2486
  }
2485
- message90 = currentError?.message || message90;
2487
+ message91 = currentError?.message || message91;
2486
2488
  }
2487
2489
  const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
2488
2490
  const filteredOptions = (0, import_react15.useMemo)(() => {
@@ -2552,7 +2554,7 @@ var SelectRoot = ({
2552
2554
  String(opt.value) || index
2553
2555
  )) })
2554
2556
  ] }),
2555
- message90 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message90 })
2557
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message91 })
2556
2558
  ]
2557
2559
  }
2558
2560
  ) });
@@ -2817,13 +2819,13 @@ var Textarea = (0, import_react16.forwardRef)(
2817
2819
  const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
2818
2820
  const { theme } = useWarqadConfig();
2819
2821
  const primaryColor = theme?.primaryColor;
2820
- let message90 = error;
2822
+ let message91 = error;
2821
2823
  if (form && name) {
2822
2824
  const {
2823
2825
  formState: { errors }
2824
2826
  } = form;
2825
2827
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
2826
- message90 = errorObj?.message;
2828
+ message91 = errorObj?.message;
2827
2829
  }
2828
2830
  const renderInput = (inputProps, ref3) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
2829
2831
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
@@ -2861,7 +2863,7 @@ var Textarea = (0, import_react16.forwardRef)(
2861
2863
  }
2862
2864
  }
2863
2865
  ) }),
2864
- message90 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message90 })
2866
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message91 })
2865
2867
  ] });
2866
2868
  (0, import_react16.useEffect)(() => {
2867
2869
  if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
@@ -3204,7 +3206,7 @@ var SearchApiRoot = ({
3204
3206
  const filteredOptions = options10.filter(
3205
3207
  (option) => !filter.includes(getOptionValue(option))
3206
3208
  );
3207
- let message90 = error || errorMessage;
3209
+ let message91 = error || errorMessage;
3208
3210
  if (form && name) {
3209
3211
  const {
3210
3212
  formState: { errors }
@@ -3214,7 +3216,7 @@ var SearchApiRoot = ({
3214
3216
  for (const part of nameParts) {
3215
3217
  currentError = currentError?.[part];
3216
3218
  }
3217
- message90 = currentError?.message || message90;
3219
+ message91 = currentError?.message || message91;
3218
3220
  }
3219
3221
  const valueCtx = {
3220
3222
  isOpen,
@@ -3248,7 +3250,7 @@ var SearchApiRoot = ({
3248
3250
  form,
3249
3251
  name,
3250
3252
  obj,
3251
- error: message90,
3253
+ error: message91,
3252
3254
  onSelect,
3253
3255
  onClear
3254
3256
  };
@@ -3611,7 +3613,7 @@ var DateInput = (0, import_react18.forwardRef)(
3611
3613
  value,
3612
3614
  ...props
3613
3615
  }, ref2) => {
3614
- let message90 = error;
3616
+ let message91 = error;
3615
3617
  const { theme } = useWarqadConfig();
3616
3618
  const primaryColor = theme?.primaryColor;
3617
3619
  const [isFocused, setIsFocused] = (0, import_react18.useState)(false);
@@ -3620,13 +3622,13 @@ var DateInput = (0, import_react18.forwardRef)(
3620
3622
  formState: { errors }
3621
3623
  } = form;
3622
3624
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
3623
- message90 = errorObj?.message;
3625
+ message91 = errorObj?.message;
3624
3626
  }
3625
3627
  const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
3626
3628
  bg-white! dark:bg-gray-900/80!
3627
3629
  text-gray-900! dark:text-zinc-100!
3628
3630
  hover:bg-white! dark:hover:bg-zinc-900!
3629
- ${message90 ? "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"}
3631
+ ${message91 ? "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"}
3630
3632
  [&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
3631
3633
  ${className}`;
3632
3634
  const renderDatePicker = (val, onChangeHandler, onBlur2, refProps) => {
@@ -3659,8 +3661,8 @@ var DateInput = (0, import_react18.forwardRef)(
3659
3661
  needConfirm: false,
3660
3662
  style: {
3661
3663
  height: "var(--input-height, 40px)",
3662
- borderColor: isFocused && !message90 ? primaryColor : void 0,
3663
- boxShadow: isFocused && !message90 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3664
+ borderColor: isFocused && !message91 ? primaryColor : void 0,
3665
+ boxShadow: isFocused && !message91 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3664
3666
  },
3665
3667
  classNames: { popup: { root: "z-50" } },
3666
3668
  suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Calendar, { className: "h-5 w-5 text-gray-400 group-focus-within:text-primary" }),
@@ -3675,7 +3677,7 @@ var DateInput = (0, import_react18.forwardRef)(
3675
3677
  {
3676
3678
  className: "block text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-200",
3677
3679
  style: {
3678
- color: message90 ? "#ef4444" : isFocused ? primaryColor : void 0
3680
+ color: message91 ? "#ef4444" : isFocused ? primaryColor : void 0
3679
3681
  },
3680
3682
  children: [
3681
3683
  label,
@@ -3693,7 +3695,7 @@ var DateInput = (0, import_react18.forwardRef)(
3693
3695
  }) => renderDatePicker(value2, onC, onBlur2, fieldRef)
3694
3696
  }
3695
3697
  ) : renderDatePicker(value, onChange, onBlur, ref2),
3696
- message90 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message90 })
3698
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message91 })
3697
3699
  ] });
3698
3700
  }
3699
3701
  );
@@ -3722,7 +3724,7 @@ var MonthInput = (0, import_react19.forwardRef)(
3722
3724
  value,
3723
3725
  ...props
3724
3726
  }, ref2) => {
3725
- let message90 = error;
3727
+ let message91 = error;
3726
3728
  const { theme } = useWarqadConfig();
3727
3729
  const primaryColor = theme?.primaryColor;
3728
3730
  const [isFocused, setIsFocused] = (0, import_react19.useState)(false);
@@ -3731,13 +3733,13 @@ var MonthInput = (0, import_react19.forwardRef)(
3731
3733
  formState: { errors }
3732
3734
  } = form;
3733
3735
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
3734
- message90 = errorObj?.message;
3736
+ message91 = errorObj?.message;
3735
3737
  }
3736
3738
  const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
3737
3739
  bg-white! dark:bg-gray-900/80!
3738
3740
  text-gray-900! dark:text-zinc-100!
3739
3741
  hover:bg-white! dark:hover:bg-zinc-900!
3740
- ${message90 ? "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"}
3742
+ ${message91 ? "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"}
3741
3743
  [&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
3742
3744
  ${className}`;
3743
3745
  const renderDatePicker = (val, onChangeHandler, onBlur2, refProps) => {
@@ -3771,8 +3773,8 @@ var MonthInput = (0, import_react19.forwardRef)(
3771
3773
  needConfirm: false,
3772
3774
  style: {
3773
3775
  height: "var(--input-height, 40px)",
3774
- borderColor: isFocused && !message90 ? primaryColor : void 0,
3775
- boxShadow: isFocused && !message90 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3776
+ borderColor: isFocused && !message91 ? primaryColor : void 0,
3777
+ boxShadow: isFocused && !message91 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3776
3778
  },
3777
3779
  classNames: { popup: { root: "z-50" } },
3778
3780
  suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Calendar, { className: "h-5 w-5 text-gray-400 group-focus-within:text-primary" }),
@@ -3787,7 +3789,7 @@ var MonthInput = (0, import_react19.forwardRef)(
3787
3789
  {
3788
3790
  className: "block text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-200",
3789
3791
  style: {
3790
- color: message90 ? "#ef4444" : isFocused ? primaryColor : void 0
3792
+ color: message91 ? "#ef4444" : isFocused ? primaryColor : void 0
3791
3793
  },
3792
3794
  children: [
3793
3795
  label,
@@ -3805,7 +3807,7 @@ var MonthInput = (0, import_react19.forwardRef)(
3805
3807
  }) => renderDatePicker(value2, onC, onBlur2, fieldRef)
3806
3808
  }
3807
3809
  ) : renderDatePicker(value, onChange, onBlur, ref2),
3808
- message90 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message90 })
3810
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message91 })
3809
3811
  ] });
3810
3812
  }
3811
3813
  );
@@ -9274,17 +9276,17 @@ var preWarningFns = [];
9274
9276
  var preMessage = (fn) => {
9275
9277
  preWarningFns.push(fn);
9276
9278
  };
9277
- function warning(valid, message90) {
9279
+ function warning(valid, message91) {
9278
9280
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
9279
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message90);
9281
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message91);
9280
9282
  if (finalMessage) {
9281
9283
  console.error(`Warning: ${finalMessage}`);
9282
9284
  }
9283
9285
  }
9284
9286
  }
9285
- function note(valid, message90) {
9287
+ function note(valid, message91) {
9286
9288
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
9287
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message90);
9289
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message91);
9288
9290
  if (finalMessage) {
9289
9291
  console.warn(`Note: ${finalMessage}`);
9290
9292
  }
@@ -9293,17 +9295,17 @@ function note(valid, message90) {
9293
9295
  function resetWarned() {
9294
9296
  warned = {};
9295
9297
  }
9296
- function call(method, valid, message90) {
9297
- if (!valid && !warned[message90]) {
9298
- method(false, message90);
9299
- warned[message90] = true;
9298
+ function call(method, valid, message91) {
9299
+ if (!valid && !warned[message91]) {
9300
+ method(false, message91);
9301
+ warned[message91] = true;
9300
9302
  }
9301
9303
  }
9302
- function warningOnce(valid, message90) {
9303
- call(warning, valid, message90);
9304
+ function warningOnce(valid, message91) {
9305
+ call(warning, valid, message91);
9304
9306
  }
9305
- function noteOnce(valid, message90) {
9306
- call(note, valid, message90);
9307
+ function noteOnce(valid, message91) {
9308
+ call(note, valid, message91);
9307
9309
  }
9308
9310
  warningOnce.preMessage = preMessage;
9309
9311
  warningOnce.resetWarned = resetWarned;
@@ -9314,8 +9316,8 @@ var import_react35 = __toESM(require("react"));
9314
9316
  function camelCase(input) {
9315
9317
  return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
9316
9318
  }
9317
- function warning2(valid, message90) {
9318
- warningOnce(valid, `[@ant-design/icons] ${message90}`);
9319
+ function warning2(valid, message91) {
9320
+ warningOnce(valid, `[@ant-design/icons] ${message91}`);
9319
9321
  }
9320
9322
  function isIconDefinition(target) {
9321
9323
  return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
@@ -15259,7 +15261,7 @@ var Transaction = ({
15259
15261
  ["journal", "journal-3"].includes(type) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(JournalView_default, { data: data?.data, isLoading }),
15260
15262
  ["payment", "payment-3"].includes(type) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PaymentView_default, { data: data?.data, isLoading }),
15261
15263
  type === "money transfer" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MoneyTransfer_default, { data: data?.data, isLoading }),
15262
- type === "expense" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ExpenseView_default, { data: data?.data, isLoading }),
15264
+ ["expense", "expense-3"].includes(type) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ExpenseView_default, { data: data?.data, isLoading }),
15263
15265
  type === "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(WalletAdjustmentView_default, { data: data?.data, isLoading }),
15264
15266
  type === "forex transfer" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ForexTransferView_default, { data: data?.data, isLoading }),
15265
15267
  type === "forex dubai to china" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ForexDubaiToChinaView_default, { data: data?.data, isLoading }),
@@ -15417,7 +15419,7 @@ var Guard = () => {
15417
15419
  const fetchProfile = async () => {
15418
15420
  try {
15419
15421
  const res = await get({
15420
- url: "/agents/me",
15422
+ url: "/users/me",
15421
15423
  v: 1
15422
15424
  });
15423
15425
  login(res?.data);
@@ -15505,7 +15507,7 @@ function Accounts({ v, url }) {
15505
15507
  "span",
15506
15508
  {
15507
15509
  onClick: () => navigate(`statements/${account?._id}`),
15508
- className: "cursor-pointer hover:underline text-blue-600",
15510
+ className: "cursor-pointer hover:underline text-blue-600 capitalize",
15509
15511
  children: account?.name
15510
15512
  }
15511
15513
  );
@@ -22975,7 +22977,7 @@ var ForexExpensesReport_default = ForexExpensesReport;
22975
22977
  var import_jsx_runtime131 = require("react/jsx-runtime");
22976
22978
  var ErrorPageBase = ({
22977
22979
  title,
22978
- message: message90,
22980
+ message: message91,
22979
22981
  statusCode,
22980
22982
  action,
22981
22983
  className = ""
@@ -22992,7 +22994,7 @@ var ErrorPageBase = ({
22992
22994
  statusCode
22993
22995
  ] }),
22994
22996
  title && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
22995
- message90 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message90 }),
22997
+ message91 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message91 }),
22996
22998
  action && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "pt-8", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
22997
22999
  "button",
22998
23000
  {
@@ -23631,6 +23633,7 @@ var options2 = [
23631
23633
  ];
23632
23634
  var AccountBalances = () => {
23633
23635
  const navigate = (0, import_react_router_dom39.useNavigate)();
23636
+ const { branchId } = (0, import_react_router_dom39.useParams)();
23634
23637
  const [searchParams, setSearchParams] = (0, import_react_router_dom39.useSearchParams)();
23635
23638
  const { apiConfig, enums, currencies } = useWarqadConfig();
23636
23639
  const defaultCurrency = currencies.stock || "all";
@@ -23675,14 +23678,14 @@ var AccountBalances = () => {
23675
23678
  }
23676
23679
  }, [urlCurrency, defaultCurrency]);
23677
23680
  const { A4DataView, data } = useA4DataView_default({
23678
- url: `${apiConfig.accountStatementApi}${type !== "all" ? `?type=${type}` : ""}`,
23681
+ url: `${apiConfig.accountStatementApi}${type !== "all" ? `?type=${type}` : ""}${branchId ? `&branch=${branchId}` : ""}`,
23679
23682
  v: 1,
23680
23683
  // No prefix
23681
23684
  params: {
23682
23685
  currency: currencyFilter === "all" ? "" : currencyFilter
23683
23686
  }
23684
23687
  });
23685
- const { TransactionView, openTransaction } = useTransactionView_default();
23688
+ const { TransactionView } = useTransactionView_default();
23686
23689
  const currency = data?.data?.currency;
23687
23690
  const columns = [
23688
23691
  {
@@ -41474,7 +41477,7 @@ function ProductForm2({
41474
41477
  try {
41475
41478
  if (isEdit) {
41476
41479
  await put({
41477
- url: `${updateUrl || "/inventory/items/update/"}/${id}`,
41480
+ url: `${updateUrl || "/inventory/items/update"}/${id}`,
41478
41481
  v: v || 3,
41479
41482
  body: {
41480
41483
  ...data,
@@ -48086,6 +48089,351 @@ var purchase3 = {
48086
48089
  };
48087
48090
  var purchase3_default = purchase3;
48088
48091
 
48092
+ // src/components/Transactions/3/expense/Expenses.tsx
48093
+ var import_react_router_dom123 = require("react-router-dom");
48094
+ var import_lucide_react125 = require("lucide-react");
48095
+ var import_jsx_runtime263 = require("react/jsx-runtime");
48096
+ function Expenses3({ url }) {
48097
+ const { branchId } = (0, import_react_router_dom123.useParams)();
48098
+ const navigate = (0, import_react_router_dom123.useNavigate)();
48099
+ const { TransactionView, openTransaction } = useTransactionView_default();
48100
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
48101
+ url: url || `/transactions/get?type=expense-3${branchId ? `&fromBranch=${branchId}` : ""}`,
48102
+ dateFilter: true
48103
+ });
48104
+ const { Modal: Modal2 } = useModal();
48105
+ const items = (data2) => [
48106
+ {
48107
+ label: `View Expense`,
48108
+ icon: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.FilePenLine, { size: 16 }),
48109
+ onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
48110
+ },
48111
+ {
48112
+ label: `Edit Expense`,
48113
+ icon: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.FilePenLine, { size: 16 }),
48114
+ onClick: () => navigate(`update?id=${data2?._id}`)
48115
+ },
48116
+ {
48117
+ label: `Delete Expense`,
48118
+ icon: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.Trash2, { className: "text-red-500", size: 16 }),
48119
+ onClick: () => {
48120
+ openTransaction({
48121
+ id: data2?._id,
48122
+ type: "expense",
48123
+ reverseable: { reload }
48124
+ });
48125
+ }
48126
+ }
48127
+ ].filter(Boolean);
48128
+ const columns = [
48129
+ {
48130
+ accessorKey: "date",
48131
+ header: "Date",
48132
+ cell: ({ row }) => {
48133
+ const expense = row.original;
48134
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex flex-col", children: [
48135
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: expense?.date }),
48136
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48137
+ "span",
48138
+ {
48139
+ onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
48140
+ className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
48141
+ children: expense.ref
48142
+ }
48143
+ )
48144
+ ] });
48145
+ }
48146
+ },
48147
+ {
48148
+ accessorKey: "description",
48149
+ header: "Description",
48150
+ cell: ({ row }) => {
48151
+ const expense = row.original;
48152
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex flex-col", children: [
48153
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "capitalize", children: expense?.description }),
48154
+ expense?.note && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
48155
+ ] });
48156
+ }
48157
+ },
48158
+ {
48159
+ accessorKey: "wallet",
48160
+ header: "Wallet",
48161
+ cell: ({ row }) => {
48162
+ const expense = row.original;
48163
+ const walletData = expense?.fromWalletData || expense?.toWalletData;
48164
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: walletData?.name || "N/A" });
48165
+ }
48166
+ },
48167
+ {
48168
+ accessorKey: "amount",
48169
+ header: "Amount",
48170
+ cell: ({ row }) => {
48171
+ const expense = row.original;
48172
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }) });
48173
+ }
48174
+ },
48175
+ {
48176
+ accessorKey: "actions",
48177
+ header: "Actions",
48178
+ cell: ({ row }) => {
48179
+ const data2 = row.original;
48180
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48181
+ Dropdown,
48182
+ {
48183
+ className: "cursor-pointer w-[150px]",
48184
+ items: items(data2),
48185
+ triggerMode: "hover",
48186
+ children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.EllipsisVertical, {})
48187
+ }
48188
+ );
48189
+ }
48190
+ }
48191
+ ];
48192
+ const expenses = data?.data || [];
48193
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(import_jsx_runtime263.Fragment, { children: [
48194
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(TransactionView, {}),
48195
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Modal2, {}),
48196
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48197
+ TransactionViewComponent,
48198
+ {
48199
+ columns,
48200
+ data: expenses,
48201
+ title: "Expenses",
48202
+ description: "Track and manage business expenses",
48203
+ index: true,
48204
+ createTitle: "Add Expense",
48205
+ onCreate: () => {
48206
+ navigate("create");
48207
+ }
48208
+ }
48209
+ )
48210
+ ] });
48211
+ }
48212
+ var Expenses_default2 = Expenses3;
48213
+
48214
+ // src/components/Transactions/3/expense/ExpenseForm.tsx
48215
+ var import_react160 = require("react");
48216
+ var import_react_router_dom124 = require("react-router-dom");
48217
+ var import_react_hook_form74 = require("react-hook-form");
48218
+ var import_zod123 = require("@hookform/resolvers/zod");
48219
+ var import_antd95 = require("antd");
48220
+
48221
+ // src/components/Transactions/3/expense/schema.ts
48222
+ var import_zod122 = require("zod");
48223
+ var expenseSchema4 = import_zod122.z.object({
48224
+ description: import_zod122.z.string().min(1, "Description is required"),
48225
+ date: zodFields.date,
48226
+ amount: import_zod122.z.number().gt(0, "Amount must be greater than 0"),
48227
+ branch: import_zod122.z.string().optional(),
48228
+ wallet: import_zod122.z.string().min(1, "Wallet is required"),
48229
+ note: import_zod122.z.string().optional(),
48230
+ // Objects for frontend helpers
48231
+ walletObject: import_zod122.z.any().optional(),
48232
+ rate: import_zod122.z.number().optional()
48233
+ });
48234
+
48235
+ // src/components/Transactions/3/expense/ExpenseForm.tsx
48236
+ var import_jsx_runtime264 = require("react/jsx-runtime");
48237
+ function ExpenseForm2() {
48238
+ const { branchId } = (0, import_react_router_dom124.useParams)();
48239
+ const { getQuery, navigate } = useApp_default();
48240
+ const id = getQuery("id");
48241
+ const isEdit = !!id;
48242
+ const [ref2, setRef] = (0, import_react160.useState)("");
48243
+ const { post, isLoading } = useApis_default();
48244
+ const { isLoading: isLoadingGet, get } = useApis_default();
48245
+ const { defaultCurrency } = useWarqadConfig().currencies;
48246
+ const methods = (0, import_react_hook_form74.useForm)({
48247
+ resolver: (0, import_zod123.zodResolver)(expenseSchema4),
48248
+ defaultValues: {
48249
+ date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
48250
+ amount: 0,
48251
+ description: "",
48252
+ wallet: "",
48253
+ rate: void 0
48254
+ }
48255
+ });
48256
+ const { handleSubmit, reset, watch } = methods;
48257
+ const walletObj = watch("walletObject");
48258
+ const currency = walletObj?.currency;
48259
+ const isRate = currency && currency !== defaultCurrency;
48260
+ const amount = watch("amount");
48261
+ const rate = watch("rate");
48262
+ const exchangedAmount2 = (0, import_react160.useMemo)(() => {
48263
+ if (isRate) {
48264
+ const am = forex_default.exchangedAmount({
48265
+ accountCurrency: defaultCurrency,
48266
+ amount,
48267
+ exchangeRate: rate ?? 1,
48268
+ transactionCurrency: currency
48269
+ });
48270
+ return Formats_default.Price(am, defaultCurrency ?? "N/A", false);
48271
+ }
48272
+ }, [amount, currency, rate, isRate]);
48273
+ const onSubmit = async (data) => {
48274
+ try {
48275
+ const payload = {
48276
+ ...data,
48277
+ type: "expense-3",
48278
+ defaultCurrency,
48279
+ branch: branchId ?? void 0,
48280
+ rate: data?.rate ?? 1
48281
+ };
48282
+ await post({
48283
+ url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
48284
+ body: payload
48285
+ });
48286
+ import_antd95.message.success(`Expense saved successfully`);
48287
+ navigate(-1);
48288
+ } catch (error) {
48289
+ import_antd95.message.error(error?.message || "Something went wrong");
48290
+ }
48291
+ };
48292
+ const fetches = async () => {
48293
+ try {
48294
+ const res = await get({
48295
+ url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
48296
+ });
48297
+ const data = res.data;
48298
+ reset({
48299
+ ...data,
48300
+ wallet: data?.fromWallet || data?.toWallet,
48301
+ // Expenses are usually withdrawals (fromWallet)
48302
+ rate: data?.exchange?.rate
48303
+ });
48304
+ setRef(data?.ref);
48305
+ } catch (error) {
48306
+ import_antd95.message.error(error?.message || "Something went wrong");
48307
+ navigate(-1);
48308
+ }
48309
+ };
48310
+ (0, import_react160.useEffect)(() => {
48311
+ if (isEdit) {
48312
+ fetches();
48313
+ }
48314
+ }, [id]);
48315
+ return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(
48316
+ Card,
48317
+ {
48318
+ className: "max-w-4xl mx-auto mt-10 relative",
48319
+ isLoading: isLoadingGet,
48320
+ loadingText: "Processing...",
48321
+ children: [
48322
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card.Header, { children: [
48323
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
48324
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
48325
+ ] }),
48326
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(
48327
+ "form",
48328
+ {
48329
+ className: "space-y-4",
48330
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
48331
+ children: [
48332
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48333
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48334
+ Fields_default.Input,
48335
+ {
48336
+ label: "Description",
48337
+ form: methods,
48338
+ name: "description",
48339
+ placeholder: "What was this expense for?",
48340
+ required: true
48341
+ }
48342
+ ),
48343
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48344
+ Feilds_default2.Wallet,
48345
+ {
48346
+ label: "Wallet",
48347
+ form: methods,
48348
+ name: "wallet",
48349
+ placeholder: "Source of funds...",
48350
+ required: true,
48351
+ showBalance: true,
48352
+ obj: "walletObject"
48353
+ }
48354
+ )
48355
+ ] }),
48356
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48357
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48358
+ Fields_default.DateInput,
48359
+ {
48360
+ label: "Date",
48361
+ form: methods,
48362
+ name: "date",
48363
+ required: true
48364
+ }
48365
+ ),
48366
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48367
+ Fields_default.Input,
48368
+ {
48369
+ label: "Amount",
48370
+ form: methods,
48371
+ name: "amount",
48372
+ type: "number",
48373
+ placeholder: "0.00",
48374
+ required: true
48375
+ }
48376
+ ),
48377
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_jsx_runtime264.Fragment, { children: [
48378
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48379
+ Fields_default.Input,
48380
+ {
48381
+ label: "Rate",
48382
+ form: methods,
48383
+ name: "rate",
48384
+ type: "number",
48385
+ placeholder: "Rate",
48386
+ required: true
48387
+ }
48388
+ ),
48389
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48390
+ Fields_default.Input,
48391
+ {
48392
+ label: "Exchanged Amount",
48393
+ type: "text",
48394
+ readOnly: true,
48395
+ disabled: true,
48396
+ value: exchangedAmount2
48397
+ }
48398
+ )
48399
+ ] })
48400
+ ] }),
48401
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48402
+ Fields_default.Textarea,
48403
+ {
48404
+ label: "Note",
48405
+ form: methods,
48406
+ name: "note",
48407
+ placeholder: "Add any additional details..."
48408
+ }
48409
+ ),
48410
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48411
+ Button,
48412
+ {
48413
+ isLoading,
48414
+ disabled: isLoading,
48415
+ type: "submit",
48416
+ className: "min-w-[100px]",
48417
+ variant: !isEdit ? "primary" : "warning",
48418
+ children: isEdit ? "Update" : "Add"
48419
+ }
48420
+ ) })
48421
+ ]
48422
+ }
48423
+ ) })
48424
+ ]
48425
+ }
48426
+ );
48427
+ }
48428
+ var ExpenseForm_default2 = ExpenseForm2;
48429
+
48430
+ // src/components/Transactions/3/expense/index.tsx
48431
+ var Expenses32 = {
48432
+ List: Expenses_default2,
48433
+ Form: ExpenseForm_default2
48434
+ };
48435
+ var expense_default = Expenses32;
48436
+
48089
48437
  // src/components/Transactions/3/index.ts
48090
48438
  var Transaction3 = {
48091
48439
  Payments: Payments_default3,
@@ -48095,26 +48443,28 @@ var Transaction3 = {
48095
48443
  Sale2: sale2_default2.List,
48096
48444
  Sale2Form: sale2_default2.Form,
48097
48445
  Purchase3: purchase3_default.List,
48098
- Purchase3Form: purchase3_default.Form
48446
+ Purchase3Form: purchase3_default.Form,
48447
+ Expenses: expense_default.List,
48448
+ ExpenseForm: expense_default.Form
48099
48449
  };
48100
48450
  var __default = Transaction3;
48101
48451
 
48102
48452
  // src/components/reports/ItemReport.tsx
48103
- var import_react_router_dom123 = require("react-router-dom");
48104
- var import_zod121 = require("zod");
48105
- var import_react_hook_form74 = require("react-hook-form");
48106
- var import_zod122 = require("@hookform/resolvers/zod");
48107
- var import_react160 = require("react");
48108
- var import_antd95 = require("antd");
48109
- var import_jsx_runtime263 = require("react/jsx-runtime");
48453
+ var import_react_router_dom125 = require("react-router-dom");
48454
+ var import_zod124 = require("zod");
48455
+ var import_react_hook_form75 = require("react-hook-form");
48456
+ var import_zod125 = require("@hookform/resolvers/zod");
48457
+ var import_react161 = require("react");
48458
+ var import_antd96 = require("antd");
48459
+ var import_jsx_runtime265 = require("react/jsx-runtime");
48110
48460
  var ItemReport = ({
48111
48461
  value = false,
48112
48462
  type
48113
48463
  }) => {
48114
48464
  const { apiConfig } = useWarqadConfig();
48115
- const { branchId } = (0, import_react_router_dom123.useParams)();
48465
+ const { branchId } = (0, import_react_router_dom125.useParams)();
48116
48466
  const { branches } = useAuth_default();
48117
- const [params, setParams] = (0, import_react160.useState)({
48467
+ const [params, setParams] = (0, import_react161.useState)({
48118
48468
  id: "",
48119
48469
  branch: "all"
48120
48470
  });
@@ -48139,9 +48489,9 @@ var ItemReport = ({
48139
48489
  header: "Date",
48140
48490
  key: "date",
48141
48491
  className: "text-xs whitespace-nowrap",
48142
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "", children: [
48143
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48144
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48492
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
48493
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48494
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48145
48495
  "span",
48146
48496
  {
48147
48497
  onClick: () => {
@@ -48160,7 +48510,7 @@ var ItemReport = ({
48160
48510
  header: "Description",
48161
48511
  key: "description",
48162
48512
  className: "text-xs whitespace-nowrap",
48163
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
48513
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
48164
48514
  },
48165
48515
  {
48166
48516
  header: "Quantity",
@@ -48168,7 +48518,7 @@ var ItemReport = ({
48168
48518
  className: "text-xs whitespace-nowrap",
48169
48519
  render: (row) => {
48170
48520
  const Qty = row.quantity;
48171
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(
48521
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
48172
48522
  "div",
48173
48523
  {
48174
48524
  className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
@@ -48185,7 +48535,7 @@ var ItemReport = ({
48185
48535
  header: "Balance",
48186
48536
  key: "runningBalance",
48187
48537
  className: "text-xs whitespace-nowrap",
48188
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
48538
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
48189
48539
  }
48190
48540
  ];
48191
48541
  let runningBalance = 0;
@@ -48197,10 +48547,10 @@ var ItemReport = ({
48197
48547
  };
48198
48548
  });
48199
48549
  const itemName = datas[0]?.name;
48200
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(import_jsx_runtime263.Fragment, { children: [
48201
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Modal2, {}),
48202
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(TransactionView, {}),
48203
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48550
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
48551
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Modal2, {}),
48552
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
48553
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48204
48554
  A4DataView,
48205
48555
  {
48206
48556
  columns,
@@ -48211,14 +48561,14 @@ var ItemReport = ({
48211
48561
  tableTitle: `${type} Movement Report`,
48212
48562
  fixed: false,
48213
48563
  error: !id ? "Please select an item" : void 0,
48214
- headers: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48564
+ headers: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48215
48565
  Button,
48216
48566
  {
48217
48567
  type: "button",
48218
48568
  size: "sm",
48219
48569
  onClick: () => openState({
48220
48570
  title: "Item Transactions",
48221
- content: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48571
+ content: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48222
48572
  ItemReportHeader2,
48223
48573
  {
48224
48574
  type,
@@ -48236,18 +48586,18 @@ var ItemReport = ({
48236
48586
  )
48237
48587
  ] });
48238
48588
  };
48239
- var schema3 = import_zod121.z.object({
48240
- pack: import_zod121.z.string().optional(),
48241
- product: import_zod121.z.string().optional(),
48242
- branch: import_zod121.z.string()
48589
+ var schema3 = import_zod124.z.object({
48590
+ pack: import_zod124.z.string().optional(),
48591
+ product: import_zod124.z.string().optional(),
48592
+ branch: import_zod124.z.string()
48243
48593
  });
48244
48594
  function ItemReportHeader2({
48245
48595
  type,
48246
48596
  close,
48247
48597
  addToParams
48248
48598
  }) {
48249
- const methods = (0, import_react_hook_form74.useForm)({
48250
- resolver: (0, import_zod122.zodResolver)(schema3),
48599
+ const methods = (0, import_react_hook_form75.useForm)({
48600
+ resolver: (0, import_zod125.zodResolver)(schema3),
48251
48601
  defaultValues: {
48252
48602
  pack: "",
48253
48603
  product: "",
@@ -48261,14 +48611,14 @@ function ItemReportHeader2({
48261
48611
  label: b.name,
48262
48612
  value: b._id
48263
48613
  }));
48264
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(
48614
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
48265
48615
  "form",
48266
48616
  {
48267
48617
  className: "space-y-3",
48268
48618
  onSubmit: handleSubmit((data) => {
48269
48619
  const id = type === "pack" ? data.pack : data.product;
48270
48620
  if (!id) {
48271
- import_antd95.message.error("Please select an item");
48621
+ import_antd96.message.error("Please select an item");
48272
48622
  methods.setFocus(type);
48273
48623
  return;
48274
48624
  }
@@ -48279,8 +48629,8 @@ function ItemReportHeader2({
48279
48629
  close();
48280
48630
  }),
48281
48631
  children: [
48282
- /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
48283
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48632
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
48633
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48284
48634
  Select,
48285
48635
  {
48286
48636
  options: [{ label: "All Branches", value: "all" }, ...branchOptions],
@@ -48288,7 +48638,7 @@ function ItemReportHeader2({
48288
48638
  name: "branch"
48289
48639
  }
48290
48640
  ),
48291
- type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48641
+ type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48292
48642
  Pack_default.Pack,
48293
48643
  {
48294
48644
  api: "/packs/get",
@@ -48296,7 +48646,7 @@ function ItemReportHeader2({
48296
48646
  form: methods,
48297
48647
  name: "pack"
48298
48648
  }
48299
- ) : /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48649
+ ) : /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48300
48650
  Feilds_default5.Product,
48301
48651
  {
48302
48652
  label: "",
@@ -48307,7 +48657,7 @@ function ItemReportHeader2({
48307
48657
  }
48308
48658
  )
48309
48659
  ] }),
48310
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Button, { type: "submit", children: "Filter" }) })
48660
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Button, { type: "submit", children: "Filter" }) })
48311
48661
  ]
48312
48662
  }
48313
48663
  );
@@ -48315,19 +48665,19 @@ function ItemReportHeader2({
48315
48665
  var ItemReport_default = ItemReport;
48316
48666
 
48317
48667
  // src/components/accounts/LeaseCollection.tsx
48318
- var import_react_router_dom124 = require("react-router-dom");
48319
- var import_react161 = require("react");
48320
- var import_jsx_runtime264 = require("react/jsx-runtime");
48668
+ var import_react_router_dom126 = require("react-router-dom");
48669
+ var import_react162 = require("react");
48670
+ var import_jsx_runtime266 = require("react/jsx-runtime");
48321
48671
  var LeaseCollection = ({
48322
48672
  leaseType,
48323
48673
  defaultCurrency = "KES"
48324
48674
  }) => {
48325
- const navigate = (0, import_react_router_dom124.useNavigate)();
48326
- const [searchParams] = (0, import_react_router_dom124.useSearchParams)();
48675
+ const navigate = (0, import_react_router_dom126.useNavigate)();
48676
+ const [searchParams] = (0, import_react_router_dom126.useSearchParams)();
48327
48677
  const { apiConfig } = useWarqadConfig();
48328
- const { branchId } = (0, import_react_router_dom124.useParams)();
48678
+ const { branchId } = (0, import_react_router_dom126.useParams)();
48329
48679
  const { branches } = useAuth_default();
48330
- const currentBranch = (0, import_react161.useMemo)(
48680
+ const currentBranch = (0, import_react162.useMemo)(
48331
48681
  () => branches?.find((b) => b?._id === branchId),
48332
48682
  [branches, branchId]
48333
48683
  );
@@ -48335,16 +48685,16 @@ var LeaseCollection = ({
48335
48685
  const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
48336
48686
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
48337
48687
  const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
48338
- const [filter, setFilter] = (0, import_react161.useState)(
48688
+ const [filter, setFilter] = (0, import_react162.useState)(
48339
48689
  initialFilter
48340
48690
  );
48341
- const [currencyFilter, setCurrencyFilter] = (0, import_react161.useState)(initialCurrency);
48342
- (0, import_react161.useEffect)(() => {
48691
+ const [currencyFilter, setCurrencyFilter] = (0, import_react162.useState)(initialCurrency);
48692
+ (0, import_react162.useEffect)(() => {
48343
48693
  if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
48344
48694
  setFilter(urlFilter);
48345
48695
  }
48346
48696
  }, [urlFilter]);
48347
- (0, import_react161.useEffect)(() => {
48697
+ (0, import_react162.useEffect)(() => {
48348
48698
  if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
48349
48699
  setCurrencyFilter(urlCurrency);
48350
48700
  } else {
@@ -48363,9 +48713,9 @@ var LeaseCollection = ({
48363
48713
  key: "name",
48364
48714
  className: "text-xs whitespace-nowrap ",
48365
48715
  searchKeys: ["name", "phoneNumber", "unitNames"],
48366
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "space-y-1", children: [
48367
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
48368
- row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("p", { className: "text-[9px]! capitalize", children: [
48716
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "space-y-1", children: [
48717
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
48718
+ row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("p", { className: "text-[9px]! capitalize", children: [
48369
48719
  "(",
48370
48720
  row.unitNames,
48371
48721
  ")"
@@ -48377,7 +48727,7 @@ var LeaseCollection = ({
48377
48727
  key: "phoneNumber",
48378
48728
  maxWidth: 70,
48379
48729
  render: (row) => {
48380
- return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("p", { children: row?.phoneNumber || "N/A" });
48730
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { children: row?.phoneNumber || "N/A" });
48381
48731
  }
48382
48732
  },
48383
48733
  // </span>
@@ -48387,11 +48737,11 @@ var LeaseCollection = ({
48387
48737
  className: "text-xs whitespace-nowrap text-right",
48388
48738
  render: (row) => {
48389
48739
  const Amount = row.totalCollectionString;
48390
- return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("p", { className: "font-bold ", children: Amount }) });
48740
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold ", children: Amount }) });
48391
48741
  },
48392
48742
  renderFooter: (data2) => {
48393
48743
  if (currencyFilter === "all") return;
48394
- return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("span", { className: " font-bold", children: Formats_default.Price(
48744
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: " font-bold", children: Formats_default.Price(
48395
48745
  data2.reduce((acc, row) => acc + row.totalCollection, 0),
48396
48746
  defaultCurrency,
48397
48747
  false
@@ -48399,7 +48749,7 @@ var LeaseCollection = ({
48399
48749
  }
48400
48750
  }
48401
48751
  ];
48402
- const datas = (0, import_react161.useMemo)(() => {
48752
+ const datas = (0, import_react162.useMemo)(() => {
48403
48753
  let runningBalance = 0;
48404
48754
  let filteredData = data?.data || [];
48405
48755
  const result = filteredData.map((item) => {
@@ -48412,9 +48762,9 @@ var LeaseCollection = ({
48412
48762
  });
48413
48763
  return result;
48414
48764
  }, [filter, currencyFilter, data]);
48415
- return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_jsx_runtime264.Fragment, { children: [
48416
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(TransactionView, {}),
48417
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48765
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48766
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
48767
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48418
48768
  A4DataView,
48419
48769
  {
48420
48770
  columns,
@@ -48424,7 +48774,7 @@ var LeaseCollection = ({
48424
48774
  subtitle: `All Collections`,
48425
48775
  fixed: false,
48426
48776
  startPage: 1e9,
48427
- headers: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "flex gap-2" })
48777
+ headers: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "flex gap-2" })
48428
48778
  }
48429
48779
  )
48430
48780
  ] });
@@ -48432,61 +48782,61 @@ var LeaseCollection = ({
48432
48782
  var LeaseCollection_default = LeaseCollection;
48433
48783
 
48434
48784
  // src/components/Transactions/cargoIM/CargoIM.tsx
48435
- var import_react_router_dom128 = require("react-router-dom");
48436
- var import_lucide_react126 = require("lucide-react");
48437
- var import_react165 = require("react");
48438
- var import_antd99 = require("antd");
48785
+ var import_react_router_dom130 = require("react-router-dom");
48786
+ var import_lucide_react127 = require("lucide-react");
48787
+ var import_react166 = require("react");
48788
+ var import_antd100 = require("antd");
48439
48789
 
48440
48790
  // src/components/Transactions/cargoIM/schema.ts
48441
- var import_zod124 = require("zod");
48442
- var InvoiceSchema2 = import_zod124.z.object({
48443
- name: import_zod124.z.string().min(1, { message: "Item name is required" }),
48444
- quantity: import_zod124.z.number().gt(0, { message: "Quantity must be greater than 0" }),
48445
- amount: import_zod124.z.number().gt(0, { message: "Price must be greater than 0" })
48791
+ var import_zod127 = require("zod");
48792
+ var InvoiceSchema2 = import_zod127.z.object({
48793
+ name: import_zod127.z.string().min(1, { message: "Item name is required" }),
48794
+ quantity: import_zod127.z.number().gt(0, { message: "Quantity must be greater than 0" }),
48795
+ amount: import_zod127.z.number().gt(0, { message: "Price must be greater than 0" })
48446
48796
  });
48447
- var createInvoiceManagerValidation2 = import_zod124.z.object({
48448
- invoices: import_zod124.z.array(InvoiceSchema2),
48449
- date: import_zod124.z.string(),
48450
- currency: import_zod124.z.string(),
48451
- branch: import_zod124.z.string().optional()
48797
+ var createInvoiceManagerValidation2 = import_zod127.z.object({
48798
+ invoices: import_zod127.z.array(InvoiceSchema2),
48799
+ date: import_zod127.z.string(),
48800
+ currency: import_zod127.z.string(),
48801
+ branch: import_zod127.z.string().optional()
48452
48802
  });
48453
- var createAccountSchema3 = import_zod124.z.object({
48454
- name: import_zod124.z.string().min(2, { message: "Name must be at least 2 characters" }),
48455
- phoneNumber: import_zod124.z.string().optional(),
48456
- branch: import_zod124.z.string().optional(),
48457
- currency: import_zod124.z.string().optional()
48803
+ var createAccountSchema3 = import_zod127.z.object({
48804
+ name: import_zod127.z.string().min(2, { message: "Name must be at least 2 characters" }),
48805
+ phoneNumber: import_zod127.z.string().optional(),
48806
+ branch: import_zod127.z.string().optional(),
48807
+ currency: import_zod127.z.string().optional()
48458
48808
  });
48459
- var journalSchema5 = import_zod124.z.object({
48809
+ var journalSchema5 = import_zod127.z.object({
48460
48810
  date: zodFields.date,
48461
- amount: import_zod124.z.number().gt(0, "Amount must be greater than 0"),
48462
- currency: import_zod124.z.string(),
48463
- description: import_zod124.z.string(),
48464
- branch: import_zod124.z.string().optional(),
48465
- action: import_zod124.z.enum(Enums_default.actionTypes).optional(),
48466
- note: import_zod124.z.string().optional()
48811
+ amount: import_zod127.z.number().gt(0, "Amount must be greater than 0"),
48812
+ currency: import_zod127.z.string(),
48813
+ description: import_zod127.z.string(),
48814
+ branch: import_zod127.z.string().optional(),
48815
+ action: import_zod127.z.enum(Enums_default.actionTypes).optional(),
48816
+ note: import_zod127.z.string().optional()
48467
48817
  });
48468
48818
 
48469
48819
  // src/components/Transactions/cargoIM/AccountForm.tsx
48470
- var import_react_hook_form75 = require("react-hook-form");
48471
- var import_zod125 = require("@hookform/resolvers/zod");
48472
- var import_antd96 = require("antd");
48473
- var import_react162 = require("react");
48474
- var import_react_router_dom125 = require("react-router-dom");
48475
- var import_jsx_runtime265 = require("react/jsx-runtime");
48820
+ var import_react_hook_form76 = require("react-hook-form");
48821
+ var import_zod128 = require("@hookform/resolvers/zod");
48822
+ var import_antd97 = require("antd");
48823
+ var import_react163 = require("react");
48824
+ var import_react_router_dom127 = require("react-router-dom");
48825
+ var import_jsx_runtime267 = require("react/jsx-runtime");
48476
48826
  function AccountForm3({
48477
48827
  onReload,
48478
48828
  close,
48479
48829
  id
48480
48830
  }) {
48481
- const { branchId } = (0, import_react_router_dom125.useParams)();
48831
+ const { branchId } = (0, import_react_router_dom127.useParams)();
48482
48832
  const { currencies } = useWarqadConfig();
48483
48833
  const { stock } = currencies;
48484
48834
  const isEdit = !!id;
48485
48835
  const type = "supplier";
48486
48836
  const { post, put, isLoading } = useApis_default();
48487
48837
  const { isLoading: isLoadingGet, get } = useApis_default();
48488
- const methods = (0, import_react_hook_form75.useForm)({
48489
- resolver: (0, import_zod125.zodResolver)(createAccountSchema3),
48838
+ const methods = (0, import_react_hook_form76.useForm)({
48839
+ resolver: (0, import_zod128.zodResolver)(createAccountSchema3),
48490
48840
  defaultValues: {
48491
48841
  name: "",
48492
48842
  phoneNumber: "",
@@ -48516,7 +48866,7 @@ function AccountForm3({
48516
48866
  body: payload
48517
48867
  });
48518
48868
  }
48519
- import_antd96.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
48869
+ import_antd97.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
48520
48870
  if (onReload) {
48521
48871
  onReload();
48522
48872
  }
@@ -48524,7 +48874,7 @@ function AccountForm3({
48524
48874
  close();
48525
48875
  }
48526
48876
  } catch (error) {
48527
- import_antd96.message.error(error?.message || "Something went wrong");
48877
+ import_antd97.message.error(error?.message || "Something went wrong");
48528
48878
  }
48529
48879
  };
48530
48880
  const fetches = async () => {
@@ -48535,33 +48885,33 @@ function AccountForm3({
48535
48885
  const data = res.data;
48536
48886
  methods.reset(data);
48537
48887
  } catch (error) {
48538
- import_antd96.message.error(error?.message || "Something went wrong");
48888
+ import_antd97.message.error(error?.message || "Something went wrong");
48539
48889
  close?.();
48540
48890
  }
48541
48891
  };
48542
- (0, import_react162.useEffect)(() => {
48892
+ (0, import_react163.useEffect)(() => {
48543
48893
  if (isEdit) {
48544
48894
  fetches();
48545
48895
  }
48546
48896
  }, [id]);
48547
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
48897
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
48548
48898
  Card,
48549
48899
  {
48550
48900
  className: "max-w-4xl mx-auto mt-10 relative",
48551
48901
  isLoading: isLoadingGet,
48552
48902
  loadingText: "Processing...",
48553
48903
  children: [
48554
- /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(Card.Header, { children: [
48555
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
48556
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
48904
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(Card.Header, { children: [
48905
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
48906
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
48557
48907
  ] }),
48558
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
48908
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
48559
48909
  "form",
48560
48910
  {
48561
48911
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
48562
48912
  children: [
48563
- /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48564
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48913
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48914
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48565
48915
  Fields_default.Input,
48566
48916
  {
48567
48917
  label: "Name",
@@ -48572,7 +48922,7 @@ function AccountForm3({
48572
48922
  required: true
48573
48923
  }
48574
48924
  ),
48575
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48925
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48576
48926
  Fields_default.PhoneInput,
48577
48927
  {
48578
48928
  label: "Phone Number",
@@ -48581,7 +48931,7 @@ function AccountForm3({
48581
48931
  placeholder: "Enter phone number"
48582
48932
  }
48583
48933
  ),
48584
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48934
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48585
48935
  Fields_default.Select,
48586
48936
  {
48587
48937
  label: "Currency",
@@ -48592,7 +48942,7 @@ function AccountForm3({
48592
48942
  }
48593
48943
  )
48594
48944
  ] }),
48595
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48945
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48596
48946
  Button,
48597
48947
  {
48598
48948
  isLoading,
@@ -48613,33 +48963,33 @@ function AccountForm3({
48613
48963
  var AccountForm_default3 = AccountForm3;
48614
48964
 
48615
48965
  // src/components/Transactions/cargoIM/InvoiceForm.tsx
48616
- var import_react163 = require("react");
48617
- var import_react_hook_form76 = require("react-hook-form");
48618
- var import_zod126 = require("@hookform/resolvers/zod");
48619
- var import_react_router_dom126 = require("react-router-dom");
48620
- var import_antd97 = require("antd");
48621
- var import_lucide_react125 = require("lucide-react");
48966
+ var import_react164 = require("react");
48967
+ var import_react_hook_form77 = require("react-hook-form");
48968
+ var import_zod129 = require("@hookform/resolvers/zod");
48969
+ var import_react_router_dom128 = require("react-router-dom");
48970
+ var import_antd98 = require("antd");
48971
+ var import_lucide_react126 = require("lucide-react");
48622
48972
  var import_dayjs11 = __toESM(require("dayjs"));
48623
- var import_jsx_runtime266 = require("react/jsx-runtime");
48973
+ var import_jsx_runtime268 = require("react/jsx-runtime");
48624
48974
  function InvoiceForm2({
48625
48975
  onReload,
48626
48976
  close,
48627
48977
  accountData,
48628
48978
  id
48629
48979
  }) {
48630
- const { branchId } = (0, import_react_router_dom126.useParams)();
48631
- const [ref2, setRef] = (0, import_react163.useState)(void 0);
48980
+ const { branchId } = (0, import_react_router_dom128.useParams)();
48981
+ const [ref2, setRef] = (0, import_react164.useState)(void 0);
48632
48982
  const { post, isLoading } = useApis_default();
48633
48983
  const { get, isLoading: getLoading } = useApis_default();
48634
48984
  const { put, isLoading: isLoadingReverse } = useApis_default();
48635
48985
  const isEdit = !!id;
48636
48986
  const { currencies } = useWarqadConfig();
48637
48987
  const { stock: defaultCurrency } = currencies;
48638
- const [itemName, setItemName] = (0, import_react163.useState)("");
48639
- const [itemQuantity, setItemQuantity] = (0, import_react163.useState)("");
48640
- const [itemPrice, setItemPrice] = (0, import_react163.useState)("");
48641
- const methods = (0, import_react_hook_form76.useForm)({
48642
- resolver: (0, import_zod126.zodResolver)(createInvoiceManagerValidation2),
48988
+ const [itemName, setItemName] = (0, import_react164.useState)("");
48989
+ const [itemQuantity, setItemQuantity] = (0, import_react164.useState)("");
48990
+ const [itemPrice, setItemPrice] = (0, import_react164.useState)("");
48991
+ const methods = (0, import_react_hook_form77.useForm)({
48992
+ resolver: (0, import_zod129.zodResolver)(createInvoiceManagerValidation2),
48643
48993
  defaultValues: {
48644
48994
  invoices: [],
48645
48995
  date: (0, import_dayjs11.default)().format("DD/MM/YYYY"),
@@ -48648,7 +48998,7 @@ function InvoiceForm2({
48648
48998
  }
48649
48999
  });
48650
49000
  const { handleSubmit, control, register, reset } = methods;
48651
- const { fields, append, remove } = (0, import_react_hook_form76.useFieldArray)({
49001
+ const { fields, append, remove } = (0, import_react_hook_form77.useFieldArray)({
48652
49002
  control,
48653
49003
  name: "invoices"
48654
49004
  });
@@ -48663,27 +49013,27 @@ function InvoiceForm2({
48663
49013
  });
48664
49014
  setRef(data?.ref);
48665
49015
  } catch (error) {
48666
- import_antd97.message.error(error?.message || "Something went wrong");
49016
+ import_antd98.message.error(error?.message || "Something went wrong");
48667
49017
  }
48668
49018
  };
48669
- (0, import_react163.useEffect)(() => {
49019
+ (0, import_react164.useEffect)(() => {
48670
49020
  if (isEdit) {
48671
49021
  fetches();
48672
49022
  }
48673
49023
  }, [isEdit]);
48674
49024
  const handleAddItem = () => {
48675
49025
  if (!itemName.trim()) {
48676
- import_antd97.message.error("Item name is required");
49026
+ import_antd98.message.error("Item name is required");
48677
49027
  return;
48678
49028
  }
48679
49029
  const qty = Number(itemQuantity);
48680
49030
  const price = Number(itemPrice);
48681
49031
  if (isNaN(qty) || qty <= 0) {
48682
- import_antd97.message.error("Quantity must be greater than 0");
49032
+ import_antd98.message.error("Quantity must be greater than 0");
48683
49033
  return;
48684
49034
  }
48685
49035
  if (isNaN(price) || price <= 0) {
48686
- import_antd97.message.error("Price must be greater than 0");
49036
+ import_antd98.message.error("Price must be greater than 0");
48687
49037
  return;
48688
49038
  }
48689
49039
  append({
@@ -48697,7 +49047,7 @@ function InvoiceForm2({
48697
49047
  };
48698
49048
  const onSubmit = async (data) => {
48699
49049
  if (data.invoices.length === 0) {
48700
- import_antd97.message.error("Please add at least one item to the invoice");
49050
+ import_antd98.message.error("Please add at least one item to the invoice");
48701
49051
  return;
48702
49052
  }
48703
49053
  try {
@@ -48710,13 +49060,13 @@ function InvoiceForm2({
48710
49060
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
48711
49061
  body: payload
48712
49062
  });
48713
- import_antd97.message.success(
49063
+ import_antd98.message.success(
48714
49064
  isEdit ? "Invoice updated successfully" : "Invoice created successfully"
48715
49065
  );
48716
49066
  if (onReload) onReload();
48717
49067
  if (close) close();
48718
49068
  } catch (error) {
48719
- import_antd97.message.error(error?.message || "Something went wrong");
49069
+ import_antd98.message.error(error?.message || "Something went wrong");
48720
49070
  }
48721
49071
  };
48722
49072
  const onReverse = async () => {
@@ -48725,11 +49075,11 @@ function InvoiceForm2({
48725
49075
  await put({
48726
49076
  url: `/transactions/reverse/${id}`
48727
49077
  });
48728
- import_antd97.message.success("Transaction reversed successfully");
49078
+ import_antd98.message.success("Transaction reversed successfully");
48729
49079
  if (onReload) onReload();
48730
49080
  if (close) close();
48731
49081
  } catch (error) {
48732
- import_antd97.message.error(error?.message || "Something went wrong");
49082
+ import_antd98.message.error(error?.message || "Something went wrong");
48733
49083
  }
48734
49084
  };
48735
49085
  const handleKeyDown = (e) => {
@@ -48741,25 +49091,25 @@ function InvoiceForm2({
48741
49091
  e.preventDefault();
48742
49092
  }
48743
49093
  };
48744
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49094
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48745
49095
  Card,
48746
49096
  {
48747
49097
  isLoading: getLoading,
48748
49098
  className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
48749
- children: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(Card.Content, { children: [
48750
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("input", { type: "hidden", ...register("currency") }),
48751
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
49099
+ children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(Card.Content, { children: [
49100
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("input", { type: "hidden", ...register("currency") }),
49101
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48752
49102
  "form",
48753
49103
  {
48754
49104
  onSubmit: handleSubmit(onSubmit),
48755
49105
  onKeyDown: handleKeyDown,
48756
49106
  className: "space-y-6",
48757
49107
  children: [
48758
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
48759
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
48760
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
48761
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
48762
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49108
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
49109
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
49110
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
49111
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
49112
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48763
49113
  Fields_default.Input,
48764
49114
  {
48765
49115
  label: "Container No",
@@ -48768,7 +49118,7 @@ function InvoiceForm2({
48768
49118
  onChange: (val) => setItemName(val)
48769
49119
  }
48770
49120
  ),
48771
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49121
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48772
49122
  Fields_default.Input,
48773
49123
  {
48774
49124
  label: "Cbm",
@@ -48778,7 +49128,7 @@ function InvoiceForm2({
48778
49128
  onChange: (val) => setItemQuantity(val)
48779
49129
  }
48780
49130
  ),
48781
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49131
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48782
49132
  Fields_default.Input,
48783
49133
  {
48784
49134
  label: "Price (KES)",
@@ -48789,7 +49139,7 @@ function InvoiceForm2({
48789
49139
  }
48790
49140
  )
48791
49141
  ] }),
48792
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
49142
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48793
49143
  Button,
48794
49144
  {
48795
49145
  type: "button",
@@ -48797,23 +49147,23 @@ function InvoiceForm2({
48797
49147
  className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
48798
49148
  variant: "outline",
48799
49149
  children: [
48800
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react125.Plus, { size: 16 }),
49150
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(import_lucide_react126.Plus, { size: 16 }),
48801
49151
  " Add Item"
48802
49152
  ]
48803
49153
  }
48804
49154
  )
48805
49155
  ] })
48806
49156
  ] }),
48807
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { children: [
48808
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
48809
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("table", { className: "w-full text-left border-collapse", children: [
48810
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("tr", { children: [
48811
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
48812
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
48813
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
48814
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
49157
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { children: [
49158
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
49159
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("table", { className: "w-full text-left border-collapse", children: [
49160
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("tr", { children: [
49161
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
49162
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
49163
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
49164
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
48815
49165
  ] }) }),
48816
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49166
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48817
49167
  "td",
48818
49168
  {
48819
49169
  colSpan: 4,
@@ -48822,30 +49172,30 @@ function InvoiceForm2({
48822
49172
  }
48823
49173
  ) }) : fields.map((item, index) => {
48824
49174
  const total = item.quantity * item.amount;
48825
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
49175
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48826
49176
  "tr",
48827
49177
  {
48828
49178
  className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
48829
49179
  children: [
48830
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
48831
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
48832
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
48833
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
49180
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
49181
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
49182
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
49183
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
48834
49184
  item.quantity,
48835
49185
  " Cbm @",
48836
49186
  " ",
48837
49187
  Formats_default.Price(item.amount, "KES")
48838
49188
  ] })
48839
49189
  ] }),
48840
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
48841
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49190
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
49191
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48842
49192
  "button",
48843
49193
  {
48844
49194
  type: "button",
48845
49195
  onClick: () => remove(index),
48846
49196
  className: "text-gray-400 hover:text-red-500 transition-colors p-1",
48847
- children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48848
- import_lucide_react125.Trash2,
49197
+ children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49198
+ import_lucide_react126.Trash2,
48849
49199
  {
48850
49200
  size: 13,
48851
49201
  className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
@@ -48858,8 +49208,8 @@ function InvoiceForm2({
48858
49208
  item.id
48859
49209
  );
48860
49210
  }) }),
48861
- fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("tr", { children: [
48862
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49211
+ fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("tr", { children: [
49212
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48863
49213
  "td",
48864
49214
  {
48865
49215
  colSpan: 2,
@@ -48867,20 +49217,20 @@ function InvoiceForm2({
48867
49217
  children: "Total"
48868
49218
  }
48869
49219
  ),
48870
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
49220
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
48871
49221
  fields.reduce(
48872
49222
  (sum, item) => sum + item.quantity * item.amount,
48873
49223
  0
48874
49224
  ),
48875
49225
  "KES"
48876
49226
  ) }),
48877
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("td", {})
49227
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", {})
48878
49228
  ] }) })
48879
49229
  ] }) }) })
48880
49230
  ] }),
48881
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
48882
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48883
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49231
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
49232
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49233
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48884
49234
  Fields_default.DateInput,
48885
49235
  {
48886
49236
  label: "Date",
@@ -48889,20 +49239,20 @@ function InvoiceForm2({
48889
49239
  required: true
48890
49240
  }
48891
49241
  ),
48892
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
49242
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
48893
49243
  ] }),
48894
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
48895
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49244
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
49245
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48896
49246
  ConfirmModal,
48897
49247
  {
48898
49248
  title: "Reverse Transaction",
48899
- description: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "space-y-3 text-left", children: [
48900
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
48901
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49249
+ description: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "space-y-3 text-left", children: [
49250
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49251
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
48902
49252
  ] }),
48903
49253
  confirmationWord: "delete",
48904
49254
  onSubmit: onReverse,
48905
- children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49255
+ children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48906
49256
  Button,
48907
49257
  {
48908
49258
  type: "button",
@@ -48915,8 +49265,8 @@ function InvoiceForm2({
48915
49265
  )
48916
49266
  }
48917
49267
  ) }),
48918
- /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex justify-end gap-3", children: [
48919
- close && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49268
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex justify-end gap-3", children: [
49269
+ close && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48920
49270
  Button,
48921
49271
  {
48922
49272
  type: "button",
@@ -48926,7 +49276,7 @@ function InvoiceForm2({
48926
49276
  children: "Cancel"
48927
49277
  }
48928
49278
  ),
48929
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49279
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48930
49280
  Button,
48931
49281
  {
48932
49282
  isLoading,
@@ -48950,13 +49300,13 @@ function InvoiceForm2({
48950
49300
  var InvoiceForm_default2 = InvoiceForm2;
48951
49301
 
48952
49302
  // src/components/Transactions/cargoIM/journalForm.tsx
48953
- var import_react164 = __toESM(require("react"));
48954
- var import_react_hook_form77 = require("react-hook-form");
48955
- var import_zod127 = require("@hookform/resolvers/zod");
48956
- var import_react_router_dom127 = require("react-router-dom");
48957
- var import_antd98 = require("antd");
49303
+ var import_react165 = __toESM(require("react"));
49304
+ var import_react_hook_form78 = require("react-hook-form");
49305
+ var import_zod130 = require("@hookform/resolvers/zod");
49306
+ var import_react_router_dom129 = require("react-router-dom");
49307
+ var import_antd99 = require("antd");
48958
49308
  var import_dayjs12 = __toESM(require("dayjs"));
48959
- var import_jsx_runtime267 = require("react/jsx-runtime");
49309
+ var import_jsx_runtime269 = require("react/jsx-runtime");
48960
49310
  function JournalForm5({
48961
49311
  onReload,
48962
49312
  close,
@@ -48964,16 +49314,16 @@ function JournalForm5({
48964
49314
  action = "debit",
48965
49315
  id
48966
49316
  }) {
48967
- const { branchId } = (0, import_react_router_dom127.useParams)();
49317
+ const { branchId } = (0, import_react_router_dom129.useParams)();
48968
49318
  const { currencies } = useWarqadConfig();
48969
49319
  const { stock: defaultCurrency } = currencies;
48970
- const [ref2, setRef] = import_react164.default.useState(void 0);
49320
+ const [ref2, setRef] = import_react165.default.useState(void 0);
48971
49321
  const { post, isLoading } = useApis_default();
48972
49322
  const { get, isLoading: getLoading } = useApis_default();
48973
49323
  const { put, isLoading: isLoadingReverse } = useApis_default();
48974
49324
  const isEdit = !!id;
48975
- const methods = (0, import_react_hook_form77.useForm)({
48976
- resolver: (0, import_zod127.zodResolver)(journalSchema5),
49325
+ const methods = (0, import_react_hook_form78.useForm)({
49326
+ resolver: (0, import_zod130.zodResolver)(journalSchema5),
48977
49327
  defaultValues: {
48978
49328
  date: (0, import_dayjs12.default)().format("DD/MM/YYYY"),
48979
49329
  currency: defaultCurrency,
@@ -48995,10 +49345,10 @@ function JournalForm5({
48995
49345
  });
48996
49346
  setRef(data?.ref);
48997
49347
  } catch (error) {
48998
- import_antd98.message.error(error?.message || "Something went wrong");
49348
+ import_antd99.message.error(error?.message || "Something went wrong");
48999
49349
  }
49000
49350
  };
49001
- import_react164.default.useEffect(() => {
49351
+ import_react165.default.useEffect(() => {
49002
49352
  if (isEdit) {
49003
49353
  fetches();
49004
49354
  }
@@ -49016,13 +49366,13 @@ function JournalForm5({
49016
49366
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
49017
49367
  body: payload
49018
49368
  });
49019
- import_antd98.message.success(
49369
+ import_antd99.message.success(
49020
49370
  isEdit ? "Journal updated successfully" : "Journal saved successfully"
49021
49371
  );
49022
49372
  if (onReload) onReload();
49023
49373
  if (close) close();
49024
49374
  } catch (error) {
49025
- import_antd98.message.error(error?.message || "Something went wrong");
49375
+ import_antd99.message.error(error?.message || "Something went wrong");
49026
49376
  }
49027
49377
  };
49028
49378
  const onReverse = async () => {
@@ -49031,11 +49381,11 @@ function JournalForm5({
49031
49381
  await put({
49032
49382
  url: `/transactions/reverse/${id}`
49033
49383
  });
49034
- import_antd98.message.success("Transaction reversed successfully");
49384
+ import_antd99.message.success("Transaction reversed successfully");
49035
49385
  if (onReload) onReload();
49036
49386
  if (close) close();
49037
49387
  } catch (error) {
49038
- import_antd98.message.error(error?.message || "Something went wrong");
49388
+ import_antd99.message.error(error?.message || "Something went wrong");
49039
49389
  }
49040
49390
  };
49041
49391
  const handleKeyDown = (e) => {
@@ -49047,19 +49397,19 @@ function JournalForm5({
49047
49397
  e.preventDefault();
49048
49398
  }
49049
49399
  };
49050
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49400
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49051
49401
  Card,
49052
49402
  {
49053
49403
  isLoading: getLoading,
49054
49404
  className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49055
- children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
49405
+ children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49056
49406
  "form",
49057
49407
  {
49058
49408
  onSubmit: handleSubmit(onSubmit),
49059
49409
  onKeyDown: handleKeyDown,
49060
49410
  className: "space-y-4",
49061
49411
  children: [
49062
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49412
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49063
49413
  Fields_default.Input,
49064
49414
  {
49065
49415
  label: "Description",
@@ -49070,8 +49420,8 @@ function JournalForm5({
49070
49420
  placeholder: "Enter description"
49071
49421
  }
49072
49422
  ),
49073
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49074
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49423
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49424
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49075
49425
  Fields_default.DateInput,
49076
49426
  {
49077
49427
  label: "Date",
@@ -49080,7 +49430,7 @@ function JournalForm5({
49080
49430
  required: true
49081
49431
  }
49082
49432
  ),
49083
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49433
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49084
49434
  Fields_default.Input,
49085
49435
  {
49086
49436
  label: "Currency",
@@ -49090,8 +49440,8 @@ function JournalForm5({
49090
49440
  }
49091
49441
  )
49092
49442
  ] }),
49093
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49094
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49443
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49444
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49095
49445
  Fields_default.Input,
49096
49446
  {
49097
49447
  label: "Amount",
@@ -49102,7 +49452,7 @@ function JournalForm5({
49102
49452
  placeholder: "0.00"
49103
49453
  }
49104
49454
  ),
49105
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49455
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49106
49456
  Fields_default.Select,
49107
49457
  {
49108
49458
  label: "Action",
@@ -49116,7 +49466,7 @@ function JournalForm5({
49116
49466
  }
49117
49467
  )
49118
49468
  ] }),
49119
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49469
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49120
49470
  Fields_default.Textarea,
49121
49471
  {
49122
49472
  label: "Note",
@@ -49126,18 +49476,18 @@ function JournalForm5({
49126
49476
  rows: 3
49127
49477
  }
49128
49478
  ),
49129
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
49130
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49479
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
49480
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49131
49481
  ConfirmModal,
49132
49482
  {
49133
49483
  title: "Reverse Transaction",
49134
- description: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "space-y-3 text-left", children: [
49135
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49136
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49484
+ description: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "space-y-3 text-left", children: [
49485
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49486
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49137
49487
  ] }),
49138
49488
  confirmationWord: "delete",
49139
49489
  onSubmit: onReverse,
49140
- children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49490
+ children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49141
49491
  Button,
49142
49492
  {
49143
49493
  type: "button",
@@ -49150,8 +49500,8 @@ function JournalForm5({
49150
49500
  )
49151
49501
  }
49152
49502
  ) }),
49153
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex justify-end gap-3", children: [
49154
- close && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49503
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex justify-end gap-3", children: [
49504
+ close && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49155
49505
  Button,
49156
49506
  {
49157
49507
  type: "button",
@@ -49161,7 +49511,7 @@ function JournalForm5({
49161
49511
  children: "Cancel"
49162
49512
  }
49163
49513
  ),
49164
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49514
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49165
49515
  Button,
49166
49516
  {
49167
49517
  isLoading,
@@ -49183,15 +49533,15 @@ function JournalForm5({
49183
49533
  var journalForm_default2 = JournalForm5;
49184
49534
 
49185
49535
  // src/components/Transactions/cargoIM/CargoIM.tsx
49186
- var import_jsx_runtime268 = require("react/jsx-runtime");
49536
+ var import_jsx_runtime270 = require("react/jsx-runtime");
49187
49537
  function CargoIM({ v, url }) {
49188
- const { branchId } = (0, import_react_router_dom128.useParams)();
49538
+ const { branchId } = (0, import_react_router_dom130.useParams)();
49189
49539
  const { apiConfig } = useWarqadConfig();
49190
49540
  const { width } = useMediaSize();
49191
49541
  const isLargeScreen = width > 768;
49192
- const navigate = (0, import_react_router_dom128.useNavigate)();
49542
+ const navigate = (0, import_react_router_dom130.useNavigate)();
49193
49543
  const type = "supplier";
49194
- const [deleteAccount, setDeleteAccount] = (0, import_react165.useState)(null);
49544
+ const [deleteAccount, setDeleteAccount] = (0, import_react166.useState)(null);
49195
49545
  const { isLoading: isActionLoading, remove } = useApis_default();
49196
49546
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
49197
49547
  url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
@@ -49202,17 +49552,17 @@ function CargoIM({ v, url }) {
49202
49552
  const items = (data2) => [
49203
49553
  {
49204
49554
  label: `Edit ${type}`,
49205
- icon: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
49555
+ icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
49206
49556
  onClick: () => openState({
49207
49557
  type: "Account",
49208
- content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
49558
+ content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
49209
49559
  title: "Account Form",
49210
49560
  width: 800
49211
49561
  })
49212
49562
  },
49213
49563
  {
49214
49564
  label: `Delete ${type}`,
49215
- icon: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
49565
+ icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.Trash2, { className: "text-red-500", size: 16 }),
49216
49566
  onClick: () => setDeleteAccount(data2)
49217
49567
  }
49218
49568
  ].filter(Boolean);
@@ -49223,7 +49573,7 @@ function CargoIM({ v, url }) {
49223
49573
  className: "w-full",
49224
49574
  cell: ({ row }) => {
49225
49575
  const account = row.original;
49226
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49576
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49227
49577
  "span",
49228
49578
  {
49229
49579
  onClick: () => navigate(`${account?._id}`),
@@ -49252,8 +49602,8 @@ function CargoIM({ v, url }) {
49252
49602
  className: "w-px whitespace-nowrap",
49253
49603
  cell: ({ row }) => {
49254
49604
  const data2 = row.original;
49255
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex gap-4 items-center", children: [
49256
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49605
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "flex gap-4 items-center", children: [
49606
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49257
49607
  "button",
49258
49608
  {
49259
49609
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -49261,7 +49611,7 @@ function CargoIM({ v, url }) {
49261
49611
  openState({
49262
49612
  type: "credit",
49263
49613
  closeOnOverlayClick: false,
49264
- content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49614
+ content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49265
49615
  InvoiceForm_default2,
49266
49616
  {
49267
49617
  onReload: reload,
@@ -49276,7 +49626,7 @@ function CargoIM({ v, url }) {
49276
49626
  children: "Inv"
49277
49627
  }
49278
49628
  ),
49279
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49629
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49280
49630
  "button",
49281
49631
  {
49282
49632
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -49284,7 +49634,7 @@ function CargoIM({ v, url }) {
49284
49634
  openState({
49285
49635
  type: "debit",
49286
49636
  closeOnOverlayClick: false,
49287
- content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49637
+ content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49288
49638
  journalForm_default2,
49289
49639
  {
49290
49640
  onReload: reload,
@@ -49300,14 +49650,14 @@ function CargoIM({ v, url }) {
49300
49650
  children: "Pay"
49301
49651
  }
49302
49652
  ),
49303
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49653
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49304
49654
  Dropdown,
49305
49655
  {
49306
49656
  className: "cursor-pointer",
49307
49657
  width: "w-[150px]",
49308
49658
  items: items(data2),
49309
49659
  triggerMode: "hover",
49310
- children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(import_lucide_react126.EllipsisVertical, {})
49660
+ children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.EllipsisVertical, {})
49311
49661
  }
49312
49662
  )
49313
49663
  ] });
@@ -49323,17 +49673,17 @@ function CargoIM({ v, url }) {
49323
49673
  const onDelete = async (id) => {
49324
49674
  try {
49325
49675
  await remove({ url: `/accounts/delete/${id}` });
49326
- import_antd99.message.success("Account deleted successfully");
49676
+ import_antd100.message.success("Account deleted successfully");
49327
49677
  reload();
49328
49678
  setDeleteAccount(null);
49329
49679
  } catch (error) {
49330
- import_antd99.message.error(error.message || "Something went wrong");
49680
+ import_antd100.message.error(error.message || "Something went wrong");
49331
49681
  return error;
49332
49682
  }
49333
49683
  };
49334
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
49335
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Modal2, {}),
49336
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49684
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
49685
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Modal2, {}),
49686
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49337
49687
  ConfirmModal,
49338
49688
  {
49339
49689
  isOpen: !!deleteAccount,
@@ -49346,7 +49696,7 @@ function CargoIM({ v, url }) {
49346
49696
  children: null
49347
49697
  }
49348
49698
  ),
49349
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49699
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49350
49700
  TransactionViewComponent,
49351
49701
  {
49352
49702
  columns,
@@ -49357,7 +49707,7 @@ function CargoIM({ v, url }) {
49357
49707
  onCreate: () => {
49358
49708
  openState({
49359
49709
  type: "account",
49360
- content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(AccountForm_default3, { onReload: reload, close }),
49710
+ content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(AccountForm_default3, { onReload: reload, close }),
49361
49711
  title: "Account Form",
49362
49712
  width: 800
49363
49713
  });
@@ -49369,9 +49719,9 @@ function CargoIM({ v, url }) {
49369
49719
  var CargoIM_default = CargoIM;
49370
49720
 
49371
49721
  // src/components/Transactions/cargoIM/cargoIMReport.tsx
49372
- var import_react_router_dom129 = require("react-router-dom");
49373
- var import_react166 = require("react");
49374
- var import_jsx_runtime269 = require("react/jsx-runtime");
49722
+ var import_react_router_dom131 = require("react-router-dom");
49723
+ var import_react167 = require("react");
49724
+ var import_jsx_runtime271 = require("react/jsx-runtime");
49375
49725
  var CargoIMReport = () => {
49376
49726
  const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
49377
49727
  const { TransactionView, openTransaction } = useTransactionView_default();
@@ -49384,10 +49734,10 @@ var CargoIMReport = () => {
49384
49734
  value: currency2
49385
49735
  };
49386
49736
  });
49387
- const [searchParams, setSearchParams] = (0, import_react_router_dom129.useSearchParams)();
49737
+ const [searchParams, setSearchParams] = (0, import_react_router_dom131.useSearchParams)();
49388
49738
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
49389
49739
  const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
49390
- const [currencyFilter, setCurrencyFilter] = (0, import_react166.useState)(initialCurrency);
49740
+ const [currencyFilter, setCurrencyFilter] = (0, import_react167.useState)(initialCurrency);
49391
49741
  const handleCurrencyChange = (value) => {
49392
49742
  setCurrencyFilter(value);
49393
49743
  setSearchParams((prev) => {
@@ -49395,7 +49745,7 @@ var CargoIMReport = () => {
49395
49745
  return prev;
49396
49746
  });
49397
49747
  };
49398
- (0, import_react166.useEffect)(() => {
49748
+ (0, import_react167.useEffect)(() => {
49399
49749
  if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
49400
49750
  setCurrencyFilter(urlCurrency);
49401
49751
  }
@@ -49415,9 +49765,9 @@ var CargoIMReport = () => {
49415
49765
  header: "Date",
49416
49766
  key: "date",
49417
49767
  className: "text-xs whitespace-nowrap",
49418
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "", children: [
49419
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49420
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49768
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "", children: [
49769
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49770
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49421
49771
  "span",
49422
49772
  {
49423
49773
  onClick: () => {
@@ -49436,13 +49786,13 @@ var CargoIMReport = () => {
49436
49786
  header: "Container No",
49437
49787
  key: "description",
49438
49788
  className: "text-xs w-full break-words",
49439
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49789
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49440
49790
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49441
49791
  /[^a-zA-Z0-9]/g,
49442
49792
  ""
49443
49793
  );
49444
49794
  const lineClass = `tx-line-${rowId}-${idx}`;
49445
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49795
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49446
49796
  "div",
49447
49797
  {
49448
49798
  className: `${lineClass} min-h-[24px] py-1 flex items-center font-bold capitalize text-black dark:text-white print:text-black whitespace-normal break-words`,
@@ -49456,13 +49806,13 @@ var CargoIMReport = () => {
49456
49806
  header: "Cbm",
49457
49807
  key: "cbm",
49458
49808
  className: "text-xs whitespace-nowrap text-right",
49459
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49809
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49460
49810
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49461
49811
  /[^a-zA-Z0-9]/g,
49462
49812
  ""
49463
49813
  );
49464
49814
  const lineClass = `tx-line-${rowId}-${idx}`;
49465
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49815
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49466
49816
  "div",
49467
49817
  {
49468
49818
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -49479,20 +49829,20 @@ var CargoIMReport = () => {
49479
49829
  ),
49480
49830
  0
49481
49831
  );
49482
- return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
49832
+ return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
49483
49833
  }
49484
49834
  },
49485
49835
  {
49486
49836
  header: "Price",
49487
49837
  key: "price",
49488
49838
  className: "text-xs whitespace-nowrap text-right",
49489
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49839
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49490
49840
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49491
49841
  /[^a-zA-Z0-9]/g,
49492
49842
  ""
49493
49843
  );
49494
49844
  const lineClass = `tx-line-${rowId}-${idx}`;
49495
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49845
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49496
49846
  "div",
49497
49847
  {
49498
49848
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -49506,13 +49856,13 @@ var CargoIMReport = () => {
49506
49856
  header: "Credit",
49507
49857
  key: "credit",
49508
49858
  className: "text-xs whitespace-nowrap text-right",
49509
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49859
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49510
49860
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49511
49861
  /[^a-zA-Z0-9]/g,
49512
49862
  ""
49513
49863
  );
49514
49864
  const lineClass = `tx-line-${rowId}-${idx}`;
49515
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49865
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49516
49866
  "div",
49517
49867
  {
49518
49868
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-green-500 dark:text-green-500 print:text-green-500 whitespace-nowrap`,
@@ -49521,7 +49871,7 @@ var CargoIMReport = () => {
49521
49871
  idx
49522
49872
  );
49523
49873
  }) }),
49524
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
49874
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
49525
49875
  data2.reduce(
49526
49876
  (acc, row) => acc + (row.lines || []).reduce(
49527
49877
  (lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
@@ -49535,13 +49885,13 @@ var CargoIMReport = () => {
49535
49885
  header: "Debit",
49536
49886
  key: "debit",
49537
49887
  className: "text-xs whitespace-nowrap text-right",
49538
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49888
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49539
49889
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49540
49890
  /[^a-zA-Z0-9]/g,
49541
49891
  ""
49542
49892
  );
49543
49893
  const lineClass = `tx-line-${rowId}-${idx}`;
49544
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49894
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49545
49895
  "div",
49546
49896
  {
49547
49897
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-red-500 dark:text-red-500 print:text-red-500 whitespace-nowrap`,
@@ -49550,7 +49900,7 @@ var CargoIMReport = () => {
49550
49900
  idx
49551
49901
  );
49552
49902
  }) }),
49553
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
49903
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
49554
49904
  data2.reduce(
49555
49905
  (acc, row) => acc + (row.lines || []).reduce(
49556
49906
  (lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
@@ -49564,14 +49914,14 @@ var CargoIMReport = () => {
49564
49914
  header: "Balance",
49565
49915
  key: "runningBalance",
49566
49916
  className: "text-xs whitespace-nowrap text-right",
49567
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
49568
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
49917
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
49918
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
49569
49919
  data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
49570
49920
  currency
49571
49921
  ) })
49572
49922
  }
49573
49923
  ];
49574
- const datas = (0, import_react166.useMemo)(() => {
49924
+ const datas = (0, import_react167.useMemo)(() => {
49575
49925
  let runningBalance = 0;
49576
49926
  const transactions = data?.data?.transactions;
49577
49927
  const res = (transactions || []).map((item) => {
@@ -49608,10 +49958,10 @@ var CargoIMReport = () => {
49608
49958
  { label: "Account Type", value: data?.data?.type },
49609
49959
  { label: "Currency", value: currencyFilter }
49610
49960
  ];
49611
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
49612
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Modal2, {}),
49613
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
49614
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49961
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
49962
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Modal2, {}),
49963
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(TransactionView, {}),
49964
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49615
49965
  A4DataView,
49616
49966
  {
49617
49967
  columns,
@@ -49626,7 +49976,7 @@ var CargoIMReport = () => {
49626
49976
  openState({
49627
49977
  type: "debit",
49628
49978
  closeOnOverlayClick: false,
49629
- content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49979
+ content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49630
49980
  InvoiceForm_default2,
49631
49981
  {
49632
49982
  close: closeTransaction,
@@ -49634,7 +49984,7 @@ var CargoIMReport = () => {
49634
49984
  onReload: reload,
49635
49985
  id: row._id
49636
49986
  }
49637
- ) : /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49987
+ ) : /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49638
49988
  journalForm_default2,
49639
49989
  {
49640
49990
  close: closeTransaction,
@@ -49647,7 +49997,7 @@ var CargoIMReport = () => {
49647
49997
  width: 800
49648
49998
  });
49649
49999
  },
49650
- headers: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
50000
+ headers: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49651
50001
  Fields_default.Select,
49652
50002
  {
49653
50003
  options: currencies,
@@ -49663,16 +50013,16 @@ var CargoIMReport = () => {
49663
50013
  var cargoIMReport_default = CargoIMReport;
49664
50014
 
49665
50015
  // src/components/accounts/forex-2/Forex2Accounts.tsx
49666
- var import_react_router_dom130 = require("react-router-dom");
49667
- var import_lucide_react127 = require("lucide-react");
49668
- var import_react167 = require("react");
49669
- var import_antd100 = require("antd");
49670
- var import_jsx_runtime270 = require("react/jsx-runtime");
50016
+ var import_react_router_dom132 = require("react-router-dom");
50017
+ var import_lucide_react128 = require("lucide-react");
50018
+ var import_react168 = require("react");
50019
+ var import_antd101 = require("antd");
50020
+ var import_jsx_runtime272 = require("react/jsx-runtime");
49671
50021
  function Forex2Accounts({ v, url }) {
49672
- const { branchId } = (0, import_react_router_dom130.useParams)();
49673
- const navigate = (0, import_react_router_dom130.useNavigate)();
50022
+ const { branchId } = (0, import_react_router_dom132.useParams)();
50023
+ const navigate = (0, import_react_router_dom132.useNavigate)();
49674
50024
  const type = "account";
49675
- const [deleteAccount, setDeleteAccount] = (0, import_react167.useState)(null);
50025
+ const [deleteAccount, setDeleteAccount] = (0, import_react168.useState)(null);
49676
50026
  const { isLoading: isActionLoading, remove } = useApis_default();
49677
50027
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
49678
50028
  url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
@@ -49683,22 +50033,22 @@ function Forex2Accounts({ v, url }) {
49683
50033
  const items = (data2) => [
49684
50034
  {
49685
50035
  label: `Currency Report`,
49686
- icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.FileChartLine, { size: 16 }),
50036
+ icon: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.FileChartLine, { size: 16 }),
49687
50037
  onClick: () => navigate(data2?._id)
49688
50038
  },
49689
50039
  {
49690
50040
  label: `Edit ${type}`,
49691
- icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
50041
+ icon: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
49692
50042
  onClick: () => openState({
49693
50043
  type: "forex account",
49694
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
50044
+ content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
49695
50045
  title: "Forex Account Form",
49696
50046
  width: 800
49697
50047
  })
49698
50048
  },
49699
50049
  {
49700
50050
  label: `Delete ${type}`,
49701
- icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.Trash2, { className: "text-red-500", size: 16 }),
50051
+ icon: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
49702
50052
  onClick: () => setDeleteAccount(data2)
49703
50053
  }
49704
50054
  ].filter(Boolean);
@@ -49708,7 +50058,7 @@ function Forex2Accounts({ v, url }) {
49708
50058
  header: "Name",
49709
50059
  cell: ({ row }) => {
49710
50060
  const account = row.original;
49711
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50061
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49712
50062
  "span",
49713
50063
  {
49714
50064
  onClick: () => navigate(`statements/${account?._id}`),
@@ -49723,7 +50073,7 @@ function Forex2Accounts({ v, url }) {
49723
50073
  header: "Phone",
49724
50074
  cell: ({ row }) => {
49725
50075
  const account = row.original;
49726
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("span", { children: account?.phoneNumber || "N/A" });
50076
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { children: account?.phoneNumber || "N/A" });
49727
50077
  }
49728
50078
  },
49729
50079
  {
@@ -49731,14 +50081,14 @@ function Forex2Accounts({ v, url }) {
49731
50081
  header: "Balances",
49732
50082
  cell: ({ row }) => {
49733
50083
  const account = row.original;
49734
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
49735
- ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
50084
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
50085
+ ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
49736
50086
  "div",
49737
50087
  {
49738
50088
  className: "flex items-center gap-1.5 px-2 py-0.5 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-100 dark:border-gray-700",
49739
50089
  children: [
49740
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
49741
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50090
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
50091
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49742
50092
  "span",
49743
50093
  {
49744
50094
  className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
@@ -49757,8 +50107,8 @@ function Forex2Accounts({ v, url }) {
49757
50107
  header: "Actions",
49758
50108
  cell: ({ row }) => {
49759
50109
  const data2 = row.original;
49760
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "flex gap-4 items-center", children: [
49761
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50110
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex gap-4 items-center", children: [
50111
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49762
50112
  "button",
49763
50113
  {
49764
50114
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -49766,7 +50116,7 @@ function Forex2Accounts({ v, url }) {
49766
50116
  openState({
49767
50117
  type: "credit",
49768
50118
  closeOnOverlayClick: false,
49769
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50119
+ content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49770
50120
  Forex2FormTransaction_default,
49771
50121
  {
49772
50122
  close,
@@ -49782,7 +50132,7 @@ function Forex2Accounts({ v, url }) {
49782
50132
  children: "Out"
49783
50133
  }
49784
50134
  ),
49785
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50135
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49786
50136
  "button",
49787
50137
  {
49788
50138
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -49790,7 +50140,7 @@ function Forex2Accounts({ v, url }) {
49790
50140
  openState({
49791
50141
  type: "debit",
49792
50142
  closeOnOverlayClick: false,
49793
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50143
+ content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49794
50144
  Forex2FormTransaction_default,
49795
50145
  {
49796
50146
  close,
@@ -49806,13 +50156,13 @@ function Forex2Accounts({ v, url }) {
49806
50156
  children: "In"
49807
50157
  }
49808
50158
  ),
49809
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50159
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49810
50160
  Dropdown,
49811
50161
  {
49812
50162
  className: "cursor-pointer w-[150px]",
49813
50163
  items: items(data2),
49814
50164
  triggerMode: "hover",
49815
- children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.EllipsisVertical, {})
50165
+ children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.EllipsisVertical, {})
49816
50166
  }
49817
50167
  )
49818
50168
  ] });
@@ -49823,11 +50173,11 @@ function Forex2Accounts({ v, url }) {
49823
50173
  const onDelete = async (id) => {
49824
50174
  try {
49825
50175
  await remove({ url: `/accounts/delete/${id}` });
49826
- import_antd100.message.success("Account deleted successfully");
50176
+ import_antd101.message.success("Account deleted successfully");
49827
50177
  reload();
49828
50178
  setDeleteAccount(null);
49829
50179
  } catch (error) {
49830
- import_antd100.message.error(error.message || "Something went wrong");
50180
+ import_antd101.message.error(error.message || "Something went wrong");
49831
50181
  return error;
49832
50182
  }
49833
50183
  };
@@ -49851,9 +50201,9 @@ function Forex2Accounts({ v, url }) {
49851
50201
  };
49852
50202
  }).filter((item) => item.debit !== 0 || item.credit !== 0);
49853
50203
  console.log(currencies);
49854
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
49855
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Modal2, {}),
49856
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50204
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_jsx_runtime272.Fragment, { children: [
50205
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Modal2, {}),
50206
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49857
50207
  ConfirmModal,
49858
50208
  {
49859
50209
  isOpen: !!deleteAccount,
@@ -49866,9 +50216,9 @@ function Forex2Accounts({ v, url }) {
49866
50216
  children: null
49867
50217
  }
49868
50218
  ),
49869
- /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { children: [
49870
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
49871
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
50219
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { children: [
50220
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
50221
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49872
50222
  TransactionViewComponent,
49873
50223
  {
49874
50224
  columns,
@@ -49880,7 +50230,7 @@ function Forex2Accounts({ v, url }) {
49880
50230
  onCreate: () => {
49881
50231
  openState({
49882
50232
  type: "forex account",
49883
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(ForexAccountForm_default, { close, reloads: reload }),
50233
+ content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ForexAccountForm_default, { close, reloads: reload }),
49884
50234
  title: "Forex Account Form",
49885
50235
  width: 800
49886
50236
  });
@@ -49893,14 +50243,14 @@ function Forex2Accounts({ v, url }) {
49893
50243
  var Forex2Accounts_default = Forex2Accounts;
49894
50244
 
49895
50245
  // src/components/reports/ProductList.tsx
49896
- var import_react_router_dom131 = require("react-router-dom");
49897
- var import_jsx_runtime271 = require("react/jsx-runtime");
50246
+ var import_react_router_dom133 = require("react-router-dom");
50247
+ var import_jsx_runtime273 = require("react/jsx-runtime");
49898
50248
  var options9 = [
49899
50249
  { label: "Product", value: "product" },
49900
50250
  { label: "Pack", value: "pack" }
49901
50251
  ];
49902
50252
  var ProductList2 = ({ value = false }) => {
49903
- const { branchId } = (0, import_react_router_dom131.useParams)();
50253
+ const { branchId } = (0, import_react_router_dom133.useParams)();
49904
50254
  const { branches } = useAuth_default();
49905
50255
  const { TransactionView } = useTransactionView_default();
49906
50256
  const { getQuery, setQuery } = useApp_default();
@@ -49922,7 +50272,7 @@ var ProductList2 = ({ value = false }) => {
49922
50272
  key: "name",
49923
50273
  className: "text-xs whitespace-nowrap",
49924
50274
  render: (row) => {
49925
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
50275
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
49926
50276
  }
49927
50277
  },
49928
50278
  ...value ? [
@@ -49930,14 +50280,14 @@ var ProductList2 = ({ value = false }) => {
49930
50280
  header: "Cost",
49931
50281
  key: "cost",
49932
50282
  className: "text-xs whitespace-nowrap text-right",
49933
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
50283
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
49934
50284
  }
49935
50285
  ] : []
49936
50286
  ];
49937
50287
  const datas = data?.data || [];
49938
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
49939
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(TransactionView, {}),
49940
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50288
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [
50289
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(TransactionView, {}),
50290
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49941
50291
  A4DataView,
49942
50292
  {
49943
50293
  columns,
@@ -49948,7 +50298,7 @@ var ProductList2 = ({ value = false }) => {
49948
50298
  tableTitle: "Stock List",
49949
50299
  fixed: false,
49950
50300
  startPage: 1e10,
49951
- headers: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50301
+ headers: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49952
50302
  Select,
49953
50303
  {
49954
50304
  options: options9,
@@ -50060,6 +50410,7 @@ var ProductList_default = ProductList2;
50060
50410
  Posts,
50061
50411
  ProductField,
50062
50412
  ProductForm,
50413
+ ProductImage,
50063
50414
  ProductList,
50064
50415
  Products,
50065
50416
  ProfileAccount,