warqadui 0.0.276 → 0.0.277

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
@@ -48434,6 +48434,148 @@ var Expenses32 = {
48434
48434
  };
48435
48435
  var expense_default = Expenses32;
48436
48436
 
48437
+ // src/components/Transactions/3/reports/Expenses3Reports.tsx
48438
+ var import_react_router_dom125 = require("react-router-dom");
48439
+ var import_react161 = require("react");
48440
+ var import_antd96 = require("antd");
48441
+ var import_dayjs11 = __toESM(require("dayjs"));
48442
+ var import_jsx_runtime265 = require("react/jsx-runtime");
48443
+ var Expenses3Reports = () => {
48444
+ const { branchId } = (0, import_react_router_dom125.useParams)();
48445
+ const [startDate, setStartDate] = (0, import_react161.useState)(null);
48446
+ const [endDate, setEndDate] = (0, import_react161.useState)(null);
48447
+ const { A4DataView, data } = useA4DataView_default({
48448
+ url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
48449
+ v: 1
48450
+ // No prefix
48451
+ });
48452
+ const { TransactionView, openTransaction } = useTransactionView_default();
48453
+ const { defaultCurrency } = useWarqadConfig()?.currencies;
48454
+ const columns = [
48455
+ {
48456
+ header: "Date",
48457
+ key: "date",
48458
+ className: "text-xs whitespace-nowrap",
48459
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
48460
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48461
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48462
+ "span",
48463
+ {
48464
+ onClick: () => {
48465
+ openTransaction({
48466
+ id: row?._id,
48467
+ type: row?.type
48468
+ });
48469
+ },
48470
+ className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
48471
+ children: row?.ref
48472
+ }
48473
+ )
48474
+ ] })
48475
+ },
48476
+ {
48477
+ header: "Description",
48478
+ key: "description",
48479
+ className: "text-xs whitespace-nowrap ",
48480
+ render: (row) => {
48481
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
48482
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
48483
+ row.note && /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.note })
48484
+ ] });
48485
+ }
48486
+ },
48487
+ {
48488
+ header: "Amount",
48489
+ key: "changedAmountString",
48490
+ className: "text-xs whitespace-nowrap text-right",
48491
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
48492
+ renderFooter: (data2) => {
48493
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
48494
+ Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
48495
+ defaultCurrency
48496
+ ) });
48497
+ }
48498
+ }
48499
+ ];
48500
+ const datas = (0, import_react161.useMemo)(() => {
48501
+ let runningBalance = 0;
48502
+ let filteredData = data?.data || [];
48503
+ const mapped = filteredData.map((item) => {
48504
+ const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
48505
+ runningBalance += changedAmount;
48506
+ return {
48507
+ ...item,
48508
+ changedAmountString: Formats_default.Amount(changedAmount, false),
48509
+ changedAmount,
48510
+ runningBalance
48511
+ };
48512
+ });
48513
+ let filtered = mapped;
48514
+ if (startDate) {
48515
+ const startOfDay = startDate.startOf("day");
48516
+ filtered = filtered.filter((tx) => {
48517
+ const rawDate = tx.dateObj || tx.date;
48518
+ if (!rawDate) return false;
48519
+ const txDate = (0, import_dayjs11.default)(rawDate);
48520
+ return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
48521
+ });
48522
+ }
48523
+ if (endDate) {
48524
+ const endOfDay = endDate.endOf("day");
48525
+ filtered = filtered.filter((tx) => {
48526
+ const rawDate = tx.dateObj || tx.date;
48527
+ if (!rawDate) return false;
48528
+ const txDate = (0, import_dayjs11.default)(rawDate);
48529
+ return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
48530
+ });
48531
+ }
48532
+ return filtered;
48533
+ }, [data, startDate, endDate]);
48534
+ return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
48535
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
48536
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48537
+ A4DataView,
48538
+ {
48539
+ columns,
48540
+ data: datas,
48541
+ index: true,
48542
+ title: `Expenses Report`,
48543
+ subtitle: `All Expenses`,
48544
+ fixed: false,
48545
+ headers: /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
48546
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48547
+ import_antd96.DatePicker,
48548
+ {
48549
+ placeholder: "Start Date",
48550
+ onChange: (date) => setStartDate(date),
48551
+ value: startDate,
48552
+ format: "DD/MM/YYYY",
48553
+ className: "min-w-[140px] max-w-[160px]"
48554
+ }
48555
+ ),
48556
+ /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48557
+ import_antd96.DatePicker,
48558
+ {
48559
+ placeholder: "End Date",
48560
+ onChange: (date) => setEndDate(date),
48561
+ value: endDate,
48562
+ format: "DD/MM/YYYY",
48563
+ className: "min-w-[140px] max-w-[160px]"
48564
+ }
48565
+ )
48566
+ ] })
48567
+ }
48568
+ )
48569
+ ] });
48570
+ };
48571
+ var Expenses3Reports_default = Expenses3Reports;
48572
+
48573
+ // src/components/Transactions/3/reports/index.tsx
48574
+ var Reports3 = {
48575
+ expenses: Expenses3Reports_default
48576
+ };
48577
+ var reports_default = Reports3;
48578
+
48437
48579
  // src/components/Transactions/3/index.ts
48438
48580
  var Transaction3 = {
48439
48581
  Payments: Payments_default3,
@@ -48445,26 +48587,27 @@ var Transaction3 = {
48445
48587
  Purchase3: purchase3_default.List,
48446
48588
  Purchase3Form: purchase3_default.Form,
48447
48589
  Expenses: expense_default.List,
48448
- ExpenseForm: expense_default.Form
48590
+ ExpenseForm: expense_default.Form,
48591
+ Reports: reports_default
48449
48592
  };
48450
48593
  var __default = Transaction3;
48451
48594
 
48452
48595
  // src/components/reports/ItemReport.tsx
48453
- var import_react_router_dom125 = require("react-router-dom");
48596
+ var import_react_router_dom126 = require("react-router-dom");
48454
48597
  var import_zod124 = require("zod");
48455
48598
  var import_react_hook_form75 = require("react-hook-form");
48456
48599
  var import_zod125 = require("@hookform/resolvers/zod");
48457
- var import_react161 = require("react");
48458
- var import_antd96 = require("antd");
48459
- var import_jsx_runtime265 = require("react/jsx-runtime");
48600
+ var import_react162 = require("react");
48601
+ var import_antd97 = require("antd");
48602
+ var import_jsx_runtime266 = require("react/jsx-runtime");
48460
48603
  var ItemReport = ({
48461
48604
  value = false,
48462
48605
  type
48463
48606
  }) => {
48464
48607
  const { apiConfig } = useWarqadConfig();
48465
- const { branchId } = (0, import_react_router_dom125.useParams)();
48608
+ const { branchId } = (0, import_react_router_dom126.useParams)();
48466
48609
  const { branches } = useAuth_default();
48467
- const [params, setParams] = (0, import_react161.useState)({
48610
+ const [params, setParams] = (0, import_react162.useState)({
48468
48611
  id: "",
48469
48612
  branch: "all"
48470
48613
  });
@@ -48489,9 +48632,9 @@ var ItemReport = ({
48489
48632
  header: "Date",
48490
48633
  key: "date",
48491
48634
  className: "text-xs whitespace-nowrap",
48492
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "", children: [
48493
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48494
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48635
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
48636
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48637
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48495
48638
  "span",
48496
48639
  {
48497
48640
  onClick: () => {
@@ -48510,7 +48653,7 @@ var ItemReport = ({
48510
48653
  header: "Description",
48511
48654
  key: "description",
48512
48655
  className: "text-xs whitespace-nowrap",
48513
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
48656
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
48514
48657
  },
48515
48658
  {
48516
48659
  header: "Quantity",
@@ -48518,7 +48661,7 @@ var ItemReport = ({
48518
48661
  className: "text-xs whitespace-nowrap",
48519
48662
  render: (row) => {
48520
48663
  const Qty = row.quantity;
48521
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
48664
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
48522
48665
  "div",
48523
48666
  {
48524
48667
  className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
@@ -48535,7 +48678,7 @@ var ItemReport = ({
48535
48678
  header: "Balance",
48536
48679
  key: "runningBalance",
48537
48680
  className: "text-xs whitespace-nowrap",
48538
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
48681
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
48539
48682
  }
48540
48683
  ];
48541
48684
  let runningBalance = 0;
@@ -48547,10 +48690,10 @@ var ItemReport = ({
48547
48690
  };
48548
48691
  });
48549
48692
  const itemName = datas[0]?.name;
48550
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(import_jsx_runtime265.Fragment, { children: [
48551
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Modal2, {}),
48552
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(TransactionView, {}),
48553
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48693
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48694
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Modal2, {}),
48695
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
48696
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48554
48697
  A4DataView,
48555
48698
  {
48556
48699
  columns,
@@ -48561,14 +48704,14 @@ var ItemReport = ({
48561
48704
  tableTitle: `${type} Movement Report`,
48562
48705
  fixed: false,
48563
48706
  error: !id ? "Please select an item" : void 0,
48564
- headers: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48707
+ headers: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48565
48708
  Button,
48566
48709
  {
48567
48710
  type: "button",
48568
48711
  size: "sm",
48569
48712
  onClick: () => openState({
48570
48713
  title: "Item Transactions",
48571
- content: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48714
+ content: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48572
48715
  ItemReportHeader2,
48573
48716
  {
48574
48717
  type,
@@ -48611,14 +48754,14 @@ function ItemReportHeader2({
48611
48754
  label: b.name,
48612
48755
  value: b._id
48613
48756
  }));
48614
- return /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)(
48757
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(
48615
48758
  "form",
48616
48759
  {
48617
48760
  className: "space-y-3",
48618
48761
  onSubmit: handleSubmit((data) => {
48619
48762
  const id = type === "pack" ? data.pack : data.product;
48620
48763
  if (!id) {
48621
- import_antd96.message.error("Please select an item");
48764
+ import_antd97.message.error("Please select an item");
48622
48765
  methods.setFocus(type);
48623
48766
  return;
48624
48767
  }
@@ -48629,8 +48772,8 @@ function ItemReportHeader2({
48629
48772
  close();
48630
48773
  }),
48631
48774
  children: [
48632
- /* @__PURE__ */ (0, import_jsx_runtime265.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
48633
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48775
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
48776
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48634
48777
  Select,
48635
48778
  {
48636
48779
  options: [{ label: "All Branches", value: "all" }, ...branchOptions],
@@ -48638,7 +48781,7 @@ function ItemReportHeader2({
48638
48781
  name: "branch"
48639
48782
  }
48640
48783
  ),
48641
- type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48784
+ type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48642
48785
  Pack_default.Pack,
48643
48786
  {
48644
48787
  api: "/packs/get",
@@ -48646,7 +48789,7 @@ function ItemReportHeader2({
48646
48789
  form: methods,
48647
48790
  name: "pack"
48648
48791
  }
48649
- ) : /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
48792
+ ) : /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48650
48793
  Feilds_default5.Product,
48651
48794
  {
48652
48795
  label: "",
@@ -48657,7 +48800,7 @@ function ItemReportHeader2({
48657
48800
  }
48658
48801
  )
48659
48802
  ] }),
48660
- /* @__PURE__ */ (0, import_jsx_runtime265.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(Button, { type: "submit", children: "Filter" }) })
48803
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Button, { type: "submit", children: "Filter" }) })
48661
48804
  ]
48662
48805
  }
48663
48806
  );
@@ -48665,19 +48808,19 @@ function ItemReportHeader2({
48665
48808
  var ItemReport_default = ItemReport;
48666
48809
 
48667
48810
  // src/components/accounts/LeaseCollection.tsx
48668
- var import_react_router_dom126 = require("react-router-dom");
48669
- var import_react162 = require("react");
48670
- var import_jsx_runtime266 = require("react/jsx-runtime");
48811
+ var import_react_router_dom127 = require("react-router-dom");
48812
+ var import_react163 = require("react");
48813
+ var import_jsx_runtime267 = require("react/jsx-runtime");
48671
48814
  var LeaseCollection = ({
48672
48815
  leaseType,
48673
48816
  defaultCurrency = "KES"
48674
48817
  }) => {
48675
- const navigate = (0, import_react_router_dom126.useNavigate)();
48676
- const [searchParams] = (0, import_react_router_dom126.useSearchParams)();
48818
+ const navigate = (0, import_react_router_dom127.useNavigate)();
48819
+ const [searchParams] = (0, import_react_router_dom127.useSearchParams)();
48677
48820
  const { apiConfig } = useWarqadConfig();
48678
- const { branchId } = (0, import_react_router_dom126.useParams)();
48821
+ const { branchId } = (0, import_react_router_dom127.useParams)();
48679
48822
  const { branches } = useAuth_default();
48680
- const currentBranch = (0, import_react162.useMemo)(
48823
+ const currentBranch = (0, import_react163.useMemo)(
48681
48824
  () => branches?.find((b) => b?._id === branchId),
48682
48825
  [branches, branchId]
48683
48826
  );
@@ -48685,16 +48828,16 @@ var LeaseCollection = ({
48685
48828
  const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
48686
48829
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
48687
48830
  const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
48688
- const [filter, setFilter] = (0, import_react162.useState)(
48831
+ const [filter, setFilter] = (0, import_react163.useState)(
48689
48832
  initialFilter
48690
48833
  );
48691
- const [currencyFilter, setCurrencyFilter] = (0, import_react162.useState)(initialCurrency);
48692
- (0, import_react162.useEffect)(() => {
48834
+ const [currencyFilter, setCurrencyFilter] = (0, import_react163.useState)(initialCurrency);
48835
+ (0, import_react163.useEffect)(() => {
48693
48836
  if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
48694
48837
  setFilter(urlFilter);
48695
48838
  }
48696
48839
  }, [urlFilter]);
48697
- (0, import_react162.useEffect)(() => {
48840
+ (0, import_react163.useEffect)(() => {
48698
48841
  if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
48699
48842
  setCurrencyFilter(urlCurrency);
48700
48843
  } else {
@@ -48713,9 +48856,9 @@ var LeaseCollection = ({
48713
48856
  key: "name",
48714
48857
  className: "text-xs whitespace-nowrap ",
48715
48858
  searchKeys: ["name", "phoneNumber", "unitNames"],
48716
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "space-y-1", children: [
48717
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
48718
- row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("p", { className: "text-[9px]! capitalize", children: [
48859
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "space-y-1", children: [
48860
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
48861
+ row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("p", { className: "text-[9px]! capitalize", children: [
48719
48862
  "(",
48720
48863
  row.unitNames,
48721
48864
  ")"
@@ -48727,7 +48870,7 @@ var LeaseCollection = ({
48727
48870
  key: "phoneNumber",
48728
48871
  maxWidth: 70,
48729
48872
  render: (row) => {
48730
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { children: row?.phoneNumber || "N/A" });
48873
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { children: row?.phoneNumber || "N/A" });
48731
48874
  }
48732
48875
  },
48733
48876
  // </span>
@@ -48737,11 +48880,11 @@ var LeaseCollection = ({
48737
48880
  className: "text-xs whitespace-nowrap text-right",
48738
48881
  render: (row) => {
48739
48882
  const Amount = row.totalCollectionString;
48740
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold ", children: Amount }) });
48883
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-bold ", children: Amount }) });
48741
48884
  },
48742
48885
  renderFooter: (data2) => {
48743
48886
  if (currencyFilter === "all") return;
48744
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: " font-bold", children: Formats_default.Price(
48887
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: " font-bold", children: Formats_default.Price(
48745
48888
  data2.reduce((acc, row) => acc + row.totalCollection, 0),
48746
48889
  defaultCurrency,
48747
48890
  false
@@ -48749,7 +48892,7 @@ var LeaseCollection = ({
48749
48892
  }
48750
48893
  }
48751
48894
  ];
48752
- const datas = (0, import_react162.useMemo)(() => {
48895
+ const datas = (0, import_react163.useMemo)(() => {
48753
48896
  let runningBalance = 0;
48754
48897
  let filteredData = data?.data || [];
48755
48898
  const result = filteredData.map((item) => {
@@ -48762,9 +48905,9 @@ var LeaseCollection = ({
48762
48905
  });
48763
48906
  return result;
48764
48907
  }, [filter, currencyFilter, data]);
48765
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48766
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
48767
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48908
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
48909
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(TransactionView, {}),
48910
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48768
48911
  A4DataView,
48769
48912
  {
48770
48913
  columns,
@@ -48774,7 +48917,7 @@ var LeaseCollection = ({
48774
48917
  subtitle: `All Collections`,
48775
48918
  fixed: false,
48776
48919
  startPage: 1e9,
48777
- headers: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "flex gap-2" })
48920
+ headers: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { className: "flex gap-2" })
48778
48921
  }
48779
48922
  )
48780
48923
  ] });
@@ -48782,10 +48925,10 @@ var LeaseCollection = ({
48782
48925
  var LeaseCollection_default = LeaseCollection;
48783
48926
 
48784
48927
  // src/components/Transactions/cargoIM/CargoIM.tsx
48785
- var import_react_router_dom130 = require("react-router-dom");
48928
+ var import_react_router_dom131 = require("react-router-dom");
48786
48929
  var import_lucide_react127 = require("lucide-react");
48787
- var import_react166 = require("react");
48788
- var import_antd100 = require("antd");
48930
+ var import_react167 = require("react");
48931
+ var import_antd101 = require("antd");
48789
48932
 
48790
48933
  // src/components/Transactions/cargoIM/schema.ts
48791
48934
  var import_zod127 = require("zod");
@@ -48819,16 +48962,16 @@ var journalSchema5 = import_zod127.z.object({
48819
48962
  // src/components/Transactions/cargoIM/AccountForm.tsx
48820
48963
  var import_react_hook_form76 = require("react-hook-form");
48821
48964
  var import_zod128 = require("@hookform/resolvers/zod");
48822
- var import_antd97 = require("antd");
48823
- var import_react163 = require("react");
48824
- var import_react_router_dom127 = require("react-router-dom");
48825
- var import_jsx_runtime267 = require("react/jsx-runtime");
48965
+ var import_antd98 = require("antd");
48966
+ var import_react164 = require("react");
48967
+ var import_react_router_dom128 = require("react-router-dom");
48968
+ var import_jsx_runtime268 = require("react/jsx-runtime");
48826
48969
  function AccountForm3({
48827
48970
  onReload,
48828
48971
  close,
48829
48972
  id
48830
48973
  }) {
48831
- const { branchId } = (0, import_react_router_dom127.useParams)();
48974
+ const { branchId } = (0, import_react_router_dom128.useParams)();
48832
48975
  const { currencies } = useWarqadConfig();
48833
48976
  const { stock } = currencies;
48834
48977
  const isEdit = !!id;
@@ -48866,7 +49009,7 @@ function AccountForm3({
48866
49009
  body: payload
48867
49010
  });
48868
49011
  }
48869
- import_antd97.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
49012
+ import_antd98.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
48870
49013
  if (onReload) {
48871
49014
  onReload();
48872
49015
  }
@@ -48874,7 +49017,7 @@ function AccountForm3({
48874
49017
  close();
48875
49018
  }
48876
49019
  } catch (error) {
48877
- import_antd97.message.error(error?.message || "Something went wrong");
49020
+ import_antd98.message.error(error?.message || "Something went wrong");
48878
49021
  }
48879
49022
  };
48880
49023
  const fetches = async () => {
@@ -48885,33 +49028,33 @@ function AccountForm3({
48885
49028
  const data = res.data;
48886
49029
  methods.reset(data);
48887
49030
  } catch (error) {
48888
- import_antd97.message.error(error?.message || "Something went wrong");
49031
+ import_antd98.message.error(error?.message || "Something went wrong");
48889
49032
  close?.();
48890
49033
  }
48891
49034
  };
48892
- (0, import_react163.useEffect)(() => {
49035
+ (0, import_react164.useEffect)(() => {
48893
49036
  if (isEdit) {
48894
49037
  fetches();
48895
49038
  }
48896
49039
  }, [id]);
48897
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
49040
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48898
49041
  Card,
48899
49042
  {
48900
49043
  className: "max-w-4xl mx-auto mt-10 relative",
48901
49044
  isLoading: isLoadingGet,
48902
49045
  loadingText: "Processing...",
48903
49046
  children: [
48904
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(Card.Header, { children: [
48905
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
48906
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
49047
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(Card.Header, { children: [
49048
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
49049
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
48907
49050
  ] }),
48908
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
49051
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48909
49052
  "form",
48910
49053
  {
48911
49054
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
48912
49055
  children: [
48913
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48914
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49056
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49057
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48915
49058
  Fields_default.Input,
48916
49059
  {
48917
49060
  label: "Name",
@@ -48922,7 +49065,7 @@ function AccountForm3({
48922
49065
  required: true
48923
49066
  }
48924
49067
  ),
48925
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49068
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48926
49069
  Fields_default.PhoneInput,
48927
49070
  {
48928
49071
  label: "Phone Number",
@@ -48931,7 +49074,7 @@ function AccountForm3({
48931
49074
  placeholder: "Enter phone number"
48932
49075
  }
48933
49076
  ),
48934
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49077
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48935
49078
  Fields_default.Select,
48936
49079
  {
48937
49080
  label: "Currency",
@@ -48942,7 +49085,7 @@ function AccountForm3({
48942
49085
  }
48943
49086
  )
48944
49087
  ] }),
48945
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49088
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48946
49089
  Button,
48947
49090
  {
48948
49091
  isLoading,
@@ -48963,36 +49106,36 @@ function AccountForm3({
48963
49106
  var AccountForm_default3 = AccountForm3;
48964
49107
 
48965
49108
  // src/components/Transactions/cargoIM/InvoiceForm.tsx
48966
- var import_react164 = require("react");
49109
+ var import_react165 = require("react");
48967
49110
  var import_react_hook_form77 = require("react-hook-form");
48968
49111
  var import_zod129 = require("@hookform/resolvers/zod");
48969
- var import_react_router_dom128 = require("react-router-dom");
48970
- var import_antd98 = require("antd");
49112
+ var import_react_router_dom129 = require("react-router-dom");
49113
+ var import_antd99 = require("antd");
48971
49114
  var import_lucide_react126 = require("lucide-react");
48972
- var import_dayjs11 = __toESM(require("dayjs"));
48973
- var import_jsx_runtime268 = require("react/jsx-runtime");
49115
+ var import_dayjs12 = __toESM(require("dayjs"));
49116
+ var import_jsx_runtime269 = require("react/jsx-runtime");
48974
49117
  function InvoiceForm2({
48975
49118
  onReload,
48976
49119
  close,
48977
49120
  accountData,
48978
49121
  id
48979
49122
  }) {
48980
- const { branchId } = (0, import_react_router_dom128.useParams)();
48981
- const [ref2, setRef] = (0, import_react164.useState)(void 0);
49123
+ const { branchId } = (0, import_react_router_dom129.useParams)();
49124
+ const [ref2, setRef] = (0, import_react165.useState)(void 0);
48982
49125
  const { post, isLoading } = useApis_default();
48983
49126
  const { get, isLoading: getLoading } = useApis_default();
48984
49127
  const { put, isLoading: isLoadingReverse } = useApis_default();
48985
49128
  const isEdit = !!id;
48986
49129
  const { currencies } = useWarqadConfig();
48987
49130
  const { stock: defaultCurrency } = currencies;
48988
- const [itemName, setItemName] = (0, import_react164.useState)("");
48989
- const [itemQuantity, setItemQuantity] = (0, import_react164.useState)("");
48990
- const [itemPrice, setItemPrice] = (0, import_react164.useState)("");
49131
+ const [itemName, setItemName] = (0, import_react165.useState)("");
49132
+ const [itemQuantity, setItemQuantity] = (0, import_react165.useState)("");
49133
+ const [itemPrice, setItemPrice] = (0, import_react165.useState)("");
48991
49134
  const methods = (0, import_react_hook_form77.useForm)({
48992
49135
  resolver: (0, import_zod129.zodResolver)(createInvoiceManagerValidation2),
48993
49136
  defaultValues: {
48994
49137
  invoices: [],
48995
- date: (0, import_dayjs11.default)().format("DD/MM/YYYY"),
49138
+ date: (0, import_dayjs12.default)().format("DD/MM/YYYY"),
48996
49139
  currency: defaultCurrency,
48997
49140
  branch: branchId ? branchId : void 0
48998
49141
  }
@@ -49013,27 +49156,27 @@ function InvoiceForm2({
49013
49156
  });
49014
49157
  setRef(data?.ref);
49015
49158
  } catch (error) {
49016
- import_antd98.message.error(error?.message || "Something went wrong");
49159
+ import_antd99.message.error(error?.message || "Something went wrong");
49017
49160
  }
49018
49161
  };
49019
- (0, import_react164.useEffect)(() => {
49162
+ (0, import_react165.useEffect)(() => {
49020
49163
  if (isEdit) {
49021
49164
  fetches();
49022
49165
  }
49023
49166
  }, [isEdit]);
49024
49167
  const handleAddItem = () => {
49025
49168
  if (!itemName.trim()) {
49026
- import_antd98.message.error("Item name is required");
49169
+ import_antd99.message.error("Item name is required");
49027
49170
  return;
49028
49171
  }
49029
49172
  const qty = Number(itemQuantity);
49030
49173
  const price = Number(itemPrice);
49031
49174
  if (isNaN(qty) || qty <= 0) {
49032
- import_antd98.message.error("Quantity must be greater than 0");
49175
+ import_antd99.message.error("Quantity must be greater than 0");
49033
49176
  return;
49034
49177
  }
49035
49178
  if (isNaN(price) || price <= 0) {
49036
- import_antd98.message.error("Price must be greater than 0");
49179
+ import_antd99.message.error("Price must be greater than 0");
49037
49180
  return;
49038
49181
  }
49039
49182
  append({
@@ -49047,7 +49190,7 @@ function InvoiceForm2({
49047
49190
  };
49048
49191
  const onSubmit = async (data) => {
49049
49192
  if (data.invoices.length === 0) {
49050
- import_antd98.message.error("Please add at least one item to the invoice");
49193
+ import_antd99.message.error("Please add at least one item to the invoice");
49051
49194
  return;
49052
49195
  }
49053
49196
  try {
@@ -49060,13 +49203,13 @@ function InvoiceForm2({
49060
49203
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
49061
49204
  body: payload
49062
49205
  });
49063
- import_antd98.message.success(
49206
+ import_antd99.message.success(
49064
49207
  isEdit ? "Invoice updated successfully" : "Invoice created successfully"
49065
49208
  );
49066
49209
  if (onReload) onReload();
49067
49210
  if (close) close();
49068
49211
  } catch (error) {
49069
- import_antd98.message.error(error?.message || "Something went wrong");
49212
+ import_antd99.message.error(error?.message || "Something went wrong");
49070
49213
  }
49071
49214
  };
49072
49215
  const onReverse = async () => {
@@ -49075,11 +49218,11 @@ function InvoiceForm2({
49075
49218
  await put({
49076
49219
  url: `/transactions/reverse/${id}`
49077
49220
  });
49078
- import_antd98.message.success("Transaction reversed successfully");
49221
+ import_antd99.message.success("Transaction reversed successfully");
49079
49222
  if (onReload) onReload();
49080
49223
  if (close) close();
49081
49224
  } catch (error) {
49082
- import_antd98.message.error(error?.message || "Something went wrong");
49225
+ import_antd99.message.error(error?.message || "Something went wrong");
49083
49226
  }
49084
49227
  };
49085
49228
  const handleKeyDown = (e) => {
@@ -49091,25 +49234,25 @@ function InvoiceForm2({
49091
49234
  e.preventDefault();
49092
49235
  }
49093
49236
  };
49094
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49237
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49095
49238
  Card,
49096
49239
  {
49097
49240
  isLoading: getLoading,
49098
49241
  className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49099
- children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(Card.Content, { children: [
49100
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("input", { type: "hidden", ...register("currency") }),
49101
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49242
+ children: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(Card.Content, { children: [
49243
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("input", { type: "hidden", ...register("currency") }),
49244
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49102
49245
  "form",
49103
49246
  {
49104
49247
  onSubmit: handleSubmit(onSubmit),
49105
49248
  onKeyDown: handleKeyDown,
49106
49249
  className: "space-y-6",
49107
49250
  children: [
49108
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
49109
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
49110
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
49111
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
49112
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49251
+ /* @__PURE__ */ (0, import_jsx_runtime269.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: [
49252
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
49253
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
49254
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
49255
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49113
49256
  Fields_default.Input,
49114
49257
  {
49115
49258
  label: "Container No",
@@ -49118,7 +49261,7 @@ function InvoiceForm2({
49118
49261
  onChange: (val) => setItemName(val)
49119
49262
  }
49120
49263
  ),
49121
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49264
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49122
49265
  Fields_default.Input,
49123
49266
  {
49124
49267
  label: "Cbm",
@@ -49128,7 +49271,7 @@ function InvoiceForm2({
49128
49271
  onChange: (val) => setItemQuantity(val)
49129
49272
  }
49130
49273
  ),
49131
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49274
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49132
49275
  Fields_default.Input,
49133
49276
  {
49134
49277
  label: "Price (KES)",
@@ -49139,7 +49282,7 @@ function InvoiceForm2({
49139
49282
  }
49140
49283
  )
49141
49284
  ] }),
49142
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49285
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49143
49286
  Button,
49144
49287
  {
49145
49288
  type: "button",
@@ -49147,23 +49290,23 @@ function InvoiceForm2({
49147
49290
  className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
49148
49291
  variant: "outline",
49149
49292
  children: [
49150
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(import_lucide_react126.Plus, { size: 16 }),
49293
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(import_lucide_react126.Plus, { size: 16 }),
49151
49294
  " Add Item"
49152
49295
  ]
49153
49296
  }
49154
49297
  )
49155
49298
  ] })
49156
49299
  ] }),
49157
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { children: [
49158
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
49159
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("table", { className: "w-full text-left border-collapse", children: [
49160
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("tr", { children: [
49161
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
49162
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
49163
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
49164
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
49300
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { children: [
49301
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
49302
+ /* @__PURE__ */ (0, import_jsx_runtime269.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_runtime269.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("table", { className: "w-full text-left border-collapse", children: [
49303
+ /* @__PURE__ */ (0, import_jsx_runtime269.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_runtime269.jsxs)("tr", { children: [
49304
+ /* @__PURE__ */ (0, import_jsx_runtime269.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: "#" }),
49305
+ /* @__PURE__ */ (0, import_jsx_runtime269.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" }),
49306
+ /* @__PURE__ */ (0, import_jsx_runtime269.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" }),
49307
+ /* @__PURE__ */ (0, import_jsx_runtime269.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" })
49165
49308
  ] }) }),
49166
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49309
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49167
49310
  "td",
49168
49311
  {
49169
49312
  colSpan: 4,
@@ -49172,29 +49315,29 @@ function InvoiceForm2({
49172
49315
  }
49173
49316
  ) }) : fields.map((item, index) => {
49174
49317
  const total = item.quantity * item.amount;
49175
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49318
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49176
49319
  "tr",
49177
49320
  {
49178
49321
  className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
49179
49322
  children: [
49180
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
49181
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
49182
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
49183
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
49323
+ /* @__PURE__ */ (0, import_jsx_runtime269.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 }),
49324
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
49325
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
49326
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
49184
49327
  item.quantity,
49185
49328
  " Cbm @",
49186
49329
  " ",
49187
49330
  Formats_default.Price(item.amount, "KES")
49188
49331
  ] })
49189
49332
  ] }),
49190
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
49191
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49333
+ /* @__PURE__ */ (0, import_jsx_runtime269.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") }),
49334
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49192
49335
  "button",
49193
49336
  {
49194
49337
  type: "button",
49195
49338
  onClick: () => remove(index),
49196
49339
  className: "text-gray-400 hover:text-red-500 transition-colors p-1",
49197
- children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49340
+ children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49198
49341
  import_lucide_react126.Trash2,
49199
49342
  {
49200
49343
  size: 13,
@@ -49208,8 +49351,8 @@ function InvoiceForm2({
49208
49351
  item.id
49209
49352
  );
49210
49353
  }) }),
49211
- fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("tr", { children: [
49212
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49354
+ fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime269.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_runtime269.jsxs)("tr", { children: [
49355
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49213
49356
  "td",
49214
49357
  {
49215
49358
  colSpan: 2,
@@ -49217,20 +49360,20 @@ function InvoiceForm2({
49217
49360
  children: "Total"
49218
49361
  }
49219
49362
  ),
49220
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
49363
+ /* @__PURE__ */ (0, import_jsx_runtime269.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(
49221
49364
  fields.reduce(
49222
49365
  (sum, item) => sum + item.quantity * item.amount,
49223
49366
  0
49224
49367
  ),
49225
49368
  "KES"
49226
49369
  ) }),
49227
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("td", {})
49370
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("td", {})
49228
49371
  ] }) })
49229
49372
  ] }) }) })
49230
49373
  ] }),
49231
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
49232
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49233
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49374
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
49375
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49376
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49234
49377
  Fields_default.DateInput,
49235
49378
  {
49236
49379
  label: "Date",
@@ -49239,20 +49382,20 @@ function InvoiceForm2({
49239
49382
  required: true
49240
49383
  }
49241
49384
  ),
49242
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
49385
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
49243
49386
  ] }),
49244
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
49245
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49387
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
49388
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49246
49389
  ConfirmModal,
49247
49390
  {
49248
49391
  title: "Reverse Transaction",
49249
- description: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "space-y-3 text-left", children: [
49250
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49251
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49392
+ description: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "space-y-3 text-left", children: [
49393
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49394
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49252
49395
  ] }),
49253
49396
  confirmationWord: "delete",
49254
49397
  onSubmit: onReverse,
49255
- children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49398
+ children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49256
49399
  Button,
49257
49400
  {
49258
49401
  type: "button",
@@ -49265,8 +49408,8 @@ function InvoiceForm2({
49265
49408
  )
49266
49409
  }
49267
49410
  ) }),
49268
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "flex justify-end gap-3", children: [
49269
- close && /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49411
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex justify-end gap-3", children: [
49412
+ close && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49270
49413
  Button,
49271
49414
  {
49272
49415
  type: "button",
@@ -49276,7 +49419,7 @@ function InvoiceForm2({
49276
49419
  children: "Cancel"
49277
49420
  }
49278
49421
  ),
49279
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49422
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49280
49423
  Button,
49281
49424
  {
49282
49425
  isLoading,
@@ -49300,13 +49443,13 @@ function InvoiceForm2({
49300
49443
  var InvoiceForm_default2 = InvoiceForm2;
49301
49444
 
49302
49445
  // src/components/Transactions/cargoIM/journalForm.tsx
49303
- var import_react165 = __toESM(require("react"));
49446
+ var import_react166 = __toESM(require("react"));
49304
49447
  var import_react_hook_form78 = require("react-hook-form");
49305
49448
  var import_zod130 = require("@hookform/resolvers/zod");
49306
- var import_react_router_dom129 = require("react-router-dom");
49307
- var import_antd99 = require("antd");
49308
- var import_dayjs12 = __toESM(require("dayjs"));
49309
- var import_jsx_runtime269 = require("react/jsx-runtime");
49449
+ var import_react_router_dom130 = require("react-router-dom");
49450
+ var import_antd100 = require("antd");
49451
+ var import_dayjs13 = __toESM(require("dayjs"));
49452
+ var import_jsx_runtime270 = require("react/jsx-runtime");
49310
49453
  function JournalForm5({
49311
49454
  onReload,
49312
49455
  close,
@@ -49314,10 +49457,10 @@ function JournalForm5({
49314
49457
  action = "debit",
49315
49458
  id
49316
49459
  }) {
49317
- const { branchId } = (0, import_react_router_dom129.useParams)();
49460
+ const { branchId } = (0, import_react_router_dom130.useParams)();
49318
49461
  const { currencies } = useWarqadConfig();
49319
49462
  const { stock: defaultCurrency } = currencies;
49320
- const [ref2, setRef] = import_react165.default.useState(void 0);
49463
+ const [ref2, setRef] = import_react166.default.useState(void 0);
49321
49464
  const { post, isLoading } = useApis_default();
49322
49465
  const { get, isLoading: getLoading } = useApis_default();
49323
49466
  const { put, isLoading: isLoadingReverse } = useApis_default();
@@ -49325,7 +49468,7 @@ function JournalForm5({
49325
49468
  const methods = (0, import_react_hook_form78.useForm)({
49326
49469
  resolver: (0, import_zod130.zodResolver)(journalSchema5),
49327
49470
  defaultValues: {
49328
- date: (0, import_dayjs12.default)().format("DD/MM/YYYY"),
49471
+ date: (0, import_dayjs13.default)().format("DD/MM/YYYY"),
49329
49472
  currency: defaultCurrency,
49330
49473
  action,
49331
49474
  description: "Payment ",
@@ -49345,10 +49488,10 @@ function JournalForm5({
49345
49488
  });
49346
49489
  setRef(data?.ref);
49347
49490
  } catch (error) {
49348
- import_antd99.message.error(error?.message || "Something went wrong");
49491
+ import_antd100.message.error(error?.message || "Something went wrong");
49349
49492
  }
49350
49493
  };
49351
- import_react165.default.useEffect(() => {
49494
+ import_react166.default.useEffect(() => {
49352
49495
  if (isEdit) {
49353
49496
  fetches();
49354
49497
  }
@@ -49366,13 +49509,13 @@ function JournalForm5({
49366
49509
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
49367
49510
  body: payload
49368
49511
  });
49369
- import_antd99.message.success(
49512
+ import_antd100.message.success(
49370
49513
  isEdit ? "Journal updated successfully" : "Journal saved successfully"
49371
49514
  );
49372
49515
  if (onReload) onReload();
49373
49516
  if (close) close();
49374
49517
  } catch (error) {
49375
- import_antd99.message.error(error?.message || "Something went wrong");
49518
+ import_antd100.message.error(error?.message || "Something went wrong");
49376
49519
  }
49377
49520
  };
49378
49521
  const onReverse = async () => {
@@ -49381,11 +49524,11 @@ function JournalForm5({
49381
49524
  await put({
49382
49525
  url: `/transactions/reverse/${id}`
49383
49526
  });
49384
- import_antd99.message.success("Transaction reversed successfully");
49527
+ import_antd100.message.success("Transaction reversed successfully");
49385
49528
  if (onReload) onReload();
49386
49529
  if (close) close();
49387
49530
  } catch (error) {
49388
- import_antd99.message.error(error?.message || "Something went wrong");
49531
+ import_antd100.message.error(error?.message || "Something went wrong");
49389
49532
  }
49390
49533
  };
49391
49534
  const handleKeyDown = (e) => {
@@ -49397,19 +49540,19 @@ function JournalForm5({
49397
49540
  e.preventDefault();
49398
49541
  }
49399
49542
  };
49400
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49543
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49401
49544
  Card,
49402
49545
  {
49403
49546
  isLoading: getLoading,
49404
49547
  className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49405
- children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49548
+ children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
49406
49549
  "form",
49407
49550
  {
49408
49551
  onSubmit: handleSubmit(onSubmit),
49409
49552
  onKeyDown: handleKeyDown,
49410
49553
  className: "space-y-4",
49411
49554
  children: [
49412
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49555
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49413
49556
  Fields_default.Input,
49414
49557
  {
49415
49558
  label: "Description",
@@ -49420,8 +49563,8 @@ function JournalForm5({
49420
49563
  placeholder: "Enter description"
49421
49564
  }
49422
49565
  ),
49423
- /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49424
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49566
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49567
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49425
49568
  Fields_default.DateInput,
49426
49569
  {
49427
49570
  label: "Date",
@@ -49430,7 +49573,7 @@ function JournalForm5({
49430
49573
  required: true
49431
49574
  }
49432
49575
  ),
49433
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49576
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49434
49577
  Fields_default.Input,
49435
49578
  {
49436
49579
  label: "Currency",
@@ -49440,8 +49583,8 @@ function JournalForm5({
49440
49583
  }
49441
49584
  )
49442
49585
  ] }),
49443
- /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49444
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49586
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49587
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49445
49588
  Fields_default.Input,
49446
49589
  {
49447
49590
  label: "Amount",
@@ -49452,7 +49595,7 @@ function JournalForm5({
49452
49595
  placeholder: "0.00"
49453
49596
  }
49454
49597
  ),
49455
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49598
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49456
49599
  Fields_default.Select,
49457
49600
  {
49458
49601
  label: "Action",
@@ -49466,7 +49609,7 @@ function JournalForm5({
49466
49609
  }
49467
49610
  )
49468
49611
  ] }),
49469
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49612
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49470
49613
  Fields_default.Textarea,
49471
49614
  {
49472
49615
  label: "Note",
@@ -49476,18 +49619,18 @@ function JournalForm5({
49476
49619
  rows: 3
49477
49620
  }
49478
49621
  ),
49479
- /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
49480
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49622
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
49623
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49481
49624
  ConfirmModal,
49482
49625
  {
49483
49626
  title: "Reverse Transaction",
49484
- description: /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "space-y-3 text-left", children: [
49485
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49486
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49627
+ description: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "space-y-3 text-left", children: [
49628
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49629
+ /* @__PURE__ */ (0, import_jsx_runtime270.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."' })
49487
49630
  ] }),
49488
49631
  confirmationWord: "delete",
49489
49632
  onSubmit: onReverse,
49490
- children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49633
+ children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49491
49634
  Button,
49492
49635
  {
49493
49636
  type: "button",
@@ -49500,8 +49643,8 @@ function JournalForm5({
49500
49643
  )
49501
49644
  }
49502
49645
  ) }),
49503
- /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "flex justify-end gap-3", children: [
49504
- close && /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49646
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "flex justify-end gap-3", children: [
49647
+ close && /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49505
49648
  Button,
49506
49649
  {
49507
49650
  type: "button",
@@ -49511,7 +49654,7 @@ function JournalForm5({
49511
49654
  children: "Cancel"
49512
49655
  }
49513
49656
  ),
49514
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49657
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49515
49658
  Button,
49516
49659
  {
49517
49660
  isLoading,
@@ -49533,15 +49676,15 @@ function JournalForm5({
49533
49676
  var journalForm_default2 = JournalForm5;
49534
49677
 
49535
49678
  // src/components/Transactions/cargoIM/CargoIM.tsx
49536
- var import_jsx_runtime270 = require("react/jsx-runtime");
49679
+ var import_jsx_runtime271 = require("react/jsx-runtime");
49537
49680
  function CargoIM({ v, url }) {
49538
- const { branchId } = (0, import_react_router_dom130.useParams)();
49681
+ const { branchId } = (0, import_react_router_dom131.useParams)();
49539
49682
  const { apiConfig } = useWarqadConfig();
49540
49683
  const { width } = useMediaSize();
49541
49684
  const isLargeScreen = width > 768;
49542
- const navigate = (0, import_react_router_dom130.useNavigate)();
49685
+ const navigate = (0, import_react_router_dom131.useNavigate)();
49543
49686
  const type = "supplier";
49544
- const [deleteAccount, setDeleteAccount] = (0, import_react166.useState)(null);
49687
+ const [deleteAccount, setDeleteAccount] = (0, import_react167.useState)(null);
49545
49688
  const { isLoading: isActionLoading, remove } = useApis_default();
49546
49689
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
49547
49690
  url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
@@ -49552,17 +49695,17 @@ function CargoIM({ v, url }) {
49552
49695
  const items = (data2) => [
49553
49696
  {
49554
49697
  label: `Edit ${type}`,
49555
- icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
49698
+ icon: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(import_lucide_react127.FilePenLine, { size: 16 }),
49556
49699
  onClick: () => openState({
49557
49700
  type: "Account",
49558
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
49701
+ content: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
49559
49702
  title: "Account Form",
49560
49703
  width: 800
49561
49704
  })
49562
49705
  },
49563
49706
  {
49564
49707
  label: `Delete ${type}`,
49565
- icon: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.Trash2, { className: "text-red-500", size: 16 }),
49708
+ icon: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(import_lucide_react127.Trash2, { className: "text-red-500", size: 16 }),
49566
49709
  onClick: () => setDeleteAccount(data2)
49567
49710
  }
49568
49711
  ].filter(Boolean);
@@ -49573,7 +49716,7 @@ function CargoIM({ v, url }) {
49573
49716
  className: "w-full",
49574
49717
  cell: ({ row }) => {
49575
49718
  const account = row.original;
49576
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49719
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49577
49720
  "span",
49578
49721
  {
49579
49722
  onClick: () => navigate(`${account?._id}`),
@@ -49602,8 +49745,8 @@ function CargoIM({ v, url }) {
49602
49745
  className: "w-px whitespace-nowrap",
49603
49746
  cell: ({ row }) => {
49604
49747
  const data2 = row.original;
49605
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "flex gap-4 items-center", children: [
49606
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49748
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex gap-4 items-center", children: [
49749
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49607
49750
  "button",
49608
49751
  {
49609
49752
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -49611,7 +49754,7 @@ function CargoIM({ v, url }) {
49611
49754
  openState({
49612
49755
  type: "credit",
49613
49756
  closeOnOverlayClick: false,
49614
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49757
+ content: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49615
49758
  InvoiceForm_default2,
49616
49759
  {
49617
49760
  onReload: reload,
@@ -49626,7 +49769,7 @@ function CargoIM({ v, url }) {
49626
49769
  children: "Inv"
49627
49770
  }
49628
49771
  ),
49629
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49772
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49630
49773
  "button",
49631
49774
  {
49632
49775
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -49634,7 +49777,7 @@ function CargoIM({ v, url }) {
49634
49777
  openState({
49635
49778
  type: "debit",
49636
49779
  closeOnOverlayClick: false,
49637
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49780
+ content: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49638
49781
  journalForm_default2,
49639
49782
  {
49640
49783
  onReload: reload,
@@ -49650,14 +49793,14 @@ function CargoIM({ v, url }) {
49650
49793
  children: "Pay"
49651
49794
  }
49652
49795
  ),
49653
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49796
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49654
49797
  Dropdown,
49655
49798
  {
49656
49799
  className: "cursor-pointer",
49657
49800
  width: "w-[150px]",
49658
49801
  items: items(data2),
49659
49802
  triggerMode: "hover",
49660
- children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(import_lucide_react127.EllipsisVertical, {})
49803
+ children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(import_lucide_react127.EllipsisVertical, {})
49661
49804
  }
49662
49805
  )
49663
49806
  ] });
@@ -49673,17 +49816,17 @@ function CargoIM({ v, url }) {
49673
49816
  const onDelete = async (id) => {
49674
49817
  try {
49675
49818
  await remove({ url: `/accounts/delete/${id}` });
49676
- import_antd100.message.success("Account deleted successfully");
49819
+ import_antd101.message.success("Account deleted successfully");
49677
49820
  reload();
49678
49821
  setDeleteAccount(null);
49679
49822
  } catch (error) {
49680
- import_antd100.message.error(error.message || "Something went wrong");
49823
+ import_antd101.message.error(error.message || "Something went wrong");
49681
49824
  return error;
49682
49825
  }
49683
49826
  };
49684
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
49685
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Modal2, {}),
49686
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49827
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
49828
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Modal2, {}),
49829
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49687
49830
  ConfirmModal,
49688
49831
  {
49689
49832
  isOpen: !!deleteAccount,
@@ -49696,7 +49839,7 @@ function CargoIM({ v, url }) {
49696
49839
  children: null
49697
49840
  }
49698
49841
  ),
49699
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49842
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49700
49843
  TransactionViewComponent,
49701
49844
  {
49702
49845
  columns,
@@ -49707,7 +49850,7 @@ function CargoIM({ v, url }) {
49707
49850
  onCreate: () => {
49708
49851
  openState({
49709
49852
  type: "account",
49710
- content: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(AccountForm_default3, { onReload: reload, close }),
49853
+ content: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(AccountForm_default3, { onReload: reload, close }),
49711
49854
  title: "Account Form",
49712
49855
  width: 800
49713
49856
  });
@@ -49719,9 +49862,9 @@ function CargoIM({ v, url }) {
49719
49862
  var CargoIM_default = CargoIM;
49720
49863
 
49721
49864
  // src/components/Transactions/cargoIM/cargoIMReport.tsx
49722
- var import_react_router_dom131 = require("react-router-dom");
49723
- var import_react167 = require("react");
49724
- var import_jsx_runtime271 = require("react/jsx-runtime");
49865
+ var import_react_router_dom132 = require("react-router-dom");
49866
+ var import_react168 = require("react");
49867
+ var import_jsx_runtime272 = require("react/jsx-runtime");
49725
49868
  var CargoIMReport = () => {
49726
49869
  const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
49727
49870
  const { TransactionView, openTransaction } = useTransactionView_default();
@@ -49734,10 +49877,10 @@ var CargoIMReport = () => {
49734
49877
  value: currency2
49735
49878
  };
49736
49879
  });
49737
- const [searchParams, setSearchParams] = (0, import_react_router_dom131.useSearchParams)();
49880
+ const [searchParams, setSearchParams] = (0, import_react_router_dom132.useSearchParams)();
49738
49881
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
49739
49882
  const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
49740
- const [currencyFilter, setCurrencyFilter] = (0, import_react167.useState)(initialCurrency);
49883
+ const [currencyFilter, setCurrencyFilter] = (0, import_react168.useState)(initialCurrency);
49741
49884
  const handleCurrencyChange = (value) => {
49742
49885
  setCurrencyFilter(value);
49743
49886
  setSearchParams((prev) => {
@@ -49745,7 +49888,7 @@ var CargoIMReport = () => {
49745
49888
  return prev;
49746
49889
  });
49747
49890
  };
49748
- (0, import_react167.useEffect)(() => {
49891
+ (0, import_react168.useEffect)(() => {
49749
49892
  if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
49750
49893
  setCurrencyFilter(urlCurrency);
49751
49894
  }
@@ -49765,9 +49908,9 @@ var CargoIMReport = () => {
49765
49908
  header: "Date",
49766
49909
  key: "date",
49767
49910
  className: "text-xs whitespace-nowrap",
49768
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "", children: [
49769
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49770
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49911
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "", children: [
49912
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49913
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49771
49914
  "span",
49772
49915
  {
49773
49916
  onClick: () => {
@@ -49786,13 +49929,13 @@ var CargoIMReport = () => {
49786
49929
  header: "Container No",
49787
49930
  key: "description",
49788
49931
  className: "text-xs w-full break-words",
49789
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49932
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.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) => {
49790
49933
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49791
49934
  /[^a-zA-Z0-9]/g,
49792
49935
  ""
49793
49936
  );
49794
49937
  const lineClass = `tx-line-${rowId}-${idx}`;
49795
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49938
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49796
49939
  "div",
49797
49940
  {
49798
49941
  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`,
@@ -49806,13 +49949,13 @@ var CargoIMReport = () => {
49806
49949
  header: "Cbm",
49807
49950
  key: "cbm",
49808
49951
  className: "text-xs whitespace-nowrap text-right",
49809
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49952
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.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) => {
49810
49953
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49811
49954
  /[^a-zA-Z0-9]/g,
49812
49955
  ""
49813
49956
  );
49814
49957
  const lineClass = `tx-line-${rowId}-${idx}`;
49815
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49958
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49816
49959
  "div",
49817
49960
  {
49818
49961
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -49829,20 +49972,20 @@ var CargoIMReport = () => {
49829
49972
  ),
49830
49973
  0
49831
49974
  );
49832
- return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
49975
+ return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
49833
49976
  }
49834
49977
  },
49835
49978
  {
49836
49979
  header: "Price",
49837
49980
  key: "price",
49838
49981
  className: "text-xs whitespace-nowrap text-right",
49839
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
49982
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.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) => {
49840
49983
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49841
49984
  /[^a-zA-Z0-9]/g,
49842
49985
  ""
49843
49986
  );
49844
49987
  const lineClass = `tx-line-${rowId}-${idx}`;
49845
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49988
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49846
49989
  "div",
49847
49990
  {
49848
49991
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -49856,13 +49999,13 @@ var CargoIMReport = () => {
49856
49999
  header: "Credit",
49857
50000
  key: "credit",
49858
50001
  className: "text-xs whitespace-nowrap text-right",
49859
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50002
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.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) => {
49860
50003
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49861
50004
  /[^a-zA-Z0-9]/g,
49862
50005
  ""
49863
50006
  );
49864
50007
  const lineClass = `tx-line-${rowId}-${idx}`;
49865
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50008
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49866
50009
  "div",
49867
50010
  {
49868
50011
  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`,
@@ -49871,7 +50014,7 @@ var CargoIMReport = () => {
49871
50014
  idx
49872
50015
  );
49873
50016
  }) }),
49874
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
50017
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
49875
50018
  data2.reduce(
49876
50019
  (acc, row) => acc + (row.lines || []).reduce(
49877
50020
  (lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
@@ -49885,13 +50028,13 @@ var CargoIMReport = () => {
49885
50028
  header: "Debit",
49886
50029
  key: "debit",
49887
50030
  className: "text-xs whitespace-nowrap text-right",
49888
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50031
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.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) => {
49889
50032
  const rowId = String(row._id || row.id || row.ref || idx).replace(
49890
50033
  /[^a-zA-Z0-9]/g,
49891
50034
  ""
49892
50035
  );
49893
50036
  const lineClass = `tx-line-${rowId}-${idx}`;
49894
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50037
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49895
50038
  "div",
49896
50039
  {
49897
50040
  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`,
@@ -49900,7 +50043,7 @@ var CargoIMReport = () => {
49900
50043
  idx
49901
50044
  );
49902
50045
  }) }),
49903
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
50046
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
49904
50047
  data2.reduce(
49905
50048
  (acc, row) => acc + (row.lines || []).reduce(
49906
50049
  (lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
@@ -49914,14 +50057,14 @@ var CargoIMReport = () => {
49914
50057
  header: "Balance",
49915
50058
  key: "runningBalance",
49916
50059
  className: "text-xs whitespace-nowrap text-right",
49917
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
49918
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
50060
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
50061
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
49919
50062
  data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
49920
50063
  currency
49921
50064
  ) })
49922
50065
  }
49923
50066
  ];
49924
- const datas = (0, import_react167.useMemo)(() => {
50067
+ const datas = (0, import_react168.useMemo)(() => {
49925
50068
  let runningBalance = 0;
49926
50069
  const transactions = data?.data?.transactions;
49927
50070
  const res = (transactions || []).map((item) => {
@@ -49958,10 +50101,10 @@ var CargoIMReport = () => {
49958
50101
  { label: "Account Type", value: data?.data?.type },
49959
50102
  { label: "Currency", value: currencyFilter }
49960
50103
  ];
49961
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(import_jsx_runtime271.Fragment, { children: [
49962
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Modal2, {}),
49963
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(TransactionView, {}),
49964
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50104
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_jsx_runtime272.Fragment, { children: [
50105
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Modal2, {}),
50106
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(TransactionView, {}),
50107
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49965
50108
  A4DataView,
49966
50109
  {
49967
50110
  columns,
@@ -49976,7 +50119,7 @@ var CargoIMReport = () => {
49976
50119
  openState({
49977
50120
  type: "debit",
49978
50121
  closeOnOverlayClick: false,
49979
- content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50122
+ content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49980
50123
  InvoiceForm_default2,
49981
50124
  {
49982
50125
  close: closeTransaction,
@@ -49984,7 +50127,7 @@ var CargoIMReport = () => {
49984
50127
  onReload: reload,
49985
50128
  id: row._id
49986
50129
  }
49987
- ) : /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50130
+ ) : /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49988
50131
  journalForm_default2,
49989
50132
  {
49990
50133
  close: closeTransaction,
@@ -49997,7 +50140,7 @@ var CargoIMReport = () => {
49997
50140
  width: 800
49998
50141
  });
49999
50142
  },
50000
- headers: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
50143
+ headers: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50001
50144
  Fields_default.Select,
50002
50145
  {
50003
50146
  options: currencies,
@@ -50013,16 +50156,16 @@ var CargoIMReport = () => {
50013
50156
  var cargoIMReport_default = CargoIMReport;
50014
50157
 
50015
50158
  // src/components/accounts/forex-2/Forex2Accounts.tsx
50016
- var import_react_router_dom132 = require("react-router-dom");
50159
+ var import_react_router_dom133 = require("react-router-dom");
50017
50160
  var import_lucide_react128 = require("lucide-react");
50018
- var import_react168 = require("react");
50019
- var import_antd101 = require("antd");
50020
- var import_jsx_runtime272 = require("react/jsx-runtime");
50161
+ var import_react169 = require("react");
50162
+ var import_antd102 = require("antd");
50163
+ var import_jsx_runtime273 = require("react/jsx-runtime");
50021
50164
  function Forex2Accounts({ v, url }) {
50022
- const { branchId } = (0, import_react_router_dom132.useParams)();
50023
- const navigate = (0, import_react_router_dom132.useNavigate)();
50165
+ const { branchId } = (0, import_react_router_dom133.useParams)();
50166
+ const navigate = (0, import_react_router_dom133.useNavigate)();
50024
50167
  const type = "account";
50025
- const [deleteAccount, setDeleteAccount] = (0, import_react168.useState)(null);
50168
+ const [deleteAccount, setDeleteAccount] = (0, import_react169.useState)(null);
50026
50169
  const { isLoading: isActionLoading, remove } = useApis_default();
50027
50170
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
50028
50171
  url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
@@ -50033,22 +50176,22 @@ function Forex2Accounts({ v, url }) {
50033
50176
  const items = (data2) => [
50034
50177
  {
50035
50178
  label: `Currency Report`,
50036
- icon: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.FileChartLine, { size: 16 }),
50179
+ icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.FileChartLine, { size: 16 }),
50037
50180
  onClick: () => navigate(data2?._id)
50038
50181
  },
50039
50182
  {
50040
50183
  label: `Edit ${type}`,
50041
- icon: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
50184
+ icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
50042
50185
  onClick: () => openState({
50043
50186
  type: "forex account",
50044
- content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
50187
+ content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
50045
50188
  title: "Forex Account Form",
50046
50189
  width: 800
50047
50190
  })
50048
50191
  },
50049
50192
  {
50050
50193
  label: `Delete ${type}`,
50051
- icon: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
50194
+ icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
50052
50195
  onClick: () => setDeleteAccount(data2)
50053
50196
  }
50054
50197
  ].filter(Boolean);
@@ -50058,7 +50201,7 @@ function Forex2Accounts({ v, url }) {
50058
50201
  header: "Name",
50059
50202
  cell: ({ row }) => {
50060
50203
  const account = row.original;
50061
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50204
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50062
50205
  "span",
50063
50206
  {
50064
50207
  onClick: () => navigate(`statements/${account?._id}`),
@@ -50073,7 +50216,7 @@ function Forex2Accounts({ v, url }) {
50073
50216
  header: "Phone",
50074
50217
  cell: ({ row }) => {
50075
50218
  const account = row.original;
50076
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { children: account?.phoneNumber || "N/A" });
50219
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("span", { children: account?.phoneNumber || "N/A" });
50077
50220
  }
50078
50221
  },
50079
50222
  {
@@ -50081,14 +50224,14 @@ function Forex2Accounts({ v, url }) {
50081
50224
  header: "Balances",
50082
50225
  cell: ({ row }) => {
50083
50226
  const account = row.original;
50084
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
50085
- ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
50227
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
50228
+ ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
50086
50229
  "div",
50087
50230
  {
50088
50231
  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",
50089
50232
  children: [
50090
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
50091
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50233
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
50234
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50092
50235
  "span",
50093
50236
  {
50094
50237
  className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
@@ -50107,8 +50250,8 @@ function Forex2Accounts({ v, url }) {
50107
50250
  header: "Actions",
50108
50251
  cell: ({ row }) => {
50109
50252
  const data2 = row.original;
50110
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex gap-4 items-center", children: [
50111
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50253
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex gap-4 items-center", children: [
50254
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50112
50255
  "button",
50113
50256
  {
50114
50257
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -50116,7 +50259,7 @@ function Forex2Accounts({ v, url }) {
50116
50259
  openState({
50117
50260
  type: "credit",
50118
50261
  closeOnOverlayClick: false,
50119
- content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50262
+ content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50120
50263
  Forex2FormTransaction_default,
50121
50264
  {
50122
50265
  close,
@@ -50132,7 +50275,7 @@ function Forex2Accounts({ v, url }) {
50132
50275
  children: "Out"
50133
50276
  }
50134
50277
  ),
50135
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50278
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50136
50279
  "button",
50137
50280
  {
50138
50281
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -50140,7 +50283,7 @@ function Forex2Accounts({ v, url }) {
50140
50283
  openState({
50141
50284
  type: "debit",
50142
50285
  closeOnOverlayClick: false,
50143
- content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50286
+ content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50144
50287
  Forex2FormTransaction_default,
50145
50288
  {
50146
50289
  close,
@@ -50156,13 +50299,13 @@ function Forex2Accounts({ v, url }) {
50156
50299
  children: "In"
50157
50300
  }
50158
50301
  ),
50159
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50302
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50160
50303
  Dropdown,
50161
50304
  {
50162
50305
  className: "cursor-pointer w-[150px]",
50163
50306
  items: items(data2),
50164
50307
  triggerMode: "hover",
50165
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react128.EllipsisVertical, {})
50308
+ children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.EllipsisVertical, {})
50166
50309
  }
50167
50310
  )
50168
50311
  ] });
@@ -50173,11 +50316,11 @@ function Forex2Accounts({ v, url }) {
50173
50316
  const onDelete = async (id) => {
50174
50317
  try {
50175
50318
  await remove({ url: `/accounts/delete/${id}` });
50176
- import_antd101.message.success("Account deleted successfully");
50319
+ import_antd102.message.success("Account deleted successfully");
50177
50320
  reload();
50178
50321
  setDeleteAccount(null);
50179
50322
  } catch (error) {
50180
- import_antd101.message.error(error.message || "Something went wrong");
50323
+ import_antd102.message.error(error.message || "Something went wrong");
50181
50324
  return error;
50182
50325
  }
50183
50326
  };
@@ -50201,9 +50344,9 @@ function Forex2Accounts({ v, url }) {
50201
50344
  };
50202
50345
  }).filter((item) => item.debit !== 0 || item.credit !== 0);
50203
50346
  console.log(currencies);
50204
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(import_jsx_runtime272.Fragment, { children: [
50205
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Modal2, {}),
50206
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50347
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [
50348
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Modal2, {}),
50349
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50207
50350
  ConfirmModal,
50208
50351
  {
50209
50352
  isOpen: !!deleteAccount,
@@ -50216,9 +50359,9 @@ function Forex2Accounts({ v, url }) {
50216
50359
  children: null
50217
50360
  }
50218
50361
  ),
50219
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { children: [
50220
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
50221
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50362
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { children: [
50363
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
50364
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50222
50365
  TransactionViewComponent,
50223
50366
  {
50224
50367
  columns,
@@ -50230,7 +50373,7 @@ function Forex2Accounts({ v, url }) {
50230
50373
  onCreate: () => {
50231
50374
  openState({
50232
50375
  type: "forex account",
50233
- content: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ForexAccountForm_default, { close, reloads: reload }),
50376
+ content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(ForexAccountForm_default, { close, reloads: reload }),
50234
50377
  title: "Forex Account Form",
50235
50378
  width: 800
50236
50379
  });
@@ -50243,14 +50386,14 @@ function Forex2Accounts({ v, url }) {
50243
50386
  var Forex2Accounts_default = Forex2Accounts;
50244
50387
 
50245
50388
  // src/components/reports/ProductList.tsx
50246
- var import_react_router_dom133 = require("react-router-dom");
50247
- var import_jsx_runtime273 = require("react/jsx-runtime");
50389
+ var import_react_router_dom134 = require("react-router-dom");
50390
+ var import_jsx_runtime274 = require("react/jsx-runtime");
50248
50391
  var options9 = [
50249
50392
  { label: "Product", value: "product" },
50250
50393
  { label: "Pack", value: "pack" }
50251
50394
  ];
50252
50395
  var ProductList2 = ({ value = false }) => {
50253
- const { branchId } = (0, import_react_router_dom133.useParams)();
50396
+ const { branchId } = (0, import_react_router_dom134.useParams)();
50254
50397
  const { branches } = useAuth_default();
50255
50398
  const { TransactionView } = useTransactionView_default();
50256
50399
  const { getQuery, setQuery } = useApp_default();
@@ -50272,7 +50415,7 @@ var ProductList2 = ({ value = false }) => {
50272
50415
  key: "name",
50273
50416
  className: "text-xs whitespace-nowrap",
50274
50417
  render: (row) => {
50275
- return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
50418
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
50276
50419
  }
50277
50420
  },
50278
50421
  ...value ? [
@@ -50280,14 +50423,14 @@ var ProductList2 = ({ value = false }) => {
50280
50423
  header: "Cost",
50281
50424
  key: "cost",
50282
50425
  className: "text-xs whitespace-nowrap text-right",
50283
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
50426
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
50284
50427
  }
50285
50428
  ] : []
50286
50429
  ];
50287
50430
  const datas = data?.data || [];
50288
- return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [
50289
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(TransactionView, {}),
50290
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50431
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_jsx_runtime274.Fragment, { children: [
50432
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(TransactionView, {}),
50433
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50291
50434
  A4DataView,
50292
50435
  {
50293
50436
  columns,
@@ -50298,7 +50441,7 @@ var ProductList2 = ({ value = false }) => {
50298
50441
  tableTitle: "Stock List",
50299
50442
  fixed: false,
50300
50443
  startPage: 1e10,
50301
- headers: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50444
+ headers: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50302
50445
  Select,
50303
50446
  {
50304
50447
  options: options9,