warqadui 0.0.276 → 0.0.277
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +410 -267
- package/dist/index.mjs +367 -224
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48646,6 +48646,148 @@ var Expenses32 = {
|
|
|
48646
48646
|
};
|
|
48647
48647
|
var expense_default = Expenses32;
|
|
48648
48648
|
|
|
48649
|
+
// src/components/Transactions/3/reports/Expenses3Reports.tsx
|
|
48650
|
+
import { useParams as useParams106 } from "react-router-dom";
|
|
48651
|
+
import { useMemo as useMemo52, useState as useState113 } from "react";
|
|
48652
|
+
import { DatePicker as DatePicker9 } from "antd";
|
|
48653
|
+
import dayjs11 from "dayjs";
|
|
48654
|
+
import { Fragment as Fragment133, jsx as jsx265, jsxs as jsxs234 } from "react/jsx-runtime";
|
|
48655
|
+
var Expenses3Reports = () => {
|
|
48656
|
+
const { branchId } = useParams106();
|
|
48657
|
+
const [startDate, setStartDate] = useState113(null);
|
|
48658
|
+
const [endDate, setEndDate] = useState113(null);
|
|
48659
|
+
const { A4DataView, data } = useA4DataView_default({
|
|
48660
|
+
url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48661
|
+
v: 1
|
|
48662
|
+
// No prefix
|
|
48663
|
+
});
|
|
48664
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48665
|
+
const { defaultCurrency } = useWarqadConfig()?.currencies;
|
|
48666
|
+
const columns = [
|
|
48667
|
+
{
|
|
48668
|
+
header: "Date",
|
|
48669
|
+
key: "date",
|
|
48670
|
+
className: "text-xs whitespace-nowrap",
|
|
48671
|
+
render: (row) => /* @__PURE__ */ jsxs234("div", { className: "", children: [
|
|
48672
|
+
/* @__PURE__ */ jsx265("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48673
|
+
/* @__PURE__ */ jsx265(
|
|
48674
|
+
"span",
|
|
48675
|
+
{
|
|
48676
|
+
onClick: () => {
|
|
48677
|
+
openTransaction({
|
|
48678
|
+
id: row?._id,
|
|
48679
|
+
type: row?.type
|
|
48680
|
+
});
|
|
48681
|
+
},
|
|
48682
|
+
className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
|
|
48683
|
+
children: row?.ref
|
|
48684
|
+
}
|
|
48685
|
+
)
|
|
48686
|
+
] })
|
|
48687
|
+
},
|
|
48688
|
+
{
|
|
48689
|
+
header: "Description",
|
|
48690
|
+
key: "description",
|
|
48691
|
+
className: "text-xs whitespace-nowrap ",
|
|
48692
|
+
render: (row) => {
|
|
48693
|
+
return /* @__PURE__ */ jsxs234("div", { className: "", children: [
|
|
48694
|
+
/* @__PURE__ */ jsx265("span", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
48695
|
+
row.note && /* @__PURE__ */ jsx265("span", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.note })
|
|
48696
|
+
] });
|
|
48697
|
+
}
|
|
48698
|
+
},
|
|
48699
|
+
{
|
|
48700
|
+
header: "Amount",
|
|
48701
|
+
key: "changedAmountString",
|
|
48702
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
48703
|
+
render: (row) => /* @__PURE__ */ jsx265("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48704
|
+
renderFooter: (data2) => {
|
|
48705
|
+
return /* @__PURE__ */ jsx265("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48706
|
+
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48707
|
+
defaultCurrency
|
|
48708
|
+
) });
|
|
48709
|
+
}
|
|
48710
|
+
}
|
|
48711
|
+
];
|
|
48712
|
+
const datas = useMemo52(() => {
|
|
48713
|
+
let runningBalance = 0;
|
|
48714
|
+
let filteredData = data?.data || [];
|
|
48715
|
+
const mapped = filteredData.map((item) => {
|
|
48716
|
+
const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
|
|
48717
|
+
runningBalance += changedAmount;
|
|
48718
|
+
return {
|
|
48719
|
+
...item,
|
|
48720
|
+
changedAmountString: Formats_default.Amount(changedAmount, false),
|
|
48721
|
+
changedAmount,
|
|
48722
|
+
runningBalance
|
|
48723
|
+
};
|
|
48724
|
+
});
|
|
48725
|
+
let filtered = mapped;
|
|
48726
|
+
if (startDate) {
|
|
48727
|
+
const startOfDay = startDate.startOf("day");
|
|
48728
|
+
filtered = filtered.filter((tx) => {
|
|
48729
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48730
|
+
if (!rawDate) return false;
|
|
48731
|
+
const txDate = dayjs11(rawDate);
|
|
48732
|
+
return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
|
|
48733
|
+
});
|
|
48734
|
+
}
|
|
48735
|
+
if (endDate) {
|
|
48736
|
+
const endOfDay = endDate.endOf("day");
|
|
48737
|
+
filtered = filtered.filter((tx) => {
|
|
48738
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48739
|
+
if (!rawDate) return false;
|
|
48740
|
+
const txDate = dayjs11(rawDate);
|
|
48741
|
+
return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
|
|
48742
|
+
});
|
|
48743
|
+
}
|
|
48744
|
+
return filtered;
|
|
48745
|
+
}, [data, startDate, endDate]);
|
|
48746
|
+
return /* @__PURE__ */ jsxs234(Fragment133, { children: [
|
|
48747
|
+
/* @__PURE__ */ jsx265(TransactionView, {}),
|
|
48748
|
+
/* @__PURE__ */ jsx265(
|
|
48749
|
+
A4DataView,
|
|
48750
|
+
{
|
|
48751
|
+
columns,
|
|
48752
|
+
data: datas,
|
|
48753
|
+
index: true,
|
|
48754
|
+
title: `Expenses Report`,
|
|
48755
|
+
subtitle: `All Expenses`,
|
|
48756
|
+
fixed: false,
|
|
48757
|
+
headers: /* @__PURE__ */ jsxs234("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
48758
|
+
/* @__PURE__ */ jsx265(
|
|
48759
|
+
DatePicker9,
|
|
48760
|
+
{
|
|
48761
|
+
placeholder: "Start Date",
|
|
48762
|
+
onChange: (date) => setStartDate(date),
|
|
48763
|
+
value: startDate,
|
|
48764
|
+
format: "DD/MM/YYYY",
|
|
48765
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48766
|
+
}
|
|
48767
|
+
),
|
|
48768
|
+
/* @__PURE__ */ jsx265(
|
|
48769
|
+
DatePicker9,
|
|
48770
|
+
{
|
|
48771
|
+
placeholder: "End Date",
|
|
48772
|
+
onChange: (date) => setEndDate(date),
|
|
48773
|
+
value: endDate,
|
|
48774
|
+
format: "DD/MM/YYYY",
|
|
48775
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48776
|
+
}
|
|
48777
|
+
)
|
|
48778
|
+
] })
|
|
48779
|
+
}
|
|
48780
|
+
)
|
|
48781
|
+
] });
|
|
48782
|
+
};
|
|
48783
|
+
var Expenses3Reports_default = Expenses3Reports;
|
|
48784
|
+
|
|
48785
|
+
// src/components/Transactions/3/reports/index.tsx
|
|
48786
|
+
var Reports3 = {
|
|
48787
|
+
expenses: Expenses3Reports_default
|
|
48788
|
+
};
|
|
48789
|
+
var reports_default = Reports3;
|
|
48790
|
+
|
|
48649
48791
|
// src/components/Transactions/3/index.ts
|
|
48650
48792
|
var Transaction3 = {
|
|
48651
48793
|
Payments: Payments_default3,
|
|
@@ -48657,26 +48799,27 @@ var Transaction3 = {
|
|
|
48657
48799
|
Purchase3: purchase3_default.List,
|
|
48658
48800
|
Purchase3Form: purchase3_default.Form,
|
|
48659
48801
|
Expenses: expense_default.List,
|
|
48660
|
-
ExpenseForm: expense_default.Form
|
|
48802
|
+
ExpenseForm: expense_default.Form,
|
|
48803
|
+
Reports: reports_default
|
|
48661
48804
|
};
|
|
48662
48805
|
var __default = Transaction3;
|
|
48663
48806
|
|
|
48664
48807
|
// src/components/reports/ItemReport.tsx
|
|
48665
|
-
import { useParams as
|
|
48808
|
+
import { useParams as useParams107 } from "react-router-dom";
|
|
48666
48809
|
import { z as z49 } from "zod";
|
|
48667
48810
|
import { useForm as useForm58 } from "react-hook-form";
|
|
48668
48811
|
import { zodResolver as zodResolver57 } from "@hookform/resolvers/zod";
|
|
48669
|
-
import { useState as
|
|
48812
|
+
import { useState as useState114 } from "react";
|
|
48670
48813
|
import { message as message85 } from "antd";
|
|
48671
|
-
import { Fragment as
|
|
48814
|
+
import { Fragment as Fragment134, jsx as jsx266, jsxs as jsxs235 } from "react/jsx-runtime";
|
|
48672
48815
|
var ItemReport = ({
|
|
48673
48816
|
value = false,
|
|
48674
48817
|
type
|
|
48675
48818
|
}) => {
|
|
48676
48819
|
const { apiConfig } = useWarqadConfig();
|
|
48677
|
-
const { branchId } =
|
|
48820
|
+
const { branchId } = useParams107();
|
|
48678
48821
|
const { branches } = useAuth_default();
|
|
48679
|
-
const [params, setParams] =
|
|
48822
|
+
const [params, setParams] = useState114({
|
|
48680
48823
|
id: "",
|
|
48681
48824
|
branch: "all"
|
|
48682
48825
|
});
|
|
@@ -48701,9 +48844,9 @@ var ItemReport = ({
|
|
|
48701
48844
|
header: "Date",
|
|
48702
48845
|
key: "date",
|
|
48703
48846
|
className: "text-xs whitespace-nowrap",
|
|
48704
|
-
render: (row) => /* @__PURE__ */
|
|
48705
|
-
/* @__PURE__ */
|
|
48706
|
-
/* @__PURE__ */
|
|
48847
|
+
render: (row) => /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48848
|
+
/* @__PURE__ */ jsx266("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48849
|
+
/* @__PURE__ */ jsx266(
|
|
48707
48850
|
"span",
|
|
48708
48851
|
{
|
|
48709
48852
|
onClick: () => {
|
|
@@ -48722,7 +48865,7 @@ var ItemReport = ({
|
|
|
48722
48865
|
header: "Description",
|
|
48723
48866
|
key: "description",
|
|
48724
48867
|
className: "text-xs whitespace-nowrap",
|
|
48725
|
-
render: (row) => /* @__PURE__ */
|
|
48868
|
+
render: (row) => /* @__PURE__ */ jsx266("div", { className: "", children: /* @__PURE__ */ jsx266("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
48726
48869
|
},
|
|
48727
48870
|
{
|
|
48728
48871
|
header: "Quantity",
|
|
@@ -48730,7 +48873,7 @@ var ItemReport = ({
|
|
|
48730
48873
|
className: "text-xs whitespace-nowrap",
|
|
48731
48874
|
render: (row) => {
|
|
48732
48875
|
const Qty = row.quantity;
|
|
48733
|
-
return /* @__PURE__ */
|
|
48876
|
+
return /* @__PURE__ */ jsxs235(
|
|
48734
48877
|
"div",
|
|
48735
48878
|
{
|
|
48736
48879
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -48747,7 +48890,7 @@ var ItemReport = ({
|
|
|
48747
48890
|
header: "Balance",
|
|
48748
48891
|
key: "runningBalance",
|
|
48749
48892
|
className: "text-xs whitespace-nowrap",
|
|
48750
|
-
render: (row) => /* @__PURE__ */
|
|
48893
|
+
render: (row) => /* @__PURE__ */ jsx266("div", { className: "", children: /* @__PURE__ */ jsx266("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
48751
48894
|
}
|
|
48752
48895
|
];
|
|
48753
48896
|
let runningBalance = 0;
|
|
@@ -48759,10 +48902,10 @@ var ItemReport = ({
|
|
|
48759
48902
|
};
|
|
48760
48903
|
});
|
|
48761
48904
|
const itemName = datas[0]?.name;
|
|
48762
|
-
return /* @__PURE__ */
|
|
48763
|
-
/* @__PURE__ */
|
|
48764
|
-
/* @__PURE__ */
|
|
48765
|
-
/* @__PURE__ */
|
|
48905
|
+
return /* @__PURE__ */ jsxs235(Fragment134, { children: [
|
|
48906
|
+
/* @__PURE__ */ jsx266(Modal2, {}),
|
|
48907
|
+
/* @__PURE__ */ jsx266(TransactionView, {}),
|
|
48908
|
+
/* @__PURE__ */ jsx266(
|
|
48766
48909
|
A4DataView,
|
|
48767
48910
|
{
|
|
48768
48911
|
columns,
|
|
@@ -48773,14 +48916,14 @@ var ItemReport = ({
|
|
|
48773
48916
|
tableTitle: `${type} Movement Report`,
|
|
48774
48917
|
fixed: false,
|
|
48775
48918
|
error: !id ? "Please select an item" : void 0,
|
|
48776
|
-
headers: /* @__PURE__ */
|
|
48919
|
+
headers: /* @__PURE__ */ jsx266(
|
|
48777
48920
|
Button,
|
|
48778
48921
|
{
|
|
48779
48922
|
type: "button",
|
|
48780
48923
|
size: "sm",
|
|
48781
48924
|
onClick: () => openState({
|
|
48782
48925
|
title: "Item Transactions",
|
|
48783
|
-
content: /* @__PURE__ */
|
|
48926
|
+
content: /* @__PURE__ */ jsx266(
|
|
48784
48927
|
ItemReportHeader2,
|
|
48785
48928
|
{
|
|
48786
48929
|
type,
|
|
@@ -48823,7 +48966,7 @@ function ItemReportHeader2({
|
|
|
48823
48966
|
label: b.name,
|
|
48824
48967
|
value: b._id
|
|
48825
48968
|
}));
|
|
48826
|
-
return /* @__PURE__ */
|
|
48969
|
+
return /* @__PURE__ */ jsxs235(
|
|
48827
48970
|
"form",
|
|
48828
48971
|
{
|
|
48829
48972
|
className: "space-y-3",
|
|
@@ -48841,8 +48984,8 @@ function ItemReportHeader2({
|
|
|
48841
48984
|
close();
|
|
48842
48985
|
}),
|
|
48843
48986
|
children: [
|
|
48844
|
-
/* @__PURE__ */
|
|
48845
|
-
/* @__PURE__ */
|
|
48987
|
+
/* @__PURE__ */ jsxs235("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
48988
|
+
/* @__PURE__ */ jsx266(
|
|
48846
48989
|
Select,
|
|
48847
48990
|
{
|
|
48848
48991
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -48850,7 +48993,7 @@ function ItemReportHeader2({
|
|
|
48850
48993
|
name: "branch"
|
|
48851
48994
|
}
|
|
48852
48995
|
),
|
|
48853
|
-
type === "pack" ? /* @__PURE__ */
|
|
48996
|
+
type === "pack" ? /* @__PURE__ */ jsx266(
|
|
48854
48997
|
Pack_default.Pack,
|
|
48855
48998
|
{
|
|
48856
48999
|
api: "/packs/get",
|
|
@@ -48858,7 +49001,7 @@ function ItemReportHeader2({
|
|
|
48858
49001
|
form: methods,
|
|
48859
49002
|
name: "pack"
|
|
48860
49003
|
}
|
|
48861
|
-
) : /* @__PURE__ */
|
|
49004
|
+
) : /* @__PURE__ */ jsx266(
|
|
48862
49005
|
Feilds_default5.Product,
|
|
48863
49006
|
{
|
|
48864
49007
|
label: "",
|
|
@@ -48869,7 +49012,7 @@ function ItemReportHeader2({
|
|
|
48869
49012
|
}
|
|
48870
49013
|
)
|
|
48871
49014
|
] }),
|
|
48872
|
-
/* @__PURE__ */
|
|
49015
|
+
/* @__PURE__ */ jsx266("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ jsx266(Button, { type: "submit", children: "Filter" }) })
|
|
48873
49016
|
]
|
|
48874
49017
|
}
|
|
48875
49018
|
);
|
|
@@ -48877,9 +49020,9 @@ function ItemReportHeader2({
|
|
|
48877
49020
|
var ItemReport_default = ItemReport;
|
|
48878
49021
|
|
|
48879
49022
|
// src/components/accounts/LeaseCollection.tsx
|
|
48880
|
-
import { useNavigate as useNavigate64, useParams as
|
|
48881
|
-
import { useMemo as
|
|
48882
|
-
import { Fragment as
|
|
49023
|
+
import { useNavigate as useNavigate64, useParams as useParams108, useSearchParams as useSearchParams19 } from "react-router-dom";
|
|
49024
|
+
import { useMemo as useMemo53, useState as useState115, useEffect as useEffect114 } from "react";
|
|
49025
|
+
import { Fragment as Fragment135, jsx as jsx267, jsxs as jsxs236 } from "react/jsx-runtime";
|
|
48883
49026
|
var LeaseCollection = ({
|
|
48884
49027
|
leaseType,
|
|
48885
49028
|
defaultCurrency = "KES"
|
|
@@ -48887,9 +49030,9 @@ var LeaseCollection = ({
|
|
|
48887
49030
|
const navigate = useNavigate64();
|
|
48888
49031
|
const [searchParams] = useSearchParams19();
|
|
48889
49032
|
const { apiConfig } = useWarqadConfig();
|
|
48890
|
-
const { branchId } =
|
|
49033
|
+
const { branchId } = useParams108();
|
|
48891
49034
|
const { branches } = useAuth_default();
|
|
48892
|
-
const currentBranch =
|
|
49035
|
+
const currentBranch = useMemo53(
|
|
48893
49036
|
() => branches?.find((b) => b?._id === branchId),
|
|
48894
49037
|
[branches, branchId]
|
|
48895
49038
|
);
|
|
@@ -48897,10 +49040,10 @@ var LeaseCollection = ({
|
|
|
48897
49040
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
48898
49041
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
48899
49042
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
48900
|
-
const [filter, setFilter] =
|
|
49043
|
+
const [filter, setFilter] = useState115(
|
|
48901
49044
|
initialFilter
|
|
48902
49045
|
);
|
|
48903
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
49046
|
+
const [currencyFilter, setCurrencyFilter] = useState115(initialCurrency);
|
|
48904
49047
|
useEffect114(() => {
|
|
48905
49048
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
48906
49049
|
setFilter(urlFilter);
|
|
@@ -48925,9 +49068,9 @@ var LeaseCollection = ({
|
|
|
48925
49068
|
key: "name",
|
|
48926
49069
|
className: "text-xs whitespace-nowrap ",
|
|
48927
49070
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
48928
|
-
render: (row) => /* @__PURE__ */
|
|
48929
|
-
/* @__PURE__ */
|
|
48930
|
-
row.unitNames && /* @__PURE__ */
|
|
49071
|
+
render: (row) => /* @__PURE__ */ jsxs236("div", { className: "space-y-1", children: [
|
|
49072
|
+
/* @__PURE__ */ jsx267("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49073
|
+
row.unitNames && /* @__PURE__ */ jsxs236("p", { className: "text-[9px]! capitalize", children: [
|
|
48931
49074
|
"(",
|
|
48932
49075
|
row.unitNames,
|
|
48933
49076
|
")"
|
|
@@ -48939,7 +49082,7 @@ var LeaseCollection = ({
|
|
|
48939
49082
|
key: "phoneNumber",
|
|
48940
49083
|
maxWidth: 70,
|
|
48941
49084
|
render: (row) => {
|
|
48942
|
-
return /* @__PURE__ */
|
|
49085
|
+
return /* @__PURE__ */ jsx267("p", { children: row?.phoneNumber || "N/A" });
|
|
48943
49086
|
}
|
|
48944
49087
|
},
|
|
48945
49088
|
// </span>
|
|
@@ -48949,11 +49092,11 @@ var LeaseCollection = ({
|
|
|
48949
49092
|
className: "text-xs whitespace-nowrap text-right",
|
|
48950
49093
|
render: (row) => {
|
|
48951
49094
|
const Amount = row.totalCollectionString;
|
|
48952
|
-
return /* @__PURE__ */
|
|
49095
|
+
return /* @__PURE__ */ jsx267("div", { className: "", children: /* @__PURE__ */ jsx267("p", { className: "font-bold ", children: Amount }) });
|
|
48953
49096
|
},
|
|
48954
49097
|
renderFooter: (data2) => {
|
|
48955
49098
|
if (currencyFilter === "all") return;
|
|
48956
|
-
return /* @__PURE__ */
|
|
49099
|
+
return /* @__PURE__ */ jsx267("span", { className: " font-bold", children: Formats_default.Price(
|
|
48957
49100
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
48958
49101
|
defaultCurrency,
|
|
48959
49102
|
false
|
|
@@ -48961,7 +49104,7 @@ var LeaseCollection = ({
|
|
|
48961
49104
|
}
|
|
48962
49105
|
}
|
|
48963
49106
|
];
|
|
48964
|
-
const datas =
|
|
49107
|
+
const datas = useMemo53(() => {
|
|
48965
49108
|
let runningBalance = 0;
|
|
48966
49109
|
let filteredData = data?.data || [];
|
|
48967
49110
|
const result = filteredData.map((item) => {
|
|
@@ -48974,9 +49117,9 @@ var LeaseCollection = ({
|
|
|
48974
49117
|
});
|
|
48975
49118
|
return result;
|
|
48976
49119
|
}, [filter, currencyFilter, data]);
|
|
48977
|
-
return /* @__PURE__ */
|
|
48978
|
-
/* @__PURE__ */
|
|
48979
|
-
/* @__PURE__ */
|
|
49120
|
+
return /* @__PURE__ */ jsxs236(Fragment135, { children: [
|
|
49121
|
+
/* @__PURE__ */ jsx267(TransactionView, {}),
|
|
49122
|
+
/* @__PURE__ */ jsx267(
|
|
48980
49123
|
A4DataView,
|
|
48981
49124
|
{
|
|
48982
49125
|
columns,
|
|
@@ -48986,7 +49129,7 @@ var LeaseCollection = ({
|
|
|
48986
49129
|
subtitle: `All Collections`,
|
|
48987
49130
|
fixed: false,
|
|
48988
49131
|
startPage: 1e9,
|
|
48989
|
-
headers: /* @__PURE__ */
|
|
49132
|
+
headers: /* @__PURE__ */ jsx267("div", { className: "flex gap-2" })
|
|
48990
49133
|
}
|
|
48991
49134
|
)
|
|
48992
49135
|
] });
|
|
@@ -48994,9 +49137,9 @@ var LeaseCollection = ({
|
|
|
48994
49137
|
var LeaseCollection_default = LeaseCollection;
|
|
48995
49138
|
|
|
48996
49139
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
48997
|
-
import { useNavigate as useNavigate65, useParams as
|
|
49140
|
+
import { useNavigate as useNavigate65, useParams as useParams112 } from "react-router-dom";
|
|
48998
49141
|
import { EllipsisVertical as EllipsisVertical47, FilePenLine as FilePenLine43, Trash2 as Trash254 } from "lucide-react";
|
|
48999
|
-
import { useState as
|
|
49142
|
+
import { useState as useState117 } from "react";
|
|
49000
49143
|
import { message as message89 } from "antd";
|
|
49001
49144
|
|
|
49002
49145
|
// src/components/Transactions/cargoIM/schema.ts
|
|
@@ -49033,14 +49176,14 @@ import { useForm as useForm59 } from "react-hook-form";
|
|
|
49033
49176
|
import { zodResolver as zodResolver58 } from "@hookform/resolvers/zod";
|
|
49034
49177
|
import { message as message86 } from "antd";
|
|
49035
49178
|
import { useEffect as useEffect115 } from "react";
|
|
49036
|
-
import { useParams as
|
|
49037
|
-
import { jsx as
|
|
49179
|
+
import { useParams as useParams109 } from "react-router-dom";
|
|
49180
|
+
import { jsx as jsx268, jsxs as jsxs237 } from "react/jsx-runtime";
|
|
49038
49181
|
function AccountForm3({
|
|
49039
49182
|
onReload,
|
|
49040
49183
|
close,
|
|
49041
49184
|
id
|
|
49042
49185
|
}) {
|
|
49043
|
-
const { branchId } =
|
|
49186
|
+
const { branchId } = useParams109();
|
|
49044
49187
|
const { currencies } = useWarqadConfig();
|
|
49045
49188
|
const { stock } = currencies;
|
|
49046
49189
|
const isEdit = !!id;
|
|
@@ -49106,24 +49249,24 @@ function AccountForm3({
|
|
|
49106
49249
|
fetches();
|
|
49107
49250
|
}
|
|
49108
49251
|
}, [id]);
|
|
49109
|
-
return /* @__PURE__ */
|
|
49252
|
+
return /* @__PURE__ */ jsxs237(
|
|
49110
49253
|
Card,
|
|
49111
49254
|
{
|
|
49112
49255
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49113
49256
|
isLoading: isLoadingGet,
|
|
49114
49257
|
loadingText: "Processing...",
|
|
49115
49258
|
children: [
|
|
49116
|
-
/* @__PURE__ */
|
|
49117
|
-
/* @__PURE__ */
|
|
49118
|
-
/* @__PURE__ */
|
|
49259
|
+
/* @__PURE__ */ jsxs237(Card.Header, { children: [
|
|
49260
|
+
/* @__PURE__ */ jsx268(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49261
|
+
/* @__PURE__ */ jsx268(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49119
49262
|
] }),
|
|
49120
|
-
/* @__PURE__ */
|
|
49263
|
+
/* @__PURE__ */ jsx268(Card.Content, { children: /* @__PURE__ */ jsxs237(
|
|
49121
49264
|
"form",
|
|
49122
49265
|
{
|
|
49123
49266
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49124
49267
|
children: [
|
|
49125
|
-
/* @__PURE__ */
|
|
49126
|
-
/* @__PURE__ */
|
|
49268
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49269
|
+
/* @__PURE__ */ jsx268(
|
|
49127
49270
|
Fields_default.Input,
|
|
49128
49271
|
{
|
|
49129
49272
|
label: "Name",
|
|
@@ -49134,7 +49277,7 @@ function AccountForm3({
|
|
|
49134
49277
|
required: true
|
|
49135
49278
|
}
|
|
49136
49279
|
),
|
|
49137
|
-
/* @__PURE__ */
|
|
49280
|
+
/* @__PURE__ */ jsx268(
|
|
49138
49281
|
Fields_default.PhoneInput,
|
|
49139
49282
|
{
|
|
49140
49283
|
label: "Phone Number",
|
|
@@ -49143,7 +49286,7 @@ function AccountForm3({
|
|
|
49143
49286
|
placeholder: "Enter phone number"
|
|
49144
49287
|
}
|
|
49145
49288
|
),
|
|
49146
|
-
/* @__PURE__ */
|
|
49289
|
+
/* @__PURE__ */ jsx268(
|
|
49147
49290
|
Fields_default.Select,
|
|
49148
49291
|
{
|
|
49149
49292
|
label: "Currency",
|
|
@@ -49154,7 +49297,7 @@ function AccountForm3({
|
|
|
49154
49297
|
}
|
|
49155
49298
|
)
|
|
49156
49299
|
] }),
|
|
49157
|
-
/* @__PURE__ */
|
|
49300
|
+
/* @__PURE__ */ jsx268("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx268(
|
|
49158
49301
|
Button,
|
|
49159
49302
|
{
|
|
49160
49303
|
isLoading,
|
|
@@ -49175,36 +49318,36 @@ function AccountForm3({
|
|
|
49175
49318
|
var AccountForm_default3 = AccountForm3;
|
|
49176
49319
|
|
|
49177
49320
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49178
|
-
import { useEffect as useEffect116, useState as
|
|
49321
|
+
import { useEffect as useEffect116, useState as useState116 } from "react";
|
|
49179
49322
|
import { useForm as useForm60, useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
49180
49323
|
import { zodResolver as zodResolver59 } from "@hookform/resolvers/zod";
|
|
49181
|
-
import { useParams as
|
|
49324
|
+
import { useParams as useParams110 } from "react-router-dom";
|
|
49182
49325
|
import { message as message87 } from "antd";
|
|
49183
49326
|
import { Trash2 as Trash253, Plus as Plus6 } from "lucide-react";
|
|
49184
|
-
import
|
|
49185
|
-
import { jsx as
|
|
49327
|
+
import dayjs12 from "dayjs";
|
|
49328
|
+
import { jsx as jsx269, jsxs as jsxs238 } from "react/jsx-runtime";
|
|
49186
49329
|
function InvoiceForm2({
|
|
49187
49330
|
onReload,
|
|
49188
49331
|
close,
|
|
49189
49332
|
accountData,
|
|
49190
49333
|
id
|
|
49191
49334
|
}) {
|
|
49192
|
-
const { branchId } =
|
|
49193
|
-
const [ref2, setRef] =
|
|
49335
|
+
const { branchId } = useParams110();
|
|
49336
|
+
const [ref2, setRef] = useState116(void 0);
|
|
49194
49337
|
const { post, isLoading } = useApis_default();
|
|
49195
49338
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49196
49339
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49197
49340
|
const isEdit = !!id;
|
|
49198
49341
|
const { currencies } = useWarqadConfig();
|
|
49199
49342
|
const { stock: defaultCurrency } = currencies;
|
|
49200
|
-
const [itemName, setItemName] =
|
|
49201
|
-
const [itemQuantity, setItemQuantity] =
|
|
49202
|
-
const [itemPrice, setItemPrice] =
|
|
49343
|
+
const [itemName, setItemName] = useState116("");
|
|
49344
|
+
const [itemQuantity, setItemQuantity] = useState116("");
|
|
49345
|
+
const [itemPrice, setItemPrice] = useState116("");
|
|
49203
49346
|
const methods = useForm60({
|
|
49204
49347
|
resolver: zodResolver59(createInvoiceManagerValidation2),
|
|
49205
49348
|
defaultValues: {
|
|
49206
49349
|
invoices: [],
|
|
49207
|
-
date:
|
|
49350
|
+
date: dayjs12().format("DD/MM/YYYY"),
|
|
49208
49351
|
currency: defaultCurrency,
|
|
49209
49352
|
branch: branchId ? branchId : void 0
|
|
49210
49353
|
}
|
|
@@ -49303,25 +49446,25 @@ function InvoiceForm2({
|
|
|
49303
49446
|
e.preventDefault();
|
|
49304
49447
|
}
|
|
49305
49448
|
};
|
|
49306
|
-
return /* @__PURE__ */
|
|
49449
|
+
return /* @__PURE__ */ jsx269(
|
|
49307
49450
|
Card,
|
|
49308
49451
|
{
|
|
49309
49452
|
isLoading: getLoading,
|
|
49310
49453
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49311
|
-
children: /* @__PURE__ */
|
|
49312
|
-
/* @__PURE__ */
|
|
49313
|
-
/* @__PURE__ */
|
|
49454
|
+
children: /* @__PURE__ */ jsxs238(Card.Content, { children: [
|
|
49455
|
+
/* @__PURE__ */ jsx269("input", { type: "hidden", ...register("currency") }),
|
|
49456
|
+
/* @__PURE__ */ jsxs238(
|
|
49314
49457
|
"form",
|
|
49315
49458
|
{
|
|
49316
49459
|
onSubmit: handleSubmit(onSubmit),
|
|
49317
49460
|
onKeyDown: handleKeyDown,
|
|
49318
49461
|
className: "space-y-6",
|
|
49319
49462
|
children: [
|
|
49320
|
-
/* @__PURE__ */
|
|
49321
|
-
/* @__PURE__ */
|
|
49322
|
-
/* @__PURE__ */
|
|
49323
|
-
/* @__PURE__ */
|
|
49324
|
-
/* @__PURE__ */
|
|
49463
|
+
/* @__PURE__ */ jsxs238("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
49464
|
+
/* @__PURE__ */ jsx269("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49465
|
+
/* @__PURE__ */ jsxs238("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49466
|
+
/* @__PURE__ */ jsxs238("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49467
|
+
/* @__PURE__ */ jsx269(
|
|
49325
49468
|
Fields_default.Input,
|
|
49326
49469
|
{
|
|
49327
49470
|
label: "Container No",
|
|
@@ -49330,7 +49473,7 @@ function InvoiceForm2({
|
|
|
49330
49473
|
onChange: (val) => setItemName(val)
|
|
49331
49474
|
}
|
|
49332
49475
|
),
|
|
49333
|
-
/* @__PURE__ */
|
|
49476
|
+
/* @__PURE__ */ jsx269(
|
|
49334
49477
|
Fields_default.Input,
|
|
49335
49478
|
{
|
|
49336
49479
|
label: "Cbm",
|
|
@@ -49340,7 +49483,7 @@ function InvoiceForm2({
|
|
|
49340
49483
|
onChange: (val) => setItemQuantity(val)
|
|
49341
49484
|
}
|
|
49342
49485
|
),
|
|
49343
|
-
/* @__PURE__ */
|
|
49486
|
+
/* @__PURE__ */ jsx269(
|
|
49344
49487
|
Fields_default.Input,
|
|
49345
49488
|
{
|
|
49346
49489
|
label: "Price (KES)",
|
|
@@ -49351,7 +49494,7 @@ function InvoiceForm2({
|
|
|
49351
49494
|
}
|
|
49352
49495
|
)
|
|
49353
49496
|
] }),
|
|
49354
|
-
/* @__PURE__ */
|
|
49497
|
+
/* @__PURE__ */ jsxs238(
|
|
49355
49498
|
Button,
|
|
49356
49499
|
{
|
|
49357
49500
|
type: "button",
|
|
@@ -49359,23 +49502,23 @@ function InvoiceForm2({
|
|
|
49359
49502
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49360
49503
|
variant: "outline",
|
|
49361
49504
|
children: [
|
|
49362
|
-
/* @__PURE__ */
|
|
49505
|
+
/* @__PURE__ */ jsx269(Plus6, { size: 16 }),
|
|
49363
49506
|
" Add Item"
|
|
49364
49507
|
]
|
|
49365
49508
|
}
|
|
49366
49509
|
)
|
|
49367
49510
|
] })
|
|
49368
49511
|
] }),
|
|
49369
|
-
/* @__PURE__ */
|
|
49370
|
-
/* @__PURE__ */
|
|
49371
|
-
/* @__PURE__ */
|
|
49372
|
-
/* @__PURE__ */
|
|
49373
|
-
/* @__PURE__ */
|
|
49374
|
-
/* @__PURE__ */
|
|
49375
|
-
/* @__PURE__ */
|
|
49376
|
-
/* @__PURE__ */
|
|
49512
|
+
/* @__PURE__ */ jsxs238("div", { children: [
|
|
49513
|
+
/* @__PURE__ */ jsx269("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49514
|
+
/* @__PURE__ */ jsx269("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ jsx269("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs238("table", { className: "w-full text-left border-collapse", children: [
|
|
49515
|
+
/* @__PURE__ */ jsx269("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs238("tr", { children: [
|
|
49516
|
+
/* @__PURE__ */ jsx269("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: "#" }),
|
|
49517
|
+
/* @__PURE__ */ jsx269("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" }),
|
|
49518
|
+
/* @__PURE__ */ jsx269("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" }),
|
|
49519
|
+
/* @__PURE__ */ jsx269("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" })
|
|
49377
49520
|
] }) }),
|
|
49378
|
-
/* @__PURE__ */
|
|
49521
|
+
/* @__PURE__ */ jsx269("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ jsx269("tr", { children: /* @__PURE__ */ jsx269(
|
|
49379
49522
|
"td",
|
|
49380
49523
|
{
|
|
49381
49524
|
colSpan: 4,
|
|
@@ -49384,29 +49527,29 @@ function InvoiceForm2({
|
|
|
49384
49527
|
}
|
|
49385
49528
|
) }) : fields.map((item, index) => {
|
|
49386
49529
|
const total = item.quantity * item.amount;
|
|
49387
|
-
return /* @__PURE__ */
|
|
49530
|
+
return /* @__PURE__ */ jsxs238(
|
|
49388
49531
|
"tr",
|
|
49389
49532
|
{
|
|
49390
49533
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49391
49534
|
children: [
|
|
49392
|
-
/* @__PURE__ */
|
|
49393
|
-
/* @__PURE__ */
|
|
49394
|
-
/* @__PURE__ */
|
|
49395
|
-
/* @__PURE__ */
|
|
49535
|
+
/* @__PURE__ */ jsx269("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 }),
|
|
49536
|
+
/* @__PURE__ */ jsxs238("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
49537
|
+
/* @__PURE__ */ jsx269("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
49538
|
+
/* @__PURE__ */ jsxs238("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49396
49539
|
item.quantity,
|
|
49397
49540
|
" Cbm @",
|
|
49398
49541
|
" ",
|
|
49399
49542
|
Formats_default.Price(item.amount, "KES")
|
|
49400
49543
|
] })
|
|
49401
49544
|
] }),
|
|
49402
|
-
/* @__PURE__ */
|
|
49403
|
-
/* @__PURE__ */
|
|
49545
|
+
/* @__PURE__ */ jsx269("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") }),
|
|
49546
|
+
/* @__PURE__ */ jsx269("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ jsx269(
|
|
49404
49547
|
"button",
|
|
49405
49548
|
{
|
|
49406
49549
|
type: "button",
|
|
49407
49550
|
onClick: () => remove(index),
|
|
49408
49551
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49409
|
-
children: /* @__PURE__ */
|
|
49552
|
+
children: /* @__PURE__ */ jsx269(
|
|
49410
49553
|
Trash253,
|
|
49411
49554
|
{
|
|
49412
49555
|
size: 13,
|
|
@@ -49420,8 +49563,8 @@ function InvoiceForm2({
|
|
|
49420
49563
|
item.id
|
|
49421
49564
|
);
|
|
49422
49565
|
}) }),
|
|
49423
|
-
fields.length > 0 && /* @__PURE__ */
|
|
49424
|
-
/* @__PURE__ */
|
|
49566
|
+
fields.length > 0 && /* @__PURE__ */ jsx269("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs238("tr", { children: [
|
|
49567
|
+
/* @__PURE__ */ jsx269(
|
|
49425
49568
|
"td",
|
|
49426
49569
|
{
|
|
49427
49570
|
colSpan: 2,
|
|
@@ -49429,20 +49572,20 @@ function InvoiceForm2({
|
|
|
49429
49572
|
children: "Total"
|
|
49430
49573
|
}
|
|
49431
49574
|
),
|
|
49432
|
-
/* @__PURE__ */
|
|
49575
|
+
/* @__PURE__ */ jsx269("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(
|
|
49433
49576
|
fields.reduce(
|
|
49434
49577
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49435
49578
|
0
|
|
49436
49579
|
),
|
|
49437
49580
|
"KES"
|
|
49438
49581
|
) }),
|
|
49439
|
-
/* @__PURE__ */
|
|
49582
|
+
/* @__PURE__ */ jsx269("td", {})
|
|
49440
49583
|
] }) })
|
|
49441
49584
|
] }) }) })
|
|
49442
49585
|
] }),
|
|
49443
|
-
/* @__PURE__ */
|
|
49444
|
-
/* @__PURE__ */
|
|
49445
|
-
/* @__PURE__ */
|
|
49586
|
+
/* @__PURE__ */ jsxs238("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
49587
|
+
/* @__PURE__ */ jsxs238("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49588
|
+
/* @__PURE__ */ jsx269(
|
|
49446
49589
|
Fields_default.DateInput,
|
|
49447
49590
|
{
|
|
49448
49591
|
label: "Date",
|
|
@@ -49451,20 +49594,20 @@ function InvoiceForm2({
|
|
|
49451
49594
|
required: true
|
|
49452
49595
|
}
|
|
49453
49596
|
),
|
|
49454
|
-
/* @__PURE__ */
|
|
49597
|
+
/* @__PURE__ */ jsx269(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49455
49598
|
] }),
|
|
49456
|
-
/* @__PURE__ */
|
|
49457
|
-
/* @__PURE__ */
|
|
49599
|
+
/* @__PURE__ */ jsxs238("div", { className: "flex justify-between items-center mt-6", children: [
|
|
49600
|
+
/* @__PURE__ */ jsx269("div", { children: isEdit && /* @__PURE__ */ jsx269(
|
|
49458
49601
|
ConfirmModal,
|
|
49459
49602
|
{
|
|
49460
49603
|
title: "Reverse Transaction",
|
|
49461
|
-
description: /* @__PURE__ */
|
|
49462
|
-
/* @__PURE__ */
|
|
49463
|
-
/* @__PURE__ */
|
|
49604
|
+
description: /* @__PURE__ */ jsxs238("div", { className: "space-y-3 text-left", children: [
|
|
49605
|
+
/* @__PURE__ */ jsx269("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49606
|
+
/* @__PURE__ */ jsx269("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."' })
|
|
49464
49607
|
] }),
|
|
49465
49608
|
confirmationWord: "delete",
|
|
49466
49609
|
onSubmit: onReverse,
|
|
49467
|
-
children: /* @__PURE__ */
|
|
49610
|
+
children: /* @__PURE__ */ jsx269(
|
|
49468
49611
|
Button,
|
|
49469
49612
|
{
|
|
49470
49613
|
type: "button",
|
|
@@ -49477,8 +49620,8 @@ function InvoiceForm2({
|
|
|
49477
49620
|
)
|
|
49478
49621
|
}
|
|
49479
49622
|
) }),
|
|
49480
|
-
/* @__PURE__ */
|
|
49481
|
-
close && /* @__PURE__ */
|
|
49623
|
+
/* @__PURE__ */ jsxs238("div", { className: "flex justify-end gap-3", children: [
|
|
49624
|
+
close && /* @__PURE__ */ jsx269(
|
|
49482
49625
|
Button,
|
|
49483
49626
|
{
|
|
49484
49627
|
type: "button",
|
|
@@ -49488,7 +49631,7 @@ function InvoiceForm2({
|
|
|
49488
49631
|
children: "Cancel"
|
|
49489
49632
|
}
|
|
49490
49633
|
),
|
|
49491
|
-
/* @__PURE__ */
|
|
49634
|
+
/* @__PURE__ */ jsx269(
|
|
49492
49635
|
Button,
|
|
49493
49636
|
{
|
|
49494
49637
|
isLoading,
|
|
@@ -49515,10 +49658,10 @@ var InvoiceForm_default2 = InvoiceForm2;
|
|
|
49515
49658
|
import React46 from "react";
|
|
49516
49659
|
import { useForm as useForm61 } from "react-hook-form";
|
|
49517
49660
|
import { zodResolver as zodResolver60 } from "@hookform/resolvers/zod";
|
|
49518
|
-
import { useParams as
|
|
49661
|
+
import { useParams as useParams111 } from "react-router-dom";
|
|
49519
49662
|
import { message as message88 } from "antd";
|
|
49520
|
-
import
|
|
49521
|
-
import { jsx as
|
|
49663
|
+
import dayjs13 from "dayjs";
|
|
49664
|
+
import { jsx as jsx270, jsxs as jsxs239 } from "react/jsx-runtime";
|
|
49522
49665
|
function JournalForm5({
|
|
49523
49666
|
onReload,
|
|
49524
49667
|
close,
|
|
@@ -49526,7 +49669,7 @@ function JournalForm5({
|
|
|
49526
49669
|
action = "debit",
|
|
49527
49670
|
id
|
|
49528
49671
|
}) {
|
|
49529
|
-
const { branchId } =
|
|
49672
|
+
const { branchId } = useParams111();
|
|
49530
49673
|
const { currencies } = useWarqadConfig();
|
|
49531
49674
|
const { stock: defaultCurrency } = currencies;
|
|
49532
49675
|
const [ref2, setRef] = React46.useState(void 0);
|
|
@@ -49537,7 +49680,7 @@ function JournalForm5({
|
|
|
49537
49680
|
const methods = useForm61({
|
|
49538
49681
|
resolver: zodResolver60(journalSchema5),
|
|
49539
49682
|
defaultValues: {
|
|
49540
|
-
date:
|
|
49683
|
+
date: dayjs13().format("DD/MM/YYYY"),
|
|
49541
49684
|
currency: defaultCurrency,
|
|
49542
49685
|
action,
|
|
49543
49686
|
description: "Payment ",
|
|
@@ -49609,19 +49752,19 @@ function JournalForm5({
|
|
|
49609
49752
|
e.preventDefault();
|
|
49610
49753
|
}
|
|
49611
49754
|
};
|
|
49612
|
-
return /* @__PURE__ */
|
|
49755
|
+
return /* @__PURE__ */ jsx270(
|
|
49613
49756
|
Card,
|
|
49614
49757
|
{
|
|
49615
49758
|
isLoading: getLoading,
|
|
49616
49759
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49617
|
-
children: /* @__PURE__ */
|
|
49760
|
+
children: /* @__PURE__ */ jsx270(Card.Content, { children: /* @__PURE__ */ jsxs239(
|
|
49618
49761
|
"form",
|
|
49619
49762
|
{
|
|
49620
49763
|
onSubmit: handleSubmit(onSubmit),
|
|
49621
49764
|
onKeyDown: handleKeyDown,
|
|
49622
49765
|
className: "space-y-4",
|
|
49623
49766
|
children: [
|
|
49624
|
-
/* @__PURE__ */
|
|
49767
|
+
/* @__PURE__ */ jsx270(
|
|
49625
49768
|
Fields_default.Input,
|
|
49626
49769
|
{
|
|
49627
49770
|
label: "Description",
|
|
@@ -49632,8 +49775,8 @@ function JournalForm5({
|
|
|
49632
49775
|
placeholder: "Enter description"
|
|
49633
49776
|
}
|
|
49634
49777
|
),
|
|
49635
|
-
/* @__PURE__ */
|
|
49636
|
-
/* @__PURE__ */
|
|
49778
|
+
/* @__PURE__ */ jsxs239("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49779
|
+
/* @__PURE__ */ jsx270(
|
|
49637
49780
|
Fields_default.DateInput,
|
|
49638
49781
|
{
|
|
49639
49782
|
label: "Date",
|
|
@@ -49642,7 +49785,7 @@ function JournalForm5({
|
|
|
49642
49785
|
required: true
|
|
49643
49786
|
}
|
|
49644
49787
|
),
|
|
49645
|
-
/* @__PURE__ */
|
|
49788
|
+
/* @__PURE__ */ jsx270(
|
|
49646
49789
|
Fields_default.Input,
|
|
49647
49790
|
{
|
|
49648
49791
|
label: "Currency",
|
|
@@ -49652,8 +49795,8 @@ function JournalForm5({
|
|
|
49652
49795
|
}
|
|
49653
49796
|
)
|
|
49654
49797
|
] }),
|
|
49655
|
-
/* @__PURE__ */
|
|
49656
|
-
/* @__PURE__ */
|
|
49798
|
+
/* @__PURE__ */ jsxs239("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49799
|
+
/* @__PURE__ */ jsx270(
|
|
49657
49800
|
Fields_default.Input,
|
|
49658
49801
|
{
|
|
49659
49802
|
label: "Amount",
|
|
@@ -49664,7 +49807,7 @@ function JournalForm5({
|
|
|
49664
49807
|
placeholder: "0.00"
|
|
49665
49808
|
}
|
|
49666
49809
|
),
|
|
49667
|
-
/* @__PURE__ */
|
|
49810
|
+
/* @__PURE__ */ jsx270(
|
|
49668
49811
|
Fields_default.Select,
|
|
49669
49812
|
{
|
|
49670
49813
|
label: "Action",
|
|
@@ -49678,7 +49821,7 @@ function JournalForm5({
|
|
|
49678
49821
|
}
|
|
49679
49822
|
)
|
|
49680
49823
|
] }),
|
|
49681
|
-
/* @__PURE__ */
|
|
49824
|
+
/* @__PURE__ */ jsx270(
|
|
49682
49825
|
Fields_default.Textarea,
|
|
49683
49826
|
{
|
|
49684
49827
|
label: "Note",
|
|
@@ -49688,18 +49831,18 @@ function JournalForm5({
|
|
|
49688
49831
|
rows: 3
|
|
49689
49832
|
}
|
|
49690
49833
|
),
|
|
49691
|
-
/* @__PURE__ */
|
|
49692
|
-
/* @__PURE__ */
|
|
49834
|
+
/* @__PURE__ */ jsxs239("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
49835
|
+
/* @__PURE__ */ jsx270("div", { children: isEdit && /* @__PURE__ */ jsx270(
|
|
49693
49836
|
ConfirmModal,
|
|
49694
49837
|
{
|
|
49695
49838
|
title: "Reverse Transaction",
|
|
49696
|
-
description: /* @__PURE__ */
|
|
49697
|
-
/* @__PURE__ */
|
|
49698
|
-
/* @__PURE__ */
|
|
49839
|
+
description: /* @__PURE__ */ jsxs239("div", { className: "space-y-3 text-left", children: [
|
|
49840
|
+
/* @__PURE__ */ jsx270("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49841
|
+
/* @__PURE__ */ jsx270("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."' })
|
|
49699
49842
|
] }),
|
|
49700
49843
|
confirmationWord: "delete",
|
|
49701
49844
|
onSubmit: onReverse,
|
|
49702
|
-
children: /* @__PURE__ */
|
|
49845
|
+
children: /* @__PURE__ */ jsx270(
|
|
49703
49846
|
Button,
|
|
49704
49847
|
{
|
|
49705
49848
|
type: "button",
|
|
@@ -49712,8 +49855,8 @@ function JournalForm5({
|
|
|
49712
49855
|
)
|
|
49713
49856
|
}
|
|
49714
49857
|
) }),
|
|
49715
|
-
/* @__PURE__ */
|
|
49716
|
-
close && /* @__PURE__ */
|
|
49858
|
+
/* @__PURE__ */ jsxs239("div", { className: "flex justify-end gap-3", children: [
|
|
49859
|
+
close && /* @__PURE__ */ jsx270(
|
|
49717
49860
|
Button,
|
|
49718
49861
|
{
|
|
49719
49862
|
type: "button",
|
|
@@ -49723,7 +49866,7 @@ function JournalForm5({
|
|
|
49723
49866
|
children: "Cancel"
|
|
49724
49867
|
}
|
|
49725
49868
|
),
|
|
49726
|
-
/* @__PURE__ */
|
|
49869
|
+
/* @__PURE__ */ jsx270(
|
|
49727
49870
|
Button,
|
|
49728
49871
|
{
|
|
49729
49872
|
isLoading,
|
|
@@ -49745,15 +49888,15 @@ function JournalForm5({
|
|
|
49745
49888
|
var journalForm_default2 = JournalForm5;
|
|
49746
49889
|
|
|
49747
49890
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49748
|
-
import { Fragment as
|
|
49891
|
+
import { Fragment as Fragment136, jsx as jsx271, jsxs as jsxs240 } from "react/jsx-runtime";
|
|
49749
49892
|
function CargoIM({ v, url }) {
|
|
49750
|
-
const { branchId } =
|
|
49893
|
+
const { branchId } = useParams112();
|
|
49751
49894
|
const { apiConfig } = useWarqadConfig();
|
|
49752
49895
|
const { width } = useMediaSize();
|
|
49753
49896
|
const isLargeScreen = width > 768;
|
|
49754
49897
|
const navigate = useNavigate65();
|
|
49755
49898
|
const type = "supplier";
|
|
49756
|
-
const [deleteAccount, setDeleteAccount] =
|
|
49899
|
+
const [deleteAccount, setDeleteAccount] = useState117(null);
|
|
49757
49900
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
49758
49901
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
49759
49902
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -49764,17 +49907,17 @@ function CargoIM({ v, url }) {
|
|
|
49764
49907
|
const items = (data2) => [
|
|
49765
49908
|
{
|
|
49766
49909
|
label: `Edit ${type}`,
|
|
49767
|
-
icon: /* @__PURE__ */
|
|
49910
|
+
icon: /* @__PURE__ */ jsx271(FilePenLine43, { size: 16 }),
|
|
49768
49911
|
onClick: () => openState({
|
|
49769
49912
|
type: "Account",
|
|
49770
|
-
content: /* @__PURE__ */
|
|
49913
|
+
content: /* @__PURE__ */ jsx271(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
49771
49914
|
title: "Account Form",
|
|
49772
49915
|
width: 800
|
|
49773
49916
|
})
|
|
49774
49917
|
},
|
|
49775
49918
|
{
|
|
49776
49919
|
label: `Delete ${type}`,
|
|
49777
|
-
icon: /* @__PURE__ */
|
|
49920
|
+
icon: /* @__PURE__ */ jsx271(Trash254, { className: "text-red-500", size: 16 }),
|
|
49778
49921
|
onClick: () => setDeleteAccount(data2)
|
|
49779
49922
|
}
|
|
49780
49923
|
].filter(Boolean);
|
|
@@ -49785,7 +49928,7 @@ function CargoIM({ v, url }) {
|
|
|
49785
49928
|
className: "w-full",
|
|
49786
49929
|
cell: ({ row }) => {
|
|
49787
49930
|
const account = row.original;
|
|
49788
|
-
return /* @__PURE__ */
|
|
49931
|
+
return /* @__PURE__ */ jsx271(
|
|
49789
49932
|
"span",
|
|
49790
49933
|
{
|
|
49791
49934
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -49814,8 +49957,8 @@ function CargoIM({ v, url }) {
|
|
|
49814
49957
|
className: "w-px whitespace-nowrap",
|
|
49815
49958
|
cell: ({ row }) => {
|
|
49816
49959
|
const data2 = row.original;
|
|
49817
|
-
return /* @__PURE__ */
|
|
49818
|
-
/* @__PURE__ */
|
|
49960
|
+
return /* @__PURE__ */ jsxs240("div", { className: "flex gap-4 items-center", children: [
|
|
49961
|
+
/* @__PURE__ */ jsx271(
|
|
49819
49962
|
"button",
|
|
49820
49963
|
{
|
|
49821
49964
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -49823,7 +49966,7 @@ function CargoIM({ v, url }) {
|
|
|
49823
49966
|
openState({
|
|
49824
49967
|
type: "credit",
|
|
49825
49968
|
closeOnOverlayClick: false,
|
|
49826
|
-
content: /* @__PURE__ */
|
|
49969
|
+
content: /* @__PURE__ */ jsx271(
|
|
49827
49970
|
InvoiceForm_default2,
|
|
49828
49971
|
{
|
|
49829
49972
|
onReload: reload,
|
|
@@ -49838,7 +49981,7 @@ function CargoIM({ v, url }) {
|
|
|
49838
49981
|
children: "Inv"
|
|
49839
49982
|
}
|
|
49840
49983
|
),
|
|
49841
|
-
/* @__PURE__ */
|
|
49984
|
+
/* @__PURE__ */ jsx271(
|
|
49842
49985
|
"button",
|
|
49843
49986
|
{
|
|
49844
49987
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -49846,7 +49989,7 @@ function CargoIM({ v, url }) {
|
|
|
49846
49989
|
openState({
|
|
49847
49990
|
type: "debit",
|
|
49848
49991
|
closeOnOverlayClick: false,
|
|
49849
|
-
content: /* @__PURE__ */
|
|
49992
|
+
content: /* @__PURE__ */ jsx271(
|
|
49850
49993
|
journalForm_default2,
|
|
49851
49994
|
{
|
|
49852
49995
|
onReload: reload,
|
|
@@ -49862,14 +50005,14 @@ function CargoIM({ v, url }) {
|
|
|
49862
50005
|
children: "Pay"
|
|
49863
50006
|
}
|
|
49864
50007
|
),
|
|
49865
|
-
/* @__PURE__ */
|
|
50008
|
+
/* @__PURE__ */ jsx271(
|
|
49866
50009
|
Dropdown,
|
|
49867
50010
|
{
|
|
49868
50011
|
className: "cursor-pointer",
|
|
49869
50012
|
width: "w-[150px]",
|
|
49870
50013
|
items: items(data2),
|
|
49871
50014
|
triggerMode: "hover",
|
|
49872
|
-
children: /* @__PURE__ */
|
|
50015
|
+
children: /* @__PURE__ */ jsx271(EllipsisVertical47, {})
|
|
49873
50016
|
}
|
|
49874
50017
|
)
|
|
49875
50018
|
] });
|
|
@@ -49893,9 +50036,9 @@ function CargoIM({ v, url }) {
|
|
|
49893
50036
|
return error;
|
|
49894
50037
|
}
|
|
49895
50038
|
};
|
|
49896
|
-
return /* @__PURE__ */
|
|
49897
|
-
/* @__PURE__ */
|
|
49898
|
-
/* @__PURE__ */
|
|
50039
|
+
return /* @__PURE__ */ jsxs240(Fragment136, { children: [
|
|
50040
|
+
/* @__PURE__ */ jsx271(Modal2, {}),
|
|
50041
|
+
/* @__PURE__ */ jsx271(
|
|
49899
50042
|
ConfirmModal,
|
|
49900
50043
|
{
|
|
49901
50044
|
isOpen: !!deleteAccount,
|
|
@@ -49908,7 +50051,7 @@ function CargoIM({ v, url }) {
|
|
|
49908
50051
|
children: null
|
|
49909
50052
|
}
|
|
49910
50053
|
),
|
|
49911
|
-
/* @__PURE__ */
|
|
50054
|
+
/* @__PURE__ */ jsx271("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ jsx271(
|
|
49912
50055
|
TransactionViewComponent,
|
|
49913
50056
|
{
|
|
49914
50057
|
columns,
|
|
@@ -49919,7 +50062,7 @@ function CargoIM({ v, url }) {
|
|
|
49919
50062
|
onCreate: () => {
|
|
49920
50063
|
openState({
|
|
49921
50064
|
type: "account",
|
|
49922
|
-
content: /* @__PURE__ */
|
|
50065
|
+
content: /* @__PURE__ */ jsx271(AccountForm_default3, { onReload: reload, close }),
|
|
49923
50066
|
title: "Account Form",
|
|
49924
50067
|
width: 800
|
|
49925
50068
|
});
|
|
@@ -49932,8 +50075,8 @@ var CargoIM_default = CargoIM;
|
|
|
49932
50075
|
|
|
49933
50076
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
49934
50077
|
import { useSearchParams as useSearchParams20 } from "react-router-dom";
|
|
49935
|
-
import { useMemo as
|
|
49936
|
-
import { Fragment as
|
|
50078
|
+
import { useMemo as useMemo54, useState as useState118, useEffect as useEffect117 } from "react";
|
|
50079
|
+
import { Fragment as Fragment137, jsx as jsx272, jsxs as jsxs241 } from "react/jsx-runtime";
|
|
49937
50080
|
var CargoIMReport = () => {
|
|
49938
50081
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
49939
50082
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -49949,7 +50092,7 @@ var CargoIMReport = () => {
|
|
|
49949
50092
|
const [searchParams, setSearchParams] = useSearchParams20();
|
|
49950
50093
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49951
50094
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
49952
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
50095
|
+
const [currencyFilter, setCurrencyFilter] = useState118(initialCurrency);
|
|
49953
50096
|
const handleCurrencyChange = (value) => {
|
|
49954
50097
|
setCurrencyFilter(value);
|
|
49955
50098
|
setSearchParams((prev) => {
|
|
@@ -49977,9 +50120,9 @@ var CargoIMReport = () => {
|
|
|
49977
50120
|
header: "Date",
|
|
49978
50121
|
key: "date",
|
|
49979
50122
|
className: "text-xs whitespace-nowrap",
|
|
49980
|
-
render: (row) => /* @__PURE__ */
|
|
49981
|
-
/* @__PURE__ */
|
|
49982
|
-
/* @__PURE__ */
|
|
50123
|
+
render: (row) => /* @__PURE__ */ jsxs241("div", { className: "", children: [
|
|
50124
|
+
/* @__PURE__ */ jsx272("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50125
|
+
/* @__PURE__ */ jsx272(
|
|
49983
50126
|
"span",
|
|
49984
50127
|
{
|
|
49985
50128
|
onClick: () => {
|
|
@@ -49998,13 +50141,13 @@ var CargoIMReport = () => {
|
|
|
49998
50141
|
header: "Container No",
|
|
49999
50142
|
key: "description",
|
|
50000
50143
|
className: "text-xs w-full break-words",
|
|
50001
|
-
render: (row) => /* @__PURE__ */
|
|
50144
|
+
render: (row) => /* @__PURE__ */ jsx272("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50002
50145
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50003
50146
|
/[^a-zA-Z0-9]/g,
|
|
50004
50147
|
""
|
|
50005
50148
|
);
|
|
50006
50149
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50007
|
-
return /* @__PURE__ */
|
|
50150
|
+
return /* @__PURE__ */ jsx272(
|
|
50008
50151
|
"div",
|
|
50009
50152
|
{
|
|
50010
50153
|
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`,
|
|
@@ -50018,13 +50161,13 @@ var CargoIMReport = () => {
|
|
|
50018
50161
|
header: "Cbm",
|
|
50019
50162
|
key: "cbm",
|
|
50020
50163
|
className: "text-xs whitespace-nowrap text-right",
|
|
50021
|
-
render: (row) => /* @__PURE__ */
|
|
50164
|
+
render: (row) => /* @__PURE__ */ jsx272("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) => {
|
|
50022
50165
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50023
50166
|
/[^a-zA-Z0-9]/g,
|
|
50024
50167
|
""
|
|
50025
50168
|
);
|
|
50026
50169
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50027
|
-
return /* @__PURE__ */
|
|
50170
|
+
return /* @__PURE__ */ jsx272(
|
|
50028
50171
|
"div",
|
|
50029
50172
|
{
|
|
50030
50173
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50041,20 +50184,20 @@ var CargoIMReport = () => {
|
|
|
50041
50184
|
),
|
|
50042
50185
|
0
|
|
50043
50186
|
);
|
|
50044
|
-
return totalCbm > 0 ? /* @__PURE__ */
|
|
50187
|
+
return totalCbm > 0 ? /* @__PURE__ */ jsx272("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50045
50188
|
}
|
|
50046
50189
|
},
|
|
50047
50190
|
{
|
|
50048
50191
|
header: "Price",
|
|
50049
50192
|
key: "price",
|
|
50050
50193
|
className: "text-xs whitespace-nowrap text-right",
|
|
50051
|
-
render: (row) => /* @__PURE__ */
|
|
50194
|
+
render: (row) => /* @__PURE__ */ jsx272("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) => {
|
|
50052
50195
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50053
50196
|
/[^a-zA-Z0-9]/g,
|
|
50054
50197
|
""
|
|
50055
50198
|
);
|
|
50056
50199
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50057
|
-
return /* @__PURE__ */
|
|
50200
|
+
return /* @__PURE__ */ jsx272(
|
|
50058
50201
|
"div",
|
|
50059
50202
|
{
|
|
50060
50203
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50068,13 +50211,13 @@ var CargoIMReport = () => {
|
|
|
50068
50211
|
header: "Credit",
|
|
50069
50212
|
key: "credit",
|
|
50070
50213
|
className: "text-xs whitespace-nowrap text-right",
|
|
50071
|
-
render: (row) => /* @__PURE__ */
|
|
50214
|
+
render: (row) => /* @__PURE__ */ jsx272("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) => {
|
|
50072
50215
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50073
50216
|
/[^a-zA-Z0-9]/g,
|
|
50074
50217
|
""
|
|
50075
50218
|
);
|
|
50076
50219
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50077
|
-
return /* @__PURE__ */
|
|
50220
|
+
return /* @__PURE__ */ jsx272(
|
|
50078
50221
|
"div",
|
|
50079
50222
|
{
|
|
50080
50223
|
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`,
|
|
@@ -50083,7 +50226,7 @@ var CargoIMReport = () => {
|
|
|
50083
50226
|
idx
|
|
50084
50227
|
);
|
|
50085
50228
|
}) }),
|
|
50086
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50229
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx272("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50087
50230
|
data2.reduce(
|
|
50088
50231
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50089
50232
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50097,13 +50240,13 @@ var CargoIMReport = () => {
|
|
|
50097
50240
|
header: "Debit",
|
|
50098
50241
|
key: "debit",
|
|
50099
50242
|
className: "text-xs whitespace-nowrap text-right",
|
|
50100
|
-
render: (row) => /* @__PURE__ */
|
|
50243
|
+
render: (row) => /* @__PURE__ */ jsx272("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) => {
|
|
50101
50244
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50102
50245
|
/[^a-zA-Z0-9]/g,
|
|
50103
50246
|
""
|
|
50104
50247
|
);
|
|
50105
50248
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50106
|
-
return /* @__PURE__ */
|
|
50249
|
+
return /* @__PURE__ */ jsx272(
|
|
50107
50250
|
"div",
|
|
50108
50251
|
{
|
|
50109
50252
|
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`,
|
|
@@ -50112,7 +50255,7 @@ var CargoIMReport = () => {
|
|
|
50112
50255
|
idx
|
|
50113
50256
|
);
|
|
50114
50257
|
}) }),
|
|
50115
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50258
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx272("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50116
50259
|
data2.reduce(
|
|
50117
50260
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50118
50261
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50126,14 +50269,14 @@ var CargoIMReport = () => {
|
|
|
50126
50269
|
header: "Balance",
|
|
50127
50270
|
key: "runningBalance",
|
|
50128
50271
|
className: "text-xs whitespace-nowrap text-right",
|
|
50129
|
-
render: (row) => /* @__PURE__ */
|
|
50130
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50272
|
+
render: (row) => /* @__PURE__ */ jsx272("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50273
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx272("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50131
50274
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50132
50275
|
currency
|
|
50133
50276
|
) })
|
|
50134
50277
|
}
|
|
50135
50278
|
];
|
|
50136
|
-
const datas =
|
|
50279
|
+
const datas = useMemo54(() => {
|
|
50137
50280
|
let runningBalance = 0;
|
|
50138
50281
|
const transactions = data?.data?.transactions;
|
|
50139
50282
|
const res = (transactions || []).map((item) => {
|
|
@@ -50170,10 +50313,10 @@ var CargoIMReport = () => {
|
|
|
50170
50313
|
{ label: "Account Type", value: data?.data?.type },
|
|
50171
50314
|
{ label: "Currency", value: currencyFilter }
|
|
50172
50315
|
];
|
|
50173
|
-
return /* @__PURE__ */
|
|
50174
|
-
/* @__PURE__ */
|
|
50175
|
-
/* @__PURE__ */
|
|
50176
|
-
/* @__PURE__ */
|
|
50316
|
+
return /* @__PURE__ */ jsxs241(Fragment137, { children: [
|
|
50317
|
+
/* @__PURE__ */ jsx272(Modal2, {}),
|
|
50318
|
+
/* @__PURE__ */ jsx272(TransactionView, {}),
|
|
50319
|
+
/* @__PURE__ */ jsx272(
|
|
50177
50320
|
A4DataView,
|
|
50178
50321
|
{
|
|
50179
50322
|
columns,
|
|
@@ -50188,7 +50331,7 @@ var CargoIMReport = () => {
|
|
|
50188
50331
|
openState({
|
|
50189
50332
|
type: "debit",
|
|
50190
50333
|
closeOnOverlayClick: false,
|
|
50191
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */
|
|
50334
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ jsx272(
|
|
50192
50335
|
InvoiceForm_default2,
|
|
50193
50336
|
{
|
|
50194
50337
|
close: closeTransaction,
|
|
@@ -50196,7 +50339,7 @@ var CargoIMReport = () => {
|
|
|
50196
50339
|
onReload: reload,
|
|
50197
50340
|
id: row._id
|
|
50198
50341
|
}
|
|
50199
|
-
) : /* @__PURE__ */
|
|
50342
|
+
) : /* @__PURE__ */ jsx272(
|
|
50200
50343
|
journalForm_default2,
|
|
50201
50344
|
{
|
|
50202
50345
|
close: closeTransaction,
|
|
@@ -50209,7 +50352,7 @@ var CargoIMReport = () => {
|
|
|
50209
50352
|
width: 800
|
|
50210
50353
|
});
|
|
50211
50354
|
},
|
|
50212
|
-
headers: /* @__PURE__ */
|
|
50355
|
+
headers: /* @__PURE__ */ jsx272("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx272(
|
|
50213
50356
|
Fields_default.Select,
|
|
50214
50357
|
{
|
|
50215
50358
|
options: currencies,
|
|
@@ -50225,21 +50368,21 @@ var CargoIMReport = () => {
|
|
|
50225
50368
|
var cargoIMReport_default = CargoIMReport;
|
|
50226
50369
|
|
|
50227
50370
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50228
|
-
import { useNavigate as useNavigate66, useParams as
|
|
50371
|
+
import { useNavigate as useNavigate66, useParams as useParams113 } from "react-router-dom";
|
|
50229
50372
|
import {
|
|
50230
50373
|
EllipsisVertical as EllipsisVertical48,
|
|
50231
50374
|
FileChartLine as FileChartLine2,
|
|
50232
50375
|
FilePenLine as FilePenLine44,
|
|
50233
50376
|
Trash2 as Trash255
|
|
50234
50377
|
} from "lucide-react";
|
|
50235
|
-
import { useState as
|
|
50378
|
+
import { useState as useState119 } from "react";
|
|
50236
50379
|
import { message as message90 } from "antd";
|
|
50237
|
-
import { Fragment as
|
|
50380
|
+
import { Fragment as Fragment138, jsx as jsx273, jsxs as jsxs242 } from "react/jsx-runtime";
|
|
50238
50381
|
function Forex2Accounts({ v, url }) {
|
|
50239
|
-
const { branchId } =
|
|
50382
|
+
const { branchId } = useParams113();
|
|
50240
50383
|
const navigate = useNavigate66();
|
|
50241
50384
|
const type = "account";
|
|
50242
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50385
|
+
const [deleteAccount, setDeleteAccount] = useState119(null);
|
|
50243
50386
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50244
50387
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50245
50388
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50250,22 +50393,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50250
50393
|
const items = (data2) => [
|
|
50251
50394
|
{
|
|
50252
50395
|
label: `Currency Report`,
|
|
50253
|
-
icon: /* @__PURE__ */
|
|
50396
|
+
icon: /* @__PURE__ */ jsx273(FileChartLine2, { size: 16 }),
|
|
50254
50397
|
onClick: () => navigate(data2?._id)
|
|
50255
50398
|
},
|
|
50256
50399
|
{
|
|
50257
50400
|
label: `Edit ${type}`,
|
|
50258
|
-
icon: /* @__PURE__ */
|
|
50401
|
+
icon: /* @__PURE__ */ jsx273(FilePenLine44, { size: 16 }),
|
|
50259
50402
|
onClick: () => openState({
|
|
50260
50403
|
type: "forex account",
|
|
50261
|
-
content: /* @__PURE__ */
|
|
50404
|
+
content: /* @__PURE__ */ jsx273(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50262
50405
|
title: "Forex Account Form",
|
|
50263
50406
|
width: 800
|
|
50264
50407
|
})
|
|
50265
50408
|
},
|
|
50266
50409
|
{
|
|
50267
50410
|
label: `Delete ${type}`,
|
|
50268
|
-
icon: /* @__PURE__ */
|
|
50411
|
+
icon: /* @__PURE__ */ jsx273(Trash255, { className: "text-red-500", size: 16 }),
|
|
50269
50412
|
onClick: () => setDeleteAccount(data2)
|
|
50270
50413
|
}
|
|
50271
50414
|
].filter(Boolean);
|
|
@@ -50275,7 +50418,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50275
50418
|
header: "Name",
|
|
50276
50419
|
cell: ({ row }) => {
|
|
50277
50420
|
const account = row.original;
|
|
50278
|
-
return /* @__PURE__ */
|
|
50421
|
+
return /* @__PURE__ */ jsx273(
|
|
50279
50422
|
"span",
|
|
50280
50423
|
{
|
|
50281
50424
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50290,7 +50433,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50290
50433
|
header: "Phone",
|
|
50291
50434
|
cell: ({ row }) => {
|
|
50292
50435
|
const account = row.original;
|
|
50293
|
-
return /* @__PURE__ */
|
|
50436
|
+
return /* @__PURE__ */ jsx273("span", { children: account?.phoneNumber || "N/A" });
|
|
50294
50437
|
}
|
|
50295
50438
|
},
|
|
50296
50439
|
{
|
|
@@ -50298,14 +50441,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50298
50441
|
header: "Balances",
|
|
50299
50442
|
cell: ({ row }) => {
|
|
50300
50443
|
const account = row.original;
|
|
50301
|
-
return /* @__PURE__ */
|
|
50302
|
-
([currency, data2]) => /* @__PURE__ */
|
|
50444
|
+
return /* @__PURE__ */ jsx273("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50445
|
+
([currency, data2]) => /* @__PURE__ */ jsxs242(
|
|
50303
50446
|
"div",
|
|
50304
50447
|
{
|
|
50305
50448
|
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",
|
|
50306
50449
|
children: [
|
|
50307
|
-
/* @__PURE__ */
|
|
50308
|
-
/* @__PURE__ */
|
|
50450
|
+
/* @__PURE__ */ jsx273("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50451
|
+
/* @__PURE__ */ jsx273(
|
|
50309
50452
|
"span",
|
|
50310
50453
|
{
|
|
50311
50454
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50324,8 +50467,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50324
50467
|
header: "Actions",
|
|
50325
50468
|
cell: ({ row }) => {
|
|
50326
50469
|
const data2 = row.original;
|
|
50327
|
-
return /* @__PURE__ */
|
|
50328
|
-
/* @__PURE__ */
|
|
50470
|
+
return /* @__PURE__ */ jsxs242("div", { className: "flex gap-4 items-center", children: [
|
|
50471
|
+
/* @__PURE__ */ jsx273(
|
|
50329
50472
|
"button",
|
|
50330
50473
|
{
|
|
50331
50474
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50333,7 +50476,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50333
50476
|
openState({
|
|
50334
50477
|
type: "credit",
|
|
50335
50478
|
closeOnOverlayClick: false,
|
|
50336
|
-
content: /* @__PURE__ */
|
|
50479
|
+
content: /* @__PURE__ */ jsx273(
|
|
50337
50480
|
Forex2FormTransaction_default,
|
|
50338
50481
|
{
|
|
50339
50482
|
close,
|
|
@@ -50349,7 +50492,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50349
50492
|
children: "Out"
|
|
50350
50493
|
}
|
|
50351
50494
|
),
|
|
50352
|
-
/* @__PURE__ */
|
|
50495
|
+
/* @__PURE__ */ jsx273(
|
|
50353
50496
|
"button",
|
|
50354
50497
|
{
|
|
50355
50498
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50357,7 +50500,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50357
50500
|
openState({
|
|
50358
50501
|
type: "debit",
|
|
50359
50502
|
closeOnOverlayClick: false,
|
|
50360
|
-
content: /* @__PURE__ */
|
|
50503
|
+
content: /* @__PURE__ */ jsx273(
|
|
50361
50504
|
Forex2FormTransaction_default,
|
|
50362
50505
|
{
|
|
50363
50506
|
close,
|
|
@@ -50373,13 +50516,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50373
50516
|
children: "In"
|
|
50374
50517
|
}
|
|
50375
50518
|
),
|
|
50376
|
-
/* @__PURE__ */
|
|
50519
|
+
/* @__PURE__ */ jsx273(
|
|
50377
50520
|
Dropdown,
|
|
50378
50521
|
{
|
|
50379
50522
|
className: "cursor-pointer w-[150px]",
|
|
50380
50523
|
items: items(data2),
|
|
50381
50524
|
triggerMode: "hover",
|
|
50382
|
-
children: /* @__PURE__ */
|
|
50525
|
+
children: /* @__PURE__ */ jsx273(EllipsisVertical48, {})
|
|
50383
50526
|
}
|
|
50384
50527
|
)
|
|
50385
50528
|
] });
|
|
@@ -50418,9 +50561,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50418
50561
|
};
|
|
50419
50562
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50420
50563
|
console.log(currencies);
|
|
50421
|
-
return /* @__PURE__ */
|
|
50422
|
-
/* @__PURE__ */
|
|
50423
|
-
/* @__PURE__ */
|
|
50564
|
+
return /* @__PURE__ */ jsxs242(Fragment138, { children: [
|
|
50565
|
+
/* @__PURE__ */ jsx273(Modal2, {}),
|
|
50566
|
+
/* @__PURE__ */ jsx273(
|
|
50424
50567
|
ConfirmModal,
|
|
50425
50568
|
{
|
|
50426
50569
|
isOpen: !!deleteAccount,
|
|
@@ -50433,9 +50576,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50433
50576
|
children: null
|
|
50434
50577
|
}
|
|
50435
50578
|
),
|
|
50436
|
-
/* @__PURE__ */
|
|
50437
|
-
/* @__PURE__ */
|
|
50438
|
-
/* @__PURE__ */
|
|
50579
|
+
/* @__PURE__ */ jsxs242("div", { children: [
|
|
50580
|
+
/* @__PURE__ */ jsx273(ForexAccountSummary_default, { currencies, isLoading }),
|
|
50581
|
+
/* @__PURE__ */ jsx273(
|
|
50439
50582
|
TransactionViewComponent,
|
|
50440
50583
|
{
|
|
50441
50584
|
columns,
|
|
@@ -50447,7 +50590,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50447
50590
|
onCreate: () => {
|
|
50448
50591
|
openState({
|
|
50449
50592
|
type: "forex account",
|
|
50450
|
-
content: /* @__PURE__ */
|
|
50593
|
+
content: /* @__PURE__ */ jsx273(ForexAccountForm_default, { close, reloads: reload }),
|
|
50451
50594
|
title: "Forex Account Form",
|
|
50452
50595
|
width: 800
|
|
50453
50596
|
});
|
|
@@ -50460,14 +50603,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50460
50603
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50461
50604
|
|
|
50462
50605
|
// src/components/reports/ProductList.tsx
|
|
50463
|
-
import { useParams as
|
|
50464
|
-
import { Fragment as
|
|
50606
|
+
import { useParams as useParams114 } from "react-router-dom";
|
|
50607
|
+
import { Fragment as Fragment139, jsx as jsx274, jsxs as jsxs243 } from "react/jsx-runtime";
|
|
50465
50608
|
var options9 = [
|
|
50466
50609
|
{ label: "Product", value: "product" },
|
|
50467
50610
|
{ label: "Pack", value: "pack" }
|
|
50468
50611
|
];
|
|
50469
50612
|
var ProductList2 = ({ value = false }) => {
|
|
50470
|
-
const { branchId } =
|
|
50613
|
+
const { branchId } = useParams114();
|
|
50471
50614
|
const { branches } = useAuth_default();
|
|
50472
50615
|
const { TransactionView } = useTransactionView_default();
|
|
50473
50616
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50489,7 +50632,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50489
50632
|
key: "name",
|
|
50490
50633
|
className: "text-xs whitespace-nowrap",
|
|
50491
50634
|
render: (row) => {
|
|
50492
|
-
return /* @__PURE__ */
|
|
50635
|
+
return /* @__PURE__ */ jsx274("div", { className: "", children: /* @__PURE__ */ jsx274("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
50493
50636
|
}
|
|
50494
50637
|
},
|
|
50495
50638
|
...value ? [
|
|
@@ -50497,14 +50640,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50497
50640
|
header: "Cost",
|
|
50498
50641
|
key: "cost",
|
|
50499
50642
|
className: "text-xs whitespace-nowrap text-right",
|
|
50500
|
-
render: (row) => /* @__PURE__ */
|
|
50643
|
+
render: (row) => /* @__PURE__ */ jsx274("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50501
50644
|
}
|
|
50502
50645
|
] : []
|
|
50503
50646
|
];
|
|
50504
50647
|
const datas = data?.data || [];
|
|
50505
|
-
return /* @__PURE__ */
|
|
50506
|
-
/* @__PURE__ */
|
|
50507
|
-
/* @__PURE__ */
|
|
50648
|
+
return /* @__PURE__ */ jsxs243(Fragment139, { children: [
|
|
50649
|
+
/* @__PURE__ */ jsx274(TransactionView, {}),
|
|
50650
|
+
/* @__PURE__ */ jsx274(
|
|
50508
50651
|
A4DataView,
|
|
50509
50652
|
{
|
|
50510
50653
|
columns,
|
|
@@ -50515,7 +50658,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50515
50658
|
tableTitle: "Stock List",
|
|
50516
50659
|
fixed: false,
|
|
50517
50660
|
startPage: 1e10,
|
|
50518
|
-
headers: /* @__PURE__ */
|
|
50661
|
+
headers: /* @__PURE__ */ jsx274(
|
|
50519
50662
|
Select,
|
|
50520
50663
|
{
|
|
50521
50664
|
options: options9,
|