warqadui 0.0.276 → 0.0.278

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