warqadui 0.0.287 → 0.0.289

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
@@ -351,7 +351,8 @@ var Enums = {
351
351
  expenseAccount: ["branch", "account"],
352
352
  integrationTypes: ["twilio-whatsapp"],
353
353
  postTypes: ["umrah", "hajj", "visa", "hotel"],
354
- postStatus: ["draft", "published", "archived"]
354
+ postStatus: ["draft", "published", "archived"],
355
+ collectionTypes: ["collected", "pending"]
355
356
  };
356
357
  var Enums_default = Enums;
357
358
 
@@ -2340,7 +2341,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
2340
2341
  enumName,
2341
2342
  ...rest
2342
2343
  } = props;
2343
- const options10 = (0, import_react15.useMemo)(() => {
2344
+ const options11 = (0, import_react15.useMemo)(() => {
2344
2345
  if (initialOptions.length > 0) return initialOptions;
2345
2346
  const targetEnum = enumData || (enumName ? enums[enumName] : void 0);
2346
2347
  if (targetEnum) {
@@ -2376,7 +2377,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
2376
2377
  SelectRoot,
2377
2378
  {
2378
2379
  ...rest,
2379
- options: options10,
2380
+ options: options11,
2380
2381
  currentValue: formValue,
2381
2382
  onChangeHandler: (val) => {
2382
2383
  formOnChange(val);
@@ -2393,7 +2394,7 @@ var Select = (0, import_react15.forwardRef)((props, ref2) => {
2393
2394
  SelectRoot,
2394
2395
  {
2395
2396
  ...rest,
2396
- options: options10,
2397
+ options: options11,
2397
2398
  currentValue: value,
2398
2399
  onChangeHandler: onChange || (() => {
2399
2400
  }),
@@ -2579,12 +2580,12 @@ var SelectTrigger = (0, import_react15.forwardRef)(
2579
2580
  dropdownContentRef,
2580
2581
  containerRef,
2581
2582
  selectedValue,
2582
- options: options10,
2583
+ options: options11,
2583
2584
  fieldInternalProps,
2584
2585
  disabled
2585
2586
  } = useSelectContext();
2586
2587
  const lastFocusTime = (0, import_react15.useRef)(0);
2587
- const displayOption = options10.find((o) => o.value === selectedValue);
2588
+ const displayOption = options11.find((o) => o.value === selectedValue);
2588
2589
  const displayValue = displayOption ? displayOption.label : selectedValue != null && selectedValue !== "" ? String(selectedValue) : placeholder;
2589
2590
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2590
2591
  "div",
@@ -3018,7 +3019,7 @@ var SearchApiRoot = ({
3018
3019
  const [searchTerm, setSearchTerm] = (0, import_react17.useState)("");
3019
3020
  const { theme } = useWarqadConfig();
3020
3021
  const primaryColor = theme?.primaryColor;
3021
- const [options10, setOptions] = (0, import_react17.useState)([]);
3022
+ const [options11, setOptions] = (0, import_react17.useState)([]);
3022
3023
  const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
3023
3024
  const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
3024
3025
  const [activeIndex, setActiveIndex] = (0, import_react17.useState)(-1);
@@ -3070,7 +3071,7 @@ var SearchApiRoot = ({
3070
3071
  return () => clearTimeout(timer);
3071
3072
  }, [searchTerm, api, isOpen]);
3072
3073
  (0, import_react17.useEffect)(() => {
3073
- if (isOpen && options10.length === 0) {
3074
+ if (isOpen && options11.length === 0) {
3074
3075
  fetchOptions("");
3075
3076
  }
3076
3077
  }, [isOpen]);
@@ -3101,8 +3102,8 @@ var SearchApiRoot = ({
3101
3102
  return option[valueKey];
3102
3103
  };
3103
3104
  (0, import_react17.useEffect)(() => {
3104
- if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject && options10.length > 0) {
3105
- const found = options10.find((o) => getOptionValue(o) === currentValue);
3105
+ if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject && options11.length > 0) {
3106
+ const found = options11.find((o) => getOptionValue(o) === currentValue);
3106
3107
  if (found) {
3107
3108
  setSelectedObject(found);
3108
3109
  if (form && obj) {
@@ -3113,7 +3114,7 @@ var SearchApiRoot = ({
3113
3114
  }
3114
3115
  }
3115
3116
  }
3116
- }, [currentValue, options10, obj]);
3117
+ }, [currentValue, options11, obj]);
3117
3118
  (0, import_react17.useEffect)(() => {
3118
3119
  if (prevApiRef.current !== api) {
3119
3120
  prevApiRef.current = api;
@@ -3158,8 +3159,8 @@ var SearchApiRoot = ({
3158
3159
  }, [fieldInternalProps]);
3159
3160
  const getDisplayValue = () => {
3160
3161
  if (selectedObject) return selectedObject[labelKey];
3161
- if (options10.length > 0 && currentValue !== void 0 && currentValue !== null && currentValue !== "") {
3162
- const found = options10.find((o) => getOptionValue(o) === currentValue);
3162
+ if (options11.length > 0 && currentValue !== void 0 && currentValue !== null && currentValue !== "") {
3163
+ const found = options11.find((o) => getOptionValue(o) === currentValue);
3163
3164
  if (found) return found[labelKey];
3164
3165
  }
3165
3166
  if (isLoading || currentValue !== void 0 && currentValue !== null && currentValue !== "" && !hasAttemptedHydration)
@@ -3203,7 +3204,7 @@ var SearchApiRoot = ({
3203
3204
  setSearchTerm("");
3204
3205
  if (onClear) onClear();
3205
3206
  };
3206
- const filteredOptions = options10.filter(
3207
+ const filteredOptions = options11.filter(
3207
3208
  (option) => !filter.includes(getOptionValue(option))
3208
3209
  );
3209
3210
  let message92 = error || errorMessage;
@@ -3368,7 +3369,7 @@ var SearchApiInput = (0, import_react17.forwardRef)(
3368
3369
  variant,
3369
3370
  activeIndex,
3370
3371
  setActiveIndex,
3371
- options: options10,
3372
+ options: options11,
3372
3373
  handleSelect,
3373
3374
  clearSelection,
3374
3375
  inputRef,
@@ -3400,7 +3401,7 @@ var SearchApiInput = (0, import_react17.forwardRef)(
3400
3401
  e.preventDefault();
3401
3402
  e.stopPropagation();
3402
3403
  setActiveIndex(
3403
- activeIndex < options10.length - 1 ? activeIndex + 1 : activeIndex
3404
+ activeIndex < options11.length - 1 ? activeIndex + 1 : activeIndex
3404
3405
  );
3405
3406
  break;
3406
3407
  case "ArrowUp":
@@ -3411,8 +3412,8 @@ var SearchApiInput = (0, import_react17.forwardRef)(
3411
3412
  case "Enter":
3412
3413
  e.preventDefault();
3413
3414
  e.stopPropagation();
3414
- if (activeIndex >= 0 && activeIndex < options10.length)
3415
- handleSelect(options10[activeIndex]);
3415
+ if (activeIndex >= 0 && activeIndex < options11.length)
3416
+ handleSelect(options11[activeIndex]);
3416
3417
  break;
3417
3418
  case "Escape":
3418
3419
  e.preventDefault();
@@ -3488,7 +3489,7 @@ var SearchApiContent = (0, import_react17.forwardRef)(
3488
3489
  dropdownContentRef,
3489
3490
  isLoading,
3490
3491
  searchTerm,
3491
- options: options10,
3492
+ options: options11,
3492
3493
  error
3493
3494
  } = useSearchApiContext();
3494
3495
  const [dropdownStyle, setDropdownStyle] = (0, import_react17.useState)({});
@@ -3528,7 +3529,7 @@ var SearchApiContent = (0, import_react17.forwardRef)(
3528
3529
  ...props,
3529
3530
  children: [
3530
3531
  error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 border-b border-gray-100 dark:border-zinc-800", children: error }),
3531
- isLoading && options10.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-4 text-center text-sm text-gray-500", children: [
3532
+ isLoading && options11.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "p-4 text-center text-sm text-gray-500", children: [
3532
3533
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Loader2, { className: "h-5 w-5 animate-spin mx-auto mb-2" }),
3533
3534
  "Loading options..."
3534
3535
  ] }) : children ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "py-1", children }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-4 text-center text-sm text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
@@ -7570,13 +7571,13 @@ var import_moment = __toESM(require("moment"));
7570
7571
  var import_react_to_print3 = require("react-to-print");
7571
7572
 
7572
7573
  // src/utils/Formats.tsx
7573
- function Price(price, currency = "USD", round2 = true, options10) {
7574
+ function Price(price, currency = "USD", round2 = true, options11) {
7574
7575
  const num = Number(price);
7575
7576
  const decimalPlaces = round2 ? 0 : Math.min(num.toString().split(".")[1]?.length ?? 0, 2);
7576
7577
  const formatted = new Intl.NumberFormat("en-US", {
7577
7578
  minimumFractionDigits: decimalPlaces,
7578
7579
  maximumFractionDigits: decimalPlaces,
7579
- ...options10
7580
+ ...options11
7580
7581
  }).format(num);
7581
7582
  return `${formatted} ${currency}`;
7582
7583
  }
@@ -8082,7 +8083,7 @@ var useTransaction_default = useTransaction;
8082
8083
  // src/utils/pdf.ts
8083
8084
  var import_html2canvas_pro = __toESM(require("html2canvas-pro"));
8084
8085
  var import_jspdf = require("jspdf");
8085
- var generatePdf = async (elementId, options10 = {}) => {
8086
+ var generatePdf = async (elementId, options11 = {}) => {
8086
8087
  const {
8087
8088
  orientation = "landscape",
8088
8089
  unit = "mm",
@@ -8092,7 +8093,7 @@ var generatePdf = async (elementId, options10 = {}) => {
8092
8093
  windowWidth = 1200,
8093
8094
  scale = 1,
8094
8095
  showPageNumbers = true
8095
- } = options10;
8096
+ } = options11;
8096
8097
  const element = document.getElementById(elementId);
8097
8098
  if (!element) {
8098
8099
  console.error(
@@ -29731,7 +29732,7 @@ var StatusFilter = ({
29731
29732
  value,
29732
29733
  onChange
29733
29734
  }) => {
29734
- const options10 = type === "rent" ? [
29735
+ const options11 = type === "rent" ? [
29735
29736
  { label: "All", value: "all", dotColor: "bg-slate-400" },
29736
29737
  { label: "Vacant", value: "vacant", dotColor: "bg-[#22c55e]" },
29737
29738
  { label: "Occupied", value: "occupied", dotColor: "bg-[#ef4444]" }
@@ -29741,7 +29742,7 @@ var StatusFilter = ({
29741
29742
  { label: "Booked", value: "booked", dotColor: "bg-[#3b82f6]" },
29742
29743
  { label: "Sold", value: "sold", dotColor: "bg-[#ef4444]" }
29743
29744
  ];
29744
- return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex gap-1 p-1 bg-slate-100 dark:bg-slate-800/80 rounded-lg border border-slate-200/50 dark:border-slate-700/60", children: options10.map((opt) => {
29745
+ return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("div", { className: "flex gap-1 p-1 bg-slate-100 dark:bg-slate-800/80 rounded-lg border border-slate-200/50 dark:border-slate-700/60", children: options11.map((opt) => {
29745
29746
  const isActive = value === opt.value;
29746
29747
  return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
29747
29748
  "button",
@@ -46301,7 +46302,8 @@ var AdjustmentStockSchema5 = import_zod117.default.object({
46301
46302
  cash: import_zod117.default.coerce.number(),
46302
46303
  credit: import_zod117.default.coerce.number(),
46303
46304
  discount: import_zod117.default.coerce.number(),
46304
- currency: import_zod117.default.enum(Enums_default.currencies)
46305
+ currency: import_zod117.default.enum(Enums_default.currencies),
46306
+ collection: import_zod117.default.enum(Enums_default.collectionTypes)
46305
46307
  });
46306
46308
  var schema_default7 = AdjustmentStockSchema5;
46307
46309
 
@@ -46384,13 +46386,13 @@ var CompleteSaleModal2 = ({
46384
46386
  ] }),
46385
46387
  /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
46386
46388
  /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
46387
- /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount & Rate" }),
46389
+ /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount, Rate & Collection" }),
46388
46390
  (discount > 0 || isRate) && /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-xs px-2 py-0.5 bg-amber-50 text-amber-600 rounded-full font-medium dark:bg-amber-950/40 dark:text-amber-400", children: discount > 0 ? "Applied" : "Exchange Rate Required" })
46389
46391
  ] }),
46390
46392
  /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)(
46391
46393
  "div",
46392
46394
  {
46393
- className: isRate ? "grid grid-cols-1 md:grid-cols-2 gap-4" : "grid grid-cols-1 gap-4",
46395
+ className: isRate ? "grid grid-cols-1 md:grid-cols-3 gap-4" : "grid grid-cols-1 md:grid-cols-2 gap-4",
46394
46396
  children: [
46395
46397
  /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
46396
46398
  Fields_default.Input,
@@ -46413,6 +46415,17 @@ var CompleteSaleModal2 = ({
46413
46415
  type: "number",
46414
46416
  className: "h-[40px]!"
46415
46417
  }
46418
+ ),
46419
+ /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
46420
+ Fields_default.Select,
46421
+ {
46422
+ label: "Collection",
46423
+ name: "collection",
46424
+ form,
46425
+ enumName: "collectionTypes",
46426
+ required: true,
46427
+ className: "h-[40px]!"
46428
+ }
46416
46429
  )
46417
46430
  ]
46418
46431
  }
@@ -46451,7 +46464,7 @@ var CompleteSaleModal2 = ({
46451
46464
  ] }),
46452
46465
  /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
46453
46466
  /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
46454
- /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Credit Payment" }),
46467
+ /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "3. Credit Payment" }),
46455
46468
  credit > 0 && /* @__PURE__ */ (0, import_jsx_runtime256.jsx)("span", { className: "text-xs px-2 py-0.5 bg-red-50 text-red-600 rounded-full font-medium dark:bg-red-950/40 dark:text-red-400", children: "Active" })
46456
46469
  ] }),
46457
46470
  /* @__PURE__ */ (0, import_jsx_runtime256.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
@@ -46575,7 +46588,8 @@ var Sale2Form2 = ({
46575
46588
  cash: 0,
46576
46589
  credit: 0,
46577
46590
  discount: 0,
46578
- invoiceNumber: ""
46591
+ invoiceNumber: "",
46592
+ collection: "collected"
46579
46593
  }
46580
46594
  });
46581
46595
  const { handleSubmit, watch, setValue } = methods;
@@ -46652,7 +46666,8 @@ var Sale2Form2 = ({
46652
46666
  cash: cashVal,
46653
46667
  credit: creditVal,
46654
46668
  discount: discountVal,
46655
- invoiceNumber: data.invoiceNumber || void 0
46669
+ invoiceNumber: data.invoiceNumber || void 0,
46670
+ collection: data.collection
46656
46671
  };
46657
46672
  try {
46658
46673
  await post({
@@ -46720,6 +46735,7 @@ var Sale2Form2 = ({
46720
46735
  setValue("discount", datas.discount || 0);
46721
46736
  setValue("invoiceNumber", datas.invoiceNumber || "");
46722
46737
  setValue("currency", datas?.currency);
46738
+ setValue("collection", datas?.collection);
46723
46739
  setTimeout(() => {
46724
46740
  setValue("rate", datas?.rate);
46725
46741
  setValue("wallet", datas?.toWalletData?._id);
@@ -46860,44 +46876,40 @@ function getStorageType5(type, branch) {
46860
46876
  }
46861
46877
  var pos_default5 = Sale2Form2;
46862
46878
 
46863
- // src/components/Transactions/3/sale2/index.ts
46864
- var Sale22 = {
46865
- List: List_default6,
46866
- Form: pos_default5
46867
- };
46868
- var sale2_default2 = Sale22;
46869
-
46870
- // src/components/Transactions/3/purchase3/List.tsx
46879
+ // src/components/Transactions/3/sale2/Collection.tsx
46880
+ var import_react156 = require("react");
46871
46881
  var import_react_router_dom120 = require("react-router-dom");
46872
46882
  var import_lucide_react123 = require("lucide-react");
46873
46883
  var import_jsx_runtime258 = require("react/jsx-runtime");
46874
- function purchase3List({
46884
+ function Collection3({
46875
46885
  url,
46876
46886
  type = "product"
46877
46887
  }) {
46878
46888
  const { branchId } = (0, import_react_router_dom120.useParams)();
46879
46889
  const navigate = (0, import_react_router_dom120.useNavigate)();
46890
+ const { currencies } = useWarqadConfig();
46891
+ const { defaultCurrency } = currencies;
46880
46892
  const { TransactionView, openTransaction } = useTransactionView_default();
46881
46893
  const { data, TransactionViewComponent, reload } = useTransaction_default({
46882
- url: url || `/transactions/get?type=stock&stock=purchase-3&stockType=${type}${branchId ? `&fromBranch=${branchId}` : ""}`,
46883
- dateFilter: true
46894
+ url: url || `/transactions/get?type=stock&stock=sale-3&stockType=${type}&collection=pending${branchId ? `&fromBranch=${branchId}` : ""}`,
46895
+ dateFilter: false
46884
46896
  });
46885
46897
  const { Modal: Modal2 } = useModal();
46886
46898
  const { PosPrinter } = usePosPrinter_default();
46887
46899
  const items = (data2) => [
46888
46900
  {
46889
- label: `View Stock Purchase`,
46901
+ label: `View Stock Sale`,
46890
46902
  icon: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Eye, { size: 16 }),
46891
46903
  className: "w-[200px]",
46892
46904
  onClick: () => openTransaction({ id: data2?._id, type: "stock" })
46893
46905
  },
46894
46906
  {
46895
- label: `Edit Stock Purchase`,
46907
+ label: `Edit Stock Sale`,
46896
46908
  icon: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.FilePenLine, { size: 16 }),
46897
46909
  onClick: () => navigate(`update?id=${data2?._id}`)
46898
46910
  },
46899
46911
  {
46900
- label: `Delete Stock Purchase`,
46912
+ label: `Delete Stock Sale`,
46901
46913
  icon: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Trash2, { className: "text-red-500", size: 16 }),
46902
46914
  onClick: () => {
46903
46915
  openTransaction({
@@ -46937,11 +46949,11 @@ function purchase3List({
46937
46949
  }
46938
46950
  },
46939
46951
  {
46940
- accessorKey: "supplier/wallet",
46941
- header: "Supplier/Wallet",
46952
+ accessorKey: "customer/wallet",
46953
+ header: "Customer/Wallet",
46942
46954
  cell: ({ row }) => {
46943
46955
  const stock = row.original;
46944
- const walletName = stock?.fromWalletData?.name;
46956
+ const walletName = stock?.toWalletData?.name;
46945
46957
  const accountName = stock?.accountData?.name || stock?.accountName;
46946
46958
  return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
46947
46959
  stock?.cash > 0 && walletName && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
@@ -46950,11 +46962,11 @@ function purchase3List({
46950
46962
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: walletName })
46951
46963
  ] }),
46952
46964
  stock?.credit > 0 && accountName && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
46953
- "Supplier:",
46965
+ "Customer:",
46954
46966
  " ",
46955
46967
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: accountName })
46956
46968
  ] }),
46957
- !(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { children: stock?.purchase === "cash" ? walletName || "Cash Wallet" : accountName || "Supplier" })
46969
+ !(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { children: stock?.sale === "cash" ? walletName || "Cash Wallet" : accountName || "Customer" })
46958
46970
  ] });
46959
46971
  }
46960
46972
  },
@@ -46971,25 +46983,33 @@ function purchase3List({
46971
46983
  header: "Action",
46972
46984
  cell: ({ row }) => {
46973
46985
  const stock = row.original;
46974
- const purchaseType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.purchase;
46986
+ const saleType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.sale;
46975
46987
  return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex flex-col", children: [
46976
- /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: `capitalize text-red-600`, children: "Stock Purchased" }),
46977
- /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "capitalize", children: purchaseType })
46988
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: `capitalize text-red-600`, children: "Stock Sold" }),
46989
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "capitalize", children: saleType })
46978
46990
  ] });
46979
46991
  }
46980
46992
  },
46981
46993
  {
46982
46994
  accessorKey: "amount",
46983
- header: "Amount",
46995
+ header: "Amount (USD)",
46984
46996
  cell: ({ row }) => {
46985
46997
  const stock = row.original;
46986
- const amount = stock?.amount - (stock?.discount || 0);
46998
+ const isUSD = (stock?.currency || "").toUpperCase() === "USD";
46999
+ const netAmount = (Number(stock?.amount) || 0) - (Number(stock?.discount) || 0);
47000
+ const usdAmount = !isUSD && stock?.exchange?.amount !== void 0 ? Number(stock.exchange.amount) : netAmount;
46987
47001
  return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex flex-col", children: [
46988
- /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold", children: Formats_default.Price(amount, stock?.currency, false) }),
46989
- stock?.discount ? /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-red-600 ", children: [
47002
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-semibold", children: Formats_default.Price(usdAmount, "USD", false) }),
47003
+ !isUSD && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
47004
+ "Original: ",
47005
+ Formats_default.Price(netAmount, stock?.currency, false),
47006
+ stock?.exchange?.rate ? ` @ ${stock.exchange.rate}` : ""
47007
+ ] }),
47008
+ isUSD && stock?.discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-xs text-red-600", children: [
46990
47009
  "Original:",
47010
+ " ",
46991
47011
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("del", { children: Formats_default.Price(stock?.amount, stock?.currency, false) })
46992
- ] }) : null
47012
+ ] })
46993
47013
  ] });
46994
47014
  }
46995
47015
  },
@@ -47011,11 +47031,374 @@ function purchase3List({
47011
47031
  }
47012
47032
  ];
47013
47033
  const stocks = data?.data || [];
47034
+ const stats = (0, import_react156.useMemo)(() => {
47035
+ const totalInvoices = stocks.length;
47036
+ let totalPendingUSD = 0;
47037
+ let totalCashUSD = 0;
47038
+ let totalCreditUSD = 0;
47039
+ stocks.forEach((item) => {
47040
+ const isUSD = (item?.currency || "").toUpperCase() === "USD";
47041
+ const netAmount = (Number(item?.amount) || 0) - (Number(item?.discount) || 0);
47042
+ let itemUsdAmount = netAmount;
47043
+ if (!isUSD && item?.exchange?.amount !== void 0) {
47044
+ itemUsdAmount = Number(item.exchange.amount) || 0;
47045
+ }
47046
+ totalPendingUSD += itemUsdAmount;
47047
+ if (isUSD) {
47048
+ totalCashUSD += Number(item?.cash) || 0;
47049
+ totalCreditUSD += Number(item?.credit) || 0;
47050
+ } else {
47051
+ const cashRatio = netAmount > 0 ? (Number(item?.cash) || 0) / netAmount : 0;
47052
+ const creditRatio = netAmount > 0 ? (Number(item?.credit) || 0) / netAmount : 0;
47053
+ totalCashUSD += itemUsdAmount * cashRatio;
47054
+ totalCreditUSD += itemUsdAmount * creditRatio;
47055
+ }
47056
+ });
47057
+ return {
47058
+ totalInvoices,
47059
+ totalPendingUSD,
47060
+ totalCashUSD,
47061
+ totalCreditUSD
47062
+ };
47063
+ }, [stocks]);
47014
47064
  return /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)(import_jsx_runtime258.Fragment, { children: [
47015
47065
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(TransactionView, {}),
47016
47066
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(Modal2, {}),
47017
47067
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(PosPrinter, {}),
47068
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("header", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-6", children: [
47069
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "bg-white dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 rounded-2xl p-5 shadow-xs flex items-center justify-between transition-all hover:shadow-md", children: [
47070
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "space-y-1", children: [
47071
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center gap-2", children: [
47072
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "Pending Invoices" }),
47073
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "px-2 py-0.5 text-[10px] font-bold bg-amber-50 text-amber-700 dark:bg-amber-950/60 dark:text-amber-400 border border-amber-200/60 dark:border-amber-900/40 rounded-full", children: "Waiting" })
47074
+ ] }),
47075
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("h3", { className: "text-3xl font-black text-zinc-900 dark:text-white", children: stats.totalInvoices }),
47076
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: [
47077
+ stats.totalInvoices === 1 ? "1 invoice" : `${stats.totalInvoices} invoices`,
47078
+ " ",
47079
+ "awaiting collection"
47080
+ ] })
47081
+ ] }),
47082
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { className: "p-3.5 rounded-2xl bg-amber-50 dark:bg-amber-950/40 text-amber-600 dark:text-amber-400 border border-amber-100 dark:border-amber-900/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Clock, { size: 24 }) })
47083
+ ] }),
47084
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "bg-white dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 rounded-2xl p-5 shadow-xs flex items-center justify-between transition-all hover:shadow-md", children: [
47085
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "space-y-1", children: [
47086
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center gap-2", children: [
47087
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "To Be Collected (USD)" }),
47088
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "px-2 py-0.5 text-[10px] font-bold bg-emerald-50 text-emerald-700 dark:bg-emerald-950/60 dark:text-emerald-400 border border-emerald-200/60 dark:border-emerald-900/40 rounded-full", children: "USD" })
47089
+ ] }),
47090
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("h3", { className: "text-3xl font-black text-emerald-600 dark:text-emerald-400", children: Formats_default.Price(stats.totalPendingUSD, "USD", false) }),
47091
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: "Total sales waiting for collection (USD)" })
47092
+ ] }),
47093
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { className: "p-3.5 rounded-2xl bg-emerald-50 dark:bg-emerald-950/40 text-emerald-600 dark:text-emerald-400 border border-emerald-100 dark:border-emerald-900/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.CircleDollarSign, { size: 24 }) })
47094
+ ] }),
47095
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "bg-white dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 rounded-2xl p-5 shadow-xs flex items-center justify-between transition-all hover:shadow-md", children: [
47096
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "space-y-2 w-full pr-3", children: [
47097
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500 dark:text-zinc-400", children: "Payment Breakdown (USD)" }),
47098
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
47099
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-zinc-500 dark:text-zinc-400 flex items-center gap-1.5", children: [
47100
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "h-2 w-2 rounded-full bg-blue-500" }),
47101
+ "Cash:"
47102
+ ] }),
47103
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-bold text-blue-600 dark:text-blue-400", children: Formats_default.Price(stats.totalCashUSD, "USD", false) })
47104
+ ] }),
47105
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
47106
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsxs)("span", { className: "text-zinc-500 dark:text-zinc-400 flex items-center gap-1.5", children: [
47107
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "h-2 w-2 rounded-full bg-red-500" }),
47108
+ "Credit:"
47109
+ ] }),
47110
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("span", { className: "font-bold text-red-500 dark:text-red-400", children: Formats_default.Price(stats.totalCreditUSD, "USD", false) })
47111
+ ] })
47112
+ ] }),
47113
+ /* @__PURE__ */ (0, import_jsx_runtime258.jsx)("div", { className: "p-3.5 rounded-2xl bg-blue-50 dark:bg-blue-950/40 text-blue-600 dark:text-blue-400 border border-blue-100 dark:border-blue-900/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(import_lucide_react123.Wallet, { size: 24 }) })
47114
+ ] })
47115
+ ] }),
47018
47116
  /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(
47117
+ TransactionViewComponent,
47118
+ {
47119
+ columns,
47120
+ data: stocks,
47121
+ title: `${type} Sales (Pending Collection)`,
47122
+ description: `Manage ${type} sales waiting for collection`,
47123
+ index: true
47124
+ },
47125
+ type
47126
+ )
47127
+ ] });
47128
+ }
47129
+ var Collection_default = Collection3;
47130
+
47131
+ // src/components/Transactions/3/sale2/CollectionLevel.tsx
47132
+ var import_react_router_dom121 = require("react-router-dom");
47133
+ var import_jsx_runtime259 = require("react/jsx-runtime");
47134
+ var options9 = [
47135
+ { label: "Product", value: "product" },
47136
+ { label: "Pack", value: "pack" }
47137
+ ];
47138
+ var CollectionLevel = ({
47139
+ value = false,
47140
+ showYard = false
47141
+ }) => {
47142
+ const { apiConfig, currencies } = useWarqadConfig();
47143
+ const { stock } = currencies;
47144
+ const { branchId } = (0, import_react_router_dom121.useParams)();
47145
+ const { branches } = useAuth_default();
47146
+ const { TransactionView } = useTransactionView_default();
47147
+ const { getQuery, setQuery } = useApp_default();
47148
+ const stockType = getQuery("stockType") || "product";
47149
+ const { A4DataView, data } = useA4DataView_default({
47150
+ url: `${apiConfig.stockLevelReportApi}?stockType=${stockType}&collection=pending${branchId ? `&branch=${branchId}` : ""}`,
47151
+ v: 1,
47152
+ // No prefix
47153
+ params: {}
47154
+ });
47155
+ let branchesData = branches || [];
47156
+ if (branchId) {
47157
+ branchesData = branchesData.filter((b) => b._id === branchId);
47158
+ }
47159
+ const branchNames = branchesData.map((b) => b.name);
47160
+ const currency = stock;
47161
+ const currentBranch = branchesData.find((b) => b._id === branchId);
47162
+ const columns = [
47163
+ {
47164
+ header: "Name",
47165
+ key: "name",
47166
+ className: "text-xs whitespace-nowrap",
47167
+ render: (row) => {
47168
+ const yard = row?.yard || 0;
47169
+ return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
47170
+ }
47171
+ },
47172
+ ...!value ? branchNames.map((branchName) => ({
47173
+ header: branchName,
47174
+ key: branchName,
47175
+ className: "text-xs whitespace-nowrap text-right",
47176
+ render: (row) => {
47177
+ const qty = row[branchName];
47178
+ return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47179
+ "div",
47180
+ {
47181
+ className: qty > 0 ? "text-green-500 font-bold" : qty < 0 ? "text-red-500 font-bold" : "",
47182
+ children: Formats_default.Amount(qty, false)
47183
+ }
47184
+ );
47185
+ }
47186
+ })) : [],
47187
+ {
47188
+ header: "Total Qty",
47189
+ key: "total",
47190
+ className: "text-xs whitespace-nowrap text-right",
47191
+ render: (row) => {
47192
+ const total = row.total;
47193
+ return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47194
+ "span",
47195
+ {
47196
+ className: total > 0 ? "text-green-500 font-bold" : total < 0 ? "text-red-500 font-bold" : "",
47197
+ children: Formats_default.Amount(total, false)
47198
+ }
47199
+ );
47200
+ },
47201
+ renderFooter: (data2) => {
47202
+ const total = data2.reduce((acc, row) => acc + row.total, 0);
47203
+ return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)("span", { className: " font-bold", children: Formats_default.Amount(total, false) });
47204
+ }
47205
+ }
47206
+ ];
47207
+ let runningBalance = 0;
47208
+ const datas = (data?.data || []).map((item) => {
47209
+ runningBalance += item.calculatedAmount;
47210
+ return {
47211
+ ...item,
47212
+ runningBalance
47213
+ };
47214
+ });
47215
+ return /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)(import_jsx_runtime259.Fragment, { children: [
47216
+ /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(TransactionView, {}),
47217
+ /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47218
+ A4DataView,
47219
+ {
47220
+ columns,
47221
+ data: datas || [],
47222
+ index: true,
47223
+ title: `Pending Collections`,
47224
+ subtitle: branchId ? currentBranch?.name : "All Branches",
47225
+ tableTitle: value ? "Current Stock Value" : "Current Stock Level",
47226
+ fixed: false,
47227
+ headers: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47228
+ Select,
47229
+ {
47230
+ options: options9,
47231
+ value: stockType,
47232
+ className: "w-32! print:hidden",
47233
+ onChange: (e) => {
47234
+ setQuery({ stockType: e });
47235
+ }
47236
+ }
47237
+ )
47238
+ }
47239
+ )
47240
+ ] });
47241
+ };
47242
+ var CollectionLevel_default = CollectionLevel;
47243
+
47244
+ // src/components/Transactions/3/sale2/index.ts
47245
+ var Sale22 = {
47246
+ List: List_default6,
47247
+ Form: pos_default5,
47248
+ Collection: Collection_default,
47249
+ CollectionLevel: CollectionLevel_default
47250
+ };
47251
+ var sale2_default2 = Sale22;
47252
+
47253
+ // src/components/Transactions/3/purchase3/List.tsx
47254
+ var import_react_router_dom122 = require("react-router-dom");
47255
+ var import_lucide_react124 = require("lucide-react");
47256
+ var import_jsx_runtime260 = require("react/jsx-runtime");
47257
+ function purchase3List({
47258
+ url,
47259
+ type = "product"
47260
+ }) {
47261
+ const { branchId } = (0, import_react_router_dom122.useParams)();
47262
+ const navigate = (0, import_react_router_dom122.useNavigate)();
47263
+ const { TransactionView, openTransaction } = useTransactionView_default();
47264
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
47265
+ url: url || `/transactions/get?type=stock&stock=purchase-3&stockType=${type}${branchId ? `&fromBranch=${branchId}` : ""}`,
47266
+ dateFilter: true
47267
+ });
47268
+ const { Modal: Modal2 } = useModal();
47269
+ const { PosPrinter } = usePosPrinter_default();
47270
+ const items = (data2) => [
47271
+ {
47272
+ label: `View Stock Purchase`,
47273
+ icon: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.Eye, { size: 16 }),
47274
+ className: "w-[200px]",
47275
+ onClick: () => openTransaction({ id: data2?._id, type: "stock" })
47276
+ },
47277
+ {
47278
+ label: `Edit Stock Purchase`,
47279
+ icon: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.FilePenLine, { size: 16 }),
47280
+ onClick: () => navigate(`update?id=${data2?._id}`)
47281
+ },
47282
+ {
47283
+ label: `Delete Stock Purchase`,
47284
+ icon: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.Trash2, { className: "text-red-500", size: 16 }),
47285
+ onClick: () => {
47286
+ openTransaction({
47287
+ id: data2?._id,
47288
+ type: "stock",
47289
+ reverseable: { reload }
47290
+ });
47291
+ }
47292
+ }
47293
+ ].filter(Boolean);
47294
+ const columns = [
47295
+ {
47296
+ accessorKey: "date",
47297
+ header: "Date",
47298
+ cell: ({ row }) => {
47299
+ const stock = row.original;
47300
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col", children: [
47301
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: stock?.date }),
47302
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47303
+ "span",
47304
+ {
47305
+ onClick: () => openTransaction({ id: stock?._id, type: "stock" }),
47306
+ className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
47307
+ children: stock.ref
47308
+ }
47309
+ )
47310
+ ] });
47311
+ }
47312
+ },
47313
+ {
47314
+ accessorKey: "branch",
47315
+ header: "Branch",
47316
+ cell: ({ row }) => {
47317
+ const stock = row.original;
47318
+ const branch = stock?.fromBranchData?.name;
47319
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: branch });
47320
+ }
47321
+ },
47322
+ {
47323
+ accessorKey: "supplier/wallet",
47324
+ header: "Supplier/Wallet",
47325
+ cell: ({ row }) => {
47326
+ const stock = row.original;
47327
+ const walletName = stock?.fromWalletData?.name;
47328
+ const accountName = stock?.accountData?.name || stock?.accountName;
47329
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
47330
+ stock?.cash > 0 && walletName && /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
47331
+ "Wallet:",
47332
+ " ",
47333
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: walletName })
47334
+ ] }),
47335
+ stock?.credit > 0 && accountName && /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("span", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
47336
+ "Supplier:",
47337
+ " ",
47338
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "font-semibold text-gray-800 dark:text-zinc-200", children: accountName })
47339
+ ] }),
47340
+ !(stock?.cash > 0 && walletName) && !(stock?.credit > 0 && accountName) && /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: stock?.purchase === "cash" ? walletName || "Cash Wallet" : accountName || "Supplier" })
47341
+ ] });
47342
+ }
47343
+ },
47344
+ {
47345
+ accessorKey: "stockType",
47346
+ header: "Stock Type",
47347
+ cell: ({ row }) => {
47348
+ const stock = row.original;
47349
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { children: stock?.stockType }) });
47350
+ }
47351
+ },
47352
+ {
47353
+ accessorKey: "action",
47354
+ header: "Action",
47355
+ cell: ({ row }) => {
47356
+ const stock = row.original;
47357
+ const purchaseType = stock?.cash > 0 && stock?.credit > 0 ? "split" : stock?.purchase;
47358
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col", children: [
47359
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: `capitalize text-red-600`, children: "Stock Purchased" }),
47360
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "capitalize", children: purchaseType })
47361
+ ] });
47362
+ }
47363
+ },
47364
+ {
47365
+ accessorKey: "amount",
47366
+ header: "Amount",
47367
+ cell: ({ row }) => {
47368
+ const stock = row.original;
47369
+ const amount = stock?.amount - (stock?.discount || 0);
47370
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex flex-col", children: [
47371
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("span", { className: "font-semibold", children: Formats_default.Price(amount, stock?.currency, false) }),
47372
+ stock?.discount ? /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("span", { className: "text-xs text-red-600 ", children: [
47373
+ "Original:",
47374
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("del", { children: Formats_default.Price(stock?.amount, stock?.currency, false) })
47375
+ ] }) : null
47376
+ ] });
47377
+ }
47378
+ },
47379
+ {
47380
+ accessorKey: "actions",
47381
+ header: "Actions",
47382
+ cell: ({ row }) => {
47383
+ const data2 = row.original;
47384
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47385
+ Dropdown,
47386
+ {
47387
+ className: "cursor-pointer",
47388
+ items: items(data2),
47389
+ triggerMode: "hover",
47390
+ children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_lucide_react124.EllipsisVertical, {})
47391
+ }
47392
+ );
47393
+ }
47394
+ }
47395
+ ];
47396
+ const stocks = data?.data || [];
47397
+ return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)(import_jsx_runtime260.Fragment, { children: [
47398
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(TransactionView, {}),
47399
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(Modal2, {}),
47400
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(PosPrinter, {}),
47401
+ /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47019
47402
  TransactionViewComponent,
47020
47403
  {
47021
47404
  columns,
@@ -47035,23 +47418,23 @@ function purchase3List({
47035
47418
  var List_default7 = purchase3List;
47036
47419
 
47037
47420
  // src/components/Transactions/3/purchase3/pos.tsx
47038
- var import_react159 = require("react");
47421
+ var import_react160 = require("react");
47039
47422
 
47040
47423
  // src/components/Transactions/3/purchase3/header.tsx
47041
47424
  var import_react_hook_form71 = require("react-hook-form");
47042
- var import_react_router_dom121 = require("react-router-dom");
47043
- var import_react156 = require("react");
47044
- var import_jsx_runtime259 = require("react/jsx-runtime");
47425
+ var import_react_router_dom123 = require("react-router-dom");
47426
+ var import_react157 = require("react");
47427
+ var import_jsx_runtime261 = require("react/jsx-runtime");
47045
47428
  function SaleHeader4({ stockType }) {
47046
47429
  const form = (0, import_react_hook_form71.useFormContext)();
47047
- const { branchId } = (0, import_react_router_dom121.useParams)();
47048
- (0, import_react156.useEffect)(() => {
47430
+ const { branchId } = (0, import_react_router_dom123.useParams)();
47431
+ (0, import_react157.useEffect)(() => {
47049
47432
  if (branchId) {
47050
47433
  form.setValue("branch", branchId);
47051
47434
  }
47052
47435
  }, [branchId]);
47053
- return /* @__PURE__ */ (0, import_jsx_runtime259.jsxs)("section", { className: "grid grid-cols-1 md:grid-cols-4 lg:grid-cols-5 border-b-2 pb-4 pt-2 gap-4", children: [
47054
- /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47436
+ return /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("section", { className: "grid grid-cols-1 md:grid-cols-4 lg:grid-cols-5 border-b-2 pb-4 pt-2 gap-4", children: [
47437
+ /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47055
47438
  Fields_default.DateInput,
47056
47439
  {
47057
47440
  label: "Date",
@@ -47061,7 +47444,7 @@ function SaleHeader4({ stockType }) {
47061
47444
  required: true
47062
47445
  }
47063
47446
  ),
47064
- /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47447
+ /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47065
47448
  Feilds_default.Branches,
47066
47449
  {
47067
47450
  name: "branch",
@@ -47072,7 +47455,7 @@ function SaleHeader4({ stockType }) {
47072
47455
  className: "h-[30px]!"
47073
47456
  }
47074
47457
  ),
47075
- /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47458
+ /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47076
47459
  Fields_default.Select,
47077
47460
  {
47078
47461
  label: "Stock Type",
@@ -47087,7 +47470,7 @@ function SaleHeader4({ stockType }) {
47087
47470
  className: "rounded-md! min-w-[100px]! h-[30px]!"
47088
47471
  }
47089
47472
  ),
47090
- /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47473
+ /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47091
47474
  Fields_default.Select,
47092
47475
  {
47093
47476
  label: "Currency",
@@ -47102,7 +47485,7 @@ function SaleHeader4({ stockType }) {
47102
47485
  className: "rounded-md! min-w-[100px]! h-[30px]!"
47103
47486
  }
47104
47487
  ),
47105
- /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
47488
+ /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47106
47489
  Fields_default.Input,
47107
47490
  {
47108
47491
  label: "Invoice Number",
@@ -47150,8 +47533,8 @@ var useFetchBalance6 = ({ form, branch, type }) => {
47150
47533
  var FetchBalance_default6 = useFetchBalance6;
47151
47534
 
47152
47535
  // src/components/Transactions/3/purchase3/table.tsx
47153
- var import_react157 = require("react");
47154
- var import_jsx_runtime260 = require("react/jsx-runtime");
47536
+ var import_react158 = require("react");
47537
+ var import_jsx_runtime262 = require("react/jsx-runtime");
47155
47538
  function PurchaseStockTable({
47156
47539
  data,
47157
47540
  methods,
@@ -47237,12 +47620,12 @@ function PurchaseStockTable({
47237
47620
  size: 400,
47238
47621
  meta: {
47239
47622
  field: ({ value, onChange, rowData }) => {
47240
- (0, import_react157.useEffect)(() => {
47623
+ (0, import_react158.useEffect)(() => {
47241
47624
  if (rowData?.lineObj && methods.getValues("lineObj") !== rowData.lineObj) {
47242
47625
  methods.setValue("lineObj", rowData.lineObj);
47243
47626
  }
47244
47627
  }, [rowData?.lineObj]);
47245
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("div", { className: "flex items-center gap-2 w-full ", children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47628
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "flex items-center gap-2 w-full ", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47246
47629
  Fields_default.SearchApi,
47247
47630
  {
47248
47631
  id: "pti-lineId",
@@ -47291,8 +47674,8 @@ function PurchaseStockTable({
47291
47674
  cell: ({ row }) => {
47292
47675
  const lineObj2 = row.original?.lineObj;
47293
47676
  const lineName = lineObj2?.name;
47294
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)("div", { className: "flex items-center gap-2 w-full ", children: [
47295
- stockType === "product" && /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("div", { className: "h-[20px] w-[20px] rounded-md overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47677
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)("div", { className: "flex items-center gap-2 w-full ", children: [
47678
+ stockType === "product" && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "h-[20px] w-[20px] rounded-md overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47296
47679
  ProductImage_default,
47297
47680
  {
47298
47681
  src: lineObj2?.imgUrl || lineObj2?.image || null,
@@ -47300,7 +47683,7 @@ function PurchaseStockTable({
47300
47683
  width: 20
47301
47684
  }
47302
47685
  ) }),
47303
- /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h1", { children: lineName })
47686
+ /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h1", { children: lineName })
47304
47687
  ] });
47305
47688
  }
47306
47689
  },
@@ -47309,7 +47692,7 @@ function PurchaseStockTable({
47309
47692
  header: "Available",
47310
47693
  maxSize: 90,
47311
47694
  meta: {
47312
- field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_jsx_runtime260.Fragment, { children: balanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(LoadingSpin, { size: "sm", className: "text-blue-600" }) : /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47695
+ field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(import_jsx_runtime262.Fragment, { children: balanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(LoadingSpin, { size: "sm", className: "text-blue-600" }) : /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47313
47696
  Fields_default.Input,
47314
47697
  {
47315
47698
  id: "pti-lineBalance",
@@ -47327,7 +47710,7 @@ function PurchaseStockTable({
47327
47710
  ) })
47328
47711
  },
47329
47712
  cell: () => {
47330
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h2", { children: "-" });
47713
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: "-" });
47331
47714
  }
47332
47715
  },
47333
47716
  ...!isRate ? [
@@ -47336,7 +47719,7 @@ function PurchaseStockTable({
47336
47719
  header: "Cost",
47337
47720
  maxSize: 140,
47338
47721
  meta: {
47339
- field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47722
+ field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47340
47723
  Fields_default.Input,
47341
47724
  {
47342
47725
  id: "pti-lineCost",
@@ -47354,7 +47737,7 @@ function PurchaseStockTable({
47354
47737
  )
47355
47738
  },
47356
47739
  cell: ({ row }) => {
47357
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h2", { children: Formats_default.Amount(row.original?.lineCost || 0) });
47740
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.Amount(row.original?.lineCost || 0) });
47358
47741
  }
47359
47742
  }
47360
47743
  ] : [],
@@ -47363,7 +47746,7 @@ function PurchaseStockTable({
47363
47746
  header: "Qty",
47364
47747
  maxSize: 90,
47365
47748
  meta: {
47366
- field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47749
+ field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47367
47750
  Fields_default.Input,
47368
47751
  {
47369
47752
  id: "pti-lineQuantity",
@@ -47380,7 +47763,7 @@ function PurchaseStockTable({
47380
47763
  )
47381
47764
  },
47382
47765
  cell: ({ row }) => {
47383
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h2", { children: Formats_default.XQty(row.original?.lineQuantity || 0) });
47766
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.XQty(row.original?.lineQuantity || 0) });
47384
47767
  }
47385
47768
  },
47386
47769
  {
@@ -47388,7 +47771,7 @@ function PurchaseStockTable({
47388
47771
  header: "Price",
47389
47772
  maxSize: 90,
47390
47773
  meta: {
47391
- field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47774
+ field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47392
47775
  Fields_default.Input,
47393
47776
  {
47394
47777
  id: "pti-lineCost",
@@ -47405,7 +47788,7 @@ function PurchaseStockTable({
47405
47788
  )
47406
47789
  },
47407
47790
  cell: ({ row }) => {
47408
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h2", { children: Formats_default.XQty(row.original?.lineSell || 0) });
47791
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.XQty(row.original?.lineSell || 0) });
47409
47792
  }
47410
47793
  },
47411
47794
  {
@@ -47413,7 +47796,7 @@ function PurchaseStockTable({
47413
47796
  header: "Total",
47414
47797
  maxSize: 150,
47415
47798
  meta: {
47416
- field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47799
+ field: ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47417
47800
  Fields_default.Input,
47418
47801
  {
47419
47802
  id: "pti-lineTotal",
@@ -47431,22 +47814,22 @@ function PurchaseStockTable({
47431
47814
  )
47432
47815
  },
47433
47816
  cell: ({ row }) => {
47434
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h2", { children: Formats_default.Amount(row.original?.lineTotal || 0) });
47817
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.Amount(row.original?.lineTotal || 0) });
47435
47818
  },
47436
47819
  footer: ({ row }) => {
47437
47820
  const total = data?.reduce((acc, row2) => acc + row2.lineTotal, 0);
47438
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)("h2", { children: Formats_default.Price(total || 0, currency, false) });
47821
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("h2", { children: Formats_default.Price(total || 0, currency, false) });
47439
47822
  }
47440
47823
  }
47441
47824
  ];
47442
- (0, import_react157.useEffect)(() => {
47825
+ (0, import_react158.useEffect)(() => {
47443
47826
  if (lineId) {
47444
47827
  fetchBalance();
47445
47828
  } else {
47446
47829
  methods.setValue("lineBalance", 0);
47447
47830
  }
47448
47831
  }, [lineId, branch]);
47449
- return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(import_jsx_runtime260.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
47832
+ return /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(import_jsx_runtime262.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
47450
47833
  PostTable,
47451
47834
  {
47452
47835
  data: data || [],
@@ -47460,7 +47843,7 @@ function PurchaseStockTable({
47460
47843
  isLoading: getLoading,
47461
47844
  defaultExpanded: true,
47462
47845
  hasSubComponent: () => stockType !== "product",
47463
- renderSubComponent: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(PackView_default, { type: stockType, data: row?.lineObj?.products })
47846
+ renderSubComponent: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(PackView_default, { type: stockType, data: row?.lineObj?.products })
47464
47847
  },
47465
47848
  data?.length
47466
47849
  ) });
@@ -47503,13 +47886,13 @@ var AdjustmentStockSchema6 = import_zod119.default.object({
47503
47886
  var schema_default8 = AdjustmentStockSchema6;
47504
47887
 
47505
47888
  // src/components/Transactions/3/purchase3/pos.tsx
47506
- var import_lucide_react124 = require("lucide-react");
47507
- var import_react_router_dom122 = require("react-router-dom");
47889
+ var import_lucide_react125 = require("lucide-react");
47890
+ var import_react_router_dom124 = require("react-router-dom");
47508
47891
 
47509
47892
  // src/components/Transactions/3/purchase3/Submit.tsx
47510
47893
  var import_react_hook_form72 = require("react-hook-form");
47511
- var import_react158 = require("react");
47512
- var import_jsx_runtime261 = require("react/jsx-runtime");
47894
+ var import_react159 = require("react");
47895
+ var import_jsx_runtime263 = require("react/jsx-runtime");
47513
47896
  var CompletePurchaseModal = ({
47514
47897
  totalAmount,
47515
47898
  onSubmit,
@@ -47558,7 +47941,7 @@ var CompletePurchaseModal = ({
47558
47941
  }
47559
47942
  };
47560
47943
  const isRate = defaultCurrency !== currency;
47561
- const exchangedNet = (0, import_react158.useMemo)(() => {
47944
+ const exchangedNet = (0, import_react159.useMemo)(() => {
47562
47945
  const total = forex_default.exchangedAmount({
47563
47946
  accountCurrency: defaultCurrency,
47564
47947
  transactionCurrency: currency,
@@ -47569,27 +47952,27 @@ var CompletePurchaseModal = ({
47569
47952
  return Formats_default.Price(total, defaultCurrency, false);
47570
47953
  }, [netAmount, currency, defaultCurrency, cash, credit, discount]);
47571
47954
  const { isSubmitting } = form.formState;
47572
- return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(Card, { isLoading: isSubmitting, children: /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "space-y-5", children: [
47573
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "bg-emerald-50 dark:bg-emerald-950/20 p-5 rounded-xl text-center space-y-1 border border-emerald-100 dark:border-emerald-900/30", children: [
47574
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-xs uppercase tracking-wider text-emerald-600 dark:text-emerald-400 font-bold", children: "Net Total Amount" }),
47575
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("h2", { className: "text-3xl font-black text-emerald-700 dark:text-emerald-300", children: Formats_default.Price(netAmount, currency, false) }),
47576
- discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("p", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
47955
+ return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Card, { isLoading: isSubmitting, children: /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "space-y-5", children: [
47956
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-emerald-50 dark:bg-emerald-950/20 p-5 rounded-xl text-center space-y-1 border border-emerald-100 dark:border-emerald-900/30", children: [
47957
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs uppercase tracking-wider text-emerald-600 dark:text-emerald-400 font-bold", children: "Net Total Amount" }),
47958
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("h2", { className: "text-3xl font-black text-emerald-700 dark:text-emerald-300", children: Formats_default.Price(netAmount, currency, false) }),
47959
+ discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("p", { className: "text-xs text-gray-500 dark:text-zinc-400", children: [
47577
47960
  "Original:",
47578
47961
  " ",
47579
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "line-through", children: Formats_default.Price(totalAmount, currency, false) })
47962
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "line-through", children: Formats_default.Price(totalAmount, currency, false) })
47580
47963
  ] })
47581
47964
  ] }),
47582
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
47583
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
47584
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount & Rate" }),
47585
- (discount > 0 || isRate) && /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-xs px-2 py-0.5 bg-amber-50 text-amber-600 rounded-full font-medium dark:bg-amber-950/40 dark:text-amber-400", children: discount > 0 ? "Applied" : "Exchange Rate Required" })
47965
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
47966
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
47967
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "1. Discount & Rate" }),
47968
+ (discount > 0 || isRate) && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs px-2 py-0.5 bg-amber-50 text-amber-600 rounded-full font-medium dark:bg-amber-950/40 dark:text-amber-400", children: discount > 0 ? "Applied" : "Exchange Rate Required" })
47586
47969
  ] }),
47587
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)(
47970
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(
47588
47971
  "div",
47589
47972
  {
47590
47973
  className: isRate ? "grid grid-cols-1 md:grid-cols-2 gap-4" : "grid grid-cols-1 gap-4",
47591
47974
  children: [
47592
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47975
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47593
47976
  Fields_default.Input,
47594
47977
  {
47595
47978
  label: "Discount Amount",
@@ -47600,7 +47983,7 @@ var CompletePurchaseModal = ({
47600
47983
  className: "h-[40px]!"
47601
47984
  }
47602
47985
  ),
47603
- isRate && /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
47986
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47604
47987
  Fields_default.Input,
47605
47988
  {
47606
47989
  label: "Rate",
@@ -47615,13 +47998,13 @@ var CompletePurchaseModal = ({
47615
47998
  }
47616
47999
  )
47617
48000
  ] }),
47618
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
47619
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
47620
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Cash Payment" }),
47621
- cash > 0 && /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-xs px-2 py-0.5 bg-blue-50 text-blue-600 rounded-full font-medium dark:bg-blue-950/40 dark:text-blue-400", children: "Active" })
48001
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
48002
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
48003
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Cash Payment" }),
48004
+ cash > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs px-2 py-0.5 bg-blue-50 text-blue-600 rounded-full font-medium dark:bg-blue-950/40 dark:text-blue-400", children: "Active" })
47622
48005
  ] }),
47623
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
47624
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
48006
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
48007
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47625
48008
  Fields_default.Input,
47626
48009
  {
47627
48010
  label: "Cash Amount",
@@ -47632,7 +48015,7 @@ var CompletePurchaseModal = ({
47632
48015
  className: "h-[40px]!"
47633
48016
  }
47634
48017
  ),
47635
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
48018
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47636
48019
  Feilds_default2.Wallet,
47637
48020
  {
47638
48021
  name: "wallet",
@@ -47646,13 +48029,13 @@ var CompletePurchaseModal = ({
47646
48029
  )
47647
48030
  ] })
47648
48031
  ] }),
47649
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
47650
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
47651
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Credit Payment" }),
47652
- credit > 0 && /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-xs px-2 py-0.5 bg-red-50 text-red-600 rounded-full font-medium dark:bg-red-950/40 dark:text-red-400", children: "Active" })
48032
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "bg-zinc-50 dark:bg-zinc-900/40 p-4 rounded-xl border border-zinc-100 dark:border-zinc-800 space-y-4", children: [
48033
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex items-center justify-between border-b pb-2 dark:border-zinc-800", children: [
48034
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-sm font-bold text-gray-800 dark:text-zinc-200", children: "2. Credit Payment" }),
48035
+ credit > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs px-2 py-0.5 bg-red-50 text-red-600 rounded-full font-medium dark:bg-red-950/40 dark:text-red-400", children: "Active" })
47653
48036
  ] }),
47654
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
47655
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
48037
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
48038
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47656
48039
  Fields_default.Input,
47657
48040
  {
47658
48041
  label: "Credit Amount",
@@ -47663,7 +48046,7 @@ var CompletePurchaseModal = ({
47663
48046
  className: "h-[40px]!"
47664
48047
  }
47665
48048
  ),
47666
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
48049
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47667
48050
  Feilds_default.Customer,
47668
48051
  {
47669
48052
  name: "supplier",
@@ -47677,37 +48060,37 @@ var CompletePurchaseModal = ({
47677
48060
  )
47678
48061
  ] })
47679
48062
  ] }),
47680
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "pt-2 space-y-2.5", children: [
47681
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-between items-center text-sm px-2", children: [
47682
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "text-gray-500 dark:text-zinc-400", children: "Total Before Discount:" }),
47683
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { className: "font-semibold text-gray-900 dark:text-white", children: Formats_default.Price(totalAmount, currency, false) })
48063
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "pt-2 space-y-2.5", children: [
48064
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2", children: [
48065
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-gray-500 dark:text-zinc-400", children: "Total Before Discount:" }),
48066
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "font-semibold text-gray-900 dark:text-white", children: Formats_default.Price(totalAmount, currency, false) })
47684
48067
  ] }),
47685
- discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-amber-600 dark:text-amber-400", children: [
47686
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: "Discount Applied:" }),
47687
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("span", { children: [
48068
+ discount > 0 && /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-amber-600 dark:text-amber-400", children: [
48069
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Discount Applied:" }),
48070
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("span", { children: [
47688
48071
  "-",
47689
48072
  Formats_default.Price(discount, currency, false)
47690
48073
  ] })
47691
48074
  ] }),
47692
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-blue-600 dark:text-blue-400", children: [
47693
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: "Cash Paid:" }),
47694
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: Formats_default.Price(cash, currency, false) })
48075
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-blue-600 dark:text-blue-400", children: [
48076
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Cash Paid:" }),
48077
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: Formats_default.Price(cash, currency, false) })
47695
48078
  ] }),
47696
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-red-500 dark:text-red-400", children: [
47697
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: "Credit Amount:" }),
47698
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: Formats_default.Price(credit, currency, false) })
48079
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-sm px-2 text-red-500 dark:text-red-400", children: [
48080
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Credit Amount:" }),
48081
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: Formats_default.Price(credit, currency, false) })
47699
48082
  ] }),
47700
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-between items-center text-base font-bold bg-zinc-100 dark:bg-zinc-800/80 p-3 rounded-lg text-gray-900 dark:text-white mt-1", children: [
47701
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: "Net Total:" }),
47702
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: Formats_default.Price(netAmount, currency, false) })
48083
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-base font-bold bg-zinc-100 dark:bg-zinc-800/80 p-3 rounded-lg text-gray-900 dark:text-white mt-1", children: [
48084
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Net Total:" }),
48085
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: Formats_default.Price(netAmount, currency, false) })
47703
48086
  ] }),
47704
- isRate && /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-between items-center text-base font-bold bg-zinc-100 dark:bg-zinc-800/80 p-3 rounded-lg text-gray-900 dark:text-white mt-1", children: [
47705
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: "Exchanged Net Total:" }),
47706
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("span", { children: exchangedNet })
48087
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-between items-center text-base font-bold bg-zinc-100 dark:bg-zinc-800/80 p-3 rounded-lg text-gray-900 dark:text-white mt-1", children: [
48088
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: "Exchanged Net Total:" }),
48089
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: exchangedNet })
47707
48090
  ] })
47708
48091
  ] }),
47709
- /* @__PURE__ */ (0, import_jsx_runtime261.jsxs)("div", { className: "flex justify-end gap-3 pt-3 border-t dark:border-zinc-800", children: [
47710
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
48092
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex justify-end gap-3 pt-3 border-t dark:border-zinc-800", children: [
48093
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47711
48094
  Button,
47712
48095
  {
47713
48096
  onClick: closeModal,
@@ -47719,7 +48102,7 @@ var CompletePurchaseModal = ({
47719
48102
  children: "Cancel"
47720
48103
  }
47721
48104
  ),
47722
- /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
48105
+ /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
47723
48106
  Button,
47724
48107
  {
47725
48108
  onClick: onSubmit,
@@ -47737,15 +48120,15 @@ var CompletePurchaseModal = ({
47737
48120
  var Submit_default3 = CompletePurchaseModal;
47738
48121
 
47739
48122
  // src/components/Transactions/3/purchase3/pos.tsx
47740
- var import_jsx_runtime262 = require("react/jsx-runtime");
48123
+ var import_jsx_runtime264 = require("react/jsx-runtime");
47741
48124
  var Purchase3Form = ({ type }) => {
47742
48125
  const { getQuery, navigate } = useApp_default();
47743
48126
  const stockType = type;
47744
- const { branchId } = (0, import_react_router_dom122.useParams)();
48127
+ const { branchId } = (0, import_react_router_dom124.useParams)();
47745
48128
  const purchaseId = getQuery("id");
47746
48129
  const { currencies } = useWarqadConfig();
47747
48130
  const { defaultCurrency } = currencies;
47748
- const [ref2, setRef] = (0, import_react159.useState)();
48131
+ const [ref2, setRef] = (0, import_react160.useState)();
47749
48132
  const { Modal: Modal2, openState, close: closeModal } = useModal_default();
47750
48133
  const methods = (0, import_react_hook_form73.useForm)({
47751
48134
  resolver: (0, import_zod120.zodResolver)(schema_default8),
@@ -47778,7 +48161,7 @@ var Purchase3Form = ({ type }) => {
47778
48161
  const lineCost = watch("lineCost");
47779
48162
  const isRate = defaultCurrency !== currency;
47780
48163
  const draft = purchaseId ? [] : storage.get(getStorageType6(stockType)) || [];
47781
- const [postData, setPostData] = (0, import_react159.useState)(draft);
48164
+ const [postData, setPostData] = (0, import_react160.useState)(draft);
47782
48165
  const { post, isLoading: submitLoading } = useApis_default();
47783
48166
  const { get, isLoading: getLoading } = useApis_default();
47784
48167
  const onSubmit = async (data) => {
@@ -47883,7 +48266,7 @@ var Purchase3Form = ({ type }) => {
47883
48266
  type: "complete_purchase2",
47884
48267
  title: "Complete purchase",
47885
48268
  width: 650,
47886
- content: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48269
+ content: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
47887
48270
  Submit_default3,
47888
48271
  {
47889
48272
  totalAmount,
@@ -47936,37 +48319,37 @@ var Purchase3Form = ({ type }) => {
47936
48319
  navigate(-1);
47937
48320
  }
47938
48321
  };
47939
- (0, import_react159.useEffect)(() => {
48322
+ (0, import_react160.useEffect)(() => {
47940
48323
  setValue("lineCost", lineObj?.cost || 0);
47941
48324
  }, [lineObj]);
47942
- (0, import_react159.useEffect)(() => {
48325
+ (0, import_react160.useEffect)(() => {
47943
48326
  const total = (lineQuantity || 0) * (lineCost || 0);
47944
48327
  setValue("lineTotal", total);
47945
48328
  }, [lineCost, lineQuantity]);
47946
- (0, import_react159.useLayoutEffect)(() => {
48329
+ (0, import_react160.useLayoutEffect)(() => {
47947
48330
  if (purchaseId) {
47948
48331
  fetchData();
47949
48332
  }
47950
48333
  }, [purchaseId]);
47951
- return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(import_react_hook_form73.FormProvider, { ...methods, children: [
47952
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(Modal2, {}),
47953
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "space-y-6 ", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)("div", { className: "grid grid-cols-1 gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(Card, { children: [
47954
- /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(Card.Header, { children: [
47955
- /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)("div", { className: "flex justify-between gap-2 items-center", children: [
47956
- /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)("section", { children: [
47957
- /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(Card.Title, { children: [
48334
+ return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_react_hook_form73.FormProvider, { ...methods, children: [
48335
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Modal2, {}),
48336
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "space-y-6 ", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "grid grid-cols-1 gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card, { children: [
48337
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card.Header, { children: [
48338
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "flex justify-between gap-2 items-center", children: [
48339
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("section", { children: [
48340
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card.Title, { children: [
47958
48341
  stockType,
47959
48342
  " Stock purchase Table"
47960
48343
  ] }),
47961
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(Card.Description, { children: !purchaseId ? "Add items to the table and process the purchase" : "Edit items in the table and update the purchase" })
48344
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Description, { children: !purchaseId ? "Add items to the table and process the purchase" : "Edit items in the table and update the purchase" })
47962
48345
  ] }),
47963
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48346
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
47964
48347
  Button,
47965
48348
  {
47966
48349
  onClick: () => {
47967
48350
  navigate(-1);
47968
48351
  },
47969
- icon: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(import_lucide_react124.ArrowLeft, {}),
48352
+ icon: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(import_lucide_react125.ArrowLeft, {}),
47970
48353
  size: "sm",
47971
48354
  type: "button",
47972
48355
  variant: "warning",
@@ -47975,9 +48358,9 @@ var Purchase3Form = ({ type }) => {
47975
48358
  }
47976
48359
  )
47977
48360
  ] }),
47978
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(header_default6, { stockType })
48361
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(header_default6, { stockType })
47979
48362
  ] }),
47980
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48363
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
47981
48364
  table_default6,
47982
48365
  {
47983
48366
  data: postData,
@@ -47988,8 +48371,8 @@ var Purchase3Form = ({ type }) => {
47988
48371
  adjustmentId: purchaseId
47989
48372
  }
47990
48373
  ) }),
47991
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(Card.Footer, { className: "flex justify-end space-y-2", children: /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)("div", { className: "flex items-center gap-3", children: [
47992
- !purchaseId ? /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(import_jsx_runtime262.Fragment, { children: storage.has(getStorageType6(stockType)) && postData?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48374
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Footer, { className: "flex justify-end space-y-2", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "flex items-center gap-3", children: [
48375
+ !purchaseId ? /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(import_jsx_runtime264.Fragment, { children: storage.has(getStorageType6(stockType)) && postData?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
47993
48376
  import_antd94.Popconfirm,
47994
48377
  {
47995
48378
  title: "Are you sure you want to clear the draft?",
@@ -47998,7 +48381,7 @@ var Purchase3Form = ({ type }) => {
47998
48381
  storage.remove(getStorageType6(stockType));
47999
48382
  setPostData([]);
48000
48383
  },
48001
- children: /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48384
+ children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48002
48385
  Button,
48003
48386
  {
48004
48387
  size: "md",
@@ -48009,7 +48392,7 @@ var Purchase3Form = ({ type }) => {
48009
48392
  }
48010
48393
  )
48011
48394
  }
48012
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48395
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48013
48396
  Button,
48014
48397
  {
48015
48398
  onClick: () => {
@@ -48023,7 +48406,7 @@ var Purchase3Form = ({ type }) => {
48023
48406
  children: "Cancel"
48024
48407
  }
48025
48408
  ),
48026
- /* @__PURE__ */ (0, import_jsx_runtime262.jsx)(
48409
+ /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48027
48410
  Button,
48028
48411
  {
48029
48412
  onClick: handleSubmit(onMainFormSubmit, (e) => {
@@ -48061,12 +48444,12 @@ var purchase3 = {
48061
48444
  var purchase3_default = purchase3;
48062
48445
 
48063
48446
  // src/components/Transactions/3/expense/Expenses.tsx
48064
- var import_react_router_dom123 = require("react-router-dom");
48065
- var import_lucide_react125 = require("lucide-react");
48066
- var import_jsx_runtime263 = require("react/jsx-runtime");
48447
+ var import_react_router_dom125 = require("react-router-dom");
48448
+ var import_lucide_react126 = require("lucide-react");
48449
+ var import_jsx_runtime265 = require("react/jsx-runtime");
48067
48450
  function Expenses3({ url }) {
48068
- const { branchId } = (0, import_react_router_dom123.useParams)();
48069
- const navigate = (0, import_react_router_dom123.useNavigate)();
48451
+ const { branchId } = (0, import_react_router_dom125.useParams)();
48452
+ const navigate = (0, import_react_router_dom125.useNavigate)();
48070
48453
  const { TransactionView, openTransaction } = useTransactionView_default();
48071
48454
  const { data, TransactionViewComponent, reload } = useTransaction_default({
48072
48455
  url: url || `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
@@ -48076,17 +48459,17 @@ function Expenses3({ url }) {
48076
48459
  const items = (data2) => [
48077
48460
  {
48078
48461
  label: `View Expense`,
48079
- icon: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.FilePenLine, { size: 16 }),
48462
+ icon: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
48080
48463
  onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
48081
48464
  },
48082
48465
  {
48083
48466
  label: `Edit Expense`,
48084
- icon: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.FilePenLine, { size: 16 }),
48467
+ icon: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
48085
48468
  onClick: () => navigate(`update?id=${data2?._id}`)
48086
48469
  },
48087
48470
  {
48088
48471
  label: `Delete Expense`,
48089
- icon: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.Trash2, { className: "text-red-500", size: 16 }),
48472
+ icon: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
48090
48473
  onClick: () => {
48091
48474
  openTransaction({
48092
48475
  id: data2?._id,
@@ -48102,9 +48485,9 @@ function Expenses3({ url }) {
48102
48485
  header: "Date",
48103
48486
  cell: ({ row }) => {
48104
48487
  const expense = row.original;
48105
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex flex-col", children: [
48106
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: expense?.date }),
48107
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48488
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex flex-col", children: [
48489
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { children: expense?.date }),
48490
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48108
48491
  "span",
48109
48492
  {
48110
48493
  onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
@@ -48120,9 +48503,9 @@ function Expenses3({ url }) {
48120
48503
  header: "Description",
48121
48504
  cell: ({ row }) => {
48122
48505
  const expense = row.original;
48123
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)("div", { className: "flex flex-col", children: [
48124
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "capitalize", children: expense?.description }),
48125
- expense?.note && /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
48506
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex flex-col", children: [
48507
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "capitalize", children: expense?.description }),
48508
+ expense?.note && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
48126
48509
  ] });
48127
48510
  }
48128
48511
  },
@@ -48132,7 +48515,7 @@ function Expenses3({ url }) {
48132
48515
  cell: ({ row }) => {
48133
48516
  const expense = row.original;
48134
48517
  const walletData = expense?.fromWalletData || expense?.toWalletData;
48135
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("span", { children: walletData?.name || "N/A" });
48518
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { children: walletData?.name || "N/A" });
48136
48519
  }
48137
48520
  },
48138
48521
  {
@@ -48140,7 +48523,7 @@ function Expenses3({ url }) {
48140
48523
  header: "Amount",
48141
48524
  cell: ({ row }) => {
48142
48525
  const expense = row.original;
48143
- 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) }) });
48526
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }) });
48144
48527
  }
48145
48528
  },
48146
48529
  {
@@ -48148,23 +48531,23 @@ function Expenses3({ url }) {
48148
48531
  header: "Actions",
48149
48532
  cell: ({ row }) => {
48150
48533
  const data2 = row.original;
48151
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48534
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48152
48535
  Dropdown,
48153
48536
  {
48154
48537
  className: "cursor-pointer w-[150px]",
48155
48538
  items: items(data2),
48156
48539
  triggerMode: "hover",
48157
- children: /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(import_lucide_react125.EllipsisVertical, {})
48540
+ children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(import_lucide_react126.EllipsisVertical, {})
48158
48541
  }
48159
48542
  );
48160
48543
  }
48161
48544
  }
48162
48545
  ];
48163
48546
  const expenses = data?.data || [];
48164
- return /* @__PURE__ */ (0, import_jsx_runtime263.jsxs)(import_jsx_runtime263.Fragment, { children: [
48165
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(TransactionView, {}),
48166
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(Modal2, {}),
48167
- /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
48547
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
48548
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
48549
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Modal2, {}),
48550
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48168
48551
  TransactionViewComponent,
48169
48552
  {
48170
48553
  columns,
@@ -48183,8 +48566,8 @@ function Expenses3({ url }) {
48183
48566
  var Expenses_default2 = Expenses3;
48184
48567
 
48185
48568
  // src/components/Transactions/3/expense/ExpenseForm.tsx
48186
- var import_react160 = require("react");
48187
- var import_react_router_dom124 = require("react-router-dom");
48569
+ var import_react161 = require("react");
48570
+ var import_react_router_dom126 = require("react-router-dom");
48188
48571
  var import_react_hook_form74 = require("react-hook-form");
48189
48572
  var import_zod123 = require("@hookform/resolvers/zod");
48190
48573
  var import_antd95 = require("antd");
@@ -48204,13 +48587,13 @@ var expenseSchema4 = import_zod122.z.object({
48204
48587
  });
48205
48588
 
48206
48589
  // src/components/Transactions/3/expense/ExpenseForm.tsx
48207
- var import_jsx_runtime264 = require("react/jsx-runtime");
48590
+ var import_jsx_runtime266 = require("react/jsx-runtime");
48208
48591
  function ExpenseForm2() {
48209
- const { branchId } = (0, import_react_router_dom124.useParams)();
48592
+ const { branchId } = (0, import_react_router_dom126.useParams)();
48210
48593
  const { getQuery, navigate } = useApp_default();
48211
48594
  const id = getQuery("id");
48212
48595
  const isEdit = !!id;
48213
- const [ref2, setRef] = (0, import_react160.useState)("");
48596
+ const [ref2, setRef] = (0, import_react161.useState)("");
48214
48597
  const { post, isLoading } = useApis_default();
48215
48598
  const { isLoading: isLoadingGet, get } = useApis_default();
48216
48599
  const { defaultCurrency } = useWarqadConfig().currencies;
@@ -48231,7 +48614,7 @@ function ExpenseForm2() {
48231
48614
  const isRate = currency && currency !== defaultCurrency;
48232
48615
  const amount = watch("amount");
48233
48616
  const rate = watch("rate");
48234
- const exchangedAmount2 = (0, import_react160.useMemo)(() => {
48617
+ const exchangedAmount2 = (0, import_react161.useMemo)(() => {
48235
48618
  if (isRate) {
48236
48619
  const am = forex_default.exchangedAmount({
48237
48620
  accountCurrency: defaultCurrency,
@@ -48279,30 +48662,30 @@ function ExpenseForm2() {
48279
48662
  navigate(-1);
48280
48663
  }
48281
48664
  };
48282
- (0, import_react160.useEffect)(() => {
48665
+ (0, import_react161.useEffect)(() => {
48283
48666
  if (isEdit) {
48284
48667
  fetches();
48285
48668
  }
48286
48669
  }, [id]);
48287
- return /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(
48670
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
48288
48671
  Card,
48289
48672
  {
48290
48673
  className: "max-w-4xl mx-auto mt-10 relative",
48291
48674
  isLoading: isLoadingGet,
48292
48675
  loadingText: "Processing...",
48293
48676
  children: [
48294
- /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(Card.Header, { children: [
48295
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
48296
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
48677
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(Card.Header, { children: [
48678
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
48679
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
48297
48680
  ] }),
48298
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(
48681
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
48299
48682
  "form",
48300
48683
  {
48301
48684
  className: "space-y-4",
48302
48685
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
48303
48686
  children: [
48304
- /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48305
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48687
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48688
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48306
48689
  Fields_default.Input,
48307
48690
  {
48308
48691
  label: "Description",
@@ -48312,7 +48695,7 @@ function ExpenseForm2() {
48312
48695
  required: true
48313
48696
  }
48314
48697
  ),
48315
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48698
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48316
48699
  Feilds_default2.Wallet,
48317
48700
  {
48318
48701
  label: "Wallet",
@@ -48325,8 +48708,8 @@ function ExpenseForm2() {
48325
48708
  }
48326
48709
  )
48327
48710
  ] }),
48328
- /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48329
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48711
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48712
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48330
48713
  Fields_default.DateInput,
48331
48714
  {
48332
48715
  label: "Date",
@@ -48335,7 +48718,7 @@ function ExpenseForm2() {
48335
48718
  required: true
48336
48719
  }
48337
48720
  ),
48338
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48721
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48339
48722
  Fields_default.Input,
48340
48723
  {
48341
48724
  label: "Amount",
@@ -48346,8 +48729,8 @@ function ExpenseForm2() {
48346
48729
  required: true
48347
48730
  }
48348
48731
  ),
48349
- isRate && /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)(import_jsx_runtime264.Fragment, { children: [
48350
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48732
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48733
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48351
48734
  Fields_default.Input,
48352
48735
  {
48353
48736
  label: "Rate",
@@ -48358,7 +48741,7 @@ function ExpenseForm2() {
48358
48741
  required: true
48359
48742
  }
48360
48743
  ),
48361
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48744
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48362
48745
  Fields_default.Input,
48363
48746
  {
48364
48747
  label: "Exchanged Amount",
@@ -48370,7 +48753,7 @@ function ExpenseForm2() {
48370
48753
  )
48371
48754
  ] })
48372
48755
  ] }),
48373
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48756
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48374
48757
  Fields_default.Textarea,
48375
48758
  {
48376
48759
  label: "Note",
@@ -48379,7 +48762,7 @@ function ExpenseForm2() {
48379
48762
  placeholder: "Add any additional details..."
48380
48763
  }
48381
48764
  ),
48382
- /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsx)(
48765
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48383
48766
  Button,
48384
48767
  {
48385
48768
  isLoading,
@@ -48407,153 +48790,17 @@ var Expenses32 = {
48407
48790
  var expense_default = Expenses32;
48408
48791
 
48409
48792
  // src/components/Transactions/3/reports/Expenses3Reports.tsx
48410
- var import_react_router_dom125 = require("react-router-dom");
48411
- var import_react161 = require("react");
48793
+ var import_react_router_dom127 = require("react-router-dom");
48794
+ var import_react162 = require("react");
48412
48795
  var import_antd96 = require("antd");
48413
48796
  var import_dayjs11 = __toESM(require("dayjs"));
48414
- var import_jsx_runtime265 = require("react/jsx-runtime");
48797
+ var import_jsx_runtime267 = require("react/jsx-runtime");
48415
48798
  var Expenses3Reports = () => {
48416
- const { branchId } = (0, import_react_router_dom125.useParams)();
48417
- const [startDate, setStartDate] = (0, import_react161.useState)(null);
48418
- const [endDate, setEndDate] = (0, import_react161.useState)(null);
48419
- const { A4DataView, data } = useA4DataView_default({
48420
- url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
48421
- v: 1
48422
- // No prefix
48423
- });
48424
- const { TransactionView, openTransaction } = useTransactionView_default();
48425
- const { defaultCurrency } = useWarqadConfig()?.currencies;
48426
- const columns = [
48427
- {
48428
- header: "Date",
48429
- key: "date",
48430
- className: "text-xs whitespace-nowrap",
48431
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
48432
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48433
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48434
- "span",
48435
- {
48436
- onClick: () => {
48437
- openTransaction({
48438
- id: row?._id,
48439
- type: row?.type
48440
- });
48441
- },
48442
- className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
48443
- children: row?.ref
48444
- }
48445
- )
48446
- ] })
48447
- },
48448
- {
48449
- header: "Description",
48450
- key: "description",
48451
- className: "text-xs whitespace-nowrap ",
48452
- render: (row) => {
48453
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
48454
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
48455
- row.note && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
48456
- ] });
48457
- }
48458
- },
48459
- {
48460
- header: "Amount",
48461
- key: "changedAmountString",
48462
- className: "text-xs whitespace-nowrap text-right",
48463
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
48464
- renderFooter: (data2) => {
48465
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
48466
- Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
48467
- defaultCurrency
48468
- ) });
48469
- }
48470
- }
48471
- ];
48472
- const datas = (0, import_react161.useMemo)(() => {
48473
- let runningBalance = 0;
48474
- let filteredData = data?.data || [];
48475
- const mapped = filteredData.map((item) => {
48476
- const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
48477
- runningBalance += changedAmount;
48478
- return {
48479
- ...item,
48480
- changedAmountString: Formats_default.Amount(changedAmount, false),
48481
- changedAmount,
48482
- runningBalance
48483
- };
48484
- });
48485
- let filtered = mapped;
48486
- if (startDate) {
48487
- const startOfDay = startDate.startOf("day");
48488
- filtered = filtered.filter((tx) => {
48489
- const rawDate = tx.dateObj || tx.date;
48490
- if (!rawDate) return false;
48491
- const txDate = (0, import_dayjs11.default)(rawDate);
48492
- return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
48493
- });
48494
- }
48495
- if (endDate) {
48496
- const endOfDay = endDate.endOf("day");
48497
- filtered = filtered.filter((tx) => {
48498
- const rawDate = tx.dateObj || tx.date;
48499
- if (!rawDate) return false;
48500
- const txDate = (0, import_dayjs11.default)(rawDate);
48501
- return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
48502
- });
48503
- }
48504
- return filtered;
48505
- }, [data, startDate, endDate]);
48506
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
48507
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
48508
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48509
- A4DataView,
48510
- {
48511
- columns,
48512
- data: datas,
48513
- index: true,
48514
- title: `Expenses Report`,
48515
- subtitle: `All Expenses`,
48516
- fixed: false,
48517
- headers: /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
48518
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48519
- import_antd96.DatePicker,
48520
- {
48521
- placeholder: "Start Date",
48522
- onChange: (date) => setStartDate(date),
48523
- value: startDate,
48524
- format: "DD/MM/YYYY",
48525
- className: "min-w-[140px] max-w-[160px]"
48526
- }
48527
- ),
48528
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48529
- import_antd96.DatePicker,
48530
- {
48531
- placeholder: "End Date",
48532
- onChange: (date) => setEndDate(date),
48533
- value: endDate,
48534
- format: "DD/MM/YYYY",
48535
- className: "min-w-[140px] max-w-[160px]"
48536
- }
48537
- )
48538
- ] })
48539
- }
48540
- )
48541
- ] });
48542
- };
48543
- var Expenses3Reports_default = Expenses3Reports;
48544
-
48545
- // src/components/Transactions/3/reports/ExpensesJournal3.tsx
48546
- var import_react_router_dom126 = require("react-router-dom");
48547
- var import_react162 = require("react");
48548
- var import_antd97 = require("antd");
48549
- var import_dayjs12 = __toESM(require("dayjs"));
48550
- var import_jsx_runtime266 = require("react/jsx-runtime");
48551
- var Expenses3Reports2 = () => {
48552
- const { branchId } = (0, import_react_router_dom126.useParams)();
48799
+ const { branchId } = (0, import_react_router_dom127.useParams)();
48553
48800
  const [startDate, setStartDate] = (0, import_react162.useState)(null);
48554
48801
  const [endDate, setEndDate] = (0, import_react162.useState)(null);
48555
48802
  const { A4DataView, data } = useA4DataView_default({
48556
- url: `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
48803
+ url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
48557
48804
  v: 1
48558
48805
  // No prefix
48559
48806
  });
@@ -48564,9 +48811,9 @@ var Expenses3Reports2 = () => {
48564
48811
  header: "Date",
48565
48812
  key: "date",
48566
48813
  className: "text-xs whitespace-nowrap",
48567
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
48568
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48569
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48814
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "", children: [
48815
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48816
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48570
48817
  "span",
48571
48818
  {
48572
48819
  onClick: () => {
@@ -48586,9 +48833,9 @@ var Expenses3Reports2 = () => {
48586
48833
  key: "description",
48587
48834
  className: "text-xs whitespace-nowrap ",
48588
48835
  render: (row) => {
48589
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
48590
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
48591
- row.note && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
48836
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "", children: [
48837
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
48838
+ row.note && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
48592
48839
  ] });
48593
48840
  }
48594
48841
  },
@@ -48596,9 +48843,9 @@ var Expenses3Reports2 = () => {
48596
48843
  header: "Amount",
48597
48844
  key: "changedAmountString",
48598
48845
  className: "text-xs whitespace-nowrap text-right",
48599
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
48846
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
48600
48847
  renderFooter: (data2) => {
48601
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
48848
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
48602
48849
  Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
48603
48850
  defaultCurrency
48604
48851
  ) });
@@ -48606,6 +48853,142 @@ var Expenses3Reports2 = () => {
48606
48853
  }
48607
48854
  ];
48608
48855
  const datas = (0, import_react162.useMemo)(() => {
48856
+ let runningBalance = 0;
48857
+ let filteredData = data?.data || [];
48858
+ const mapped = filteredData.map((item) => {
48859
+ const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
48860
+ runningBalance += changedAmount;
48861
+ return {
48862
+ ...item,
48863
+ changedAmountString: Formats_default.Amount(changedAmount, false),
48864
+ changedAmount,
48865
+ runningBalance
48866
+ };
48867
+ });
48868
+ let filtered = mapped;
48869
+ if (startDate) {
48870
+ const startOfDay = startDate.startOf("day");
48871
+ filtered = filtered.filter((tx) => {
48872
+ const rawDate = tx.dateObj || tx.date;
48873
+ if (!rawDate) return false;
48874
+ const txDate = (0, import_dayjs11.default)(rawDate);
48875
+ return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
48876
+ });
48877
+ }
48878
+ if (endDate) {
48879
+ const endOfDay = endDate.endOf("day");
48880
+ filtered = filtered.filter((tx) => {
48881
+ const rawDate = tx.dateObj || tx.date;
48882
+ if (!rawDate) return false;
48883
+ const txDate = (0, import_dayjs11.default)(rawDate);
48884
+ return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
48885
+ });
48886
+ }
48887
+ return filtered;
48888
+ }, [data, startDate, endDate]);
48889
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
48890
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(TransactionView, {}),
48891
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48892
+ A4DataView,
48893
+ {
48894
+ columns,
48895
+ data: datas,
48896
+ index: true,
48897
+ title: `Expenses Report`,
48898
+ subtitle: `All Expenses`,
48899
+ fixed: false,
48900
+ headers: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
48901
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48902
+ import_antd96.DatePicker,
48903
+ {
48904
+ placeholder: "Start Date",
48905
+ onChange: (date) => setStartDate(date),
48906
+ value: startDate,
48907
+ format: "DD/MM/YYYY",
48908
+ className: "min-w-[140px] max-w-[160px]"
48909
+ }
48910
+ ),
48911
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48912
+ import_antd96.DatePicker,
48913
+ {
48914
+ placeholder: "End Date",
48915
+ onChange: (date) => setEndDate(date),
48916
+ value: endDate,
48917
+ format: "DD/MM/YYYY",
48918
+ className: "min-w-[140px] max-w-[160px]"
48919
+ }
48920
+ )
48921
+ ] })
48922
+ }
48923
+ )
48924
+ ] });
48925
+ };
48926
+ var Expenses3Reports_default = Expenses3Reports;
48927
+
48928
+ // src/components/Transactions/3/reports/ExpensesJournal3.tsx
48929
+ var import_react_router_dom128 = require("react-router-dom");
48930
+ var import_react163 = require("react");
48931
+ var import_antd97 = require("antd");
48932
+ var import_dayjs12 = __toESM(require("dayjs"));
48933
+ var import_jsx_runtime268 = require("react/jsx-runtime");
48934
+ var Expenses3Reports2 = () => {
48935
+ const { branchId } = (0, import_react_router_dom128.useParams)();
48936
+ const [startDate, setStartDate] = (0, import_react163.useState)(null);
48937
+ const [endDate, setEndDate] = (0, import_react163.useState)(null);
48938
+ const { A4DataView, data } = useA4DataView_default({
48939
+ url: `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
48940
+ v: 1
48941
+ // No prefix
48942
+ });
48943
+ const { TransactionView, openTransaction } = useTransactionView_default();
48944
+ const { defaultCurrency } = useWarqadConfig()?.currencies;
48945
+ const columns = [
48946
+ {
48947
+ header: "Date",
48948
+ key: "date",
48949
+ className: "text-xs whitespace-nowrap",
48950
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
48951
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48952
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48953
+ "span",
48954
+ {
48955
+ onClick: () => {
48956
+ openTransaction({
48957
+ id: row?._id,
48958
+ type: row?.type
48959
+ });
48960
+ },
48961
+ className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
48962
+ children: row?.ref
48963
+ }
48964
+ )
48965
+ ] })
48966
+ },
48967
+ {
48968
+ header: "Description",
48969
+ key: "description",
48970
+ className: "text-xs whitespace-nowrap ",
48971
+ render: (row) => {
48972
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
48973
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
48974
+ row.note && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-medium italic text-[8px] capitalize text-gray-500 dark:text-white ", children: row.note })
48975
+ ] });
48976
+ }
48977
+ },
48978
+ {
48979
+ header: "Amount",
48980
+ key: "changedAmountString",
48981
+ className: "text-xs whitespace-nowrap text-right",
48982
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
48983
+ renderFooter: (data2) => {
48984
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
48985
+ Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
48986
+ defaultCurrency
48987
+ ) });
48988
+ }
48989
+ }
48990
+ ];
48991
+ const datas = (0, import_react163.useMemo)(() => {
48609
48992
  let runningBalance = 0;
48610
48993
  let filteredData = data?.data || [];
48611
48994
  const mapped = filteredData.map((item) => {
@@ -48639,9 +49022,9 @@ var Expenses3Reports2 = () => {
48639
49022
  }
48640
49023
  return filtered;
48641
49024
  }, [data, startDate, endDate]);
48642
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48643
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
48644
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49025
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
49026
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(TransactionView, {}),
49027
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48645
49028
  A4DataView,
48646
49029
  {
48647
49030
  columns,
@@ -48650,8 +49033,8 @@ var Expenses3Reports2 = () => {
48650
49033
  title: `Expenses Journal Report`,
48651
49034
  subtitle: `All Expenses`,
48652
49035
  fixed: false,
48653
- headers: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
48654
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49036
+ headers: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
49037
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48655
49038
  import_antd97.DatePicker,
48656
49039
  {
48657
49040
  placeholder: "Start Date",
@@ -48661,7 +49044,7 @@ var Expenses3Reports2 = () => {
48661
49044
  className: "min-w-[140px] max-w-[160px]"
48662
49045
  }
48663
49046
  ),
48664
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
49047
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48665
49048
  import_antd97.DatePicker,
48666
49049
  {
48667
49050
  placeholder: "End Date",
@@ -48686,12 +49069,12 @@ var Reports3 = {
48686
49069
  var reports_default = Reports3;
48687
49070
 
48688
49071
  // src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
48689
- var import_react_router_dom127 = require("react-router-dom");
48690
- var import_lucide_react126 = require("lucide-react");
48691
- var import_jsx_runtime267 = require("react/jsx-runtime");
49072
+ var import_react_router_dom129 = require("react-router-dom");
49073
+ var import_lucide_react127 = require("lucide-react");
49074
+ var import_jsx_runtime269 = require("react/jsx-runtime");
48692
49075
  function ExpensesJournal3({ url }) {
48693
- const { branchId } = (0, import_react_router_dom127.useParams)();
48694
- const navigate = (0, import_react_router_dom127.useNavigate)();
49076
+ const { branchId } = (0, import_react_router_dom129.useParams)();
49077
+ const navigate = (0, import_react_router_dom129.useNavigate)();
48695
49078
  const { TransactionView, openTransaction } = useTransactionView_default();
48696
49079
  const { data, TransactionViewComponent, reload } = useTransaction_default({
48697
49080
  url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
@@ -48701,17 +49084,17 @@ function ExpensesJournal3({ url }) {
48701
49084
  const items = (data2) => [
48702
49085
  {
48703
49086
  label: `View Expense`,
48704
- icon: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
49087
+ icon: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
48705
49088
  onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
48706
49089
  },
48707
49090
  {
48708
49091
  label: `Edit Expense`,
48709
- icon: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
49092
+ icon: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
48710
49093
  onClick: () => navigate(`update?id=${data2?._id}`)
48711
49094
  },
48712
49095
  {
48713
49096
  label: `Delete Expense`,
48714
- icon: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
49097
+ icon: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.Trash2, { className: "text-red-500", size: 16 }),
48715
49098
  onClick: () => {
48716
49099
  openTransaction({
48717
49100
  id: data2?._id,
@@ -48727,9 +49110,9 @@ function ExpensesJournal3({ url }) {
48727
49110
  header: "Date",
48728
49111
  cell: ({ row }) => {
48729
49112
  const expense = row.original;
48730
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex flex-col", children: [
48731
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { children: expense?.date }),
48732
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49113
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex flex-col", children: [
49114
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { children: expense?.date }),
49115
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
48733
49116
  "span",
48734
49117
  {
48735
49118
  onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
@@ -48745,9 +49128,9 @@ function ExpensesJournal3({ url }) {
48745
49128
  header: "Description",
48746
49129
  cell: ({ row }) => {
48747
49130
  const expense = row.original;
48748
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex flex-col", children: [
48749
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "capitalize", children: expense?.description }),
48750
- expense?.note && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
49131
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex flex-col", children: [
49132
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "capitalize", children: expense?.description }),
49133
+ expense?.note && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
48751
49134
  ] });
48752
49135
  }
48753
49136
  },
@@ -48756,9 +49139,9 @@ function ExpensesJournal3({ url }) {
48756
49139
  header: "Amount",
48757
49140
  cell: ({ row }) => {
48758
49141
  const expense = row.original;
48759
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "", children: [
48760
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
48761
- expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
49142
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "", children: [
49143
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
49144
+ expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
48762
49145
  "rate ",
48763
49146
  expense?.exchange?.rate,
48764
49147
  " ,",
@@ -48776,23 +49159,23 @@ function ExpensesJournal3({ url }) {
48776
49159
  header: "Actions",
48777
49160
  cell: ({ row }) => {
48778
49161
  const data2 = row.original;
48779
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49162
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
48780
49163
  Dropdown,
48781
49164
  {
48782
49165
  className: "cursor-pointer w-[150px]",
48783
49166
  items: items(data2),
48784
49167
  triggerMode: "hover",
48785
- children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.EllipsisVertical, {})
49168
+ children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react127.EllipsisVertical, {})
48786
49169
  }
48787
49170
  );
48788
49171
  }
48789
49172
  }
48790
49173
  ];
48791
49174
  const expenses = data?.data || [];
48792
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
48793
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(TransactionView, {}),
48794
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Modal2, {}),
48795
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49175
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
49176
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
49177
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Modal2, {}),
49178
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
48796
49179
  TransactionViewComponent,
48797
49180
  {
48798
49181
  columns,
@@ -48811,8 +49194,8 @@ function ExpensesJournal3({ url }) {
48811
49194
  var ExpensesJournal_default = ExpensesJournal3;
48812
49195
 
48813
49196
  // src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
48814
- var import_react163 = require("react");
48815
- var import_react_router_dom128 = require("react-router-dom");
49197
+ var import_react164 = require("react");
49198
+ var import_react_router_dom130 = require("react-router-dom");
48816
49199
  var import_react_hook_form75 = require("react-hook-form");
48817
49200
  var import_zod126 = require("@hookform/resolvers/zod");
48818
49201
  var import_antd98 = require("antd");
@@ -48830,13 +49213,13 @@ var expenseSchema5 = import_zod125.z.object({
48830
49213
  });
48831
49214
 
48832
49215
  // src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
48833
- var import_jsx_runtime268 = require("react/jsx-runtime");
49216
+ var import_jsx_runtime270 = require("react/jsx-runtime");
48834
49217
  function ExpensesJournal3Form() {
48835
- const { branchId } = (0, import_react_router_dom128.useParams)();
49218
+ const { branchId } = (0, import_react_router_dom130.useParams)();
48836
49219
  const { getQuery, navigate } = useApp_default();
48837
49220
  const id = getQuery("id");
48838
49221
  const isEdit = !!id;
48839
- const [ref2, setRef] = (0, import_react163.useState)("");
49222
+ const [ref2, setRef] = (0, import_react164.useState)("");
48840
49223
  const { post, isLoading } = useApis_default();
48841
49224
  const { isLoading: isLoadingGet, get } = useApis_default();
48842
49225
  const { defaultCurrency } = useWarqadConfig().currencies;
@@ -48855,7 +49238,7 @@ function ExpensesJournal3Form() {
48855
49238
  const isRate = currency && currency !== defaultCurrency;
48856
49239
  const amount = watch("amount");
48857
49240
  const rate = watch("rate");
48858
- const exchangedAmount2 = (0, import_react163.useMemo)(() => {
49241
+ const exchangedAmount2 = (0, import_react164.useMemo)(() => {
48859
49242
  if (isRate) {
48860
49243
  const am = forex_default.exchangedAmount({
48861
49244
  accountCurrency: defaultCurrency,
@@ -48901,30 +49284,30 @@ function ExpensesJournal3Form() {
48901
49284
  navigate(-1);
48902
49285
  }
48903
49286
  };
48904
- (0, import_react163.useEffect)(() => {
49287
+ (0, import_react164.useEffect)(() => {
48905
49288
  if (isEdit) {
48906
49289
  fetches();
48907
49290
  }
48908
49291
  }, [id]);
48909
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49292
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
48910
49293
  Card,
48911
49294
  {
48912
49295
  className: "max-w-4xl mx-auto mt-10 relative",
48913
49296
  isLoading: isLoadingGet,
48914
49297
  loadingText: "Processing...",
48915
49298
  children: [
48916
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(Card.Header, { children: [
48917
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
48918
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
49299
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(Card.Header, { children: [
49300
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
49301
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
48919
49302
  ] }),
48920
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49303
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
48921
49304
  "form",
48922
49305
  {
48923
49306
  className: "space-y-4",
48924
49307
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
48925
49308
  children: [
48926
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48927
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49309
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49310
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48928
49311
  Fields_default.Input,
48929
49312
  {
48930
49313
  label: "Description",
@@ -48934,7 +49317,7 @@ function ExpensesJournal3Form() {
48934
49317
  required: true
48935
49318
  }
48936
49319
  ),
48937
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49320
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48938
49321
  Fields_default.Select,
48939
49322
  {
48940
49323
  label: "Currency",
@@ -48945,8 +49328,8 @@ function ExpensesJournal3Form() {
48945
49328
  }
48946
49329
  )
48947
49330
  ] }),
48948
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48949
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49331
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49332
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48950
49333
  Fields_default.DateInput,
48951
49334
  {
48952
49335
  label: "Date",
@@ -48955,7 +49338,7 @@ function ExpensesJournal3Form() {
48955
49338
  required: true
48956
49339
  }
48957
49340
  ),
48958
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49341
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48959
49342
  Fields_default.Input,
48960
49343
  {
48961
49344
  label: "Amount",
@@ -48966,8 +49349,8 @@ function ExpensesJournal3Form() {
48966
49349
  required: true
48967
49350
  }
48968
49351
  ),
48969
- isRate && /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
48970
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49352
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
49353
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48971
49354
  Fields_default.Input,
48972
49355
  {
48973
49356
  label: "Rate",
@@ -48978,7 +49361,7 @@ function ExpensesJournal3Form() {
48978
49361
  required: true
48979
49362
  }
48980
49363
  ),
48981
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49364
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48982
49365
  Fields_default.Input,
48983
49366
  {
48984
49367
  label: "Exchanged Amount",
@@ -48990,7 +49373,7 @@ function ExpensesJournal3Form() {
48990
49373
  )
48991
49374
  ] })
48992
49375
  ] }),
48993
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49376
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
48994
49377
  Fields_default.Textarea,
48995
49378
  {
48996
49379
  label: "Note",
@@ -48999,7 +49382,7 @@ function ExpensesJournal3Form() {
48999
49382
  placeholder: "Add any additional details..."
49000
49383
  }
49001
49384
  ),
49002
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49385
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49003
49386
  Button,
49004
49387
  {
49005
49388
  isLoading,
@@ -49034,31 +49417,33 @@ var Transaction3 = {
49034
49417
  JournalsForm: JournalsForm_default,
49035
49418
  Sale2: sale2_default2.List,
49036
49419
  Sale2Form: sale2_default2.Form,
49420
+ Collection: sale2_default2.Collection,
49037
49421
  Purchase3: purchase3_default.List,
49038
49422
  Purchase3Form: purchase3_default.Form,
49039
49423
  Expenses: expense_default.List,
49040
49424
  ExpenseForm: expense_default.Form,
49041
49425
  Reports: reports_default,
49042
- ExpensesJournal3: expenseJournal_default
49426
+ ExpensesJournal3: expenseJournal_default,
49427
+ CollectionLevel: sale2_default2.CollectionLevel
49043
49428
  };
49044
49429
  var __default = Transaction3;
49045
49430
 
49046
49431
  // src/components/reports/ItemReport.tsx
49047
- var import_react_router_dom129 = require("react-router-dom");
49432
+ var import_react_router_dom131 = require("react-router-dom");
49048
49433
  var import_zod127 = require("zod");
49049
49434
  var import_react_hook_form76 = require("react-hook-form");
49050
49435
  var import_zod128 = require("@hookform/resolvers/zod");
49051
- var import_react164 = require("react");
49436
+ var import_react165 = require("react");
49052
49437
  var import_antd99 = require("antd");
49053
- var import_jsx_runtime269 = require("react/jsx-runtime");
49438
+ var import_jsx_runtime271 = require("react/jsx-runtime");
49054
49439
  var ItemReport = ({
49055
49440
  value = false,
49056
49441
  type
49057
49442
  }) => {
49058
49443
  const { apiConfig } = useWarqadConfig();
49059
- const { branchId } = (0, import_react_router_dom129.useParams)();
49444
+ const { branchId } = (0, import_react_router_dom131.useParams)();
49060
49445
  const { branches } = useAuth_default();
49061
- const [params, setParams] = (0, import_react164.useState)({
49446
+ const [params, setParams] = (0, import_react165.useState)({
49062
49447
  id: "",
49063
49448
  branch: "all"
49064
49449
  });
@@ -49083,9 +49468,9 @@ var ItemReport = ({
49083
49468
  header: "Date",
49084
49469
  key: "date",
49085
49470
  className: "text-xs whitespace-nowrap",
49086
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "", children: [
49087
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49088
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49471
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "", children: [
49472
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49473
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49089
49474
  "span",
49090
49475
  {
49091
49476
  onClick: () => {
@@ -49104,7 +49489,7 @@ var ItemReport = ({
49104
49489
  header: "Description",
49105
49490
  key: "description",
49106
49491
  className: "text-xs whitespace-nowrap",
49107
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
49492
+ render: (row) => /* @__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.description }) })
49108
49493
  },
49109
49494
  {
49110
49495
  header: "Quantity",
@@ -49112,7 +49497,7 @@ var ItemReport = ({
49112
49497
  className: "text-xs whitespace-nowrap",
49113
49498
  render: (row) => {
49114
49499
  const Qty = row.quantity;
49115
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49500
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49116
49501
  "div",
49117
49502
  {
49118
49503
  className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
@@ -49129,7 +49514,7 @@ var ItemReport = ({
49129
49514
  header: "Balance",
49130
49515
  key: "runningBalance",
49131
49516
  className: "text-xs whitespace-nowrap",
49132
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
49517
+ render: (row) => /* @__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: Formats_default.XQty(row.runningBalance) }) })
49133
49518
  }
49134
49519
  ];
49135
49520
  let runningBalance = 0;
@@ -49141,10 +49526,10 @@ var ItemReport = ({
49141
49526
  };
49142
49527
  });
49143
49528
  const itemName = datas[0]?.name;
49144
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
49145
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Modal2, {}),
49146
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
49147
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49529
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
49530
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Modal2, {}),
49531
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(TransactionView, {}),
49532
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49148
49533
  A4DataView,
49149
49534
  {
49150
49535
  columns,
@@ -49155,14 +49540,14 @@ var ItemReport = ({
49155
49540
  tableTitle: `${type} Movement Report`,
49156
49541
  fixed: false,
49157
49542
  error: !id ? "Please select an item" : void 0,
49158
- headers: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49543
+ headers: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49159
49544
  Button,
49160
49545
  {
49161
49546
  type: "button",
49162
49547
  size: "sm",
49163
49548
  onClick: () => openState({
49164
49549
  title: "Item Transactions",
49165
- content: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49550
+ content: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49166
49551
  ItemReportHeader2,
49167
49552
  {
49168
49553
  type,
@@ -49205,7 +49590,7 @@ function ItemReportHeader2({
49205
49590
  label: b.name,
49206
49591
  value: b._id
49207
49592
  }));
49208
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49593
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49209
49594
  "form",
49210
49595
  {
49211
49596
  className: "space-y-3",
@@ -49223,8 +49608,8 @@ function ItemReportHeader2({
49223
49608
  close();
49224
49609
  }),
49225
49610
  children: [
49226
- /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
49227
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49611
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
49612
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49228
49613
  Select,
49229
49614
  {
49230
49615
  options: [{ label: "All Branches", value: "all" }, ...branchOptions],
@@ -49232,7 +49617,7 @@ function ItemReportHeader2({
49232
49617
  name: "branch"
49233
49618
  }
49234
49619
  ),
49235
- type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49620
+ type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49236
49621
  Pack_default.Pack,
49237
49622
  {
49238
49623
  api: "/packs/get",
@@ -49240,7 +49625,7 @@ function ItemReportHeader2({
49240
49625
  form: methods,
49241
49626
  name: "pack"
49242
49627
  }
49243
- ) : /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49628
+ ) : /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49244
49629
  Feilds_default5.Product,
49245
49630
  {
49246
49631
  label: "",
@@ -49251,7 +49636,7 @@ function ItemReportHeader2({
49251
49636
  }
49252
49637
  )
49253
49638
  ] }),
49254
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Button, { type: "submit", children: "Filter" }) })
49639
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Button, { type: "submit", children: "Filter" }) })
49255
49640
  ]
49256
49641
  }
49257
49642
  );
@@ -49259,19 +49644,19 @@ function ItemReportHeader2({
49259
49644
  var ItemReport_default = ItemReport;
49260
49645
 
49261
49646
  // src/components/accounts/LeaseCollection.tsx
49262
- var import_react_router_dom130 = require("react-router-dom");
49263
- var import_react165 = require("react");
49264
- var import_jsx_runtime270 = require("react/jsx-runtime");
49647
+ var import_react_router_dom132 = require("react-router-dom");
49648
+ var import_react166 = require("react");
49649
+ var import_jsx_runtime272 = require("react/jsx-runtime");
49265
49650
  var LeaseCollection = ({
49266
49651
  leaseType,
49267
49652
  defaultCurrency = "KES"
49268
49653
  }) => {
49269
- const navigate = (0, import_react_router_dom130.useNavigate)();
49270
- const [searchParams] = (0, import_react_router_dom130.useSearchParams)();
49654
+ const navigate = (0, import_react_router_dom132.useNavigate)();
49655
+ const [searchParams] = (0, import_react_router_dom132.useSearchParams)();
49271
49656
  const { apiConfig } = useWarqadConfig();
49272
- const { branchId } = (0, import_react_router_dom130.useParams)();
49657
+ const { branchId } = (0, import_react_router_dom132.useParams)();
49273
49658
  const { branches } = useAuth_default();
49274
- const currentBranch = (0, import_react165.useMemo)(
49659
+ const currentBranch = (0, import_react166.useMemo)(
49275
49660
  () => branches?.find((b) => b?._id === branchId),
49276
49661
  [branches, branchId]
49277
49662
  );
@@ -49279,16 +49664,16 @@ var LeaseCollection = ({
49279
49664
  const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
49280
49665
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
49281
49666
  const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
49282
- const [filter, setFilter] = (0, import_react165.useState)(
49667
+ const [filter, setFilter] = (0, import_react166.useState)(
49283
49668
  initialFilter
49284
49669
  );
49285
- const [currencyFilter, setCurrencyFilter] = (0, import_react165.useState)(initialCurrency);
49286
- (0, import_react165.useEffect)(() => {
49670
+ const [currencyFilter, setCurrencyFilter] = (0, import_react166.useState)(initialCurrency);
49671
+ (0, import_react166.useEffect)(() => {
49287
49672
  if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
49288
49673
  setFilter(urlFilter);
49289
49674
  }
49290
49675
  }, [urlFilter]);
49291
- (0, import_react165.useEffect)(() => {
49676
+ (0, import_react166.useEffect)(() => {
49292
49677
  if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
49293
49678
  setCurrencyFilter(urlCurrency);
49294
49679
  } else {
@@ -49307,9 +49692,9 @@ var LeaseCollection = ({
49307
49692
  key: "name",
49308
49693
  className: "text-xs whitespace-nowrap ",
49309
49694
  searchKeys: ["name", "phoneNumber", "unitNames"],
49310
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "space-y-1", children: [
49311
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
49312
- row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("p", { className: "text-[9px]! capitalize", children: [
49695
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-1", children: [
49696
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
49697
+ row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("p", { className: "text-[9px]! capitalize", children: [
49313
49698
  "(",
49314
49699
  row.unitNames,
49315
49700
  ")"
@@ -49321,7 +49706,7 @@ var LeaseCollection = ({
49321
49706
  key: "phoneNumber",
49322
49707
  maxWidth: 70,
49323
49708
  render: (row) => {
49324
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { children: row?.phoneNumber || "N/A" });
49709
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: row?.phoneNumber || "N/A" });
49325
49710
  }
49326
49711
  },
49327
49712
  // </span>
@@ -49331,11 +49716,11 @@ var LeaseCollection = ({
49331
49716
  className: "text-xs whitespace-nowrap text-right",
49332
49717
  render: (row) => {
49333
49718
  const Amount = row.totalCollectionString;
49334
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { className: "font-bold ", children: Amount }) });
49719
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "font-bold ", children: Amount }) });
49335
49720
  },
49336
49721
  renderFooter: (data2) => {
49337
49722
  if (currencyFilter === "all") return;
49338
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("span", { className: " font-bold", children: Formats_default.Price(
49723
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: " font-bold", children: Formats_default.Price(
49339
49724
  data2.reduce((acc, row) => acc + row.totalCollection, 0),
49340
49725
  defaultCurrency,
49341
49726
  false
@@ -49343,7 +49728,7 @@ var LeaseCollection = ({
49343
49728
  }
49344
49729
  }
49345
49730
  ];
49346
- const datas = (0, import_react165.useMemo)(() => {
49731
+ const datas = (0, import_react166.useMemo)(() => {
49347
49732
  let runningBalance = 0;
49348
49733
  let filteredData = data?.data || [];
49349
49734
  const result = filteredData.map((item) => {
@@ -49356,9 +49741,9 @@ var LeaseCollection = ({
49356
49741
  });
49357
49742
  return result;
49358
49743
  }, [filter, currencyFilter, data]);
49359
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
49360
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(TransactionView, {}),
49361
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49744
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_jsx_runtime272.Fragment, { children: [
49745
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(TransactionView, {}),
49746
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49362
49747
  A4DataView,
49363
49748
  {
49364
49749
  columns,
@@ -49368,7 +49753,7 @@ var LeaseCollection = ({
49368
49753
  subtitle: `All Collections`,
49369
49754
  fixed: false,
49370
49755
  startPage: 1e9,
49371
- headers: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "flex gap-2" })
49756
+ headers: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "flex gap-2" })
49372
49757
  }
49373
49758
  )
49374
49759
  ] });
@@ -49376,9 +49761,9 @@ var LeaseCollection = ({
49376
49761
  var LeaseCollection_default = LeaseCollection;
49377
49762
 
49378
49763
  // src/components/Transactions/cargoIM/CargoIM.tsx
49379
- var import_react_router_dom134 = require("react-router-dom");
49380
- var import_lucide_react128 = require("lucide-react");
49381
- var import_react169 = require("react");
49764
+ var import_react_router_dom136 = require("react-router-dom");
49765
+ var import_lucide_react129 = require("lucide-react");
49766
+ var import_react170 = require("react");
49382
49767
  var import_antd103 = require("antd");
49383
49768
 
49384
49769
  // src/components/Transactions/cargoIM/schema.ts
@@ -49414,15 +49799,15 @@ var journalSchema5 = import_zod130.z.object({
49414
49799
  var import_react_hook_form77 = require("react-hook-form");
49415
49800
  var import_zod131 = require("@hookform/resolvers/zod");
49416
49801
  var import_antd100 = require("antd");
49417
- var import_react166 = require("react");
49418
- var import_react_router_dom131 = require("react-router-dom");
49419
- var import_jsx_runtime271 = require("react/jsx-runtime");
49802
+ var import_react167 = require("react");
49803
+ var import_react_router_dom133 = require("react-router-dom");
49804
+ var import_jsx_runtime273 = require("react/jsx-runtime");
49420
49805
  function AccountForm3({
49421
49806
  onReload,
49422
49807
  close,
49423
49808
  id
49424
49809
  }) {
49425
- const { branchId } = (0, import_react_router_dom131.useParams)();
49810
+ const { branchId } = (0, import_react_router_dom133.useParams)();
49426
49811
  const { currencies } = useWarqadConfig();
49427
49812
  const { stock } = currencies;
49428
49813
  const isEdit = !!id;
@@ -49483,29 +49868,29 @@ function AccountForm3({
49483
49868
  close?.();
49484
49869
  }
49485
49870
  };
49486
- (0, import_react166.useEffect)(() => {
49871
+ (0, import_react167.useEffect)(() => {
49487
49872
  if (isEdit) {
49488
49873
  fetches();
49489
49874
  }
49490
49875
  }, [id]);
49491
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49876
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
49492
49877
  Card,
49493
49878
  {
49494
49879
  className: "max-w-4xl mx-auto mt-10 relative",
49495
49880
  isLoading: isLoadingGet,
49496
49881
  loadingText: "Processing...",
49497
49882
  children: [
49498
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Card.Header, { children: [
49499
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
49500
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
49883
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(Card.Header, { children: [
49884
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
49885
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
49501
49886
  ] }),
49502
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49887
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
49503
49888
  "form",
49504
49889
  {
49505
49890
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
49506
49891
  children: [
49507
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49508
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49892
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49893
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49509
49894
  Fields_default.Input,
49510
49895
  {
49511
49896
  label: "Name",
@@ -49516,7 +49901,7 @@ function AccountForm3({
49516
49901
  required: true
49517
49902
  }
49518
49903
  ),
49519
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49904
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49520
49905
  Fields_default.PhoneInput,
49521
49906
  {
49522
49907
  label: "Phone Number",
@@ -49525,7 +49910,7 @@ function AccountForm3({
49525
49910
  placeholder: "Enter phone number"
49526
49911
  }
49527
49912
  ),
49528
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49913
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49529
49914
  Fields_default.Select,
49530
49915
  {
49531
49916
  label: "Currency",
@@ -49536,7 +49921,7 @@ function AccountForm3({
49536
49921
  }
49537
49922
  )
49538
49923
  ] }),
49539
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49924
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49540
49925
  Button,
49541
49926
  {
49542
49927
  isLoading,
@@ -49557,31 +49942,31 @@ function AccountForm3({
49557
49942
  var AccountForm_default3 = AccountForm3;
49558
49943
 
49559
49944
  // src/components/Transactions/cargoIM/InvoiceForm.tsx
49560
- var import_react167 = require("react");
49945
+ var import_react168 = require("react");
49561
49946
  var import_react_hook_form78 = require("react-hook-form");
49562
49947
  var import_zod132 = require("@hookform/resolvers/zod");
49563
- var import_react_router_dom132 = require("react-router-dom");
49948
+ var import_react_router_dom134 = require("react-router-dom");
49564
49949
  var import_antd101 = require("antd");
49565
- var import_lucide_react127 = require("lucide-react");
49950
+ var import_lucide_react128 = require("lucide-react");
49566
49951
  var import_dayjs13 = __toESM(require("dayjs"));
49567
- var import_jsx_runtime272 = require("react/jsx-runtime");
49952
+ var import_jsx_runtime274 = require("react/jsx-runtime");
49568
49953
  function InvoiceForm2({
49569
49954
  onReload,
49570
49955
  close,
49571
49956
  accountData,
49572
49957
  id
49573
49958
  }) {
49574
- const { branchId } = (0, import_react_router_dom132.useParams)();
49575
- const [ref2, setRef] = (0, import_react167.useState)(void 0);
49959
+ const { branchId } = (0, import_react_router_dom134.useParams)();
49960
+ const [ref2, setRef] = (0, import_react168.useState)(void 0);
49576
49961
  const { post, isLoading } = useApis_default();
49577
49962
  const { get, isLoading: getLoading } = useApis_default();
49578
49963
  const { put, isLoading: isLoadingReverse } = useApis_default();
49579
49964
  const isEdit = !!id;
49580
49965
  const { currencies } = useWarqadConfig();
49581
49966
  const { stock: defaultCurrency } = currencies;
49582
- const [itemName, setItemName] = (0, import_react167.useState)("");
49583
- const [itemQuantity, setItemQuantity] = (0, import_react167.useState)("");
49584
- const [itemPrice, setItemPrice] = (0, import_react167.useState)("");
49967
+ const [itemName, setItemName] = (0, import_react168.useState)("");
49968
+ const [itemQuantity, setItemQuantity] = (0, import_react168.useState)("");
49969
+ const [itemPrice, setItemPrice] = (0, import_react168.useState)("");
49585
49970
  const methods = (0, import_react_hook_form78.useForm)({
49586
49971
  resolver: (0, import_zod132.zodResolver)(createInvoiceManagerValidation2),
49587
49972
  defaultValues: {
@@ -49610,7 +49995,7 @@ function InvoiceForm2({
49610
49995
  import_antd101.message.error(error?.message || "Something went wrong");
49611
49996
  }
49612
49997
  };
49613
- (0, import_react167.useEffect)(() => {
49998
+ (0, import_react168.useEffect)(() => {
49614
49999
  if (isEdit) {
49615
50000
  fetches();
49616
50001
  }
@@ -49685,25 +50070,25 @@ function InvoiceForm2({
49685
50070
  e.preventDefault();
49686
50071
  }
49687
50072
  };
49688
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50073
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49689
50074
  Card,
49690
50075
  {
49691
50076
  isLoading: getLoading,
49692
50077
  className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49693
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(Card.Content, { children: [
49694
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("input", { type: "hidden", ...register("currency") }),
49695
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
50078
+ children: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(Card.Content, { children: [
50079
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("input", { type: "hidden", ...register("currency") }),
50080
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(
49696
50081
  "form",
49697
50082
  {
49698
50083
  onSubmit: handleSubmit(onSubmit),
49699
50084
  onKeyDown: handleKeyDown,
49700
50085
  className: "space-y-6",
49701
50086
  children: [
49702
- /* @__PURE__ */ (0, import_jsx_runtime272.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: [
49703
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
49704
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
49705
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
49706
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50087
+ /* @__PURE__ */ (0, import_jsx_runtime274.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: [
50088
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
50089
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
50090
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
50091
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49707
50092
  Fields_default.Input,
49708
50093
  {
49709
50094
  label: "Container No",
@@ -49712,7 +50097,7 @@ function InvoiceForm2({
49712
50097
  onChange: (val) => setItemName(val)
49713
50098
  }
49714
50099
  ),
49715
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50100
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49716
50101
  Fields_default.Input,
49717
50102
  {
49718
50103
  label: "Cbm",
@@ -49722,7 +50107,7 @@ function InvoiceForm2({
49722
50107
  onChange: (val) => setItemQuantity(val)
49723
50108
  }
49724
50109
  ),
49725
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50110
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49726
50111
  Fields_default.Input,
49727
50112
  {
49728
50113
  label: "Price (KES)",
@@ -49733,7 +50118,7 @@ function InvoiceForm2({
49733
50118
  }
49734
50119
  )
49735
50120
  ] }),
49736
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
50121
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(
49737
50122
  Button,
49738
50123
  {
49739
50124
  type: "button",
@@ -49741,23 +50126,23 @@ function InvoiceForm2({
49741
50126
  className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
49742
50127
  variant: "outline",
49743
50128
  children: [
49744
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react127.Plus, { size: 16 }),
50129
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.Plus, { size: 16 }),
49745
50130
  " Add Item"
49746
50131
  ]
49747
50132
  }
49748
50133
  )
49749
50134
  ] })
49750
50135
  ] }),
49751
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { children: [
49752
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
49753
- /* @__PURE__ */ (0, import_jsx_runtime272.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_runtime272.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("table", { className: "w-full text-left border-collapse", children: [
49754
- /* @__PURE__ */ (0, import_jsx_runtime272.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_runtime272.jsxs)("tr", { children: [
49755
- /* @__PURE__ */ (0, import_jsx_runtime272.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: "#" }),
49756
- /* @__PURE__ */ (0, import_jsx_runtime272.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" }),
49757
- /* @__PURE__ */ (0, import_jsx_runtime272.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" }),
49758
- /* @__PURE__ */ (0, import_jsx_runtime272.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" })
50136
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { children: [
50137
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
50138
+ /* @__PURE__ */ (0, import_jsx_runtime274.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_runtime274.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("table", { className: "w-full text-left border-collapse", children: [
50139
+ /* @__PURE__ */ (0, import_jsx_runtime274.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_runtime274.jsxs)("tr", { children: [
50140
+ /* @__PURE__ */ (0, import_jsx_runtime274.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: "#" }),
50141
+ /* @__PURE__ */ (0, import_jsx_runtime274.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" }),
50142
+ /* @__PURE__ */ (0, import_jsx_runtime274.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" }),
50143
+ /* @__PURE__ */ (0, import_jsx_runtime274.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" })
49759
50144
  ] }) }),
49760
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50145
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49761
50146
  "td",
49762
50147
  {
49763
50148
  colSpan: 4,
@@ -49766,30 +50151,30 @@ function InvoiceForm2({
49766
50151
  }
49767
50152
  ) }) : fields.map((item, index) => {
49768
50153
  const total = item.quantity * item.amount;
49769
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
50154
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(
49770
50155
  "tr",
49771
50156
  {
49772
50157
  className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
49773
50158
  children: [
49774
- /* @__PURE__ */ (0, import_jsx_runtime272.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 }),
49775
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
49776
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
49777
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
50159
+ /* @__PURE__ */ (0, import_jsx_runtime274.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 }),
50160
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
50161
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
50162
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
49778
50163
  item.quantity,
49779
50164
  " Cbm @",
49780
50165
  " ",
49781
50166
  Formats_default.Price(item.amount, "KES")
49782
50167
  ] })
49783
50168
  ] }),
49784
- /* @__PURE__ */ (0, import_jsx_runtime272.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") }),
49785
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50169
+ /* @__PURE__ */ (0, import_jsx_runtime274.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") }),
50170
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49786
50171
  "button",
49787
50172
  {
49788
50173
  type: "button",
49789
50174
  onClick: () => remove(index),
49790
50175
  className: "text-gray-400 hover:text-red-500 transition-colors p-1",
49791
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49792
- import_lucide_react127.Trash2,
50176
+ children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50177
+ import_lucide_react128.Trash2,
49793
50178
  {
49794
50179
  size: 13,
49795
50180
  className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
@@ -49802,8 +50187,8 @@ function InvoiceForm2({
49802
50187
  item.id
49803
50188
  );
49804
50189
  }) }),
49805
- fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime272.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_runtime272.jsxs)("tr", { children: [
49806
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50190
+ fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime274.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_runtime274.jsxs)("tr", { children: [
50191
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49807
50192
  "td",
49808
50193
  {
49809
50194
  colSpan: 2,
@@ -49811,20 +50196,20 @@ function InvoiceForm2({
49811
50196
  children: "Total"
49812
50197
  }
49813
50198
  ),
49814
- /* @__PURE__ */ (0, import_jsx_runtime272.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(
50199
+ /* @__PURE__ */ (0, import_jsx_runtime274.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(
49815
50200
  fields.reduce(
49816
50201
  (sum, item) => sum + item.quantity * item.amount,
49817
50202
  0
49818
50203
  ),
49819
50204
  "KES"
49820
50205
  ) }),
49821
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", {})
50206
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("td", {})
49822
50207
  ] }) })
49823
50208
  ] }) }) })
49824
50209
  ] }),
49825
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
49826
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49827
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50210
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
50211
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50212
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49828
50213
  Fields_default.DateInput,
49829
50214
  {
49830
50215
  label: "Date",
@@ -49833,20 +50218,20 @@ function InvoiceForm2({
49833
50218
  required: true
49834
50219
  }
49835
50220
  ),
49836
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
50221
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
49837
50222
  ] }),
49838
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
49839
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50223
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
50224
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49840
50225
  ConfirmModal,
49841
50226
  {
49842
50227
  title: "Reverse Transaction",
49843
- description: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-3 text-left", children: [
49844
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49845
- /* @__PURE__ */ (0, import_jsx_runtime272.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."' })
50228
+ description: /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "space-y-3 text-left", children: [
50229
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
50230
+ /* @__PURE__ */ (0, import_jsx_runtime274.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."' })
49846
50231
  ] }),
49847
50232
  confirmationWord: "delete",
49848
50233
  onSubmit: onReverse,
49849
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50234
+ children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49850
50235
  Button,
49851
50236
  {
49852
50237
  type: "button",
@@ -49859,8 +50244,8 @@ function InvoiceForm2({
49859
50244
  )
49860
50245
  }
49861
50246
  ) }),
49862
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-end gap-3", children: [
49863
- close && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50247
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex justify-end gap-3", children: [
50248
+ close && /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49864
50249
  Button,
49865
50250
  {
49866
50251
  type: "button",
@@ -49870,7 +50255,7 @@ function InvoiceForm2({
49870
50255
  children: "Cancel"
49871
50256
  }
49872
50257
  ),
49873
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50258
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
49874
50259
  Button,
49875
50260
  {
49876
50261
  isLoading,
@@ -49894,13 +50279,13 @@ function InvoiceForm2({
49894
50279
  var InvoiceForm_default2 = InvoiceForm2;
49895
50280
 
49896
50281
  // src/components/Transactions/cargoIM/journalForm.tsx
49897
- var import_react168 = __toESM(require("react"));
50282
+ var import_react169 = __toESM(require("react"));
49898
50283
  var import_react_hook_form79 = require("react-hook-form");
49899
50284
  var import_zod133 = require("@hookform/resolvers/zod");
49900
- var import_react_router_dom133 = require("react-router-dom");
50285
+ var import_react_router_dom135 = require("react-router-dom");
49901
50286
  var import_antd102 = require("antd");
49902
50287
  var import_dayjs14 = __toESM(require("dayjs"));
49903
- var import_jsx_runtime273 = require("react/jsx-runtime");
50288
+ var import_jsx_runtime275 = require("react/jsx-runtime");
49904
50289
  function JournalForm5({
49905
50290
  onReload,
49906
50291
  close,
@@ -49908,10 +50293,10 @@ function JournalForm5({
49908
50293
  action = "debit",
49909
50294
  id
49910
50295
  }) {
49911
- const { branchId } = (0, import_react_router_dom133.useParams)();
50296
+ const { branchId } = (0, import_react_router_dom135.useParams)();
49912
50297
  const { currencies } = useWarqadConfig();
49913
50298
  const { stock: defaultCurrency } = currencies;
49914
- const [ref2, setRef] = import_react168.default.useState(void 0);
50299
+ const [ref2, setRef] = import_react169.default.useState(void 0);
49915
50300
  const { post, isLoading } = useApis_default();
49916
50301
  const { get, isLoading: getLoading } = useApis_default();
49917
50302
  const { put, isLoading: isLoadingReverse } = useApis_default();
@@ -49942,7 +50327,7 @@ function JournalForm5({
49942
50327
  import_antd102.message.error(error?.message || "Something went wrong");
49943
50328
  }
49944
50329
  };
49945
- import_react168.default.useEffect(() => {
50330
+ import_react169.default.useEffect(() => {
49946
50331
  if (isEdit) {
49947
50332
  fetches();
49948
50333
  }
@@ -49991,19 +50376,19 @@ function JournalForm5({
49991
50376
  e.preventDefault();
49992
50377
  }
49993
50378
  };
49994
- return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50379
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
49995
50380
  Card,
49996
50381
  {
49997
50382
  isLoading: getLoading,
49998
50383
  className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49999
- children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
50384
+ children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
50000
50385
  "form",
50001
50386
  {
50002
50387
  onSubmit: handleSubmit(onSubmit),
50003
50388
  onKeyDown: handleKeyDown,
50004
50389
  className: "space-y-4",
50005
50390
  children: [
50006
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50391
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50007
50392
  Fields_default.Input,
50008
50393
  {
50009
50394
  label: "Description",
@@ -50014,8 +50399,8 @@ function JournalForm5({
50014
50399
  placeholder: "Enter description"
50015
50400
  }
50016
50401
  ),
50017
- /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50018
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50402
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50403
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50019
50404
  Fields_default.DateInput,
50020
50405
  {
50021
50406
  label: "Date",
@@ -50024,7 +50409,7 @@ function JournalForm5({
50024
50409
  required: true
50025
50410
  }
50026
50411
  ),
50027
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50412
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50028
50413
  Fields_default.Input,
50029
50414
  {
50030
50415
  label: "Currency",
@@ -50034,8 +50419,8 @@ function JournalForm5({
50034
50419
  }
50035
50420
  )
50036
50421
  ] }),
50037
- /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50038
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50422
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50423
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50039
50424
  Fields_default.Input,
50040
50425
  {
50041
50426
  label: "Amount",
@@ -50046,7 +50431,7 @@ function JournalForm5({
50046
50431
  placeholder: "0.00"
50047
50432
  }
50048
50433
  ),
50049
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50434
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50050
50435
  Fields_default.Select,
50051
50436
  {
50052
50437
  label: "Action",
@@ -50060,7 +50445,7 @@ function JournalForm5({
50060
50445
  }
50061
50446
  )
50062
50447
  ] }),
50063
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50448
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50064
50449
  Fields_default.Textarea,
50065
50450
  {
50066
50451
  label: "Note",
@@ -50070,18 +50455,18 @@ function JournalForm5({
50070
50455
  rows: 3
50071
50456
  }
50072
50457
  ),
50073
- /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
50074
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50458
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
50459
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50075
50460
  ConfirmModal,
50076
50461
  {
50077
50462
  title: "Reverse Transaction",
50078
- description: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "space-y-3 text-left", children: [
50079
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
50080
- /* @__PURE__ */ (0, import_jsx_runtime273.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."' })
50463
+ description: /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "space-y-3 text-left", children: [
50464
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
50465
+ /* @__PURE__ */ (0, import_jsx_runtime275.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."' })
50081
50466
  ] }),
50082
50467
  confirmationWord: "delete",
50083
50468
  onSubmit: onReverse,
50084
- children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50469
+ children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50085
50470
  Button,
50086
50471
  {
50087
50472
  type: "button",
@@ -50094,8 +50479,8 @@ function JournalForm5({
50094
50479
  )
50095
50480
  }
50096
50481
  ) }),
50097
- /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex justify-end gap-3", children: [
50098
- close && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50482
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex justify-end gap-3", children: [
50483
+ close && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50099
50484
  Button,
50100
50485
  {
50101
50486
  type: "button",
@@ -50105,7 +50490,7 @@ function JournalForm5({
50105
50490
  children: "Cancel"
50106
50491
  }
50107
50492
  ),
50108
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50493
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50109
50494
  Button,
50110
50495
  {
50111
50496
  isLoading,
@@ -50127,15 +50512,15 @@ function JournalForm5({
50127
50512
  var journalForm_default2 = JournalForm5;
50128
50513
 
50129
50514
  // src/components/Transactions/cargoIM/CargoIM.tsx
50130
- var import_jsx_runtime274 = require("react/jsx-runtime");
50515
+ var import_jsx_runtime276 = require("react/jsx-runtime");
50131
50516
  function CargoIM({ v, url }) {
50132
- const { branchId } = (0, import_react_router_dom134.useParams)();
50517
+ const { branchId } = (0, import_react_router_dom136.useParams)();
50133
50518
  const { apiConfig } = useWarqadConfig();
50134
50519
  const { width } = useMediaSize();
50135
50520
  const isLargeScreen = width > 768;
50136
- const navigate = (0, import_react_router_dom134.useNavigate)();
50521
+ const navigate = (0, import_react_router_dom136.useNavigate)();
50137
50522
  const type = "supplier";
50138
- const [deleteAccount, setDeleteAccount] = (0, import_react169.useState)(null);
50523
+ const [deleteAccount, setDeleteAccount] = (0, import_react170.useState)(null);
50139
50524
  const { isLoading: isActionLoading, remove } = useApis_default();
50140
50525
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
50141
50526
  url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
@@ -50146,17 +50531,17 @@ function CargoIM({ v, url }) {
50146
50531
  const items = (data2) => [
50147
50532
  {
50148
50533
  label: `Edit ${type}`,
50149
- icon: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
50534
+ icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
50150
50535
  onClick: () => openState({
50151
50536
  type: "Account",
50152
- content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
50537
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
50153
50538
  title: "Account Form",
50154
50539
  width: 800
50155
50540
  })
50156
50541
  },
50157
50542
  {
50158
50543
  label: `Delete ${type}`,
50159
- icon: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
50544
+ icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
50160
50545
  onClick: () => setDeleteAccount(data2)
50161
50546
  }
50162
50547
  ].filter(Boolean);
@@ -50167,7 +50552,7 @@ function CargoIM({ v, url }) {
50167
50552
  className: "w-full",
50168
50553
  cell: ({ row }) => {
50169
50554
  const account = row.original;
50170
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50555
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50171
50556
  "span",
50172
50557
  {
50173
50558
  onClick: () => navigate(`${account?._id}`),
@@ -50196,8 +50581,8 @@ function CargoIM({ v, url }) {
50196
50581
  className: "w-px whitespace-nowrap",
50197
50582
  cell: ({ row }) => {
50198
50583
  const data2 = row.original;
50199
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex gap-4 items-center", children: [
50200
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50584
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)("div", { className: "flex gap-4 items-center", children: [
50585
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50201
50586
  "button",
50202
50587
  {
50203
50588
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -50205,7 +50590,7 @@ function CargoIM({ v, url }) {
50205
50590
  openState({
50206
50591
  type: "credit",
50207
50592
  closeOnOverlayClick: false,
50208
- content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50593
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50209
50594
  InvoiceForm_default2,
50210
50595
  {
50211
50596
  onReload: reload,
@@ -50220,7 +50605,7 @@ function CargoIM({ v, url }) {
50220
50605
  children: "Inv"
50221
50606
  }
50222
50607
  ),
50223
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50608
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50224
50609
  "button",
50225
50610
  {
50226
50611
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -50228,7 +50613,7 @@ function CargoIM({ v, url }) {
50228
50613
  openState({
50229
50614
  type: "debit",
50230
50615
  closeOnOverlayClick: false,
50231
- content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50616
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50232
50617
  journalForm_default2,
50233
50618
  {
50234
50619
  onReload: reload,
@@ -50244,14 +50629,14 @@ function CargoIM({ v, url }) {
50244
50629
  children: "Pay"
50245
50630
  }
50246
50631
  ),
50247
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50632
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50248
50633
  Dropdown,
50249
50634
  {
50250
50635
  className: "cursor-pointer",
50251
50636
  width: "w-[150px]",
50252
50637
  items: items(data2),
50253
50638
  triggerMode: "hover",
50254
- children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.EllipsisVertical, {})
50639
+ children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.EllipsisVertical, {})
50255
50640
  }
50256
50641
  )
50257
50642
  ] });
@@ -50275,9 +50660,9 @@ function CargoIM({ v, url }) {
50275
50660
  return error;
50276
50661
  }
50277
50662
  };
50278
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_jsx_runtime274.Fragment, { children: [
50279
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Modal2, {}),
50280
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50663
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
50664
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(Modal2, {}),
50665
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50281
50666
  ConfirmModal,
50282
50667
  {
50283
50668
  isOpen: !!deleteAccount,
@@ -50290,7 +50675,7 @@ function CargoIM({ v, url }) {
50290
50675
  children: null
50291
50676
  }
50292
50677
  ),
50293
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50678
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50294
50679
  TransactionViewComponent,
50295
50680
  {
50296
50681
  columns,
@@ -50301,7 +50686,7 @@ function CargoIM({ v, url }) {
50301
50686
  onCreate: () => {
50302
50687
  openState({
50303
50688
  type: "account",
50304
- content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(AccountForm_default3, { onReload: reload, close }),
50689
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(AccountForm_default3, { onReload: reload, close }),
50305
50690
  title: "Account Form",
50306
50691
  width: 800
50307
50692
  });
@@ -50313,9 +50698,9 @@ function CargoIM({ v, url }) {
50313
50698
  var CargoIM_default = CargoIM;
50314
50699
 
50315
50700
  // src/components/Transactions/cargoIM/cargoIMReport.tsx
50316
- var import_react_router_dom135 = require("react-router-dom");
50317
- var import_react170 = require("react");
50318
- var import_jsx_runtime275 = require("react/jsx-runtime");
50701
+ var import_react_router_dom137 = require("react-router-dom");
50702
+ var import_react171 = require("react");
50703
+ var import_jsx_runtime277 = require("react/jsx-runtime");
50319
50704
  var CargoIMReport = () => {
50320
50705
  const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
50321
50706
  const { TransactionView, openTransaction } = useTransactionView_default();
@@ -50328,10 +50713,10 @@ var CargoIMReport = () => {
50328
50713
  value: currency2
50329
50714
  };
50330
50715
  });
50331
- const [searchParams, setSearchParams] = (0, import_react_router_dom135.useSearchParams)();
50716
+ const [searchParams, setSearchParams] = (0, import_react_router_dom137.useSearchParams)();
50332
50717
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
50333
50718
  const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
50334
- const [currencyFilter, setCurrencyFilter] = (0, import_react170.useState)(initialCurrency);
50719
+ const [currencyFilter, setCurrencyFilter] = (0, import_react171.useState)(initialCurrency);
50335
50720
  const handleCurrencyChange = (value) => {
50336
50721
  setCurrencyFilter(value);
50337
50722
  setSearchParams((prev) => {
@@ -50339,7 +50724,7 @@ var CargoIMReport = () => {
50339
50724
  return prev;
50340
50725
  });
50341
50726
  };
50342
- (0, import_react170.useEffect)(() => {
50727
+ (0, import_react171.useEffect)(() => {
50343
50728
  if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
50344
50729
  setCurrencyFilter(urlCurrency);
50345
50730
  }
@@ -50359,9 +50744,9 @@ var CargoIMReport = () => {
50359
50744
  header: "Date",
50360
50745
  key: "date",
50361
50746
  className: "text-xs whitespace-nowrap",
50362
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "", children: [
50363
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
50364
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50747
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)("div", { className: "", children: [
50748
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
50749
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50365
50750
  "span",
50366
50751
  {
50367
50752
  onClick: () => {
@@ -50380,13 +50765,13 @@ var CargoIMReport = () => {
50380
50765
  header: "Container No",
50381
50766
  key: "description",
50382
50767
  className: "text-xs w-full break-words",
50383
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.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) => {
50768
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.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) => {
50384
50769
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50385
50770
  /[^a-zA-Z0-9]/g,
50386
50771
  ""
50387
50772
  );
50388
50773
  const lineClass = `tx-line-${rowId}-${idx}`;
50389
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50774
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50390
50775
  "div",
50391
50776
  {
50392
50777
  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`,
@@ -50400,13 +50785,13 @@ var CargoIMReport = () => {
50400
50785
  header: "Cbm",
50401
50786
  key: "cbm",
50402
50787
  className: "text-xs whitespace-nowrap text-right",
50403
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.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) => {
50788
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.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) => {
50404
50789
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50405
50790
  /[^a-zA-Z0-9]/g,
50406
50791
  ""
50407
50792
  );
50408
50793
  const lineClass = `tx-line-${rowId}-${idx}`;
50409
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50794
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50410
50795
  "div",
50411
50796
  {
50412
50797
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -50423,20 +50808,20 @@ var CargoIMReport = () => {
50423
50808
  ),
50424
50809
  0
50425
50810
  );
50426
- return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
50811
+ return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
50427
50812
  }
50428
50813
  },
50429
50814
  {
50430
50815
  header: "Price",
50431
50816
  key: "price",
50432
50817
  className: "text-xs whitespace-nowrap text-right",
50433
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.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) => {
50818
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.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) => {
50434
50819
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50435
50820
  /[^a-zA-Z0-9]/g,
50436
50821
  ""
50437
50822
  );
50438
50823
  const lineClass = `tx-line-${rowId}-${idx}`;
50439
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50824
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50440
50825
  "div",
50441
50826
  {
50442
50827
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -50450,13 +50835,13 @@ var CargoIMReport = () => {
50450
50835
  header: "Credit",
50451
50836
  key: "credit",
50452
50837
  className: "text-xs whitespace-nowrap text-right",
50453
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.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) => {
50838
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.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) => {
50454
50839
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50455
50840
  /[^a-zA-Z0-9]/g,
50456
50841
  ""
50457
50842
  );
50458
50843
  const lineClass = `tx-line-${rowId}-${idx}`;
50459
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50844
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50460
50845
  "div",
50461
50846
  {
50462
50847
  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`,
@@ -50465,7 +50850,7 @@ var CargoIMReport = () => {
50465
50850
  idx
50466
50851
  );
50467
50852
  }) }),
50468
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
50853
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
50469
50854
  data2.reduce(
50470
50855
  (acc, row) => acc + (row.lines || []).reduce(
50471
50856
  (lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
@@ -50479,13 +50864,13 @@ var CargoIMReport = () => {
50479
50864
  header: "Debit",
50480
50865
  key: "debit",
50481
50866
  className: "text-xs whitespace-nowrap text-right",
50482
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.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) => {
50867
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.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) => {
50483
50868
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50484
50869
  /[^a-zA-Z0-9]/g,
50485
50870
  ""
50486
50871
  );
50487
50872
  const lineClass = `tx-line-${rowId}-${idx}`;
50488
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50873
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50489
50874
  "div",
50490
50875
  {
50491
50876
  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`,
@@ -50494,7 +50879,7 @@ var CargoIMReport = () => {
50494
50879
  idx
50495
50880
  );
50496
50881
  }) }),
50497
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
50882
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
50498
50883
  data2.reduce(
50499
50884
  (acc, row) => acc + (row.lines || []).reduce(
50500
50885
  (lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
@@ -50508,14 +50893,14 @@ var CargoIMReport = () => {
50508
50893
  header: "Balance",
50509
50894
  key: "runningBalance",
50510
50895
  className: "text-xs whitespace-nowrap text-right",
50511
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
50512
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
50896
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
50897
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
50513
50898
  data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
50514
50899
  currency
50515
50900
  ) })
50516
50901
  }
50517
50902
  ];
50518
- const datas = (0, import_react170.useMemo)(() => {
50903
+ const datas = (0, import_react171.useMemo)(() => {
50519
50904
  let runningBalance = 0;
50520
50905
  const transactions = data?.data?.transactions;
50521
50906
  const res = (transactions || []).map((item) => {
@@ -50552,10 +50937,10 @@ var CargoIMReport = () => {
50552
50937
  { label: "Account Type", value: data?.data?.type },
50553
50938
  { label: "Currency", value: currencyFilter }
50554
50939
  ];
50555
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(import_jsx_runtime275.Fragment, { children: [
50556
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Modal2, {}),
50557
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(TransactionView, {}),
50558
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50940
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)(import_jsx_runtime277.Fragment, { children: [
50941
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(Modal2, {}),
50942
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(TransactionView, {}),
50943
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50559
50944
  A4DataView,
50560
50945
  {
50561
50946
  columns,
@@ -50570,7 +50955,7 @@ var CargoIMReport = () => {
50570
50955
  openState({
50571
50956
  type: "debit",
50572
50957
  closeOnOverlayClick: false,
50573
- content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50958
+ content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50574
50959
  InvoiceForm_default2,
50575
50960
  {
50576
50961
  close: closeTransaction,
@@ -50578,7 +50963,7 @@ var CargoIMReport = () => {
50578
50963
  onReload: reload,
50579
50964
  id: row._id
50580
50965
  }
50581
- ) : /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50966
+ ) : /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50582
50967
  journalForm_default2,
50583
50968
  {
50584
50969
  close: closeTransaction,
@@ -50591,7 +50976,7 @@ var CargoIMReport = () => {
50591
50976
  width: 800
50592
50977
  });
50593
50978
  },
50594
- headers: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50979
+ headers: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50595
50980
  Fields_default.Select,
50596
50981
  {
50597
50982
  options: currencies,
@@ -50607,16 +50992,16 @@ var CargoIMReport = () => {
50607
50992
  var cargoIMReport_default = CargoIMReport;
50608
50993
 
50609
50994
  // src/components/accounts/forex-2/Forex2Accounts.tsx
50610
- var import_react_router_dom136 = require("react-router-dom");
50611
- var import_lucide_react129 = require("lucide-react");
50612
- var import_react171 = require("react");
50995
+ var import_react_router_dom138 = require("react-router-dom");
50996
+ var import_lucide_react130 = require("lucide-react");
50997
+ var import_react172 = require("react");
50613
50998
  var import_antd104 = require("antd");
50614
- var import_jsx_runtime276 = require("react/jsx-runtime");
50999
+ var import_jsx_runtime278 = require("react/jsx-runtime");
50615
51000
  function Forex2Accounts({ v, url }) {
50616
- const { branchId } = (0, import_react_router_dom136.useParams)();
50617
- const navigate = (0, import_react_router_dom136.useNavigate)();
51001
+ const { branchId } = (0, import_react_router_dom138.useParams)();
51002
+ const navigate = (0, import_react_router_dom138.useNavigate)();
50618
51003
  const type = "account";
50619
- const [deleteAccount, setDeleteAccount] = (0, import_react171.useState)(null);
51004
+ const [deleteAccount, setDeleteAccount] = (0, import_react172.useState)(null);
50620
51005
  const { isLoading: isActionLoading, remove } = useApis_default();
50621
51006
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
50622
51007
  url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
@@ -50627,22 +51012,22 @@ function Forex2Accounts({ v, url }) {
50627
51012
  const items = (data2) => [
50628
51013
  {
50629
51014
  label: `Currency Report`,
50630
- icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.FileChartLine, { size: 16 }),
51015
+ icon: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.FileChartLine, { size: 16 }),
50631
51016
  onClick: () => navigate(data2?._id)
50632
51017
  },
50633
51018
  {
50634
51019
  label: `Edit ${type}`,
50635
- icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
51020
+ icon: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.FilePenLine, { size: 16 }),
50636
51021
  onClick: () => openState({
50637
51022
  type: "forex account",
50638
- content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
51023
+ content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
50639
51024
  title: "Forex Account Form",
50640
51025
  width: 800
50641
51026
  })
50642
51027
  },
50643
51028
  {
50644
51029
  label: `Delete ${type}`,
50645
- icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
51030
+ icon: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.Trash2, { className: "text-red-500", size: 16 }),
50646
51031
  onClick: () => setDeleteAccount(data2)
50647
51032
  }
50648
51033
  ].filter(Boolean);
@@ -50652,7 +51037,7 @@ function Forex2Accounts({ v, url }) {
50652
51037
  header: "Name",
50653
51038
  cell: ({ row }) => {
50654
51039
  const account = row.original;
50655
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51040
+ return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50656
51041
  "span",
50657
51042
  {
50658
51043
  onClick: () => navigate(`statements/${account?._id}`),
@@ -50667,7 +51052,7 @@ function Forex2Accounts({ v, url }) {
50667
51052
  header: "Phone",
50668
51053
  cell: ({ row }) => {
50669
51054
  const account = row.original;
50670
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("span", { children: account?.phoneNumber || "N/A" });
51055
+ return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)("span", { children: account?.phoneNumber || "N/A" });
50671
51056
  }
50672
51057
  },
50673
51058
  {
@@ -50675,14 +51060,14 @@ function Forex2Accounts({ v, url }) {
50675
51060
  header: "Balances",
50676
51061
  cell: ({ row }) => {
50677
51062
  const account = row.original;
50678
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
50679
- ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(
51063
+ return /* @__PURE__ */ (0, import_jsx_runtime278.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
51064
+ ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(
50680
51065
  "div",
50681
51066
  {
50682
51067
  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",
50683
51068
  children: [
50684
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
50685
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51069
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
51070
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50686
51071
  "span",
50687
51072
  {
50688
51073
  className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
@@ -50701,8 +51086,8 @@ function Forex2Accounts({ v, url }) {
50701
51086
  header: "Actions",
50702
51087
  cell: ({ row }) => {
50703
51088
  const data2 = row.original;
50704
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)("div", { className: "flex gap-4 items-center", children: [
50705
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51089
+ return /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)("div", { className: "flex gap-4 items-center", children: [
51090
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50706
51091
  "button",
50707
51092
  {
50708
51093
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -50710,7 +51095,7 @@ function Forex2Accounts({ v, url }) {
50710
51095
  openState({
50711
51096
  type: "credit",
50712
51097
  closeOnOverlayClick: false,
50713
- content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51098
+ content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50714
51099
  Forex2FormTransaction_default,
50715
51100
  {
50716
51101
  close,
@@ -50726,7 +51111,7 @@ function Forex2Accounts({ v, url }) {
50726
51111
  children: "Out"
50727
51112
  }
50728
51113
  ),
50729
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51114
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50730
51115
  "button",
50731
51116
  {
50732
51117
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -50734,7 +51119,7 @@ function Forex2Accounts({ v, url }) {
50734
51119
  openState({
50735
51120
  type: "debit",
50736
51121
  closeOnOverlayClick: false,
50737
- content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51122
+ content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50738
51123
  Forex2FormTransaction_default,
50739
51124
  {
50740
51125
  close,
@@ -50750,13 +51135,13 @@ function Forex2Accounts({ v, url }) {
50750
51135
  children: "In"
50751
51136
  }
50752
51137
  ),
50753
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51138
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50754
51139
  Dropdown,
50755
51140
  {
50756
51141
  className: "cursor-pointer w-[150px]",
50757
51142
  items: items(data2),
50758
51143
  triggerMode: "hover",
50759
- children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.EllipsisVertical, {})
51144
+ children: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(import_lucide_react130.EllipsisVertical, {})
50760
51145
  }
50761
51146
  )
50762
51147
  ] });
@@ -50795,9 +51180,9 @@ function Forex2Accounts({ v, url }) {
50795
51180
  };
50796
51181
  }).filter((item) => item.debit !== 0 || item.credit !== 0);
50797
51182
  console.log(currencies);
50798
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
50799
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(Modal2, {}),
50800
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51183
+ return /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(import_jsx_runtime278.Fragment, { children: [
51184
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(Modal2, {}),
51185
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50801
51186
  ConfirmModal,
50802
51187
  {
50803
51188
  isOpen: !!deleteAccount,
@@ -50810,9 +51195,9 @@ function Forex2Accounts({ v, url }) {
50810
51195
  children: null
50811
51196
  }
50812
51197
  ),
50813
- /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)("div", { children: [
50814
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
50815
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
51198
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)("div", { children: [
51199
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
51200
+ /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
50816
51201
  TransactionViewComponent,
50817
51202
  {
50818
51203
  columns,
@@ -50824,7 +51209,7 @@ function Forex2Accounts({ v, url }) {
50824
51209
  onCreate: () => {
50825
51210
  openState({
50826
51211
  type: "forex account",
50827
- content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ForexAccountForm_default, { close, reloads: reload }),
51212
+ content: /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ForexAccountForm_default, { close, reloads: reload }),
50828
51213
  title: "Forex Account Form",
50829
51214
  width: 800
50830
51215
  });
@@ -50837,14 +51222,14 @@ function Forex2Accounts({ v, url }) {
50837
51222
  var Forex2Accounts_default = Forex2Accounts;
50838
51223
 
50839
51224
  // src/components/reports/ProductList.tsx
50840
- var import_react_router_dom137 = require("react-router-dom");
50841
- var import_jsx_runtime277 = require("react/jsx-runtime");
50842
- var options9 = [
51225
+ var import_react_router_dom139 = require("react-router-dom");
51226
+ var import_jsx_runtime279 = require("react/jsx-runtime");
51227
+ var options10 = [
50843
51228
  { label: "Product", value: "product" },
50844
51229
  { label: "Pack", value: "pack" }
50845
51230
  ];
50846
51231
  var ProductList2 = ({ value = false }) => {
50847
- const { branchId } = (0, import_react_router_dom137.useParams)();
51232
+ const { branchId } = (0, import_react_router_dom139.useParams)();
50848
51233
  const { branches } = useAuth_default();
50849
51234
  const { TransactionView } = useTransactionView_default();
50850
51235
  const { getQuery, setQuery } = useApp_default();
@@ -50866,7 +51251,7 @@ var ProductList2 = ({ value = false }) => {
50866
51251
  key: "name",
50867
51252
  className: "text-xs whitespace-nowrap",
50868
51253
  render: (row) => {
50869
- return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
51254
+ return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
50870
51255
  }
50871
51256
  },
50872
51257
  ...value ? [
@@ -50874,14 +51259,14 @@ var ProductList2 = ({ value = false }) => {
50874
51259
  header: "Cost",
50875
51260
  key: "cost",
50876
51261
  className: "text-xs whitespace-nowrap text-right",
50877
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
51262
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime279.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
50878
51263
  }
50879
51264
  ] : []
50880
51265
  ];
50881
51266
  const datas = data?.data || [];
50882
- return /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)(import_jsx_runtime277.Fragment, { children: [
50883
- /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(TransactionView, {}),
50884
- /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
51267
+ return /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(import_jsx_runtime279.Fragment, { children: [
51268
+ /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(TransactionView, {}),
51269
+ /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
50885
51270
  A4DataView,
50886
51271
  {
50887
51272
  columns,
@@ -50891,11 +51276,10 @@ var ProductList2 = ({ value = false }) => {
50891
51276
  subtitle: branchId ? currentBranch?.name : "All Branches",
50892
51277
  tableTitle: "Stock List",
50893
51278
  fixed: false,
50894
- startPage: 1e10,
50895
- headers: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
51279
+ headers: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
50896
51280
  Select,
50897
51281
  {
50898
- options: options9,
51282
+ options: options10,
50899
51283
  value: stockType,
50900
51284
  className: "w-32! print:hidden",
50901
51285
  onChange: (e) => {