warqadui 0.0.284 → 0.0.285

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
@@ -48440,7 +48440,7 @@ var Expenses3Reports = () => {
48440
48440
  const [startDate, setStartDate] = (0, import_react161.useState)(null);
48441
48441
  const [endDate, setEndDate] = (0, import_react161.useState)(null);
48442
48442
  const { A4DataView, data } = useA4DataView_default({
48443
- url: `/transactions/get?isExpenses3=true${branchId ? `&branch=${branchId}` : ""}`,
48443
+ url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
48444
48444
  v: 1
48445
48445
  // No prefix
48446
48446
  });
@@ -48565,19 +48565,156 @@ var Expenses3Reports = () => {
48565
48565
  };
48566
48566
  var Expenses3Reports_default = Expenses3Reports;
48567
48567
 
48568
+ // src/components/Transactions/3/reports/ExpensesJournal3.tsx
48569
+ var import_react_router_dom126 = require("react-router-dom");
48570
+ var import_react162 = require("react");
48571
+ var import_antd97 = require("antd");
48572
+ var import_dayjs12 = __toESM(require("dayjs"));
48573
+ var import_jsx_runtime266 = require("react/jsx-runtime");
48574
+ var Expenses3Reports2 = () => {
48575
+ const { branchId } = (0, import_react_router_dom126.useParams)();
48576
+ const [startDate, setStartDate] = (0, import_react162.useState)(null);
48577
+ const [endDate, setEndDate] = (0, import_react162.useState)(null);
48578
+ const { A4DataView, data } = useA4DataView_default({
48579
+ url: `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
48580
+ v: 1
48581
+ // No prefix
48582
+ });
48583
+ const { TransactionView, openTransaction } = useTransactionView_default();
48584
+ const { defaultCurrency } = useWarqadConfig()?.currencies;
48585
+ const columns = [
48586
+ {
48587
+ header: "Date",
48588
+ key: "date",
48589
+ className: "text-xs whitespace-nowrap",
48590
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
48591
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48592
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48593
+ "span",
48594
+ {
48595
+ onClick: () => {
48596
+ openTransaction({
48597
+ id: row?._id,
48598
+ type: row?.type
48599
+ });
48600
+ },
48601
+ className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
48602
+ children: row?.ref
48603
+ }
48604
+ )
48605
+ ] })
48606
+ },
48607
+ {
48608
+ header: "Description",
48609
+ key: "description",
48610
+ className: "text-xs whitespace-nowrap ",
48611
+ render: (row) => {
48612
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
48613
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
48614
+ row.note && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-medium italic text-xs capitalize text-gray-500 dark:text-white ", children: row.note })
48615
+ ] });
48616
+ }
48617
+ },
48618
+ {
48619
+ header: "Amount",
48620
+ key: "changedAmountString",
48621
+ className: "text-xs whitespace-nowrap text-right",
48622
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
48623
+ renderFooter: (data2) => {
48624
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
48625
+ Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
48626
+ defaultCurrency
48627
+ ) });
48628
+ }
48629
+ }
48630
+ ];
48631
+ const datas = (0, import_react162.useMemo)(() => {
48632
+ let runningBalance = 0;
48633
+ let filteredData = data?.data || [];
48634
+ const mapped = filteredData.map((item) => {
48635
+ const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
48636
+ runningBalance += changedAmount;
48637
+ return {
48638
+ ...item,
48639
+ changedAmountString: Formats_default.Amount(changedAmount, false),
48640
+ changedAmount,
48641
+ runningBalance
48642
+ };
48643
+ });
48644
+ let filtered = mapped;
48645
+ if (startDate) {
48646
+ const startOfDay = startDate.startOf("day");
48647
+ filtered = filtered.filter((tx) => {
48648
+ const rawDate = tx.dateObj || tx.date;
48649
+ if (!rawDate) return false;
48650
+ const txDate = (0, import_dayjs12.default)(rawDate);
48651
+ return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
48652
+ });
48653
+ }
48654
+ if (endDate) {
48655
+ const endOfDay = endDate.endOf("day");
48656
+ filtered = filtered.filter((tx) => {
48657
+ const rawDate = tx.dateObj || tx.date;
48658
+ if (!rawDate) return false;
48659
+ const txDate = (0, import_dayjs12.default)(rawDate);
48660
+ return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
48661
+ });
48662
+ }
48663
+ return filtered;
48664
+ }, [data, startDate, endDate]);
48665
+ return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48666
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
48667
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48668
+ A4DataView,
48669
+ {
48670
+ columns,
48671
+ data: datas,
48672
+ index: true,
48673
+ title: `Expenses Journal Report`,
48674
+ subtitle: `All Expenses`,
48675
+ fixed: false,
48676
+ headers: /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
48677
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48678
+ import_antd97.DatePicker,
48679
+ {
48680
+ placeholder: "Start Date",
48681
+ onChange: (date) => setStartDate(date),
48682
+ value: startDate,
48683
+ format: "DD/MM/YYYY",
48684
+ className: "min-w-[140px] max-w-[160px]"
48685
+ }
48686
+ ),
48687
+ /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48688
+ import_antd97.DatePicker,
48689
+ {
48690
+ placeholder: "End Date",
48691
+ onChange: (date) => setEndDate(date),
48692
+ value: endDate,
48693
+ format: "DD/MM/YYYY",
48694
+ className: "min-w-[140px] max-w-[160px]"
48695
+ }
48696
+ )
48697
+ ] })
48698
+ }
48699
+ )
48700
+ ] });
48701
+ };
48702
+ var ExpensesJournal3_default = Expenses3Reports2;
48703
+
48568
48704
  // src/components/Transactions/3/reports/index.tsx
48569
48705
  var Reports3 = {
48570
- expenses: Expenses3Reports_default
48706
+ expenses: Expenses3Reports_default,
48707
+ expensesJournal: ExpensesJournal3_default
48571
48708
  };
48572
48709
  var reports_default = Reports3;
48573
48710
 
48574
48711
  // src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
48575
- var import_react_router_dom126 = require("react-router-dom");
48712
+ var import_react_router_dom127 = require("react-router-dom");
48576
48713
  var import_lucide_react126 = require("lucide-react");
48577
- var import_jsx_runtime266 = require("react/jsx-runtime");
48714
+ var import_jsx_runtime267 = require("react/jsx-runtime");
48578
48715
  function ExpensesJournal3({ url }) {
48579
- const { branchId } = (0, import_react_router_dom126.useParams)();
48580
- const navigate = (0, import_react_router_dom126.useNavigate)();
48716
+ const { branchId } = (0, import_react_router_dom127.useParams)();
48717
+ const navigate = (0, import_react_router_dom127.useNavigate)();
48581
48718
  const { TransactionView, openTransaction } = useTransactionView_default();
48582
48719
  const { data, TransactionViewComponent, reload } = useTransaction_default({
48583
48720
  url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
@@ -48587,17 +48724,17 @@ function ExpensesJournal3({ url }) {
48587
48724
  const items = (data2) => [
48588
48725
  {
48589
48726
  label: `View Expense`,
48590
- icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
48727
+ icon: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
48591
48728
  onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
48592
48729
  },
48593
48730
  {
48594
48731
  label: `Edit Expense`,
48595
- icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
48732
+ icon: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
48596
48733
  onClick: () => navigate(`update?id=${data2?._id}`)
48597
48734
  },
48598
48735
  {
48599
48736
  label: `Delete Expense`,
48600
- icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
48737
+ icon: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
48601
48738
  onClick: () => {
48602
48739
  openTransaction({
48603
48740
  id: data2?._id,
@@ -48613,9 +48750,9 @@ function ExpensesJournal3({ url }) {
48613
48750
  header: "Date",
48614
48751
  cell: ({ row }) => {
48615
48752
  const expense = row.original;
48616
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col", children: [
48617
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { children: expense?.date }),
48618
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48753
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex flex-col", children: [
48754
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { children: expense?.date }),
48755
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48619
48756
  "span",
48620
48757
  {
48621
48758
  onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
@@ -48631,9 +48768,9 @@ function ExpensesJournal3({ url }) {
48631
48768
  header: "Description",
48632
48769
  cell: ({ row }) => {
48633
48770
  const expense = row.original;
48634
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col", children: [
48635
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "capitalize", children: expense?.description }),
48636
- expense?.note && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
48771
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "flex flex-col", children: [
48772
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "capitalize", children: expense?.description }),
48773
+ expense?.note && /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
48637
48774
  ] });
48638
48775
  }
48639
48776
  },
@@ -48642,9 +48779,9 @@ function ExpensesJournal3({ url }) {
48642
48779
  header: "Amount",
48643
48780
  cell: ({ row }) => {
48644
48781
  const expense = row.original;
48645
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
48646
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
48647
- expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
48782
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "", children: [
48783
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
48784
+ expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
48648
48785
  "rate ",
48649
48786
  expense?.exchange?.rate,
48650
48787
  " ,",
@@ -48662,23 +48799,23 @@ function ExpensesJournal3({ url }) {
48662
48799
  header: "Actions",
48663
48800
  cell: ({ row }) => {
48664
48801
  const data2 = row.original;
48665
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48802
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48666
48803
  Dropdown,
48667
48804
  {
48668
48805
  className: "cursor-pointer w-[150px]",
48669
48806
  items: items(data2),
48670
48807
  triggerMode: "hover",
48671
- children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.EllipsisVertical, {})
48808
+ children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(import_lucide_react126.EllipsisVertical, {})
48672
48809
  }
48673
48810
  );
48674
48811
  }
48675
48812
  }
48676
48813
  ];
48677
48814
  const expenses = data?.data || [];
48678
- return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
48679
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
48680
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Modal2, {}),
48681
- /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
48815
+ return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
48816
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(TransactionView, {}),
48817
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Modal2, {}),
48818
+ /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48682
48819
  TransactionViewComponent,
48683
48820
  {
48684
48821
  columns,
@@ -48697,11 +48834,11 @@ function ExpensesJournal3({ url }) {
48697
48834
  var ExpensesJournal_default = ExpensesJournal3;
48698
48835
 
48699
48836
  // src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
48700
- var import_react162 = require("react");
48701
- var import_react_router_dom127 = require("react-router-dom");
48837
+ var import_react163 = require("react");
48838
+ var import_react_router_dom128 = require("react-router-dom");
48702
48839
  var import_react_hook_form75 = require("react-hook-form");
48703
48840
  var import_zod126 = require("@hookform/resolvers/zod");
48704
- var import_antd97 = require("antd");
48841
+ var import_antd98 = require("antd");
48705
48842
 
48706
48843
  // src/components/Transactions/3/expenseJournal/schema.ts
48707
48844
  var import_zod125 = require("zod");
@@ -48716,13 +48853,13 @@ var expenseSchema5 = import_zod125.z.object({
48716
48853
  });
48717
48854
 
48718
48855
  // src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
48719
- var import_jsx_runtime267 = require("react/jsx-runtime");
48856
+ var import_jsx_runtime268 = require("react/jsx-runtime");
48720
48857
  function ExpensesJournal3Form() {
48721
- const { branchId } = (0, import_react_router_dom127.useParams)();
48858
+ const { branchId } = (0, import_react_router_dom128.useParams)();
48722
48859
  const { getQuery, navigate } = useApp_default();
48723
48860
  const id = getQuery("id");
48724
48861
  const isEdit = !!id;
48725
- const [ref2, setRef] = (0, import_react162.useState)("");
48862
+ const [ref2, setRef] = (0, import_react163.useState)("");
48726
48863
  const { post, isLoading } = useApis_default();
48727
48864
  const { isLoading: isLoadingGet, get } = useApis_default();
48728
48865
  const { defaultCurrency } = useWarqadConfig().currencies;
@@ -48741,7 +48878,7 @@ function ExpensesJournal3Form() {
48741
48878
  const isRate = currency && currency !== defaultCurrency;
48742
48879
  const amount = watch("amount");
48743
48880
  const rate = watch("rate");
48744
- const exchangedAmount2 = (0, import_react162.useMemo)(() => {
48881
+ const exchangedAmount2 = (0, import_react163.useMemo)(() => {
48745
48882
  if (isRate) {
48746
48883
  const am = forex_default.exchangedAmount({
48747
48884
  accountCurrency: defaultCurrency,
@@ -48765,10 +48902,10 @@ function ExpensesJournal3Form() {
48765
48902
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
48766
48903
  body: payload
48767
48904
  });
48768
- import_antd97.message.success(`Expense saved successfully`);
48905
+ import_antd98.message.success(`Expense saved successfully`);
48769
48906
  navigate(-1);
48770
48907
  } catch (error) {
48771
- import_antd97.message.error(error?.message || "Something went wrong");
48908
+ import_antd98.message.error(error?.message || "Something went wrong");
48772
48909
  }
48773
48910
  };
48774
48911
  const fetches = async () => {
@@ -48783,34 +48920,34 @@ function ExpensesJournal3Form() {
48783
48920
  });
48784
48921
  setRef(data?.ref);
48785
48922
  } catch (error) {
48786
- import_antd97.message.error(error?.message || "Something went wrong");
48923
+ import_antd98.message.error(error?.message || "Something went wrong");
48787
48924
  navigate(-1);
48788
48925
  }
48789
48926
  };
48790
- (0, import_react162.useEffect)(() => {
48927
+ (0, import_react163.useEffect)(() => {
48791
48928
  if (isEdit) {
48792
48929
  fetches();
48793
48930
  }
48794
48931
  }, [id]);
48795
- return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
48932
+ return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48796
48933
  Card,
48797
48934
  {
48798
48935
  className: "max-w-4xl mx-auto mt-10 relative",
48799
48936
  isLoading: isLoadingGet,
48800
48937
  loadingText: "Processing...",
48801
48938
  children: [
48802
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(Card.Header, { children: [
48803
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
48804
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
48939
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(Card.Header, { children: [
48940
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
48941
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
48805
48942
  ] }),
48806
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
48943
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
48807
48944
  "form",
48808
48945
  {
48809
48946
  className: "space-y-4",
48810
48947
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
48811
48948
  children: [
48812
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48813
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48949
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48950
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48814
48951
  Fields_default.Input,
48815
48952
  {
48816
48953
  label: "Description",
@@ -48820,7 +48957,7 @@ function ExpensesJournal3Form() {
48820
48957
  required: true
48821
48958
  }
48822
48959
  ),
48823
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48960
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48824
48961
  Fields_default.Select,
48825
48962
  {
48826
48963
  label: "Currency",
@@ -48831,8 +48968,8 @@ function ExpensesJournal3Form() {
48831
48968
  }
48832
48969
  )
48833
48970
  ] }),
48834
- /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48835
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48971
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
48972
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48836
48973
  Fields_default.DateInput,
48837
48974
  {
48838
48975
  label: "Date",
@@ -48841,7 +48978,7 @@ function ExpensesJournal3Form() {
48841
48978
  required: true
48842
48979
  }
48843
48980
  ),
48844
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48981
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48845
48982
  Fields_default.Input,
48846
48983
  {
48847
48984
  label: "Amount",
@@ -48852,8 +48989,8 @@ function ExpensesJournal3Form() {
48852
48989
  required: true
48853
48990
  }
48854
48991
  ),
48855
- isRate && /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
48856
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
48992
+ isRate && /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
48993
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48857
48994
  Fields_default.Input,
48858
48995
  {
48859
48996
  label: "Rate",
@@ -48864,7 +49001,7 @@ function ExpensesJournal3Form() {
48864
49001
  required: true
48865
49002
  }
48866
49003
  ),
48867
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49004
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48868
49005
  Fields_default.Input,
48869
49006
  {
48870
49007
  label: "Exchanged Amount",
@@ -48876,7 +49013,7 @@ function ExpensesJournal3Form() {
48876
49013
  )
48877
49014
  ] })
48878
49015
  ] }),
48879
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49016
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48880
49017
  Fields_default.Textarea,
48881
49018
  {
48882
49019
  label: "Note",
@@ -48885,7 +49022,7 @@ function ExpensesJournal3Form() {
48885
49022
  placeholder: "Add any additional details..."
48886
49023
  }
48887
49024
  ),
48888
- /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
49025
+ /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
48889
49026
  Button,
48890
49027
  {
48891
49028
  isLoading,
@@ -48930,21 +49067,21 @@ var Transaction3 = {
48930
49067
  var __default = Transaction3;
48931
49068
 
48932
49069
  // src/components/reports/ItemReport.tsx
48933
- var import_react_router_dom128 = require("react-router-dom");
49070
+ var import_react_router_dom129 = require("react-router-dom");
48934
49071
  var import_zod127 = require("zod");
48935
49072
  var import_react_hook_form76 = require("react-hook-form");
48936
49073
  var import_zod128 = require("@hookform/resolvers/zod");
48937
- var import_react163 = require("react");
48938
- var import_antd98 = require("antd");
48939
- var import_jsx_runtime268 = require("react/jsx-runtime");
49074
+ var import_react164 = require("react");
49075
+ var import_antd99 = require("antd");
49076
+ var import_jsx_runtime269 = require("react/jsx-runtime");
48940
49077
  var ItemReport = ({
48941
49078
  value = false,
48942
49079
  type
48943
49080
  }) => {
48944
49081
  const { apiConfig } = useWarqadConfig();
48945
- const { branchId } = (0, import_react_router_dom128.useParams)();
49082
+ const { branchId } = (0, import_react_router_dom129.useParams)();
48946
49083
  const { branches } = useAuth_default();
48947
- const [params, setParams] = (0, import_react163.useState)({
49084
+ const [params, setParams] = (0, import_react164.useState)({
48948
49085
  id: "",
48949
49086
  branch: "all"
48950
49087
  });
@@ -48969,9 +49106,9 @@ var ItemReport = ({
48969
49106
  header: "Date",
48970
49107
  key: "date",
48971
49108
  className: "text-xs whitespace-nowrap",
48972
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
48973
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
48974
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49109
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "", children: [
49110
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
49111
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
48975
49112
  "span",
48976
49113
  {
48977
49114
  onClick: () => {
@@ -48990,7 +49127,7 @@ var ItemReport = ({
48990
49127
  header: "Description",
48991
49128
  key: "description",
48992
49129
  className: "text-xs whitespace-nowrap",
48993
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
49130
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
48994
49131
  },
48995
49132
  {
48996
49133
  header: "Quantity",
@@ -48998,7 +49135,7 @@ var ItemReport = ({
48998
49135
  className: "text-xs whitespace-nowrap",
48999
49136
  render: (row) => {
49000
49137
  const Qty = row.quantity;
49001
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49138
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49002
49139
  "div",
49003
49140
  {
49004
49141
  className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
@@ -49015,7 +49152,7 @@ var ItemReport = ({
49015
49152
  header: "Balance",
49016
49153
  key: "runningBalance",
49017
49154
  className: "text-xs whitespace-nowrap",
49018
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
49155
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
49019
49156
  }
49020
49157
  ];
49021
49158
  let runningBalance = 0;
@@ -49027,10 +49164,10 @@ var ItemReport = ({
49027
49164
  };
49028
49165
  });
49029
49166
  const itemName = datas[0]?.name;
49030
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
49031
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Modal2, {}),
49032
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(TransactionView, {}),
49033
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49167
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
49168
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Modal2, {}),
49169
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
49170
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49034
49171
  A4DataView,
49035
49172
  {
49036
49173
  columns,
@@ -49041,14 +49178,14 @@ var ItemReport = ({
49041
49178
  tableTitle: `${type} Movement Report`,
49042
49179
  fixed: false,
49043
49180
  error: !id ? "Please select an item" : void 0,
49044
- headers: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49181
+ headers: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49045
49182
  Button,
49046
49183
  {
49047
49184
  type: "button",
49048
49185
  size: "sm",
49049
49186
  onClick: () => openState({
49050
49187
  title: "Item Transactions",
49051
- content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49188
+ content: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49052
49189
  ItemReportHeader2,
49053
49190
  {
49054
49191
  type,
@@ -49091,14 +49228,14 @@ function ItemReportHeader2({
49091
49228
  label: b.name,
49092
49229
  value: b._id
49093
49230
  }));
49094
- return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
49231
+ return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(
49095
49232
  "form",
49096
49233
  {
49097
49234
  className: "space-y-3",
49098
49235
  onSubmit: handleSubmit((data) => {
49099
49236
  const id = type === "pack" ? data.pack : data.product;
49100
49237
  if (!id) {
49101
- import_antd98.message.error("Please select an item");
49238
+ import_antd99.message.error("Please select an item");
49102
49239
  methods.setFocus(type);
49103
49240
  return;
49104
49241
  }
@@ -49109,8 +49246,8 @@ function ItemReportHeader2({
49109
49246
  close();
49110
49247
  }),
49111
49248
  children: [
49112
- /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
49113
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49249
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
49250
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49114
49251
  Select,
49115
49252
  {
49116
49253
  options: [{ label: "All Branches", value: "all" }, ...branchOptions],
@@ -49118,7 +49255,7 @@ function ItemReportHeader2({
49118
49255
  name: "branch"
49119
49256
  }
49120
49257
  ),
49121
- type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49258
+ type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49122
49259
  Pack_default.Pack,
49123
49260
  {
49124
49261
  api: "/packs/get",
@@ -49126,7 +49263,7 @@ function ItemReportHeader2({
49126
49263
  form: methods,
49127
49264
  name: "pack"
49128
49265
  }
49129
- ) : /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
49266
+ ) : /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49130
49267
  Feilds_default5.Product,
49131
49268
  {
49132
49269
  label: "",
@@ -49137,7 +49274,7 @@ function ItemReportHeader2({
49137
49274
  }
49138
49275
  )
49139
49276
  ] }),
49140
- /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Button, { type: "submit", children: "Filter" }) })
49277
+ /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(Button, { type: "submit", children: "Filter" }) })
49141
49278
  ]
49142
49279
  }
49143
49280
  );
@@ -49145,19 +49282,19 @@ function ItemReportHeader2({
49145
49282
  var ItemReport_default = ItemReport;
49146
49283
 
49147
49284
  // src/components/accounts/LeaseCollection.tsx
49148
- var import_react_router_dom129 = require("react-router-dom");
49149
- var import_react164 = require("react");
49150
- var import_jsx_runtime269 = require("react/jsx-runtime");
49285
+ var import_react_router_dom130 = require("react-router-dom");
49286
+ var import_react165 = require("react");
49287
+ var import_jsx_runtime270 = require("react/jsx-runtime");
49151
49288
  var LeaseCollection = ({
49152
49289
  leaseType,
49153
49290
  defaultCurrency = "KES"
49154
49291
  }) => {
49155
- const navigate = (0, import_react_router_dom129.useNavigate)();
49156
- const [searchParams] = (0, import_react_router_dom129.useSearchParams)();
49292
+ const navigate = (0, import_react_router_dom130.useNavigate)();
49293
+ const [searchParams] = (0, import_react_router_dom130.useSearchParams)();
49157
49294
  const { apiConfig } = useWarqadConfig();
49158
- const { branchId } = (0, import_react_router_dom129.useParams)();
49295
+ const { branchId } = (0, import_react_router_dom130.useParams)();
49159
49296
  const { branches } = useAuth_default();
49160
- const currentBranch = (0, import_react164.useMemo)(
49297
+ const currentBranch = (0, import_react165.useMemo)(
49161
49298
  () => branches?.find((b) => b?._id === branchId),
49162
49299
  [branches, branchId]
49163
49300
  );
@@ -49165,16 +49302,16 @@ var LeaseCollection = ({
49165
49302
  const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
49166
49303
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
49167
49304
  const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
49168
- const [filter, setFilter] = (0, import_react164.useState)(
49305
+ const [filter, setFilter] = (0, import_react165.useState)(
49169
49306
  initialFilter
49170
49307
  );
49171
- const [currencyFilter, setCurrencyFilter] = (0, import_react164.useState)(initialCurrency);
49172
- (0, import_react164.useEffect)(() => {
49308
+ const [currencyFilter, setCurrencyFilter] = (0, import_react165.useState)(initialCurrency);
49309
+ (0, import_react165.useEffect)(() => {
49173
49310
  if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
49174
49311
  setFilter(urlFilter);
49175
49312
  }
49176
49313
  }, [urlFilter]);
49177
- (0, import_react164.useEffect)(() => {
49314
+ (0, import_react165.useEffect)(() => {
49178
49315
  if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
49179
49316
  setCurrencyFilter(urlCurrency);
49180
49317
  } else {
@@ -49193,9 +49330,9 @@ var LeaseCollection = ({
49193
49330
  key: "name",
49194
49331
  className: "text-xs whitespace-nowrap ",
49195
49332
  searchKeys: ["name", "phoneNumber", "unitNames"],
49196
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "space-y-1", children: [
49197
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
49198
- row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("p", { className: "text-[9px]! capitalize", children: [
49333
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "space-y-1", children: [
49334
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
49335
+ row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("p", { className: "text-[9px]! capitalize", children: [
49199
49336
  "(",
49200
49337
  row.unitNames,
49201
49338
  ")"
@@ -49207,7 +49344,7 @@ var LeaseCollection = ({
49207
49344
  key: "phoneNumber",
49208
49345
  maxWidth: 70,
49209
49346
  render: (row) => {
49210
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { children: row?.phoneNumber || "N/A" });
49347
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { children: row?.phoneNumber || "N/A" });
49211
49348
  }
49212
49349
  },
49213
49350
  // </span>
@@ -49217,11 +49354,11 @@ var LeaseCollection = ({
49217
49354
  className: "text-xs whitespace-nowrap text-right",
49218
49355
  render: (row) => {
49219
49356
  const Amount = row.totalCollectionString;
49220
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold ", children: Amount }) });
49357
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("p", { className: "font-bold ", children: Amount }) });
49221
49358
  },
49222
49359
  renderFooter: (data2) => {
49223
49360
  if (currencyFilter === "all") return;
49224
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: " font-bold", children: Formats_default.Price(
49361
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("span", { className: " font-bold", children: Formats_default.Price(
49225
49362
  data2.reduce((acc, row) => acc + row.totalCollection, 0),
49226
49363
  defaultCurrency,
49227
49364
  false
@@ -49229,7 +49366,7 @@ var LeaseCollection = ({
49229
49366
  }
49230
49367
  }
49231
49368
  ];
49232
- const datas = (0, import_react164.useMemo)(() => {
49369
+ const datas = (0, import_react165.useMemo)(() => {
49233
49370
  let runningBalance = 0;
49234
49371
  let filteredData = data?.data || [];
49235
49372
  const result = filteredData.map((item) => {
@@ -49242,9 +49379,9 @@ var LeaseCollection = ({
49242
49379
  });
49243
49380
  return result;
49244
49381
  }, [filter, currencyFilter, data]);
49245
- return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
49246
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
49247
- /* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
49382
+ return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
49383
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(TransactionView, {}),
49384
+ /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49248
49385
  A4DataView,
49249
49386
  {
49250
49387
  columns,
@@ -49254,7 +49391,7 @@ var LeaseCollection = ({
49254
49391
  subtitle: `All Collections`,
49255
49392
  fixed: false,
49256
49393
  startPage: 1e9,
49257
- headers: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex gap-2" })
49394
+ headers: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("div", { className: "flex gap-2" })
49258
49395
  }
49259
49396
  )
49260
49397
  ] });
@@ -49262,10 +49399,10 @@ var LeaseCollection = ({
49262
49399
  var LeaseCollection_default = LeaseCollection;
49263
49400
 
49264
49401
  // src/components/Transactions/cargoIM/CargoIM.tsx
49265
- var import_react_router_dom133 = require("react-router-dom");
49402
+ var import_react_router_dom134 = require("react-router-dom");
49266
49403
  var import_lucide_react128 = require("lucide-react");
49267
- var import_react168 = require("react");
49268
- var import_antd102 = require("antd");
49404
+ var import_react169 = require("react");
49405
+ var import_antd103 = require("antd");
49269
49406
 
49270
49407
  // src/components/Transactions/cargoIM/schema.ts
49271
49408
  var import_zod130 = require("zod");
@@ -49299,16 +49436,16 @@ var journalSchema5 = import_zod130.z.object({
49299
49436
  // src/components/Transactions/cargoIM/AccountForm.tsx
49300
49437
  var import_react_hook_form77 = require("react-hook-form");
49301
49438
  var import_zod131 = require("@hookform/resolvers/zod");
49302
- var import_antd99 = require("antd");
49303
- var import_react165 = require("react");
49304
- var import_react_router_dom130 = require("react-router-dom");
49305
- var import_jsx_runtime270 = require("react/jsx-runtime");
49439
+ var import_antd100 = require("antd");
49440
+ var import_react166 = require("react");
49441
+ var import_react_router_dom131 = require("react-router-dom");
49442
+ var import_jsx_runtime271 = require("react/jsx-runtime");
49306
49443
  function AccountForm3({
49307
49444
  onReload,
49308
49445
  close,
49309
49446
  id
49310
49447
  }) {
49311
- const { branchId } = (0, import_react_router_dom130.useParams)();
49448
+ const { branchId } = (0, import_react_router_dom131.useParams)();
49312
49449
  const { currencies } = useWarqadConfig();
49313
49450
  const { stock } = currencies;
49314
49451
  const isEdit = !!id;
@@ -49346,7 +49483,7 @@ function AccountForm3({
49346
49483
  body: payload
49347
49484
  });
49348
49485
  }
49349
- import_antd99.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
49486
+ import_antd100.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
49350
49487
  if (onReload) {
49351
49488
  onReload();
49352
49489
  }
@@ -49354,7 +49491,7 @@ function AccountForm3({
49354
49491
  close();
49355
49492
  }
49356
49493
  } catch (error) {
49357
- import_antd99.message.error(error?.message || "Something went wrong");
49494
+ import_antd100.message.error(error?.message || "Something went wrong");
49358
49495
  }
49359
49496
  };
49360
49497
  const fetches = async () => {
@@ -49365,33 +49502,33 @@ function AccountForm3({
49365
49502
  const data = res.data;
49366
49503
  methods.reset(data);
49367
49504
  } catch (error) {
49368
- import_antd99.message.error(error?.message || "Something went wrong");
49505
+ import_antd100.message.error(error?.message || "Something went wrong");
49369
49506
  close?.();
49370
49507
  }
49371
49508
  };
49372
- (0, import_react165.useEffect)(() => {
49509
+ (0, import_react166.useEffect)(() => {
49373
49510
  if (isEdit) {
49374
49511
  fetches();
49375
49512
  }
49376
49513
  }, [id]);
49377
- return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
49514
+ return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49378
49515
  Card,
49379
49516
  {
49380
49517
  className: "max-w-4xl mx-auto mt-10 relative",
49381
49518
  isLoading: isLoadingGet,
49382
49519
  loadingText: "Processing...",
49383
49520
  children: [
49384
- /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(Card.Header, { children: [
49385
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
49386
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
49521
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Card.Header, { children: [
49522
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
49523
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
49387
49524
  ] }),
49388
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
49525
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49389
49526
  "form",
49390
49527
  {
49391
49528
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
49392
49529
  children: [
49393
- /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49394
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49530
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49531
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49395
49532
  Fields_default.Input,
49396
49533
  {
49397
49534
  label: "Name",
@@ -49402,7 +49539,7 @@ function AccountForm3({
49402
49539
  required: true
49403
49540
  }
49404
49541
  ),
49405
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49542
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49406
49543
  Fields_default.PhoneInput,
49407
49544
  {
49408
49545
  label: "Phone Number",
@@ -49411,7 +49548,7 @@ function AccountForm3({
49411
49548
  placeholder: "Enter phone number"
49412
49549
  }
49413
49550
  ),
49414
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49551
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49415
49552
  Fields_default.Select,
49416
49553
  {
49417
49554
  label: "Currency",
@@ -49422,7 +49559,7 @@ function AccountForm3({
49422
49559
  }
49423
49560
  )
49424
49561
  ] }),
49425
- /* @__PURE__ */ (0, import_jsx_runtime270.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
49562
+ /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49426
49563
  Button,
49427
49564
  {
49428
49565
  isLoading,
@@ -49443,36 +49580,36 @@ function AccountForm3({
49443
49580
  var AccountForm_default3 = AccountForm3;
49444
49581
 
49445
49582
  // src/components/Transactions/cargoIM/InvoiceForm.tsx
49446
- var import_react166 = require("react");
49583
+ var import_react167 = require("react");
49447
49584
  var import_react_hook_form78 = require("react-hook-form");
49448
49585
  var import_zod132 = require("@hookform/resolvers/zod");
49449
- var import_react_router_dom131 = require("react-router-dom");
49450
- var import_antd100 = require("antd");
49586
+ var import_react_router_dom132 = require("react-router-dom");
49587
+ var import_antd101 = require("antd");
49451
49588
  var import_lucide_react127 = require("lucide-react");
49452
- var import_dayjs12 = __toESM(require("dayjs"));
49453
- var import_jsx_runtime271 = require("react/jsx-runtime");
49589
+ var import_dayjs13 = __toESM(require("dayjs"));
49590
+ var import_jsx_runtime272 = require("react/jsx-runtime");
49454
49591
  function InvoiceForm2({
49455
49592
  onReload,
49456
49593
  close,
49457
49594
  accountData,
49458
49595
  id
49459
49596
  }) {
49460
- const { branchId } = (0, import_react_router_dom131.useParams)();
49461
- const [ref2, setRef] = (0, import_react166.useState)(void 0);
49597
+ const { branchId } = (0, import_react_router_dom132.useParams)();
49598
+ const [ref2, setRef] = (0, import_react167.useState)(void 0);
49462
49599
  const { post, isLoading } = useApis_default();
49463
49600
  const { get, isLoading: getLoading } = useApis_default();
49464
49601
  const { put, isLoading: isLoadingReverse } = useApis_default();
49465
49602
  const isEdit = !!id;
49466
49603
  const { currencies } = useWarqadConfig();
49467
49604
  const { stock: defaultCurrency } = currencies;
49468
- const [itemName, setItemName] = (0, import_react166.useState)("");
49469
- const [itemQuantity, setItemQuantity] = (0, import_react166.useState)("");
49470
- const [itemPrice, setItemPrice] = (0, import_react166.useState)("");
49605
+ const [itemName, setItemName] = (0, import_react167.useState)("");
49606
+ const [itemQuantity, setItemQuantity] = (0, import_react167.useState)("");
49607
+ const [itemPrice, setItemPrice] = (0, import_react167.useState)("");
49471
49608
  const methods = (0, import_react_hook_form78.useForm)({
49472
49609
  resolver: (0, import_zod132.zodResolver)(createInvoiceManagerValidation2),
49473
49610
  defaultValues: {
49474
49611
  invoices: [],
49475
- date: (0, import_dayjs12.default)().format("DD/MM/YYYY"),
49612
+ date: (0, import_dayjs13.default)().format("DD/MM/YYYY"),
49476
49613
  currency: defaultCurrency,
49477
49614
  branch: branchId ? branchId : void 0
49478
49615
  }
@@ -49493,27 +49630,27 @@ function InvoiceForm2({
49493
49630
  });
49494
49631
  setRef(data?.ref);
49495
49632
  } catch (error) {
49496
- import_antd100.message.error(error?.message || "Something went wrong");
49633
+ import_antd101.message.error(error?.message || "Something went wrong");
49497
49634
  }
49498
49635
  };
49499
- (0, import_react166.useEffect)(() => {
49636
+ (0, import_react167.useEffect)(() => {
49500
49637
  if (isEdit) {
49501
49638
  fetches();
49502
49639
  }
49503
49640
  }, [isEdit]);
49504
49641
  const handleAddItem = () => {
49505
49642
  if (!itemName.trim()) {
49506
- import_antd100.message.error("Item name is required");
49643
+ import_antd101.message.error("Item name is required");
49507
49644
  return;
49508
49645
  }
49509
49646
  const qty = Number(itemQuantity);
49510
49647
  const price = Number(itemPrice);
49511
49648
  if (isNaN(qty) || qty <= 0) {
49512
- import_antd100.message.error("Quantity must be greater than 0");
49649
+ import_antd101.message.error("Quantity must be greater than 0");
49513
49650
  return;
49514
49651
  }
49515
49652
  if (isNaN(price) || price <= 0) {
49516
- import_antd100.message.error("Price must be greater than 0");
49653
+ import_antd101.message.error("Price must be greater than 0");
49517
49654
  return;
49518
49655
  }
49519
49656
  append({
@@ -49527,7 +49664,7 @@ function InvoiceForm2({
49527
49664
  };
49528
49665
  const onSubmit = async (data) => {
49529
49666
  if (data.invoices.length === 0) {
49530
- import_antd100.message.error("Please add at least one item to the invoice");
49667
+ import_antd101.message.error("Please add at least one item to the invoice");
49531
49668
  return;
49532
49669
  }
49533
49670
  try {
@@ -49540,13 +49677,13 @@ function InvoiceForm2({
49540
49677
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
49541
49678
  body: payload
49542
49679
  });
49543
- import_antd100.message.success(
49680
+ import_antd101.message.success(
49544
49681
  isEdit ? "Invoice updated successfully" : "Invoice created successfully"
49545
49682
  );
49546
49683
  if (onReload) onReload();
49547
49684
  if (close) close();
49548
49685
  } catch (error) {
49549
- import_antd100.message.error(error?.message || "Something went wrong");
49686
+ import_antd101.message.error(error?.message || "Something went wrong");
49550
49687
  }
49551
49688
  };
49552
49689
  const onReverse = async () => {
@@ -49555,11 +49692,11 @@ function InvoiceForm2({
49555
49692
  await put({
49556
49693
  url: `/transactions/reverse/${id}`
49557
49694
  });
49558
- import_antd100.message.success("Transaction reversed successfully");
49695
+ import_antd101.message.success("Transaction reversed successfully");
49559
49696
  if (onReload) onReload();
49560
49697
  if (close) close();
49561
49698
  } catch (error) {
49562
- import_antd100.message.error(error?.message || "Something went wrong");
49699
+ import_antd101.message.error(error?.message || "Something went wrong");
49563
49700
  }
49564
49701
  };
49565
49702
  const handleKeyDown = (e) => {
@@ -49571,25 +49708,25 @@ function InvoiceForm2({
49571
49708
  e.preventDefault();
49572
49709
  }
49573
49710
  };
49574
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49711
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49575
49712
  Card,
49576
49713
  {
49577
49714
  isLoading: getLoading,
49578
49715
  className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49579
- children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Card.Content, { children: [
49580
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("input", { type: "hidden", ...register("currency") }),
49581
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49716
+ children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(Card.Content, { children: [
49717
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("input", { type: "hidden", ...register("currency") }),
49718
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
49582
49719
  "form",
49583
49720
  {
49584
49721
  onSubmit: handleSubmit(onSubmit),
49585
49722
  onKeyDown: handleKeyDown,
49586
49723
  className: "space-y-6",
49587
49724
  children: [
49588
- /* @__PURE__ */ (0, import_jsx_runtime271.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: [
49589
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
49590
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
49591
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
49592
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49725
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
49726
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
49727
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
49728
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
49729
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49593
49730
  Fields_default.Input,
49594
49731
  {
49595
49732
  label: "Container No",
@@ -49598,7 +49735,7 @@ function InvoiceForm2({
49598
49735
  onChange: (val) => setItemName(val)
49599
49736
  }
49600
49737
  ),
49601
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49738
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49602
49739
  Fields_default.Input,
49603
49740
  {
49604
49741
  label: "Cbm",
@@ -49608,7 +49745,7 @@ function InvoiceForm2({
49608
49745
  onChange: (val) => setItemQuantity(val)
49609
49746
  }
49610
49747
  ),
49611
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49748
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49612
49749
  Fields_default.Input,
49613
49750
  {
49614
49751
  label: "Price (KES)",
@@ -49619,7 +49756,7 @@ function InvoiceForm2({
49619
49756
  }
49620
49757
  )
49621
49758
  ] }),
49622
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49759
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
49623
49760
  Button,
49624
49761
  {
49625
49762
  type: "button",
@@ -49627,23 +49764,23 @@ function InvoiceForm2({
49627
49764
  className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
49628
49765
  variant: "outline",
49629
49766
  children: [
49630
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(import_lucide_react127.Plus, { size: 16 }),
49767
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_lucide_react127.Plus, { size: 16 }),
49631
49768
  " Add Item"
49632
49769
  ]
49633
49770
  }
49634
49771
  )
49635
49772
  ] })
49636
49773
  ] }),
49637
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { children: [
49638
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
49639
- /* @__PURE__ */ (0, import_jsx_runtime271.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_runtime271.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("table", { className: "w-full text-left border-collapse", children: [
49640
- /* @__PURE__ */ (0, import_jsx_runtime271.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_runtime271.jsxs)("tr", { children: [
49641
- /* @__PURE__ */ (0, import_jsx_runtime271.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: "#" }),
49642
- /* @__PURE__ */ (0, import_jsx_runtime271.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" }),
49643
- /* @__PURE__ */ (0, import_jsx_runtime271.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" }),
49644
- /* @__PURE__ */ (0, import_jsx_runtime271.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" })
49774
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { children: [
49775
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
49776
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("table", { className: "w-full text-left border-collapse", children: [
49777
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("tr", { children: [
49778
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
49779
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
49780
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
49781
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
49645
49782
  ] }) }),
49646
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49783
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49647
49784
  "td",
49648
49785
  {
49649
49786
  colSpan: 4,
@@ -49652,29 +49789,29 @@ function InvoiceForm2({
49652
49789
  }
49653
49790
  ) }) : fields.map((item, index) => {
49654
49791
  const total = item.quantity * item.amount;
49655
- return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
49792
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
49656
49793
  "tr",
49657
49794
  {
49658
49795
  className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
49659
49796
  children: [
49660
- /* @__PURE__ */ (0, import_jsx_runtime271.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 }),
49661
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
49662
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
49663
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
49797
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
49798
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
49799
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
49800
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
49664
49801
  item.quantity,
49665
49802
  " Cbm @",
49666
49803
  " ",
49667
49804
  Formats_default.Price(item.amount, "KES")
49668
49805
  ] })
49669
49806
  ] }),
49670
- /* @__PURE__ */ (0, import_jsx_runtime271.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") }),
49671
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49807
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
49808
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49672
49809
  "button",
49673
49810
  {
49674
49811
  type: "button",
49675
49812
  onClick: () => remove(index),
49676
49813
  className: "text-gray-400 hover:text-red-500 transition-colors p-1",
49677
- children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49814
+ children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49678
49815
  import_lucide_react127.Trash2,
49679
49816
  {
49680
49817
  size: 13,
@@ -49688,8 +49825,8 @@ function InvoiceForm2({
49688
49825
  item.id
49689
49826
  );
49690
49827
  }) }),
49691
- fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime271.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_runtime271.jsxs)("tr", { children: [
49692
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49828
+ fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("tr", { children: [
49829
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49693
49830
  "td",
49694
49831
  {
49695
49832
  colSpan: 2,
@@ -49697,20 +49834,20 @@ function InvoiceForm2({
49697
49834
  children: "Total"
49698
49835
  }
49699
49836
  ),
49700
- /* @__PURE__ */ (0, import_jsx_runtime271.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(
49837
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
49701
49838
  fields.reduce(
49702
49839
  (sum, item) => sum + item.quantity * item.amount,
49703
49840
  0
49704
49841
  ),
49705
49842
  "KES"
49706
49843
  ) }),
49707
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", {})
49844
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("td", {})
49708
49845
  ] }) })
49709
49846
  ] }) }) })
49710
49847
  ] }),
49711
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
49712
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49713
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49848
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
49849
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49850
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49714
49851
  Fields_default.DateInput,
49715
49852
  {
49716
49853
  label: "Date",
@@ -49719,20 +49856,20 @@ function InvoiceForm2({
49719
49856
  required: true
49720
49857
  }
49721
49858
  ),
49722
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
49859
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
49723
49860
  ] }),
49724
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
49725
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49861
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
49862
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49726
49863
  ConfirmModal,
49727
49864
  {
49728
49865
  title: "Reverse Transaction",
49729
- description: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "space-y-3 text-left", children: [
49730
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49731
- /* @__PURE__ */ (0, import_jsx_runtime271.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."' })
49866
+ description: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-3 text-left", children: [
49867
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49868
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49732
49869
  ] }),
49733
49870
  confirmationWord: "delete",
49734
49871
  onSubmit: onReverse,
49735
- children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49872
+ children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49736
49873
  Button,
49737
49874
  {
49738
49875
  type: "button",
@@ -49745,8 +49882,8 @@ function InvoiceForm2({
49745
49882
  )
49746
49883
  }
49747
49884
  ) }),
49748
- /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex justify-end gap-3", children: [
49749
- close && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49885
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-end gap-3", children: [
49886
+ close && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49750
49887
  Button,
49751
49888
  {
49752
49889
  type: "button",
@@ -49756,7 +49893,7 @@ function InvoiceForm2({
49756
49893
  children: "Cancel"
49757
49894
  }
49758
49895
  ),
49759
- /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
49896
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
49760
49897
  Button,
49761
49898
  {
49762
49899
  isLoading,
@@ -49780,13 +49917,13 @@ function InvoiceForm2({
49780
49917
  var InvoiceForm_default2 = InvoiceForm2;
49781
49918
 
49782
49919
  // src/components/Transactions/cargoIM/journalForm.tsx
49783
- var import_react167 = __toESM(require("react"));
49920
+ var import_react168 = __toESM(require("react"));
49784
49921
  var import_react_hook_form79 = require("react-hook-form");
49785
49922
  var import_zod133 = require("@hookform/resolvers/zod");
49786
- var import_react_router_dom132 = require("react-router-dom");
49787
- var import_antd101 = require("antd");
49788
- var import_dayjs13 = __toESM(require("dayjs"));
49789
- var import_jsx_runtime272 = require("react/jsx-runtime");
49923
+ var import_react_router_dom133 = require("react-router-dom");
49924
+ var import_antd102 = require("antd");
49925
+ var import_dayjs14 = __toESM(require("dayjs"));
49926
+ var import_jsx_runtime273 = require("react/jsx-runtime");
49790
49927
  function JournalForm5({
49791
49928
  onReload,
49792
49929
  close,
@@ -49794,10 +49931,10 @@ function JournalForm5({
49794
49931
  action = "debit",
49795
49932
  id
49796
49933
  }) {
49797
- const { branchId } = (0, import_react_router_dom132.useParams)();
49934
+ const { branchId } = (0, import_react_router_dom133.useParams)();
49798
49935
  const { currencies } = useWarqadConfig();
49799
49936
  const { stock: defaultCurrency } = currencies;
49800
- const [ref2, setRef] = import_react167.default.useState(void 0);
49937
+ const [ref2, setRef] = import_react168.default.useState(void 0);
49801
49938
  const { post, isLoading } = useApis_default();
49802
49939
  const { get, isLoading: getLoading } = useApis_default();
49803
49940
  const { put, isLoading: isLoadingReverse } = useApis_default();
@@ -49805,7 +49942,7 @@ function JournalForm5({
49805
49942
  const methods = (0, import_react_hook_form79.useForm)({
49806
49943
  resolver: (0, import_zod133.zodResolver)(journalSchema5),
49807
49944
  defaultValues: {
49808
- date: (0, import_dayjs13.default)().format("DD/MM/YYYY"),
49945
+ date: (0, import_dayjs14.default)().format("DD/MM/YYYY"),
49809
49946
  currency: defaultCurrency,
49810
49947
  action,
49811
49948
  description: "Payment ",
@@ -49825,10 +49962,10 @@ function JournalForm5({
49825
49962
  });
49826
49963
  setRef(data?.ref);
49827
49964
  } catch (error) {
49828
- import_antd101.message.error(error?.message || "Something went wrong");
49965
+ import_antd102.message.error(error?.message || "Something went wrong");
49829
49966
  }
49830
49967
  };
49831
- import_react167.default.useEffect(() => {
49968
+ import_react168.default.useEffect(() => {
49832
49969
  if (isEdit) {
49833
49970
  fetches();
49834
49971
  }
@@ -49846,13 +49983,13 @@ function JournalForm5({
49846
49983
  url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
49847
49984
  body: payload
49848
49985
  });
49849
- import_antd101.message.success(
49986
+ import_antd102.message.success(
49850
49987
  isEdit ? "Journal updated successfully" : "Journal saved successfully"
49851
49988
  );
49852
49989
  if (onReload) onReload();
49853
49990
  if (close) close();
49854
49991
  } catch (error) {
49855
- import_antd101.message.error(error?.message || "Something went wrong");
49992
+ import_antd102.message.error(error?.message || "Something went wrong");
49856
49993
  }
49857
49994
  };
49858
49995
  const onReverse = async () => {
@@ -49861,11 +49998,11 @@ function JournalForm5({
49861
49998
  await put({
49862
49999
  url: `/transactions/reverse/${id}`
49863
50000
  });
49864
- import_antd101.message.success("Transaction reversed successfully");
50001
+ import_antd102.message.success("Transaction reversed successfully");
49865
50002
  if (onReload) onReload();
49866
50003
  if (close) close();
49867
50004
  } catch (error) {
49868
- import_antd101.message.error(error?.message || "Something went wrong");
50005
+ import_antd102.message.error(error?.message || "Something went wrong");
49869
50006
  }
49870
50007
  };
49871
50008
  const handleKeyDown = (e) => {
@@ -49877,19 +50014,19 @@ function JournalForm5({
49877
50014
  e.preventDefault();
49878
50015
  }
49879
50016
  };
49880
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50017
+ return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49881
50018
  Card,
49882
50019
  {
49883
50020
  isLoading: getLoading,
49884
50021
  className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
49885
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
50022
+ children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(
49886
50023
  "form",
49887
50024
  {
49888
50025
  onSubmit: handleSubmit(onSubmit),
49889
50026
  onKeyDown: handleKeyDown,
49890
50027
  className: "space-y-4",
49891
50028
  children: [
49892
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50029
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49893
50030
  Fields_default.Input,
49894
50031
  {
49895
50032
  label: "Description",
@@ -49900,8 +50037,8 @@ function JournalForm5({
49900
50037
  placeholder: "Enter description"
49901
50038
  }
49902
50039
  ),
49903
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49904
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50040
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50041
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49905
50042
  Fields_default.DateInput,
49906
50043
  {
49907
50044
  label: "Date",
@@ -49910,7 +50047,7 @@ function JournalForm5({
49910
50047
  required: true
49911
50048
  }
49912
50049
  ),
49913
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50050
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49914
50051
  Fields_default.Input,
49915
50052
  {
49916
50053
  label: "Currency",
@@ -49920,8 +50057,8 @@ function JournalForm5({
49920
50057
  }
49921
50058
  )
49922
50059
  ] }),
49923
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
49924
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50060
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
50061
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49925
50062
  Fields_default.Input,
49926
50063
  {
49927
50064
  label: "Amount",
@@ -49932,7 +50069,7 @@ function JournalForm5({
49932
50069
  placeholder: "0.00"
49933
50070
  }
49934
50071
  ),
49935
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50072
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49936
50073
  Fields_default.Select,
49937
50074
  {
49938
50075
  label: "Action",
@@ -49946,7 +50083,7 @@ function JournalForm5({
49946
50083
  }
49947
50084
  )
49948
50085
  ] }),
49949
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50086
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49950
50087
  Fields_default.Textarea,
49951
50088
  {
49952
50089
  label: "Note",
@@ -49956,18 +50093,18 @@ function JournalForm5({
49956
50093
  rows: 3
49957
50094
  }
49958
50095
  ),
49959
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
49960
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50096
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
50097
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49961
50098
  ConfirmModal,
49962
50099
  {
49963
50100
  title: "Reverse Transaction",
49964
- description: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-3 text-left", children: [
49965
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
49966
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
50101
+ description: /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "space-y-3 text-left", children: [
50102
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
50103
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
49967
50104
  ] }),
49968
50105
  confirmationWord: "delete",
49969
50106
  onSubmit: onReverse,
49970
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50107
+ children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49971
50108
  Button,
49972
50109
  {
49973
50110
  type: "button",
@@ -49980,8 +50117,8 @@ function JournalForm5({
49980
50117
  )
49981
50118
  }
49982
50119
  ) }),
49983
- /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-end gap-3", children: [
49984
- close && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50120
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex justify-end gap-3", children: [
50121
+ close && /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49985
50122
  Button,
49986
50123
  {
49987
50124
  type: "button",
@@ -49991,7 +50128,7 @@ function JournalForm5({
49991
50128
  children: "Cancel"
49992
50129
  }
49993
50130
  ),
49994
- /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
50131
+ /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
49995
50132
  Button,
49996
50133
  {
49997
50134
  isLoading,
@@ -50013,15 +50150,15 @@ function JournalForm5({
50013
50150
  var journalForm_default2 = JournalForm5;
50014
50151
 
50015
50152
  // src/components/Transactions/cargoIM/CargoIM.tsx
50016
- var import_jsx_runtime273 = require("react/jsx-runtime");
50153
+ var import_jsx_runtime274 = require("react/jsx-runtime");
50017
50154
  function CargoIM({ v, url }) {
50018
- const { branchId } = (0, import_react_router_dom133.useParams)();
50155
+ const { branchId } = (0, import_react_router_dom134.useParams)();
50019
50156
  const { apiConfig } = useWarqadConfig();
50020
50157
  const { width } = useMediaSize();
50021
50158
  const isLargeScreen = width > 768;
50022
- const navigate = (0, import_react_router_dom133.useNavigate)();
50159
+ const navigate = (0, import_react_router_dom134.useNavigate)();
50023
50160
  const type = "supplier";
50024
- const [deleteAccount, setDeleteAccount] = (0, import_react168.useState)(null);
50161
+ const [deleteAccount, setDeleteAccount] = (0, import_react169.useState)(null);
50025
50162
  const { isLoading: isActionLoading, remove } = useApis_default();
50026
50163
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
50027
50164
  url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
@@ -50032,17 +50169,17 @@ function CargoIM({ v, url }) {
50032
50169
  const items = (data2) => [
50033
50170
  {
50034
50171
  label: `Edit ${type}`,
50035
- icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
50172
+ icon: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
50036
50173
  onClick: () => openState({
50037
50174
  type: "Account",
50038
- content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
50175
+ content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
50039
50176
  title: "Account Form",
50040
50177
  width: 800
50041
50178
  })
50042
50179
  },
50043
50180
  {
50044
50181
  label: `Delete ${type}`,
50045
- icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
50182
+ icon: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
50046
50183
  onClick: () => setDeleteAccount(data2)
50047
50184
  }
50048
50185
  ].filter(Boolean);
@@ -50053,7 +50190,7 @@ function CargoIM({ v, url }) {
50053
50190
  className: "w-full",
50054
50191
  cell: ({ row }) => {
50055
50192
  const account = row.original;
50056
- return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50193
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50057
50194
  "span",
50058
50195
  {
50059
50196
  onClick: () => navigate(`${account?._id}`),
@@ -50082,8 +50219,8 @@ function CargoIM({ v, url }) {
50082
50219
  className: "w-px whitespace-nowrap",
50083
50220
  cell: ({ row }) => {
50084
50221
  const data2 = row.original;
50085
- return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex gap-4 items-center", children: [
50086
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50222
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "flex gap-4 items-center", children: [
50223
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50087
50224
  "button",
50088
50225
  {
50089
50226
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -50091,7 +50228,7 @@ function CargoIM({ v, url }) {
50091
50228
  openState({
50092
50229
  type: "credit",
50093
50230
  closeOnOverlayClick: false,
50094
- content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50231
+ content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50095
50232
  InvoiceForm_default2,
50096
50233
  {
50097
50234
  onReload: reload,
@@ -50106,7 +50243,7 @@ function CargoIM({ v, url }) {
50106
50243
  children: "Inv"
50107
50244
  }
50108
50245
  ),
50109
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50246
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50110
50247
  "button",
50111
50248
  {
50112
50249
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -50114,7 +50251,7 @@ function CargoIM({ v, url }) {
50114
50251
  openState({
50115
50252
  type: "debit",
50116
50253
  closeOnOverlayClick: false,
50117
- content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50254
+ content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50118
50255
  journalForm_default2,
50119
50256
  {
50120
50257
  onReload: reload,
@@ -50130,14 +50267,14 @@ function CargoIM({ v, url }) {
50130
50267
  children: "Pay"
50131
50268
  }
50132
50269
  ),
50133
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50270
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50134
50271
  Dropdown,
50135
50272
  {
50136
50273
  className: "cursor-pointer",
50137
50274
  width: "w-[150px]",
50138
50275
  items: items(data2),
50139
50276
  triggerMode: "hover",
50140
- children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.EllipsisVertical, {})
50277
+ children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(import_lucide_react128.EllipsisVertical, {})
50141
50278
  }
50142
50279
  )
50143
50280
  ] });
@@ -50153,17 +50290,17 @@ function CargoIM({ v, url }) {
50153
50290
  const onDelete = async (id) => {
50154
50291
  try {
50155
50292
  await remove({ url: `/accounts/delete/${id}` });
50156
- import_antd102.message.success("Account deleted successfully");
50293
+ import_antd103.message.success("Account deleted successfully");
50157
50294
  reload();
50158
50295
  setDeleteAccount(null);
50159
50296
  } catch (error) {
50160
- import_antd102.message.error(error.message || "Something went wrong");
50297
+ import_antd103.message.error(error.message || "Something went wrong");
50161
50298
  return error;
50162
50299
  }
50163
50300
  };
50164
- return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [
50165
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Modal2, {}),
50166
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50301
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_jsx_runtime274.Fragment, { children: [
50302
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Modal2, {}),
50303
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50167
50304
  ConfirmModal,
50168
50305
  {
50169
50306
  isOpen: !!deleteAccount,
@@ -50176,7 +50313,7 @@ function CargoIM({ v, url }) {
50176
50313
  children: null
50177
50314
  }
50178
50315
  ),
50179
- /* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
50316
+ /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50180
50317
  TransactionViewComponent,
50181
50318
  {
50182
50319
  columns,
@@ -50187,7 +50324,7 @@ function CargoIM({ v, url }) {
50187
50324
  onCreate: () => {
50188
50325
  openState({
50189
50326
  type: "account",
50190
- content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(AccountForm_default3, { onReload: reload, close }),
50327
+ content: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(AccountForm_default3, { onReload: reload, close }),
50191
50328
  title: "Account Form",
50192
50329
  width: 800
50193
50330
  });
@@ -50199,9 +50336,9 @@ function CargoIM({ v, url }) {
50199
50336
  var CargoIM_default = CargoIM;
50200
50337
 
50201
50338
  // src/components/Transactions/cargoIM/cargoIMReport.tsx
50202
- var import_react_router_dom134 = require("react-router-dom");
50203
- var import_react169 = require("react");
50204
- var import_jsx_runtime274 = require("react/jsx-runtime");
50339
+ var import_react_router_dom135 = require("react-router-dom");
50340
+ var import_react170 = require("react");
50341
+ var import_jsx_runtime275 = require("react/jsx-runtime");
50205
50342
  var CargoIMReport = () => {
50206
50343
  const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
50207
50344
  const { TransactionView, openTransaction } = useTransactionView_default();
@@ -50214,10 +50351,10 @@ var CargoIMReport = () => {
50214
50351
  value: currency2
50215
50352
  };
50216
50353
  });
50217
- const [searchParams, setSearchParams] = (0, import_react_router_dom134.useSearchParams)();
50354
+ const [searchParams, setSearchParams] = (0, import_react_router_dom135.useSearchParams)();
50218
50355
  const urlCurrency = searchParams.get("currency")?.toUpperCase();
50219
50356
  const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
50220
- const [currencyFilter, setCurrencyFilter] = (0, import_react169.useState)(initialCurrency);
50357
+ const [currencyFilter, setCurrencyFilter] = (0, import_react170.useState)(initialCurrency);
50221
50358
  const handleCurrencyChange = (value) => {
50222
50359
  setCurrencyFilter(value);
50223
50360
  setSearchParams((prev) => {
@@ -50225,7 +50362,7 @@ var CargoIMReport = () => {
50225
50362
  return prev;
50226
50363
  });
50227
50364
  };
50228
- (0, import_react169.useEffect)(() => {
50365
+ (0, import_react170.useEffect)(() => {
50229
50366
  if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
50230
50367
  setCurrencyFilter(urlCurrency);
50231
50368
  }
@@ -50245,9 +50382,9 @@ var CargoIMReport = () => {
50245
50382
  header: "Date",
50246
50383
  key: "date",
50247
50384
  className: "text-xs whitespace-nowrap",
50248
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "", children: [
50249
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
50250
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50385
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "", children: [
50386
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
50387
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50251
50388
  "span",
50252
50389
  {
50253
50390
  onClick: () => {
@@ -50266,13 +50403,13 @@ var CargoIMReport = () => {
50266
50403
  header: "Container No",
50267
50404
  key: "description",
50268
50405
  className: "text-xs w-full break-words",
50269
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.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) => {
50406
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50270
50407
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50271
50408
  /[^a-zA-Z0-9]/g,
50272
50409
  ""
50273
50410
  );
50274
50411
  const lineClass = `tx-line-${rowId}-${idx}`;
50275
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50412
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50276
50413
  "div",
50277
50414
  {
50278
50415
  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`,
@@ -50286,13 +50423,13 @@ var CargoIMReport = () => {
50286
50423
  header: "Cbm",
50287
50424
  key: "cbm",
50288
50425
  className: "text-xs whitespace-nowrap text-right",
50289
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.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) => {
50426
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50290
50427
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50291
50428
  /[^a-zA-Z0-9]/g,
50292
50429
  ""
50293
50430
  );
50294
50431
  const lineClass = `tx-line-${rowId}-${idx}`;
50295
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50432
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50296
50433
  "div",
50297
50434
  {
50298
50435
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -50309,20 +50446,20 @@ var CargoIMReport = () => {
50309
50446
  ),
50310
50447
  0
50311
50448
  );
50312
- return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
50449
+ return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
50313
50450
  }
50314
50451
  },
50315
50452
  {
50316
50453
  header: "Price",
50317
50454
  key: "price",
50318
50455
  className: "text-xs whitespace-nowrap text-right",
50319
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.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) => {
50456
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50320
50457
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50321
50458
  /[^a-zA-Z0-9]/g,
50322
50459
  ""
50323
50460
  );
50324
50461
  const lineClass = `tx-line-${rowId}-${idx}`;
50325
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50462
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50326
50463
  "div",
50327
50464
  {
50328
50465
  className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
@@ -50336,13 +50473,13 @@ var CargoIMReport = () => {
50336
50473
  header: "Credit",
50337
50474
  key: "credit",
50338
50475
  className: "text-xs whitespace-nowrap text-right",
50339
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.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) => {
50476
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50340
50477
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50341
50478
  /[^a-zA-Z0-9]/g,
50342
50479
  ""
50343
50480
  );
50344
50481
  const lineClass = `tx-line-${rowId}-${idx}`;
50345
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50482
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50346
50483
  "div",
50347
50484
  {
50348
50485
  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`,
@@ -50351,7 +50488,7 @@ var CargoIMReport = () => {
50351
50488
  idx
50352
50489
  );
50353
50490
  }) }),
50354
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
50491
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
50355
50492
  data2.reduce(
50356
50493
  (acc, row) => acc + (row.lines || []).reduce(
50357
50494
  (lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
@@ -50365,13 +50502,13 @@ var CargoIMReport = () => {
50365
50502
  header: "Debit",
50366
50503
  key: "debit",
50367
50504
  className: "text-xs whitespace-nowrap text-right",
50368
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.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) => {
50505
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
50369
50506
  const rowId = String(row._id || row.id || row.ref || idx).replace(
50370
50507
  /[^a-zA-Z0-9]/g,
50371
50508
  ""
50372
50509
  );
50373
50510
  const lineClass = `tx-line-${rowId}-${idx}`;
50374
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50511
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50375
50512
  "div",
50376
50513
  {
50377
50514
  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`,
@@ -50380,7 +50517,7 @@ var CargoIMReport = () => {
50380
50517
  idx
50381
50518
  );
50382
50519
  }) }),
50383
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
50520
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
50384
50521
  data2.reduce(
50385
50522
  (acc, row) => acc + (row.lines || []).reduce(
50386
50523
  (lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
@@ -50394,14 +50531,14 @@ var CargoIMReport = () => {
50394
50531
  header: "Balance",
50395
50532
  key: "runningBalance",
50396
50533
  className: "text-xs whitespace-nowrap text-right",
50397
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
50398
- renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
50534
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
50535
+ renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
50399
50536
  data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
50400
50537
  currency
50401
50538
  ) })
50402
50539
  }
50403
50540
  ];
50404
- const datas = (0, import_react169.useMemo)(() => {
50541
+ const datas = (0, import_react170.useMemo)(() => {
50405
50542
  let runningBalance = 0;
50406
50543
  const transactions = data?.data?.transactions;
50407
50544
  const res = (transactions || []).map((item) => {
@@ -50438,10 +50575,10 @@ var CargoIMReport = () => {
50438
50575
  { label: "Account Type", value: data?.data?.type },
50439
50576
  { label: "Currency", value: currencyFilter }
50440
50577
  ];
50441
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_jsx_runtime274.Fragment, { children: [
50442
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Modal2, {}),
50443
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(TransactionView, {}),
50444
- /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50578
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(import_jsx_runtime275.Fragment, { children: [
50579
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Modal2, {}),
50580
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(TransactionView, {}),
50581
+ /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50445
50582
  A4DataView,
50446
50583
  {
50447
50584
  columns,
@@ -50456,7 +50593,7 @@ var CargoIMReport = () => {
50456
50593
  openState({
50457
50594
  type: "debit",
50458
50595
  closeOnOverlayClick: false,
50459
- content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50596
+ content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50460
50597
  InvoiceForm_default2,
50461
50598
  {
50462
50599
  close: closeTransaction,
@@ -50464,7 +50601,7 @@ var CargoIMReport = () => {
50464
50601
  onReload: reload,
50465
50602
  id: row._id
50466
50603
  }
50467
- ) : /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50604
+ ) : /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50468
50605
  journalForm_default2,
50469
50606
  {
50470
50607
  close: closeTransaction,
@@ -50477,7 +50614,7 @@ var CargoIMReport = () => {
50477
50614
  width: 800
50478
50615
  });
50479
50616
  },
50480
- headers: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
50617
+ headers: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50481
50618
  Fields_default.Select,
50482
50619
  {
50483
50620
  options: currencies,
@@ -50493,16 +50630,16 @@ var CargoIMReport = () => {
50493
50630
  var cargoIMReport_default = CargoIMReport;
50494
50631
 
50495
50632
  // src/components/accounts/forex-2/Forex2Accounts.tsx
50496
- var import_react_router_dom135 = require("react-router-dom");
50633
+ var import_react_router_dom136 = require("react-router-dom");
50497
50634
  var import_lucide_react129 = require("lucide-react");
50498
- var import_react170 = require("react");
50499
- var import_antd103 = require("antd");
50500
- var import_jsx_runtime275 = require("react/jsx-runtime");
50635
+ var import_react171 = require("react");
50636
+ var import_antd104 = require("antd");
50637
+ var import_jsx_runtime276 = require("react/jsx-runtime");
50501
50638
  function Forex2Accounts({ v, url }) {
50502
- const { branchId } = (0, import_react_router_dom135.useParams)();
50503
- const navigate = (0, import_react_router_dom135.useNavigate)();
50639
+ const { branchId } = (0, import_react_router_dom136.useParams)();
50640
+ const navigate = (0, import_react_router_dom136.useNavigate)();
50504
50641
  const type = "account";
50505
- const [deleteAccount, setDeleteAccount] = (0, import_react170.useState)(null);
50642
+ const [deleteAccount, setDeleteAccount] = (0, import_react171.useState)(null);
50506
50643
  const { isLoading: isActionLoading, remove } = useApis_default();
50507
50644
  const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
50508
50645
  url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
@@ -50513,22 +50650,22 @@ function Forex2Accounts({ v, url }) {
50513
50650
  const items = (data2) => [
50514
50651
  {
50515
50652
  label: `Currency Report`,
50516
- icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.FileChartLine, { size: 16 }),
50653
+ icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.FileChartLine, { size: 16 }),
50517
50654
  onClick: () => navigate(data2?._id)
50518
50655
  },
50519
50656
  {
50520
50657
  label: `Edit ${type}`,
50521
- icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
50658
+ icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
50522
50659
  onClick: () => openState({
50523
50660
  type: "forex account",
50524
- content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
50661
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
50525
50662
  title: "Forex Account Form",
50526
50663
  width: 800
50527
50664
  })
50528
50665
  },
50529
50666
  {
50530
50667
  label: `Delete ${type}`,
50531
- icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
50668
+ icon: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
50532
50669
  onClick: () => setDeleteAccount(data2)
50533
50670
  }
50534
50671
  ].filter(Boolean);
@@ -50538,7 +50675,7 @@ function Forex2Accounts({ v, url }) {
50538
50675
  header: "Name",
50539
50676
  cell: ({ row }) => {
50540
50677
  const account = row.original;
50541
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50678
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50542
50679
  "span",
50543
50680
  {
50544
50681
  onClick: () => navigate(`statements/${account?._id}`),
@@ -50553,7 +50690,7 @@ function Forex2Accounts({ v, url }) {
50553
50690
  header: "Phone",
50554
50691
  cell: ({ row }) => {
50555
50692
  const account = row.original;
50556
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { children: account?.phoneNumber || "N/A" });
50693
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("span", { children: account?.phoneNumber || "N/A" });
50557
50694
  }
50558
50695
  },
50559
50696
  {
@@ -50561,14 +50698,14 @@ function Forex2Accounts({ v, url }) {
50561
50698
  header: "Balances",
50562
50699
  cell: ({ row }) => {
50563
50700
  const account = row.original;
50564
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
50565
- ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
50701
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
50702
+ ([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(
50566
50703
  "div",
50567
50704
  {
50568
50705
  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",
50569
50706
  children: [
50570
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
50571
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50707
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
50708
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50572
50709
  "span",
50573
50710
  {
50574
50711
  className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
@@ -50587,8 +50724,8 @@ function Forex2Accounts({ v, url }) {
50587
50724
  header: "Actions",
50588
50725
  cell: ({ row }) => {
50589
50726
  const data2 = row.original;
50590
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex gap-4 items-center", children: [
50591
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50727
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)("div", { className: "flex gap-4 items-center", children: [
50728
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50592
50729
  "button",
50593
50730
  {
50594
50731
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
@@ -50596,7 +50733,7 @@ function Forex2Accounts({ v, url }) {
50596
50733
  openState({
50597
50734
  type: "credit",
50598
50735
  closeOnOverlayClick: false,
50599
- content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50736
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50600
50737
  Forex2FormTransaction_default,
50601
50738
  {
50602
50739
  close,
@@ -50612,7 +50749,7 @@ function Forex2Accounts({ v, url }) {
50612
50749
  children: "Out"
50613
50750
  }
50614
50751
  ),
50615
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50752
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50616
50753
  "button",
50617
50754
  {
50618
50755
  className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
@@ -50620,7 +50757,7 @@ function Forex2Accounts({ v, url }) {
50620
50757
  openState({
50621
50758
  type: "debit",
50622
50759
  closeOnOverlayClick: false,
50623
- content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50760
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50624
50761
  Forex2FormTransaction_default,
50625
50762
  {
50626
50763
  close,
@@ -50636,13 +50773,13 @@ function Forex2Accounts({ v, url }) {
50636
50773
  children: "In"
50637
50774
  }
50638
50775
  ),
50639
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50776
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50640
50777
  Dropdown,
50641
50778
  {
50642
50779
  className: "cursor-pointer w-[150px]",
50643
50780
  items: items(data2),
50644
50781
  triggerMode: "hover",
50645
- children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.EllipsisVertical, {})
50782
+ children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(import_lucide_react129.EllipsisVertical, {})
50646
50783
  }
50647
50784
  )
50648
50785
  ] });
@@ -50653,11 +50790,11 @@ function Forex2Accounts({ v, url }) {
50653
50790
  const onDelete = async (id) => {
50654
50791
  try {
50655
50792
  await remove({ url: `/accounts/delete/${id}` });
50656
- import_antd103.message.success("Account deleted successfully");
50793
+ import_antd104.message.success("Account deleted successfully");
50657
50794
  reload();
50658
50795
  setDeleteAccount(null);
50659
50796
  } catch (error) {
50660
- import_antd103.message.error(error.message || "Something went wrong");
50797
+ import_antd104.message.error(error.message || "Something went wrong");
50661
50798
  return error;
50662
50799
  }
50663
50800
  };
@@ -50681,9 +50818,9 @@ function Forex2Accounts({ v, url }) {
50681
50818
  };
50682
50819
  }).filter((item) => item.debit !== 0 || item.credit !== 0);
50683
50820
  console.log(currencies);
50684
- return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(import_jsx_runtime275.Fragment, { children: [
50685
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Modal2, {}),
50686
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50821
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
50822
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(Modal2, {}),
50823
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50687
50824
  ConfirmModal,
50688
50825
  {
50689
50826
  isOpen: !!deleteAccount,
@@ -50696,9 +50833,9 @@ function Forex2Accounts({ v, url }) {
50696
50833
  children: null
50697
50834
  }
50698
50835
  ),
50699
- /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { children: [
50700
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
50701
- /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
50836
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)("div", { children: [
50837
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
50838
+ /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50702
50839
  TransactionViewComponent,
50703
50840
  {
50704
50841
  columns,
@@ -50710,7 +50847,7 @@ function Forex2Accounts({ v, url }) {
50710
50847
  onCreate: () => {
50711
50848
  openState({
50712
50849
  type: "forex account",
50713
- content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountForm_default, { close, reloads: reload }),
50850
+ content: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ForexAccountForm_default, { close, reloads: reload }),
50714
50851
  title: "Forex Account Form",
50715
50852
  width: 800
50716
50853
  });
@@ -50723,14 +50860,14 @@ function Forex2Accounts({ v, url }) {
50723
50860
  var Forex2Accounts_default = Forex2Accounts;
50724
50861
 
50725
50862
  // src/components/reports/ProductList.tsx
50726
- var import_react_router_dom136 = require("react-router-dom");
50727
- var import_jsx_runtime276 = require("react/jsx-runtime");
50863
+ var import_react_router_dom137 = require("react-router-dom");
50864
+ var import_jsx_runtime277 = require("react/jsx-runtime");
50728
50865
  var options9 = [
50729
50866
  { label: "Product", value: "product" },
50730
50867
  { label: "Pack", value: "pack" }
50731
50868
  ];
50732
50869
  var ProductList2 = ({ value = false }) => {
50733
- const { branchId } = (0, import_react_router_dom136.useParams)();
50870
+ const { branchId } = (0, import_react_router_dom137.useParams)();
50734
50871
  const { branches } = useAuth_default();
50735
50872
  const { TransactionView } = useTransactionView_default();
50736
50873
  const { getQuery, setQuery } = useApp_default();
@@ -50752,7 +50889,7 @@ var ProductList2 = ({ value = false }) => {
50752
50889
  key: "name",
50753
50890
  className: "text-xs whitespace-nowrap",
50754
50891
  render: (row) => {
50755
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
50892
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
50756
50893
  }
50757
50894
  },
50758
50895
  ...value ? [
@@ -50760,14 +50897,14 @@ var ProductList2 = ({ value = false }) => {
50760
50897
  header: "Cost",
50761
50898
  key: "cost",
50762
50899
  className: "text-xs whitespace-nowrap text-right",
50763
- render: (row) => /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
50900
+ render: (row) => /* @__PURE__ */ (0, import_jsx_runtime277.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
50764
50901
  }
50765
50902
  ] : []
50766
50903
  ];
50767
50904
  const datas = data?.data || [];
50768
- return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
50769
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(TransactionView, {}),
50770
- /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50905
+ return /* @__PURE__ */ (0, import_jsx_runtime277.jsxs)(import_jsx_runtime277.Fragment, { children: [
50906
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(TransactionView, {}),
50907
+ /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50771
50908
  A4DataView,
50772
50909
  {
50773
50910
  columns,
@@ -50778,7 +50915,7 @@ var ProductList2 = ({ value = false }) => {
50778
50915
  tableTitle: "Stock List",
50779
50916
  fixed: false,
50780
50917
  startPage: 1e10,
50781
- headers: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
50918
+ headers: /* @__PURE__ */ (0, import_jsx_runtime277.jsx)(
50782
50919
  Select,
50783
50920
  {
50784
50921
  options: options9,