warqadui 0.0.284 → 0.0.286
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +461 -347
- package/dist/index.mjs +412 -298
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -28887,7 +28887,7 @@ var StockLevel = ({
|
|
|
28887
28887
|
className: "text-xs whitespace-nowrap",
|
|
28888
28888
|
render: (row) => {
|
|
28889
28889
|
const yard = row?.yard || 0;
|
|
28890
|
-
return /* @__PURE__ */ jsx162("div", { className: "", children: /* @__PURE__ */ jsx162("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
28890
|
+
return /* @__PURE__ */ jsx162("div", { className: "", children: /* @__PURE__ */ jsx162("p", { className: "font-bold uppercase text-black dark:text-white print:text-black", children: row.name }) });
|
|
28891
28891
|
}
|
|
28892
28892
|
},
|
|
28893
28893
|
...!value ? branchNames.map((branchName) => ({
|
|
@@ -28900,7 +28900,7 @@ var StockLevel = ({
|
|
|
28900
28900
|
"div",
|
|
28901
28901
|
{
|
|
28902
28902
|
className: qty > 0 ? "text-green-500 font-bold" : qty < 0 ? "text-red-500 font-bold" : "",
|
|
28903
|
-
children: Formats_default.
|
|
28903
|
+
children: Formats_default.Amount(qty, false)
|
|
28904
28904
|
}
|
|
28905
28905
|
);
|
|
28906
28906
|
}
|
|
@@ -28915,37 +28915,15 @@ var StockLevel = ({
|
|
|
28915
28915
|
"span",
|
|
28916
28916
|
{
|
|
28917
28917
|
className: total > 0 ? "text-green-500 font-bold" : total < 0 ? "text-red-500 font-bold" : "",
|
|
28918
|
-
children: Formats_default.
|
|
28918
|
+
children: Formats_default.Amount(total, false)
|
|
28919
28919
|
}
|
|
28920
28920
|
);
|
|
28921
28921
|
},
|
|
28922
28922
|
renderFooter: (data2) => {
|
|
28923
28923
|
const total = data2.reduce((acc, row) => acc + row.total, 0);
|
|
28924
|
-
return /* @__PURE__ */ jsx162("span", { className: " font-bold", children: Formats_default.
|
|
28924
|
+
return /* @__PURE__ */ jsx162("span", { className: " font-bold", children: Formats_default.Amount(total, false) });
|
|
28925
28925
|
}
|
|
28926
28926
|
},
|
|
28927
|
-
...showYard ? [
|
|
28928
|
-
{
|
|
28929
|
-
header: "total Yard",
|
|
28930
|
-
key: "yard",
|
|
28931
|
-
className: "text-xs whitespace-nowrap",
|
|
28932
|
-
render: (row) => {
|
|
28933
|
-
const yard = row?.yard || 0;
|
|
28934
|
-
const totalYard = yard * row.total;
|
|
28935
|
-
return /* @__PURE__ */ jsxs137("div", { className: "", children: [
|
|
28936
|
-
/* @__PURE__ */ jsx162("p", { className: "font-bold text-right text-black dark:text-white print:text-black", children: yard > 0 ? Formats_default.Qty(totalYard) : "" }),
|
|
28937
|
-
/* @__PURE__ */ jsx162("p", { className: "text-[10px] text-gray-500 text-right dark:text-gray-400", children: yard > 0 ? `per/ ${Formats_default.Amount(row.totalValue / totalYard, false)}` : "" })
|
|
28938
|
-
] });
|
|
28939
|
-
},
|
|
28940
|
-
renderFooter: (data2) => {
|
|
28941
|
-
const total = data2.reduce(
|
|
28942
|
-
(acc, row) => acc + (row.yard || 0) * row.total,
|
|
28943
|
-
0
|
|
28944
|
-
);
|
|
28945
|
-
return /* @__PURE__ */ jsx162("p", { className: " font-bold text-right", children: Formats_default.Qty(total) });
|
|
28946
|
-
}
|
|
28947
|
-
}
|
|
28948
|
-
] : [],
|
|
28949
28927
|
...value ? [
|
|
28950
28928
|
{
|
|
28951
28929
|
header: "Cost",
|
|
@@ -46185,7 +46163,6 @@ function SaleStockTable3({
|
|
|
46185
46163
|
adjustmentId
|
|
46186
46164
|
}) {
|
|
46187
46165
|
const { branchId } = useApp_default();
|
|
46188
|
-
const { currencies } = useWarqadConfig();
|
|
46189
46166
|
const { branches } = useAuth_default();
|
|
46190
46167
|
const branchCurrency = (branches || []).find(
|
|
46191
46168
|
(item) => item._id === branchId
|
|
@@ -46412,7 +46389,7 @@ function SaleStockTable3({
|
|
|
46412
46389
|
)
|
|
46413
46390
|
},
|
|
46414
46391
|
cell: ({ row }) => {
|
|
46415
|
-
return /* @__PURE__ */ jsx255("h2", { children: Formats_default.
|
|
46392
|
+
return /* @__PURE__ */ jsx255("h2", { children: Formats_default.Amount(row.original?.lineQuantity || 0, false) });
|
|
46416
46393
|
}
|
|
46417
46394
|
},
|
|
46418
46395
|
{
|
|
@@ -46437,7 +46414,7 @@ function SaleStockTable3({
|
|
|
46437
46414
|
)
|
|
46438
46415
|
},
|
|
46439
46416
|
cell: ({ row }) => {
|
|
46440
|
-
return /* @__PURE__ */ jsx255("h2", { children: Formats_default.
|
|
46417
|
+
return /* @__PURE__ */ jsx255("h2", { children: Formats_default.Amount(row.original?.lineSell || 0, false) });
|
|
46441
46418
|
}
|
|
46442
46419
|
},
|
|
46443
46420
|
{
|
|
@@ -46463,7 +46440,7 @@ function SaleStockTable3({
|
|
|
46463
46440
|
)
|
|
46464
46441
|
},
|
|
46465
46442
|
cell: ({ row }) => {
|
|
46466
|
-
return /* @__PURE__ */ jsx255("h2", { children: Formats_default.Amount(row.original?.lineTotal || 0) });
|
|
46443
|
+
return /* @__PURE__ */ jsx255("h2", { children: Formats_default.Amount(row.original?.lineTotal || 0, false) });
|
|
46467
46444
|
},
|
|
46468
46445
|
footer: ({ row }) => {
|
|
46469
46446
|
const total = data?.reduce((acc, row2) => acc + row2.lineTotal, 0);
|
|
@@ -48652,7 +48629,7 @@ var Expenses3Reports = () => {
|
|
|
48652
48629
|
const [startDate, setStartDate] = useState113(null);
|
|
48653
48630
|
const [endDate, setEndDate] = useState113(null);
|
|
48654
48631
|
const { A4DataView, data } = useA4DataView_default({
|
|
48655
|
-
url: `/transactions/get?
|
|
48632
|
+
url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48656
48633
|
v: 1
|
|
48657
48634
|
// No prefix
|
|
48658
48635
|
});
|
|
@@ -48777,18 +48754,155 @@ var Expenses3Reports = () => {
|
|
|
48777
48754
|
};
|
|
48778
48755
|
var Expenses3Reports_default = Expenses3Reports;
|
|
48779
48756
|
|
|
48757
|
+
// src/components/Transactions/3/reports/ExpensesJournal3.tsx
|
|
48758
|
+
import { useParams as useParams107 } from "react-router-dom";
|
|
48759
|
+
import { useMemo as useMemo53, useState as useState114 } from "react";
|
|
48760
|
+
import { DatePicker as DatePicker10 } from "antd";
|
|
48761
|
+
import dayjs12 from "dayjs";
|
|
48762
|
+
import { Fragment as Fragment134, jsx as jsx266, jsxs as jsxs235 } from "react/jsx-runtime";
|
|
48763
|
+
var Expenses3Reports2 = () => {
|
|
48764
|
+
const { branchId } = useParams107();
|
|
48765
|
+
const [startDate, setStartDate] = useState114(null);
|
|
48766
|
+
const [endDate, setEndDate] = useState114(null);
|
|
48767
|
+
const { A4DataView, data } = useA4DataView_default({
|
|
48768
|
+
url: `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48769
|
+
v: 1
|
|
48770
|
+
// No prefix
|
|
48771
|
+
});
|
|
48772
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48773
|
+
const { defaultCurrency } = useWarqadConfig()?.currencies;
|
|
48774
|
+
const columns = [
|
|
48775
|
+
{
|
|
48776
|
+
header: "Date",
|
|
48777
|
+
key: "date",
|
|
48778
|
+
className: "text-xs whitespace-nowrap",
|
|
48779
|
+
render: (row) => /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48780
|
+
/* @__PURE__ */ jsx266("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48781
|
+
/* @__PURE__ */ jsx266(
|
|
48782
|
+
"span",
|
|
48783
|
+
{
|
|
48784
|
+
onClick: () => {
|
|
48785
|
+
openTransaction({
|
|
48786
|
+
id: row?._id,
|
|
48787
|
+
type: row?.type
|
|
48788
|
+
});
|
|
48789
|
+
},
|
|
48790
|
+
className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
|
|
48791
|
+
children: row?.ref
|
|
48792
|
+
}
|
|
48793
|
+
)
|
|
48794
|
+
] })
|
|
48795
|
+
},
|
|
48796
|
+
{
|
|
48797
|
+
header: "Description",
|
|
48798
|
+
key: "description",
|
|
48799
|
+
className: "text-xs whitespace-nowrap ",
|
|
48800
|
+
render: (row) => {
|
|
48801
|
+
return /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48802
|
+
/* @__PURE__ */ jsx266("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
48803
|
+
row.note && /* @__PURE__ */ jsx266("p", { className: "font-medium italic text-xs capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48804
|
+
] });
|
|
48805
|
+
}
|
|
48806
|
+
},
|
|
48807
|
+
{
|
|
48808
|
+
header: "Amount",
|
|
48809
|
+
key: "changedAmountString",
|
|
48810
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
48811
|
+
render: (row) => /* @__PURE__ */ jsx266("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48812
|
+
renderFooter: (data2) => {
|
|
48813
|
+
return /* @__PURE__ */ jsx266("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48814
|
+
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48815
|
+
defaultCurrency
|
|
48816
|
+
) });
|
|
48817
|
+
}
|
|
48818
|
+
}
|
|
48819
|
+
];
|
|
48820
|
+
const datas = useMemo53(() => {
|
|
48821
|
+
let runningBalance = 0;
|
|
48822
|
+
let filteredData = data?.data || [];
|
|
48823
|
+
const mapped = filteredData.map((item) => {
|
|
48824
|
+
const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
|
|
48825
|
+
runningBalance += changedAmount;
|
|
48826
|
+
return {
|
|
48827
|
+
...item,
|
|
48828
|
+
changedAmountString: Formats_default.Amount(changedAmount, false),
|
|
48829
|
+
changedAmount,
|
|
48830
|
+
runningBalance
|
|
48831
|
+
};
|
|
48832
|
+
});
|
|
48833
|
+
let filtered = mapped;
|
|
48834
|
+
if (startDate) {
|
|
48835
|
+
const startOfDay = startDate.startOf("day");
|
|
48836
|
+
filtered = filtered.filter((tx) => {
|
|
48837
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48838
|
+
if (!rawDate) return false;
|
|
48839
|
+
const txDate = dayjs12(rawDate);
|
|
48840
|
+
return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
|
|
48841
|
+
});
|
|
48842
|
+
}
|
|
48843
|
+
if (endDate) {
|
|
48844
|
+
const endOfDay = endDate.endOf("day");
|
|
48845
|
+
filtered = filtered.filter((tx) => {
|
|
48846
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48847
|
+
if (!rawDate) return false;
|
|
48848
|
+
const txDate = dayjs12(rawDate);
|
|
48849
|
+
return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
|
|
48850
|
+
});
|
|
48851
|
+
}
|
|
48852
|
+
return filtered;
|
|
48853
|
+
}, [data, startDate, endDate]);
|
|
48854
|
+
return /* @__PURE__ */ jsxs235(Fragment134, { children: [
|
|
48855
|
+
/* @__PURE__ */ jsx266(TransactionView, {}),
|
|
48856
|
+
/* @__PURE__ */ jsx266(
|
|
48857
|
+
A4DataView,
|
|
48858
|
+
{
|
|
48859
|
+
columns,
|
|
48860
|
+
data: datas,
|
|
48861
|
+
index: true,
|
|
48862
|
+
title: `Expenses Journal Report`,
|
|
48863
|
+
subtitle: `All Expenses`,
|
|
48864
|
+
fixed: false,
|
|
48865
|
+
headers: /* @__PURE__ */ jsxs235("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
48866
|
+
/* @__PURE__ */ jsx266(
|
|
48867
|
+
DatePicker10,
|
|
48868
|
+
{
|
|
48869
|
+
placeholder: "Start Date",
|
|
48870
|
+
onChange: (date) => setStartDate(date),
|
|
48871
|
+
value: startDate,
|
|
48872
|
+
format: "DD/MM/YYYY",
|
|
48873
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48874
|
+
}
|
|
48875
|
+
),
|
|
48876
|
+
/* @__PURE__ */ jsx266(
|
|
48877
|
+
DatePicker10,
|
|
48878
|
+
{
|
|
48879
|
+
placeholder: "End Date",
|
|
48880
|
+
onChange: (date) => setEndDate(date),
|
|
48881
|
+
value: endDate,
|
|
48882
|
+
format: "DD/MM/YYYY",
|
|
48883
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48884
|
+
}
|
|
48885
|
+
)
|
|
48886
|
+
] })
|
|
48887
|
+
}
|
|
48888
|
+
)
|
|
48889
|
+
] });
|
|
48890
|
+
};
|
|
48891
|
+
var ExpensesJournal3_default = Expenses3Reports2;
|
|
48892
|
+
|
|
48780
48893
|
// src/components/Transactions/3/reports/index.tsx
|
|
48781
48894
|
var Reports3 = {
|
|
48782
|
-
expenses: Expenses3Reports_default
|
|
48895
|
+
expenses: Expenses3Reports_default,
|
|
48896
|
+
expensesJournal: ExpensesJournal3_default
|
|
48783
48897
|
};
|
|
48784
48898
|
var reports_default = Reports3;
|
|
48785
48899
|
|
|
48786
48900
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48787
|
-
import { useNavigate as useNavigate64, useParams as
|
|
48901
|
+
import { useNavigate as useNavigate64, useParams as useParams108 } from "react-router-dom";
|
|
48788
48902
|
import { EllipsisVertical as EllipsisVertical47, FilePenLine as FilePenLine43, Trash2 as Trash253 } from "lucide-react";
|
|
48789
|
-
import { Fragment as
|
|
48903
|
+
import { Fragment as Fragment135, jsx as jsx267, jsxs as jsxs236 } from "react/jsx-runtime";
|
|
48790
48904
|
function ExpensesJournal3({ url }) {
|
|
48791
|
-
const { branchId } =
|
|
48905
|
+
const { branchId } = useParams108();
|
|
48792
48906
|
const navigate = useNavigate64();
|
|
48793
48907
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48794
48908
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
@@ -48799,17 +48913,17 @@ function ExpensesJournal3({ url }) {
|
|
|
48799
48913
|
const items = (data2) => [
|
|
48800
48914
|
{
|
|
48801
48915
|
label: `View Expense`,
|
|
48802
|
-
icon: /* @__PURE__ */
|
|
48916
|
+
icon: /* @__PURE__ */ jsx267(FilePenLine43, { size: 16 }),
|
|
48803
48917
|
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48804
48918
|
},
|
|
48805
48919
|
{
|
|
48806
48920
|
label: `Edit Expense`,
|
|
48807
|
-
icon: /* @__PURE__ */
|
|
48921
|
+
icon: /* @__PURE__ */ jsx267(FilePenLine43, { size: 16 }),
|
|
48808
48922
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48809
48923
|
},
|
|
48810
48924
|
{
|
|
48811
48925
|
label: `Delete Expense`,
|
|
48812
|
-
icon: /* @__PURE__ */
|
|
48926
|
+
icon: /* @__PURE__ */ jsx267(Trash253, { className: "text-red-500", size: 16 }),
|
|
48813
48927
|
onClick: () => {
|
|
48814
48928
|
openTransaction({
|
|
48815
48929
|
id: data2?._id,
|
|
@@ -48825,9 +48939,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48825
48939
|
header: "Date",
|
|
48826
48940
|
cell: ({ row }) => {
|
|
48827
48941
|
const expense = row.original;
|
|
48828
|
-
return /* @__PURE__ */
|
|
48829
|
-
/* @__PURE__ */
|
|
48830
|
-
/* @__PURE__ */
|
|
48942
|
+
return /* @__PURE__ */ jsxs236("div", { className: "flex flex-col", children: [
|
|
48943
|
+
/* @__PURE__ */ jsx267("span", { children: expense?.date }),
|
|
48944
|
+
/* @__PURE__ */ jsx267(
|
|
48831
48945
|
"span",
|
|
48832
48946
|
{
|
|
48833
48947
|
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
@@ -48843,9 +48957,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48843
48957
|
header: "Description",
|
|
48844
48958
|
cell: ({ row }) => {
|
|
48845
48959
|
const expense = row.original;
|
|
48846
|
-
return /* @__PURE__ */
|
|
48847
|
-
/* @__PURE__ */
|
|
48848
|
-
expense?.note && /* @__PURE__ */
|
|
48960
|
+
return /* @__PURE__ */ jsxs236("div", { className: "flex flex-col", children: [
|
|
48961
|
+
/* @__PURE__ */ jsx267("span", { className: "capitalize", children: expense?.description }),
|
|
48962
|
+
expense?.note && /* @__PURE__ */ jsx267("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48849
48963
|
] });
|
|
48850
48964
|
}
|
|
48851
48965
|
},
|
|
@@ -48854,9 +48968,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48854
48968
|
header: "Amount",
|
|
48855
48969
|
cell: ({ row }) => {
|
|
48856
48970
|
const expense = row.original;
|
|
48857
|
-
return /* @__PURE__ */
|
|
48858
|
-
/* @__PURE__ */
|
|
48859
|
-
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */
|
|
48971
|
+
return /* @__PURE__ */ jsxs236("div", { className: "", children: [
|
|
48972
|
+
/* @__PURE__ */ jsx267("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
48973
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ jsxs236("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48860
48974
|
"rate ",
|
|
48861
48975
|
expense?.exchange?.rate,
|
|
48862
48976
|
" ,",
|
|
@@ -48874,23 +48988,23 @@ function ExpensesJournal3({ url }) {
|
|
|
48874
48988
|
header: "Actions",
|
|
48875
48989
|
cell: ({ row }) => {
|
|
48876
48990
|
const data2 = row.original;
|
|
48877
|
-
return /* @__PURE__ */
|
|
48991
|
+
return /* @__PURE__ */ jsx267(
|
|
48878
48992
|
Dropdown,
|
|
48879
48993
|
{
|
|
48880
48994
|
className: "cursor-pointer w-[150px]",
|
|
48881
48995
|
items: items(data2),
|
|
48882
48996
|
triggerMode: "hover",
|
|
48883
|
-
children: /* @__PURE__ */
|
|
48997
|
+
children: /* @__PURE__ */ jsx267(EllipsisVertical47, {})
|
|
48884
48998
|
}
|
|
48885
48999
|
);
|
|
48886
49000
|
}
|
|
48887
49001
|
}
|
|
48888
49002
|
];
|
|
48889
49003
|
const expenses = data?.data || [];
|
|
48890
|
-
return /* @__PURE__ */
|
|
48891
|
-
/* @__PURE__ */
|
|
48892
|
-
/* @__PURE__ */
|
|
48893
|
-
/* @__PURE__ */
|
|
49004
|
+
return /* @__PURE__ */ jsxs236(Fragment135, { children: [
|
|
49005
|
+
/* @__PURE__ */ jsx267(TransactionView, {}),
|
|
49006
|
+
/* @__PURE__ */ jsx267(Modal2, {}),
|
|
49007
|
+
/* @__PURE__ */ jsx267(
|
|
48894
49008
|
TransactionViewComponent,
|
|
48895
49009
|
{
|
|
48896
49010
|
columns,
|
|
@@ -48909,8 +49023,8 @@ function ExpensesJournal3({ url }) {
|
|
|
48909
49023
|
var ExpensesJournal_default = ExpensesJournal3;
|
|
48910
49024
|
|
|
48911
49025
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48912
|
-
import { useEffect as useEffect114, useMemo as
|
|
48913
|
-
import { useParams as
|
|
49026
|
+
import { useEffect as useEffect114, useMemo as useMemo54, useState as useState115 } from "react";
|
|
49027
|
+
import { useParams as useParams109 } from "react-router-dom";
|
|
48914
49028
|
import { useForm as useForm58 } from "react-hook-form";
|
|
48915
49029
|
import { zodResolver as zodResolver57 } from "@hookform/resolvers/zod";
|
|
48916
49030
|
import { message as message85 } from "antd";
|
|
@@ -48928,13 +49042,13 @@ var expenseSchema5 = z49.object({
|
|
|
48928
49042
|
});
|
|
48929
49043
|
|
|
48930
49044
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48931
|
-
import { Fragment as
|
|
49045
|
+
import { Fragment as Fragment136, jsx as jsx268, jsxs as jsxs237 } from "react/jsx-runtime";
|
|
48932
49046
|
function ExpensesJournal3Form() {
|
|
48933
|
-
const { branchId } =
|
|
49047
|
+
const { branchId } = useParams109();
|
|
48934
49048
|
const { getQuery, navigate } = useApp_default();
|
|
48935
49049
|
const id = getQuery("id");
|
|
48936
49050
|
const isEdit = !!id;
|
|
48937
|
-
const [ref2, setRef] =
|
|
49051
|
+
const [ref2, setRef] = useState115("");
|
|
48938
49052
|
const { post, isLoading } = useApis_default();
|
|
48939
49053
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48940
49054
|
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
@@ -48953,7 +49067,7 @@ function ExpensesJournal3Form() {
|
|
|
48953
49067
|
const isRate = currency && currency !== defaultCurrency;
|
|
48954
49068
|
const amount = watch("amount");
|
|
48955
49069
|
const rate = watch("rate");
|
|
48956
|
-
const exchangedAmount2 =
|
|
49070
|
+
const exchangedAmount2 = useMemo54(() => {
|
|
48957
49071
|
if (isRate) {
|
|
48958
49072
|
const am = forex_default.exchangedAmount({
|
|
48959
49073
|
accountCurrency: defaultCurrency,
|
|
@@ -49004,25 +49118,25 @@ function ExpensesJournal3Form() {
|
|
|
49004
49118
|
fetches();
|
|
49005
49119
|
}
|
|
49006
49120
|
}, [id]);
|
|
49007
|
-
return /* @__PURE__ */
|
|
49121
|
+
return /* @__PURE__ */ jsxs237(
|
|
49008
49122
|
Card,
|
|
49009
49123
|
{
|
|
49010
49124
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49011
49125
|
isLoading: isLoadingGet,
|
|
49012
49126
|
loadingText: "Processing...",
|
|
49013
49127
|
children: [
|
|
49014
|
-
/* @__PURE__ */
|
|
49015
|
-
/* @__PURE__ */
|
|
49016
|
-
/* @__PURE__ */
|
|
49128
|
+
/* @__PURE__ */ jsxs237(Card.Header, { children: [
|
|
49129
|
+
/* @__PURE__ */ jsx268(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
49130
|
+
/* @__PURE__ */ jsx268(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
49017
49131
|
] }),
|
|
49018
|
-
/* @__PURE__ */
|
|
49132
|
+
/* @__PURE__ */ jsx268(Card.Content, { children: /* @__PURE__ */ jsxs237(
|
|
49019
49133
|
"form",
|
|
49020
49134
|
{
|
|
49021
49135
|
className: "space-y-4",
|
|
49022
49136
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49023
49137
|
children: [
|
|
49024
|
-
/* @__PURE__ */
|
|
49025
|
-
/* @__PURE__ */
|
|
49138
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49139
|
+
/* @__PURE__ */ jsx268(
|
|
49026
49140
|
Fields_default.Input,
|
|
49027
49141
|
{
|
|
49028
49142
|
label: "Description",
|
|
@@ -49032,7 +49146,7 @@ function ExpensesJournal3Form() {
|
|
|
49032
49146
|
required: true
|
|
49033
49147
|
}
|
|
49034
49148
|
),
|
|
49035
|
-
/* @__PURE__ */
|
|
49149
|
+
/* @__PURE__ */ jsx268(
|
|
49036
49150
|
Fields_default.Select,
|
|
49037
49151
|
{
|
|
49038
49152
|
label: "Currency",
|
|
@@ -49043,8 +49157,8 @@ function ExpensesJournal3Form() {
|
|
|
49043
49157
|
}
|
|
49044
49158
|
)
|
|
49045
49159
|
] }),
|
|
49046
|
-
/* @__PURE__ */
|
|
49047
|
-
/* @__PURE__ */
|
|
49160
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49161
|
+
/* @__PURE__ */ jsx268(
|
|
49048
49162
|
Fields_default.DateInput,
|
|
49049
49163
|
{
|
|
49050
49164
|
label: "Date",
|
|
@@ -49053,7 +49167,7 @@ function ExpensesJournal3Form() {
|
|
|
49053
49167
|
required: true
|
|
49054
49168
|
}
|
|
49055
49169
|
),
|
|
49056
|
-
/* @__PURE__ */
|
|
49170
|
+
/* @__PURE__ */ jsx268(
|
|
49057
49171
|
Fields_default.Input,
|
|
49058
49172
|
{
|
|
49059
49173
|
label: "Amount",
|
|
@@ -49064,8 +49178,8 @@ function ExpensesJournal3Form() {
|
|
|
49064
49178
|
required: true
|
|
49065
49179
|
}
|
|
49066
49180
|
),
|
|
49067
|
-
isRate && /* @__PURE__ */
|
|
49068
|
-
/* @__PURE__ */
|
|
49181
|
+
isRate && /* @__PURE__ */ jsxs237(Fragment136, { children: [
|
|
49182
|
+
/* @__PURE__ */ jsx268(
|
|
49069
49183
|
Fields_default.Input,
|
|
49070
49184
|
{
|
|
49071
49185
|
label: "Rate",
|
|
@@ -49076,7 +49190,7 @@ function ExpensesJournal3Form() {
|
|
|
49076
49190
|
required: true
|
|
49077
49191
|
}
|
|
49078
49192
|
),
|
|
49079
|
-
/* @__PURE__ */
|
|
49193
|
+
/* @__PURE__ */ jsx268(
|
|
49080
49194
|
Fields_default.Input,
|
|
49081
49195
|
{
|
|
49082
49196
|
label: "Exchanged Amount",
|
|
@@ -49088,7 +49202,7 @@ function ExpensesJournal3Form() {
|
|
|
49088
49202
|
)
|
|
49089
49203
|
] })
|
|
49090
49204
|
] }),
|
|
49091
|
-
/* @__PURE__ */
|
|
49205
|
+
/* @__PURE__ */ jsx268(
|
|
49092
49206
|
Fields_default.Textarea,
|
|
49093
49207
|
{
|
|
49094
49208
|
label: "Note",
|
|
@@ -49097,7 +49211,7 @@ function ExpensesJournal3Form() {
|
|
|
49097
49211
|
placeholder: "Add any additional details..."
|
|
49098
49212
|
}
|
|
49099
49213
|
),
|
|
49100
|
-
/* @__PURE__ */
|
|
49214
|
+
/* @__PURE__ */ jsx268("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx268(
|
|
49101
49215
|
Button,
|
|
49102
49216
|
{
|
|
49103
49217
|
isLoading,
|
|
@@ -49142,21 +49256,21 @@ var Transaction3 = {
|
|
|
49142
49256
|
var __default = Transaction3;
|
|
49143
49257
|
|
|
49144
49258
|
// src/components/reports/ItemReport.tsx
|
|
49145
|
-
import { useParams as
|
|
49259
|
+
import { useParams as useParams110 } from "react-router-dom";
|
|
49146
49260
|
import { z as z50 } from "zod";
|
|
49147
49261
|
import { useForm as useForm59 } from "react-hook-form";
|
|
49148
49262
|
import { zodResolver as zodResolver58 } from "@hookform/resolvers/zod";
|
|
49149
|
-
import { useState as
|
|
49263
|
+
import { useState as useState116 } from "react";
|
|
49150
49264
|
import { message as message86 } from "antd";
|
|
49151
|
-
import { Fragment as
|
|
49265
|
+
import { Fragment as Fragment137, jsx as jsx269, jsxs as jsxs238 } from "react/jsx-runtime";
|
|
49152
49266
|
var ItemReport = ({
|
|
49153
49267
|
value = false,
|
|
49154
49268
|
type
|
|
49155
49269
|
}) => {
|
|
49156
49270
|
const { apiConfig } = useWarqadConfig();
|
|
49157
|
-
const { branchId } =
|
|
49271
|
+
const { branchId } = useParams110();
|
|
49158
49272
|
const { branches } = useAuth_default();
|
|
49159
|
-
const [params, setParams] =
|
|
49273
|
+
const [params, setParams] = useState116({
|
|
49160
49274
|
id: "",
|
|
49161
49275
|
branch: "all"
|
|
49162
49276
|
});
|
|
@@ -49181,9 +49295,9 @@ var ItemReport = ({
|
|
|
49181
49295
|
header: "Date",
|
|
49182
49296
|
key: "date",
|
|
49183
49297
|
className: "text-xs whitespace-nowrap",
|
|
49184
|
-
render: (row) => /* @__PURE__ */
|
|
49185
|
-
/* @__PURE__ */
|
|
49186
|
-
/* @__PURE__ */
|
|
49298
|
+
render: (row) => /* @__PURE__ */ jsxs238("div", { className: "", children: [
|
|
49299
|
+
/* @__PURE__ */ jsx269("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49300
|
+
/* @__PURE__ */ jsx269(
|
|
49187
49301
|
"span",
|
|
49188
49302
|
{
|
|
49189
49303
|
onClick: () => {
|
|
@@ -49202,7 +49316,7 @@ var ItemReport = ({
|
|
|
49202
49316
|
header: "Description",
|
|
49203
49317
|
key: "description",
|
|
49204
49318
|
className: "text-xs whitespace-nowrap",
|
|
49205
|
-
render: (row) => /* @__PURE__ */
|
|
49319
|
+
render: (row) => /* @__PURE__ */ jsx269("div", { className: "", children: /* @__PURE__ */ jsx269("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
49206
49320
|
},
|
|
49207
49321
|
{
|
|
49208
49322
|
header: "Quantity",
|
|
@@ -49210,7 +49324,7 @@ var ItemReport = ({
|
|
|
49210
49324
|
className: "text-xs whitespace-nowrap",
|
|
49211
49325
|
render: (row) => {
|
|
49212
49326
|
const Qty = row.quantity;
|
|
49213
|
-
return /* @__PURE__ */
|
|
49327
|
+
return /* @__PURE__ */ jsxs238(
|
|
49214
49328
|
"div",
|
|
49215
49329
|
{
|
|
49216
49330
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -49227,7 +49341,7 @@ var ItemReport = ({
|
|
|
49227
49341
|
header: "Balance",
|
|
49228
49342
|
key: "runningBalance",
|
|
49229
49343
|
className: "text-xs whitespace-nowrap",
|
|
49230
|
-
render: (row) => /* @__PURE__ */
|
|
49344
|
+
render: (row) => /* @__PURE__ */ jsx269("div", { className: "", children: /* @__PURE__ */ jsx269("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
49231
49345
|
}
|
|
49232
49346
|
];
|
|
49233
49347
|
let runningBalance = 0;
|
|
@@ -49239,10 +49353,10 @@ var ItemReport = ({
|
|
|
49239
49353
|
};
|
|
49240
49354
|
});
|
|
49241
49355
|
const itemName = datas[0]?.name;
|
|
49242
|
-
return /* @__PURE__ */
|
|
49243
|
-
/* @__PURE__ */
|
|
49244
|
-
/* @__PURE__ */
|
|
49245
|
-
/* @__PURE__ */
|
|
49356
|
+
return /* @__PURE__ */ jsxs238(Fragment137, { children: [
|
|
49357
|
+
/* @__PURE__ */ jsx269(Modal2, {}),
|
|
49358
|
+
/* @__PURE__ */ jsx269(TransactionView, {}),
|
|
49359
|
+
/* @__PURE__ */ jsx269(
|
|
49246
49360
|
A4DataView,
|
|
49247
49361
|
{
|
|
49248
49362
|
columns,
|
|
@@ -49253,14 +49367,14 @@ var ItemReport = ({
|
|
|
49253
49367
|
tableTitle: `${type} Movement Report`,
|
|
49254
49368
|
fixed: false,
|
|
49255
49369
|
error: !id ? "Please select an item" : void 0,
|
|
49256
|
-
headers: /* @__PURE__ */
|
|
49370
|
+
headers: /* @__PURE__ */ jsx269(
|
|
49257
49371
|
Button,
|
|
49258
49372
|
{
|
|
49259
49373
|
type: "button",
|
|
49260
49374
|
size: "sm",
|
|
49261
49375
|
onClick: () => openState({
|
|
49262
49376
|
title: "Item Transactions",
|
|
49263
|
-
content: /* @__PURE__ */
|
|
49377
|
+
content: /* @__PURE__ */ jsx269(
|
|
49264
49378
|
ItemReportHeader2,
|
|
49265
49379
|
{
|
|
49266
49380
|
type,
|
|
@@ -49303,7 +49417,7 @@ function ItemReportHeader2({
|
|
|
49303
49417
|
label: b.name,
|
|
49304
49418
|
value: b._id
|
|
49305
49419
|
}));
|
|
49306
|
-
return /* @__PURE__ */
|
|
49420
|
+
return /* @__PURE__ */ jsxs238(
|
|
49307
49421
|
"form",
|
|
49308
49422
|
{
|
|
49309
49423
|
className: "space-y-3",
|
|
@@ -49321,8 +49435,8 @@ function ItemReportHeader2({
|
|
|
49321
49435
|
close();
|
|
49322
49436
|
}),
|
|
49323
49437
|
children: [
|
|
49324
|
-
/* @__PURE__ */
|
|
49325
|
-
/* @__PURE__ */
|
|
49438
|
+
/* @__PURE__ */ jsxs238("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49439
|
+
/* @__PURE__ */ jsx269(
|
|
49326
49440
|
Select,
|
|
49327
49441
|
{
|
|
49328
49442
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -49330,7 +49444,7 @@ function ItemReportHeader2({
|
|
|
49330
49444
|
name: "branch"
|
|
49331
49445
|
}
|
|
49332
49446
|
),
|
|
49333
|
-
type === "pack" ? /* @__PURE__ */
|
|
49447
|
+
type === "pack" ? /* @__PURE__ */ jsx269(
|
|
49334
49448
|
Pack_default.Pack,
|
|
49335
49449
|
{
|
|
49336
49450
|
api: "/packs/get",
|
|
@@ -49338,7 +49452,7 @@ function ItemReportHeader2({
|
|
|
49338
49452
|
form: methods,
|
|
49339
49453
|
name: "pack"
|
|
49340
49454
|
}
|
|
49341
|
-
) : /* @__PURE__ */
|
|
49455
|
+
) : /* @__PURE__ */ jsx269(
|
|
49342
49456
|
Feilds_default5.Product,
|
|
49343
49457
|
{
|
|
49344
49458
|
label: "",
|
|
@@ -49349,7 +49463,7 @@ function ItemReportHeader2({
|
|
|
49349
49463
|
}
|
|
49350
49464
|
)
|
|
49351
49465
|
] }),
|
|
49352
|
-
/* @__PURE__ */
|
|
49466
|
+
/* @__PURE__ */ jsx269("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ jsx269(Button, { type: "submit", children: "Filter" }) })
|
|
49353
49467
|
]
|
|
49354
49468
|
}
|
|
49355
49469
|
);
|
|
@@ -49357,9 +49471,9 @@ function ItemReportHeader2({
|
|
|
49357
49471
|
var ItemReport_default = ItemReport;
|
|
49358
49472
|
|
|
49359
49473
|
// src/components/accounts/LeaseCollection.tsx
|
|
49360
|
-
import { useNavigate as useNavigate65, useParams as
|
|
49361
|
-
import { useMemo as
|
|
49362
|
-
import { Fragment as
|
|
49474
|
+
import { useNavigate as useNavigate65, useParams as useParams111, useSearchParams as useSearchParams19 } from "react-router-dom";
|
|
49475
|
+
import { useMemo as useMemo55, useState as useState117, useEffect as useEffect115 } from "react";
|
|
49476
|
+
import { Fragment as Fragment138, jsx as jsx270, jsxs as jsxs239 } from "react/jsx-runtime";
|
|
49363
49477
|
var LeaseCollection = ({
|
|
49364
49478
|
leaseType,
|
|
49365
49479
|
defaultCurrency = "KES"
|
|
@@ -49367,9 +49481,9 @@ var LeaseCollection = ({
|
|
|
49367
49481
|
const navigate = useNavigate65();
|
|
49368
49482
|
const [searchParams] = useSearchParams19();
|
|
49369
49483
|
const { apiConfig } = useWarqadConfig();
|
|
49370
|
-
const { branchId } =
|
|
49484
|
+
const { branchId } = useParams111();
|
|
49371
49485
|
const { branches } = useAuth_default();
|
|
49372
|
-
const currentBranch =
|
|
49486
|
+
const currentBranch = useMemo55(
|
|
49373
49487
|
() => branches?.find((b) => b?._id === branchId),
|
|
49374
49488
|
[branches, branchId]
|
|
49375
49489
|
);
|
|
@@ -49377,10 +49491,10 @@ var LeaseCollection = ({
|
|
|
49377
49491
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
49378
49492
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49379
49493
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
49380
|
-
const [filter, setFilter] =
|
|
49494
|
+
const [filter, setFilter] = useState117(
|
|
49381
49495
|
initialFilter
|
|
49382
49496
|
);
|
|
49383
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
49497
|
+
const [currencyFilter, setCurrencyFilter] = useState117(initialCurrency);
|
|
49384
49498
|
useEffect115(() => {
|
|
49385
49499
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
49386
49500
|
setFilter(urlFilter);
|
|
@@ -49405,9 +49519,9 @@ var LeaseCollection = ({
|
|
|
49405
49519
|
key: "name",
|
|
49406
49520
|
className: "text-xs whitespace-nowrap ",
|
|
49407
49521
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
49408
|
-
render: (row) => /* @__PURE__ */
|
|
49409
|
-
/* @__PURE__ */
|
|
49410
|
-
row.unitNames && /* @__PURE__ */
|
|
49522
|
+
render: (row) => /* @__PURE__ */ jsxs239("div", { className: "space-y-1", children: [
|
|
49523
|
+
/* @__PURE__ */ jsx270("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49524
|
+
row.unitNames && /* @__PURE__ */ jsxs239("p", { className: "text-[9px]! capitalize", children: [
|
|
49411
49525
|
"(",
|
|
49412
49526
|
row.unitNames,
|
|
49413
49527
|
")"
|
|
@@ -49419,7 +49533,7 @@ var LeaseCollection = ({
|
|
|
49419
49533
|
key: "phoneNumber",
|
|
49420
49534
|
maxWidth: 70,
|
|
49421
49535
|
render: (row) => {
|
|
49422
|
-
return /* @__PURE__ */
|
|
49536
|
+
return /* @__PURE__ */ jsx270("p", { children: row?.phoneNumber || "N/A" });
|
|
49423
49537
|
}
|
|
49424
49538
|
},
|
|
49425
49539
|
// </span>
|
|
@@ -49429,11 +49543,11 @@ var LeaseCollection = ({
|
|
|
49429
49543
|
className: "text-xs whitespace-nowrap text-right",
|
|
49430
49544
|
render: (row) => {
|
|
49431
49545
|
const Amount = row.totalCollectionString;
|
|
49432
|
-
return /* @__PURE__ */
|
|
49546
|
+
return /* @__PURE__ */ jsx270("div", { className: "", children: /* @__PURE__ */ jsx270("p", { className: "font-bold ", children: Amount }) });
|
|
49433
49547
|
},
|
|
49434
49548
|
renderFooter: (data2) => {
|
|
49435
49549
|
if (currencyFilter === "all") return;
|
|
49436
|
-
return /* @__PURE__ */
|
|
49550
|
+
return /* @__PURE__ */ jsx270("span", { className: " font-bold", children: Formats_default.Price(
|
|
49437
49551
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
49438
49552
|
defaultCurrency,
|
|
49439
49553
|
false
|
|
@@ -49441,7 +49555,7 @@ var LeaseCollection = ({
|
|
|
49441
49555
|
}
|
|
49442
49556
|
}
|
|
49443
49557
|
];
|
|
49444
|
-
const datas =
|
|
49558
|
+
const datas = useMemo55(() => {
|
|
49445
49559
|
let runningBalance = 0;
|
|
49446
49560
|
let filteredData = data?.data || [];
|
|
49447
49561
|
const result = filteredData.map((item) => {
|
|
@@ -49454,9 +49568,9 @@ var LeaseCollection = ({
|
|
|
49454
49568
|
});
|
|
49455
49569
|
return result;
|
|
49456
49570
|
}, [filter, currencyFilter, data]);
|
|
49457
|
-
return /* @__PURE__ */
|
|
49458
|
-
/* @__PURE__ */
|
|
49459
|
-
/* @__PURE__ */
|
|
49571
|
+
return /* @__PURE__ */ jsxs239(Fragment138, { children: [
|
|
49572
|
+
/* @__PURE__ */ jsx270(TransactionView, {}),
|
|
49573
|
+
/* @__PURE__ */ jsx270(
|
|
49460
49574
|
A4DataView,
|
|
49461
49575
|
{
|
|
49462
49576
|
columns,
|
|
@@ -49466,7 +49580,7 @@ var LeaseCollection = ({
|
|
|
49466
49580
|
subtitle: `All Collections`,
|
|
49467
49581
|
fixed: false,
|
|
49468
49582
|
startPage: 1e9,
|
|
49469
|
-
headers: /* @__PURE__ */
|
|
49583
|
+
headers: /* @__PURE__ */ jsx270("div", { className: "flex gap-2" })
|
|
49470
49584
|
}
|
|
49471
49585
|
)
|
|
49472
49586
|
] });
|
|
@@ -49474,9 +49588,9 @@ var LeaseCollection = ({
|
|
|
49474
49588
|
var LeaseCollection_default = LeaseCollection;
|
|
49475
49589
|
|
|
49476
49590
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49477
|
-
import { useNavigate as useNavigate66, useParams as
|
|
49591
|
+
import { useNavigate as useNavigate66, useParams as useParams115 } from "react-router-dom";
|
|
49478
49592
|
import { EllipsisVertical as EllipsisVertical48, FilePenLine as FilePenLine44, Trash2 as Trash255 } from "lucide-react";
|
|
49479
|
-
import { useState as
|
|
49593
|
+
import { useState as useState119 } from "react";
|
|
49480
49594
|
import { message as message90 } from "antd";
|
|
49481
49595
|
|
|
49482
49596
|
// src/components/Transactions/cargoIM/schema.ts
|
|
@@ -49513,14 +49627,14 @@ import { useForm as useForm60 } from "react-hook-form";
|
|
|
49513
49627
|
import { zodResolver as zodResolver59 } from "@hookform/resolvers/zod";
|
|
49514
49628
|
import { message as message87 } from "antd";
|
|
49515
49629
|
import { useEffect as useEffect116 } from "react";
|
|
49516
|
-
import { useParams as
|
|
49517
|
-
import { jsx as
|
|
49630
|
+
import { useParams as useParams112 } from "react-router-dom";
|
|
49631
|
+
import { jsx as jsx271, jsxs as jsxs240 } from "react/jsx-runtime";
|
|
49518
49632
|
function AccountForm3({
|
|
49519
49633
|
onReload,
|
|
49520
49634
|
close,
|
|
49521
49635
|
id
|
|
49522
49636
|
}) {
|
|
49523
|
-
const { branchId } =
|
|
49637
|
+
const { branchId } = useParams112();
|
|
49524
49638
|
const { currencies } = useWarqadConfig();
|
|
49525
49639
|
const { stock } = currencies;
|
|
49526
49640
|
const isEdit = !!id;
|
|
@@ -49586,24 +49700,24 @@ function AccountForm3({
|
|
|
49586
49700
|
fetches();
|
|
49587
49701
|
}
|
|
49588
49702
|
}, [id]);
|
|
49589
|
-
return /* @__PURE__ */
|
|
49703
|
+
return /* @__PURE__ */ jsxs240(
|
|
49590
49704
|
Card,
|
|
49591
49705
|
{
|
|
49592
49706
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49593
49707
|
isLoading: isLoadingGet,
|
|
49594
49708
|
loadingText: "Processing...",
|
|
49595
49709
|
children: [
|
|
49596
|
-
/* @__PURE__ */
|
|
49597
|
-
/* @__PURE__ */
|
|
49598
|
-
/* @__PURE__ */
|
|
49710
|
+
/* @__PURE__ */ jsxs240(Card.Header, { children: [
|
|
49711
|
+
/* @__PURE__ */ jsx271(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49712
|
+
/* @__PURE__ */ jsx271(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49599
49713
|
] }),
|
|
49600
|
-
/* @__PURE__ */
|
|
49714
|
+
/* @__PURE__ */ jsx271(Card.Content, { children: /* @__PURE__ */ jsxs240(
|
|
49601
49715
|
"form",
|
|
49602
49716
|
{
|
|
49603
49717
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49604
49718
|
children: [
|
|
49605
|
-
/* @__PURE__ */
|
|
49606
|
-
/* @__PURE__ */
|
|
49719
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49720
|
+
/* @__PURE__ */ jsx271(
|
|
49607
49721
|
Fields_default.Input,
|
|
49608
49722
|
{
|
|
49609
49723
|
label: "Name",
|
|
@@ -49614,7 +49728,7 @@ function AccountForm3({
|
|
|
49614
49728
|
required: true
|
|
49615
49729
|
}
|
|
49616
49730
|
),
|
|
49617
|
-
/* @__PURE__ */
|
|
49731
|
+
/* @__PURE__ */ jsx271(
|
|
49618
49732
|
Fields_default.PhoneInput,
|
|
49619
49733
|
{
|
|
49620
49734
|
label: "Phone Number",
|
|
@@ -49623,7 +49737,7 @@ function AccountForm3({
|
|
|
49623
49737
|
placeholder: "Enter phone number"
|
|
49624
49738
|
}
|
|
49625
49739
|
),
|
|
49626
|
-
/* @__PURE__ */
|
|
49740
|
+
/* @__PURE__ */ jsx271(
|
|
49627
49741
|
Fields_default.Select,
|
|
49628
49742
|
{
|
|
49629
49743
|
label: "Currency",
|
|
@@ -49634,7 +49748,7 @@ function AccountForm3({
|
|
|
49634
49748
|
}
|
|
49635
49749
|
)
|
|
49636
49750
|
] }),
|
|
49637
|
-
/* @__PURE__ */
|
|
49751
|
+
/* @__PURE__ */ jsx271("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx271(
|
|
49638
49752
|
Button,
|
|
49639
49753
|
{
|
|
49640
49754
|
isLoading,
|
|
@@ -49655,36 +49769,36 @@ function AccountForm3({
|
|
|
49655
49769
|
var AccountForm_default3 = AccountForm3;
|
|
49656
49770
|
|
|
49657
49771
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49658
|
-
import { useEffect as useEffect117, useState as
|
|
49772
|
+
import { useEffect as useEffect117, useState as useState118 } from "react";
|
|
49659
49773
|
import { useForm as useForm61, useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
49660
49774
|
import { zodResolver as zodResolver60 } from "@hookform/resolvers/zod";
|
|
49661
|
-
import { useParams as
|
|
49775
|
+
import { useParams as useParams113 } from "react-router-dom";
|
|
49662
49776
|
import { message as message88 } from "antd";
|
|
49663
49777
|
import { Trash2 as Trash254, Plus as Plus6 } from "lucide-react";
|
|
49664
|
-
import
|
|
49665
|
-
import { jsx as
|
|
49778
|
+
import dayjs13 from "dayjs";
|
|
49779
|
+
import { jsx as jsx272, jsxs as jsxs241 } from "react/jsx-runtime";
|
|
49666
49780
|
function InvoiceForm2({
|
|
49667
49781
|
onReload,
|
|
49668
49782
|
close,
|
|
49669
49783
|
accountData,
|
|
49670
49784
|
id
|
|
49671
49785
|
}) {
|
|
49672
|
-
const { branchId } =
|
|
49673
|
-
const [ref2, setRef] =
|
|
49786
|
+
const { branchId } = useParams113();
|
|
49787
|
+
const [ref2, setRef] = useState118(void 0);
|
|
49674
49788
|
const { post, isLoading } = useApis_default();
|
|
49675
49789
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49676
49790
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49677
49791
|
const isEdit = !!id;
|
|
49678
49792
|
const { currencies } = useWarqadConfig();
|
|
49679
49793
|
const { stock: defaultCurrency } = currencies;
|
|
49680
|
-
const [itemName, setItemName] =
|
|
49681
|
-
const [itemQuantity, setItemQuantity] =
|
|
49682
|
-
const [itemPrice, setItemPrice] =
|
|
49794
|
+
const [itemName, setItemName] = useState118("");
|
|
49795
|
+
const [itemQuantity, setItemQuantity] = useState118("");
|
|
49796
|
+
const [itemPrice, setItemPrice] = useState118("");
|
|
49683
49797
|
const methods = useForm61({
|
|
49684
49798
|
resolver: zodResolver60(createInvoiceManagerValidation2),
|
|
49685
49799
|
defaultValues: {
|
|
49686
49800
|
invoices: [],
|
|
49687
|
-
date:
|
|
49801
|
+
date: dayjs13().format("DD/MM/YYYY"),
|
|
49688
49802
|
currency: defaultCurrency,
|
|
49689
49803
|
branch: branchId ? branchId : void 0
|
|
49690
49804
|
}
|
|
@@ -49783,25 +49897,25 @@ function InvoiceForm2({
|
|
|
49783
49897
|
e.preventDefault();
|
|
49784
49898
|
}
|
|
49785
49899
|
};
|
|
49786
|
-
return /* @__PURE__ */
|
|
49900
|
+
return /* @__PURE__ */ jsx272(
|
|
49787
49901
|
Card,
|
|
49788
49902
|
{
|
|
49789
49903
|
isLoading: getLoading,
|
|
49790
49904
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49791
|
-
children: /* @__PURE__ */
|
|
49792
|
-
/* @__PURE__ */
|
|
49793
|
-
/* @__PURE__ */
|
|
49905
|
+
children: /* @__PURE__ */ jsxs241(Card.Content, { children: [
|
|
49906
|
+
/* @__PURE__ */ jsx272("input", { type: "hidden", ...register("currency") }),
|
|
49907
|
+
/* @__PURE__ */ jsxs241(
|
|
49794
49908
|
"form",
|
|
49795
49909
|
{
|
|
49796
49910
|
onSubmit: handleSubmit(onSubmit),
|
|
49797
49911
|
onKeyDown: handleKeyDown,
|
|
49798
49912
|
className: "space-y-6",
|
|
49799
49913
|
children: [
|
|
49800
|
-
/* @__PURE__ */
|
|
49801
|
-
/* @__PURE__ */
|
|
49802
|
-
/* @__PURE__ */
|
|
49803
|
-
/* @__PURE__ */
|
|
49804
|
-
/* @__PURE__ */
|
|
49914
|
+
/* @__PURE__ */ jsxs241("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
49915
|
+
/* @__PURE__ */ jsx272("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49916
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49917
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49918
|
+
/* @__PURE__ */ jsx272(
|
|
49805
49919
|
Fields_default.Input,
|
|
49806
49920
|
{
|
|
49807
49921
|
label: "Container No",
|
|
@@ -49810,7 +49924,7 @@ function InvoiceForm2({
|
|
|
49810
49924
|
onChange: (val) => setItemName(val)
|
|
49811
49925
|
}
|
|
49812
49926
|
),
|
|
49813
|
-
/* @__PURE__ */
|
|
49927
|
+
/* @__PURE__ */ jsx272(
|
|
49814
49928
|
Fields_default.Input,
|
|
49815
49929
|
{
|
|
49816
49930
|
label: "Cbm",
|
|
@@ -49820,7 +49934,7 @@ function InvoiceForm2({
|
|
|
49820
49934
|
onChange: (val) => setItemQuantity(val)
|
|
49821
49935
|
}
|
|
49822
49936
|
),
|
|
49823
|
-
/* @__PURE__ */
|
|
49937
|
+
/* @__PURE__ */ jsx272(
|
|
49824
49938
|
Fields_default.Input,
|
|
49825
49939
|
{
|
|
49826
49940
|
label: "Price (KES)",
|
|
@@ -49831,7 +49945,7 @@ function InvoiceForm2({
|
|
|
49831
49945
|
}
|
|
49832
49946
|
)
|
|
49833
49947
|
] }),
|
|
49834
|
-
/* @__PURE__ */
|
|
49948
|
+
/* @__PURE__ */ jsxs241(
|
|
49835
49949
|
Button,
|
|
49836
49950
|
{
|
|
49837
49951
|
type: "button",
|
|
@@ -49839,23 +49953,23 @@ function InvoiceForm2({
|
|
|
49839
49953
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49840
49954
|
variant: "outline",
|
|
49841
49955
|
children: [
|
|
49842
|
-
/* @__PURE__ */
|
|
49956
|
+
/* @__PURE__ */ jsx272(Plus6, { size: 16 }),
|
|
49843
49957
|
" Add Item"
|
|
49844
49958
|
]
|
|
49845
49959
|
}
|
|
49846
49960
|
)
|
|
49847
49961
|
] })
|
|
49848
49962
|
] }),
|
|
49849
|
-
/* @__PURE__ */
|
|
49850
|
-
/* @__PURE__ */
|
|
49851
|
-
/* @__PURE__ */
|
|
49852
|
-
/* @__PURE__ */
|
|
49853
|
-
/* @__PURE__ */
|
|
49854
|
-
/* @__PURE__ */
|
|
49855
|
-
/* @__PURE__ */
|
|
49856
|
-
/* @__PURE__ */
|
|
49963
|
+
/* @__PURE__ */ jsxs241("div", { children: [
|
|
49964
|
+
/* @__PURE__ */ jsx272("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49965
|
+
/* @__PURE__ */ jsx272("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ jsx272("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs241("table", { className: "w-full text-left border-collapse", children: [
|
|
49966
|
+
/* @__PURE__ */ jsx272("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs241("tr", { children: [
|
|
49967
|
+
/* @__PURE__ */ jsx272("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: "#" }),
|
|
49968
|
+
/* @__PURE__ */ jsx272("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" }),
|
|
49969
|
+
/* @__PURE__ */ jsx272("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" }),
|
|
49970
|
+
/* @__PURE__ */ jsx272("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" })
|
|
49857
49971
|
] }) }),
|
|
49858
|
-
/* @__PURE__ */
|
|
49972
|
+
/* @__PURE__ */ jsx272("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ jsx272("tr", { children: /* @__PURE__ */ jsx272(
|
|
49859
49973
|
"td",
|
|
49860
49974
|
{
|
|
49861
49975
|
colSpan: 4,
|
|
@@ -49864,29 +49978,29 @@ function InvoiceForm2({
|
|
|
49864
49978
|
}
|
|
49865
49979
|
) }) : fields.map((item, index) => {
|
|
49866
49980
|
const total = item.quantity * item.amount;
|
|
49867
|
-
return /* @__PURE__ */
|
|
49981
|
+
return /* @__PURE__ */ jsxs241(
|
|
49868
49982
|
"tr",
|
|
49869
49983
|
{
|
|
49870
49984
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49871
49985
|
children: [
|
|
49872
|
-
/* @__PURE__ */
|
|
49873
|
-
/* @__PURE__ */
|
|
49874
|
-
/* @__PURE__ */
|
|
49875
|
-
/* @__PURE__ */
|
|
49986
|
+
/* @__PURE__ */ jsx272("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 }),
|
|
49987
|
+
/* @__PURE__ */ jsxs241("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
49988
|
+
/* @__PURE__ */ jsx272("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
49989
|
+
/* @__PURE__ */ jsxs241("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49876
49990
|
item.quantity,
|
|
49877
49991
|
" Cbm @",
|
|
49878
49992
|
" ",
|
|
49879
49993
|
Formats_default.Price(item.amount, "KES")
|
|
49880
49994
|
] })
|
|
49881
49995
|
] }),
|
|
49882
|
-
/* @__PURE__ */
|
|
49883
|
-
/* @__PURE__ */
|
|
49996
|
+
/* @__PURE__ */ jsx272("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") }),
|
|
49997
|
+
/* @__PURE__ */ jsx272("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ jsx272(
|
|
49884
49998
|
"button",
|
|
49885
49999
|
{
|
|
49886
50000
|
type: "button",
|
|
49887
50001
|
onClick: () => remove(index),
|
|
49888
50002
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49889
|
-
children: /* @__PURE__ */
|
|
50003
|
+
children: /* @__PURE__ */ jsx272(
|
|
49890
50004
|
Trash254,
|
|
49891
50005
|
{
|
|
49892
50006
|
size: 13,
|
|
@@ -49900,8 +50014,8 @@ function InvoiceForm2({
|
|
|
49900
50014
|
item.id
|
|
49901
50015
|
);
|
|
49902
50016
|
}) }),
|
|
49903
|
-
fields.length > 0 && /* @__PURE__ */
|
|
49904
|
-
/* @__PURE__ */
|
|
50017
|
+
fields.length > 0 && /* @__PURE__ */ jsx272("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs241("tr", { children: [
|
|
50018
|
+
/* @__PURE__ */ jsx272(
|
|
49905
50019
|
"td",
|
|
49906
50020
|
{
|
|
49907
50021
|
colSpan: 2,
|
|
@@ -49909,20 +50023,20 @@ function InvoiceForm2({
|
|
|
49909
50023
|
children: "Total"
|
|
49910
50024
|
}
|
|
49911
50025
|
),
|
|
49912
|
-
/* @__PURE__ */
|
|
50026
|
+
/* @__PURE__ */ jsx272("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(
|
|
49913
50027
|
fields.reduce(
|
|
49914
50028
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49915
50029
|
0
|
|
49916
50030
|
),
|
|
49917
50031
|
"KES"
|
|
49918
50032
|
) }),
|
|
49919
|
-
/* @__PURE__ */
|
|
50033
|
+
/* @__PURE__ */ jsx272("td", {})
|
|
49920
50034
|
] }) })
|
|
49921
50035
|
] }) }) })
|
|
49922
50036
|
] }),
|
|
49923
|
-
/* @__PURE__ */
|
|
49924
|
-
/* @__PURE__ */
|
|
49925
|
-
/* @__PURE__ */
|
|
50037
|
+
/* @__PURE__ */ jsxs241("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
50038
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50039
|
+
/* @__PURE__ */ jsx272(
|
|
49926
50040
|
Fields_default.DateInput,
|
|
49927
50041
|
{
|
|
49928
50042
|
label: "Date",
|
|
@@ -49931,20 +50045,20 @@ function InvoiceForm2({
|
|
|
49931
50045
|
required: true
|
|
49932
50046
|
}
|
|
49933
50047
|
),
|
|
49934
|
-
/* @__PURE__ */
|
|
50048
|
+
/* @__PURE__ */ jsx272(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49935
50049
|
] }),
|
|
49936
|
-
/* @__PURE__ */
|
|
49937
|
-
/* @__PURE__ */
|
|
50050
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-between items-center mt-6", children: [
|
|
50051
|
+
/* @__PURE__ */ jsx272("div", { children: isEdit && /* @__PURE__ */ jsx272(
|
|
49938
50052
|
ConfirmModal,
|
|
49939
50053
|
{
|
|
49940
50054
|
title: "Reverse Transaction",
|
|
49941
|
-
description: /* @__PURE__ */
|
|
49942
|
-
/* @__PURE__ */
|
|
49943
|
-
/* @__PURE__ */
|
|
50055
|
+
description: /* @__PURE__ */ jsxs241("div", { className: "space-y-3 text-left", children: [
|
|
50056
|
+
/* @__PURE__ */ jsx272("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50057
|
+
/* @__PURE__ */ jsx272("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."' })
|
|
49944
50058
|
] }),
|
|
49945
50059
|
confirmationWord: "delete",
|
|
49946
50060
|
onSubmit: onReverse,
|
|
49947
|
-
children: /* @__PURE__ */
|
|
50061
|
+
children: /* @__PURE__ */ jsx272(
|
|
49948
50062
|
Button,
|
|
49949
50063
|
{
|
|
49950
50064
|
type: "button",
|
|
@@ -49957,8 +50071,8 @@ function InvoiceForm2({
|
|
|
49957
50071
|
)
|
|
49958
50072
|
}
|
|
49959
50073
|
) }),
|
|
49960
|
-
/* @__PURE__ */
|
|
49961
|
-
close && /* @__PURE__ */
|
|
50074
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-end gap-3", children: [
|
|
50075
|
+
close && /* @__PURE__ */ jsx272(
|
|
49962
50076
|
Button,
|
|
49963
50077
|
{
|
|
49964
50078
|
type: "button",
|
|
@@ -49968,7 +50082,7 @@ function InvoiceForm2({
|
|
|
49968
50082
|
children: "Cancel"
|
|
49969
50083
|
}
|
|
49970
50084
|
),
|
|
49971
|
-
/* @__PURE__ */
|
|
50085
|
+
/* @__PURE__ */ jsx272(
|
|
49972
50086
|
Button,
|
|
49973
50087
|
{
|
|
49974
50088
|
isLoading,
|
|
@@ -49995,10 +50109,10 @@ var InvoiceForm_default2 = InvoiceForm2;
|
|
|
49995
50109
|
import React47 from "react";
|
|
49996
50110
|
import { useForm as useForm62 } from "react-hook-form";
|
|
49997
50111
|
import { zodResolver as zodResolver61 } from "@hookform/resolvers/zod";
|
|
49998
|
-
import { useParams as
|
|
50112
|
+
import { useParams as useParams114 } from "react-router-dom";
|
|
49999
50113
|
import { message as message89 } from "antd";
|
|
50000
|
-
import
|
|
50001
|
-
import { jsx as
|
|
50114
|
+
import dayjs14 from "dayjs";
|
|
50115
|
+
import { jsx as jsx273, jsxs as jsxs242 } from "react/jsx-runtime";
|
|
50002
50116
|
function JournalForm5({
|
|
50003
50117
|
onReload,
|
|
50004
50118
|
close,
|
|
@@ -50006,7 +50120,7 @@ function JournalForm5({
|
|
|
50006
50120
|
action = "debit",
|
|
50007
50121
|
id
|
|
50008
50122
|
}) {
|
|
50009
|
-
const { branchId } =
|
|
50123
|
+
const { branchId } = useParams114();
|
|
50010
50124
|
const { currencies } = useWarqadConfig();
|
|
50011
50125
|
const { stock: defaultCurrency } = currencies;
|
|
50012
50126
|
const [ref2, setRef] = React47.useState(void 0);
|
|
@@ -50017,7 +50131,7 @@ function JournalForm5({
|
|
|
50017
50131
|
const methods = useForm62({
|
|
50018
50132
|
resolver: zodResolver61(journalSchema5),
|
|
50019
50133
|
defaultValues: {
|
|
50020
|
-
date:
|
|
50134
|
+
date: dayjs14().format("DD/MM/YYYY"),
|
|
50021
50135
|
currency: defaultCurrency,
|
|
50022
50136
|
action,
|
|
50023
50137
|
description: "Payment ",
|
|
@@ -50089,19 +50203,19 @@ function JournalForm5({
|
|
|
50089
50203
|
e.preventDefault();
|
|
50090
50204
|
}
|
|
50091
50205
|
};
|
|
50092
|
-
return /* @__PURE__ */
|
|
50206
|
+
return /* @__PURE__ */ jsx273(
|
|
50093
50207
|
Card,
|
|
50094
50208
|
{
|
|
50095
50209
|
isLoading: getLoading,
|
|
50096
50210
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
50097
|
-
children: /* @__PURE__ */
|
|
50211
|
+
children: /* @__PURE__ */ jsx273(Card.Content, { children: /* @__PURE__ */ jsxs242(
|
|
50098
50212
|
"form",
|
|
50099
50213
|
{
|
|
50100
50214
|
onSubmit: handleSubmit(onSubmit),
|
|
50101
50215
|
onKeyDown: handleKeyDown,
|
|
50102
50216
|
className: "space-y-4",
|
|
50103
50217
|
children: [
|
|
50104
|
-
/* @__PURE__ */
|
|
50218
|
+
/* @__PURE__ */ jsx273(
|
|
50105
50219
|
Fields_default.Input,
|
|
50106
50220
|
{
|
|
50107
50221
|
label: "Description",
|
|
@@ -50112,8 +50226,8 @@ function JournalForm5({
|
|
|
50112
50226
|
placeholder: "Enter description"
|
|
50113
50227
|
}
|
|
50114
50228
|
),
|
|
50115
|
-
/* @__PURE__ */
|
|
50116
|
-
/* @__PURE__ */
|
|
50229
|
+
/* @__PURE__ */ jsxs242("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50230
|
+
/* @__PURE__ */ jsx273(
|
|
50117
50231
|
Fields_default.DateInput,
|
|
50118
50232
|
{
|
|
50119
50233
|
label: "Date",
|
|
@@ -50122,7 +50236,7 @@ function JournalForm5({
|
|
|
50122
50236
|
required: true
|
|
50123
50237
|
}
|
|
50124
50238
|
),
|
|
50125
|
-
/* @__PURE__ */
|
|
50239
|
+
/* @__PURE__ */ jsx273(
|
|
50126
50240
|
Fields_default.Input,
|
|
50127
50241
|
{
|
|
50128
50242
|
label: "Currency",
|
|
@@ -50132,8 +50246,8 @@ function JournalForm5({
|
|
|
50132
50246
|
}
|
|
50133
50247
|
)
|
|
50134
50248
|
] }),
|
|
50135
|
-
/* @__PURE__ */
|
|
50136
|
-
/* @__PURE__ */
|
|
50249
|
+
/* @__PURE__ */ jsxs242("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50250
|
+
/* @__PURE__ */ jsx273(
|
|
50137
50251
|
Fields_default.Input,
|
|
50138
50252
|
{
|
|
50139
50253
|
label: "Amount",
|
|
@@ -50144,7 +50258,7 @@ function JournalForm5({
|
|
|
50144
50258
|
placeholder: "0.00"
|
|
50145
50259
|
}
|
|
50146
50260
|
),
|
|
50147
|
-
/* @__PURE__ */
|
|
50261
|
+
/* @__PURE__ */ jsx273(
|
|
50148
50262
|
Fields_default.Select,
|
|
50149
50263
|
{
|
|
50150
50264
|
label: "Action",
|
|
@@ -50158,7 +50272,7 @@ function JournalForm5({
|
|
|
50158
50272
|
}
|
|
50159
50273
|
)
|
|
50160
50274
|
] }),
|
|
50161
|
-
/* @__PURE__ */
|
|
50275
|
+
/* @__PURE__ */ jsx273(
|
|
50162
50276
|
Fields_default.Textarea,
|
|
50163
50277
|
{
|
|
50164
50278
|
label: "Note",
|
|
@@ -50168,18 +50282,18 @@ function JournalForm5({
|
|
|
50168
50282
|
rows: 3
|
|
50169
50283
|
}
|
|
50170
50284
|
),
|
|
50171
|
-
/* @__PURE__ */
|
|
50172
|
-
/* @__PURE__ */
|
|
50285
|
+
/* @__PURE__ */ jsxs242("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
50286
|
+
/* @__PURE__ */ jsx273("div", { children: isEdit && /* @__PURE__ */ jsx273(
|
|
50173
50287
|
ConfirmModal,
|
|
50174
50288
|
{
|
|
50175
50289
|
title: "Reverse Transaction",
|
|
50176
|
-
description: /* @__PURE__ */
|
|
50177
|
-
/* @__PURE__ */
|
|
50178
|
-
/* @__PURE__ */
|
|
50290
|
+
description: /* @__PURE__ */ jsxs242("div", { className: "space-y-3 text-left", children: [
|
|
50291
|
+
/* @__PURE__ */ jsx273("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50292
|
+
/* @__PURE__ */ jsx273("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."' })
|
|
50179
50293
|
] }),
|
|
50180
50294
|
confirmationWord: "delete",
|
|
50181
50295
|
onSubmit: onReverse,
|
|
50182
|
-
children: /* @__PURE__ */
|
|
50296
|
+
children: /* @__PURE__ */ jsx273(
|
|
50183
50297
|
Button,
|
|
50184
50298
|
{
|
|
50185
50299
|
type: "button",
|
|
@@ -50192,8 +50306,8 @@ function JournalForm5({
|
|
|
50192
50306
|
)
|
|
50193
50307
|
}
|
|
50194
50308
|
) }),
|
|
50195
|
-
/* @__PURE__ */
|
|
50196
|
-
close && /* @__PURE__ */
|
|
50309
|
+
/* @__PURE__ */ jsxs242("div", { className: "flex justify-end gap-3", children: [
|
|
50310
|
+
close && /* @__PURE__ */ jsx273(
|
|
50197
50311
|
Button,
|
|
50198
50312
|
{
|
|
50199
50313
|
type: "button",
|
|
@@ -50203,7 +50317,7 @@ function JournalForm5({
|
|
|
50203
50317
|
children: "Cancel"
|
|
50204
50318
|
}
|
|
50205
50319
|
),
|
|
50206
|
-
/* @__PURE__ */
|
|
50320
|
+
/* @__PURE__ */ jsx273(
|
|
50207
50321
|
Button,
|
|
50208
50322
|
{
|
|
50209
50323
|
isLoading,
|
|
@@ -50225,15 +50339,15 @@ function JournalForm5({
|
|
|
50225
50339
|
var journalForm_default2 = JournalForm5;
|
|
50226
50340
|
|
|
50227
50341
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
50228
|
-
import { Fragment as
|
|
50342
|
+
import { Fragment as Fragment139, jsx as jsx274, jsxs as jsxs243 } from "react/jsx-runtime";
|
|
50229
50343
|
function CargoIM({ v, url }) {
|
|
50230
|
-
const { branchId } =
|
|
50344
|
+
const { branchId } = useParams115();
|
|
50231
50345
|
const { apiConfig } = useWarqadConfig();
|
|
50232
50346
|
const { width } = useMediaSize();
|
|
50233
50347
|
const isLargeScreen = width > 768;
|
|
50234
50348
|
const navigate = useNavigate66();
|
|
50235
50349
|
const type = "supplier";
|
|
50236
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50350
|
+
const [deleteAccount, setDeleteAccount] = useState119(null);
|
|
50237
50351
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50238
50352
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50239
50353
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -50244,17 +50358,17 @@ function CargoIM({ v, url }) {
|
|
|
50244
50358
|
const items = (data2) => [
|
|
50245
50359
|
{
|
|
50246
50360
|
label: `Edit ${type}`,
|
|
50247
|
-
icon: /* @__PURE__ */
|
|
50361
|
+
icon: /* @__PURE__ */ jsx274(FilePenLine44, { size: 16 }),
|
|
50248
50362
|
onClick: () => openState({
|
|
50249
50363
|
type: "Account",
|
|
50250
|
-
content: /* @__PURE__ */
|
|
50364
|
+
content: /* @__PURE__ */ jsx274(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
50251
50365
|
title: "Account Form",
|
|
50252
50366
|
width: 800
|
|
50253
50367
|
})
|
|
50254
50368
|
},
|
|
50255
50369
|
{
|
|
50256
50370
|
label: `Delete ${type}`,
|
|
50257
|
-
icon: /* @__PURE__ */
|
|
50371
|
+
icon: /* @__PURE__ */ jsx274(Trash255, { className: "text-red-500", size: 16 }),
|
|
50258
50372
|
onClick: () => setDeleteAccount(data2)
|
|
50259
50373
|
}
|
|
50260
50374
|
].filter(Boolean);
|
|
@@ -50265,7 +50379,7 @@ function CargoIM({ v, url }) {
|
|
|
50265
50379
|
className: "w-full",
|
|
50266
50380
|
cell: ({ row }) => {
|
|
50267
50381
|
const account = row.original;
|
|
50268
|
-
return /* @__PURE__ */
|
|
50382
|
+
return /* @__PURE__ */ jsx274(
|
|
50269
50383
|
"span",
|
|
50270
50384
|
{
|
|
50271
50385
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -50294,8 +50408,8 @@ function CargoIM({ v, url }) {
|
|
|
50294
50408
|
className: "w-px whitespace-nowrap",
|
|
50295
50409
|
cell: ({ row }) => {
|
|
50296
50410
|
const data2 = row.original;
|
|
50297
|
-
return /* @__PURE__ */
|
|
50298
|
-
/* @__PURE__ */
|
|
50411
|
+
return /* @__PURE__ */ jsxs243("div", { className: "flex gap-4 items-center", children: [
|
|
50412
|
+
/* @__PURE__ */ jsx274(
|
|
50299
50413
|
"button",
|
|
50300
50414
|
{
|
|
50301
50415
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50303,7 +50417,7 @@ function CargoIM({ v, url }) {
|
|
|
50303
50417
|
openState({
|
|
50304
50418
|
type: "credit",
|
|
50305
50419
|
closeOnOverlayClick: false,
|
|
50306
|
-
content: /* @__PURE__ */
|
|
50420
|
+
content: /* @__PURE__ */ jsx274(
|
|
50307
50421
|
InvoiceForm_default2,
|
|
50308
50422
|
{
|
|
50309
50423
|
onReload: reload,
|
|
@@ -50318,7 +50432,7 @@ function CargoIM({ v, url }) {
|
|
|
50318
50432
|
children: "Inv"
|
|
50319
50433
|
}
|
|
50320
50434
|
),
|
|
50321
|
-
/* @__PURE__ */
|
|
50435
|
+
/* @__PURE__ */ jsx274(
|
|
50322
50436
|
"button",
|
|
50323
50437
|
{
|
|
50324
50438
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50326,7 +50440,7 @@ function CargoIM({ v, url }) {
|
|
|
50326
50440
|
openState({
|
|
50327
50441
|
type: "debit",
|
|
50328
50442
|
closeOnOverlayClick: false,
|
|
50329
|
-
content: /* @__PURE__ */
|
|
50443
|
+
content: /* @__PURE__ */ jsx274(
|
|
50330
50444
|
journalForm_default2,
|
|
50331
50445
|
{
|
|
50332
50446
|
onReload: reload,
|
|
@@ -50342,14 +50456,14 @@ function CargoIM({ v, url }) {
|
|
|
50342
50456
|
children: "Pay"
|
|
50343
50457
|
}
|
|
50344
50458
|
),
|
|
50345
|
-
/* @__PURE__ */
|
|
50459
|
+
/* @__PURE__ */ jsx274(
|
|
50346
50460
|
Dropdown,
|
|
50347
50461
|
{
|
|
50348
50462
|
className: "cursor-pointer",
|
|
50349
50463
|
width: "w-[150px]",
|
|
50350
50464
|
items: items(data2),
|
|
50351
50465
|
triggerMode: "hover",
|
|
50352
|
-
children: /* @__PURE__ */
|
|
50466
|
+
children: /* @__PURE__ */ jsx274(EllipsisVertical48, {})
|
|
50353
50467
|
}
|
|
50354
50468
|
)
|
|
50355
50469
|
] });
|
|
@@ -50373,9 +50487,9 @@ function CargoIM({ v, url }) {
|
|
|
50373
50487
|
return error;
|
|
50374
50488
|
}
|
|
50375
50489
|
};
|
|
50376
|
-
return /* @__PURE__ */
|
|
50377
|
-
/* @__PURE__ */
|
|
50378
|
-
/* @__PURE__ */
|
|
50490
|
+
return /* @__PURE__ */ jsxs243(Fragment139, { children: [
|
|
50491
|
+
/* @__PURE__ */ jsx274(Modal2, {}),
|
|
50492
|
+
/* @__PURE__ */ jsx274(
|
|
50379
50493
|
ConfirmModal,
|
|
50380
50494
|
{
|
|
50381
50495
|
isOpen: !!deleteAccount,
|
|
@@ -50388,7 +50502,7 @@ function CargoIM({ v, url }) {
|
|
|
50388
50502
|
children: null
|
|
50389
50503
|
}
|
|
50390
50504
|
),
|
|
50391
|
-
/* @__PURE__ */
|
|
50505
|
+
/* @__PURE__ */ jsx274("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ jsx274(
|
|
50392
50506
|
TransactionViewComponent,
|
|
50393
50507
|
{
|
|
50394
50508
|
columns,
|
|
@@ -50399,7 +50513,7 @@ function CargoIM({ v, url }) {
|
|
|
50399
50513
|
onCreate: () => {
|
|
50400
50514
|
openState({
|
|
50401
50515
|
type: "account",
|
|
50402
|
-
content: /* @__PURE__ */
|
|
50516
|
+
content: /* @__PURE__ */ jsx274(AccountForm_default3, { onReload: reload, close }),
|
|
50403
50517
|
title: "Account Form",
|
|
50404
50518
|
width: 800
|
|
50405
50519
|
});
|
|
@@ -50412,8 +50526,8 @@ var CargoIM_default = CargoIM;
|
|
|
50412
50526
|
|
|
50413
50527
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
50414
50528
|
import { useSearchParams as useSearchParams20 } from "react-router-dom";
|
|
50415
|
-
import { useMemo as
|
|
50416
|
-
import { Fragment as
|
|
50529
|
+
import { useMemo as useMemo56, useState as useState120, useEffect as useEffect118 } from "react";
|
|
50530
|
+
import { Fragment as Fragment140, jsx as jsx275, jsxs as jsxs244 } from "react/jsx-runtime";
|
|
50417
50531
|
var CargoIMReport = () => {
|
|
50418
50532
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
50419
50533
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -50429,7 +50543,7 @@ var CargoIMReport = () => {
|
|
|
50429
50543
|
const [searchParams, setSearchParams] = useSearchParams20();
|
|
50430
50544
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
50431
50545
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
50432
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
50546
|
+
const [currencyFilter, setCurrencyFilter] = useState120(initialCurrency);
|
|
50433
50547
|
const handleCurrencyChange = (value) => {
|
|
50434
50548
|
setCurrencyFilter(value);
|
|
50435
50549
|
setSearchParams((prev) => {
|
|
@@ -50457,9 +50571,9 @@ var CargoIMReport = () => {
|
|
|
50457
50571
|
header: "Date",
|
|
50458
50572
|
key: "date",
|
|
50459
50573
|
className: "text-xs whitespace-nowrap",
|
|
50460
|
-
render: (row) => /* @__PURE__ */
|
|
50461
|
-
/* @__PURE__ */
|
|
50462
|
-
/* @__PURE__ */
|
|
50574
|
+
render: (row) => /* @__PURE__ */ jsxs244("div", { className: "", children: [
|
|
50575
|
+
/* @__PURE__ */ jsx275("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50576
|
+
/* @__PURE__ */ jsx275(
|
|
50463
50577
|
"span",
|
|
50464
50578
|
{
|
|
50465
50579
|
onClick: () => {
|
|
@@ -50478,13 +50592,13 @@ var CargoIMReport = () => {
|
|
|
50478
50592
|
header: "Container No",
|
|
50479
50593
|
key: "description",
|
|
50480
50594
|
className: "text-xs w-full break-words",
|
|
50481
|
-
render: (row) => /* @__PURE__ */
|
|
50595
|
+
render: (row) => /* @__PURE__ */ jsx275("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) => {
|
|
50482
50596
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50483
50597
|
/[^a-zA-Z0-9]/g,
|
|
50484
50598
|
""
|
|
50485
50599
|
);
|
|
50486
50600
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50487
|
-
return /* @__PURE__ */
|
|
50601
|
+
return /* @__PURE__ */ jsx275(
|
|
50488
50602
|
"div",
|
|
50489
50603
|
{
|
|
50490
50604
|
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`,
|
|
@@ -50498,13 +50612,13 @@ var CargoIMReport = () => {
|
|
|
50498
50612
|
header: "Cbm",
|
|
50499
50613
|
key: "cbm",
|
|
50500
50614
|
className: "text-xs whitespace-nowrap text-right",
|
|
50501
|
-
render: (row) => /* @__PURE__ */
|
|
50615
|
+
render: (row) => /* @__PURE__ */ jsx275("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) => {
|
|
50502
50616
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50503
50617
|
/[^a-zA-Z0-9]/g,
|
|
50504
50618
|
""
|
|
50505
50619
|
);
|
|
50506
50620
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50507
|
-
return /* @__PURE__ */
|
|
50621
|
+
return /* @__PURE__ */ jsx275(
|
|
50508
50622
|
"div",
|
|
50509
50623
|
{
|
|
50510
50624
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50521,20 +50635,20 @@ var CargoIMReport = () => {
|
|
|
50521
50635
|
),
|
|
50522
50636
|
0
|
|
50523
50637
|
);
|
|
50524
|
-
return totalCbm > 0 ? /* @__PURE__ */
|
|
50638
|
+
return totalCbm > 0 ? /* @__PURE__ */ jsx275("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50525
50639
|
}
|
|
50526
50640
|
},
|
|
50527
50641
|
{
|
|
50528
50642
|
header: "Price",
|
|
50529
50643
|
key: "price",
|
|
50530
50644
|
className: "text-xs whitespace-nowrap text-right",
|
|
50531
|
-
render: (row) => /* @__PURE__ */
|
|
50645
|
+
render: (row) => /* @__PURE__ */ jsx275("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) => {
|
|
50532
50646
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50533
50647
|
/[^a-zA-Z0-9]/g,
|
|
50534
50648
|
""
|
|
50535
50649
|
);
|
|
50536
50650
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50537
|
-
return /* @__PURE__ */
|
|
50651
|
+
return /* @__PURE__ */ jsx275(
|
|
50538
50652
|
"div",
|
|
50539
50653
|
{
|
|
50540
50654
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50548,13 +50662,13 @@ var CargoIMReport = () => {
|
|
|
50548
50662
|
header: "Credit",
|
|
50549
50663
|
key: "credit",
|
|
50550
50664
|
className: "text-xs whitespace-nowrap text-right",
|
|
50551
|
-
render: (row) => /* @__PURE__ */
|
|
50665
|
+
render: (row) => /* @__PURE__ */ jsx275("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) => {
|
|
50552
50666
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50553
50667
|
/[^a-zA-Z0-9]/g,
|
|
50554
50668
|
""
|
|
50555
50669
|
);
|
|
50556
50670
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50557
|
-
return /* @__PURE__ */
|
|
50671
|
+
return /* @__PURE__ */ jsx275(
|
|
50558
50672
|
"div",
|
|
50559
50673
|
{
|
|
50560
50674
|
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`,
|
|
@@ -50563,7 +50677,7 @@ var CargoIMReport = () => {
|
|
|
50563
50677
|
idx
|
|
50564
50678
|
);
|
|
50565
50679
|
}) }),
|
|
50566
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50680
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx275("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50567
50681
|
data2.reduce(
|
|
50568
50682
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50569
50683
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50577,13 +50691,13 @@ var CargoIMReport = () => {
|
|
|
50577
50691
|
header: "Debit",
|
|
50578
50692
|
key: "debit",
|
|
50579
50693
|
className: "text-xs whitespace-nowrap text-right",
|
|
50580
|
-
render: (row) => /* @__PURE__ */
|
|
50694
|
+
render: (row) => /* @__PURE__ */ jsx275("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) => {
|
|
50581
50695
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50582
50696
|
/[^a-zA-Z0-9]/g,
|
|
50583
50697
|
""
|
|
50584
50698
|
);
|
|
50585
50699
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50586
|
-
return /* @__PURE__ */
|
|
50700
|
+
return /* @__PURE__ */ jsx275(
|
|
50587
50701
|
"div",
|
|
50588
50702
|
{
|
|
50589
50703
|
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`,
|
|
@@ -50592,7 +50706,7 @@ var CargoIMReport = () => {
|
|
|
50592
50706
|
idx
|
|
50593
50707
|
);
|
|
50594
50708
|
}) }),
|
|
50595
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50709
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx275("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50596
50710
|
data2.reduce(
|
|
50597
50711
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50598
50712
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50606,14 +50720,14 @@ var CargoIMReport = () => {
|
|
|
50606
50720
|
header: "Balance",
|
|
50607
50721
|
key: "runningBalance",
|
|
50608
50722
|
className: "text-xs whitespace-nowrap text-right",
|
|
50609
|
-
render: (row) => /* @__PURE__ */
|
|
50610
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50723
|
+
render: (row) => /* @__PURE__ */ jsx275("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50724
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx275("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50611
50725
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50612
50726
|
currency
|
|
50613
50727
|
) })
|
|
50614
50728
|
}
|
|
50615
50729
|
];
|
|
50616
|
-
const datas =
|
|
50730
|
+
const datas = useMemo56(() => {
|
|
50617
50731
|
let runningBalance = 0;
|
|
50618
50732
|
const transactions = data?.data?.transactions;
|
|
50619
50733
|
const res = (transactions || []).map((item) => {
|
|
@@ -50650,10 +50764,10 @@ var CargoIMReport = () => {
|
|
|
50650
50764
|
{ label: "Account Type", value: data?.data?.type },
|
|
50651
50765
|
{ label: "Currency", value: currencyFilter }
|
|
50652
50766
|
];
|
|
50653
|
-
return /* @__PURE__ */
|
|
50654
|
-
/* @__PURE__ */
|
|
50655
|
-
/* @__PURE__ */
|
|
50656
|
-
/* @__PURE__ */
|
|
50767
|
+
return /* @__PURE__ */ jsxs244(Fragment140, { children: [
|
|
50768
|
+
/* @__PURE__ */ jsx275(Modal2, {}),
|
|
50769
|
+
/* @__PURE__ */ jsx275(TransactionView, {}),
|
|
50770
|
+
/* @__PURE__ */ jsx275(
|
|
50657
50771
|
A4DataView,
|
|
50658
50772
|
{
|
|
50659
50773
|
columns,
|
|
@@ -50668,7 +50782,7 @@ var CargoIMReport = () => {
|
|
|
50668
50782
|
openState({
|
|
50669
50783
|
type: "debit",
|
|
50670
50784
|
closeOnOverlayClick: false,
|
|
50671
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */
|
|
50785
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ jsx275(
|
|
50672
50786
|
InvoiceForm_default2,
|
|
50673
50787
|
{
|
|
50674
50788
|
close: closeTransaction,
|
|
@@ -50676,7 +50790,7 @@ var CargoIMReport = () => {
|
|
|
50676
50790
|
onReload: reload,
|
|
50677
50791
|
id: row._id
|
|
50678
50792
|
}
|
|
50679
|
-
) : /* @__PURE__ */
|
|
50793
|
+
) : /* @__PURE__ */ jsx275(
|
|
50680
50794
|
journalForm_default2,
|
|
50681
50795
|
{
|
|
50682
50796
|
close: closeTransaction,
|
|
@@ -50689,7 +50803,7 @@ var CargoIMReport = () => {
|
|
|
50689
50803
|
width: 800
|
|
50690
50804
|
});
|
|
50691
50805
|
},
|
|
50692
|
-
headers: /* @__PURE__ */
|
|
50806
|
+
headers: /* @__PURE__ */ jsx275("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx275(
|
|
50693
50807
|
Fields_default.Select,
|
|
50694
50808
|
{
|
|
50695
50809
|
options: currencies,
|
|
@@ -50705,21 +50819,21 @@ var CargoIMReport = () => {
|
|
|
50705
50819
|
var cargoIMReport_default = CargoIMReport;
|
|
50706
50820
|
|
|
50707
50821
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50708
|
-
import { useNavigate as useNavigate67, useParams as
|
|
50822
|
+
import { useNavigate as useNavigate67, useParams as useParams116 } from "react-router-dom";
|
|
50709
50823
|
import {
|
|
50710
50824
|
EllipsisVertical as EllipsisVertical49,
|
|
50711
50825
|
FileChartLine as FileChartLine2,
|
|
50712
50826
|
FilePenLine as FilePenLine45,
|
|
50713
50827
|
Trash2 as Trash256
|
|
50714
50828
|
} from "lucide-react";
|
|
50715
|
-
import { useState as
|
|
50829
|
+
import { useState as useState121 } from "react";
|
|
50716
50830
|
import { message as message91 } from "antd";
|
|
50717
|
-
import { Fragment as
|
|
50831
|
+
import { Fragment as Fragment141, jsx as jsx276, jsxs as jsxs245 } from "react/jsx-runtime";
|
|
50718
50832
|
function Forex2Accounts({ v, url }) {
|
|
50719
|
-
const { branchId } =
|
|
50833
|
+
const { branchId } = useParams116();
|
|
50720
50834
|
const navigate = useNavigate67();
|
|
50721
50835
|
const type = "account";
|
|
50722
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50836
|
+
const [deleteAccount, setDeleteAccount] = useState121(null);
|
|
50723
50837
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50724
50838
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50725
50839
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50730,22 +50844,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50730
50844
|
const items = (data2) => [
|
|
50731
50845
|
{
|
|
50732
50846
|
label: `Currency Report`,
|
|
50733
|
-
icon: /* @__PURE__ */
|
|
50847
|
+
icon: /* @__PURE__ */ jsx276(FileChartLine2, { size: 16 }),
|
|
50734
50848
|
onClick: () => navigate(data2?._id)
|
|
50735
50849
|
},
|
|
50736
50850
|
{
|
|
50737
50851
|
label: `Edit ${type}`,
|
|
50738
|
-
icon: /* @__PURE__ */
|
|
50852
|
+
icon: /* @__PURE__ */ jsx276(FilePenLine45, { size: 16 }),
|
|
50739
50853
|
onClick: () => openState({
|
|
50740
50854
|
type: "forex account",
|
|
50741
|
-
content: /* @__PURE__ */
|
|
50855
|
+
content: /* @__PURE__ */ jsx276(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50742
50856
|
title: "Forex Account Form",
|
|
50743
50857
|
width: 800
|
|
50744
50858
|
})
|
|
50745
50859
|
},
|
|
50746
50860
|
{
|
|
50747
50861
|
label: `Delete ${type}`,
|
|
50748
|
-
icon: /* @__PURE__ */
|
|
50862
|
+
icon: /* @__PURE__ */ jsx276(Trash256, { className: "text-red-500", size: 16 }),
|
|
50749
50863
|
onClick: () => setDeleteAccount(data2)
|
|
50750
50864
|
}
|
|
50751
50865
|
].filter(Boolean);
|
|
@@ -50755,7 +50869,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50755
50869
|
header: "Name",
|
|
50756
50870
|
cell: ({ row }) => {
|
|
50757
50871
|
const account = row.original;
|
|
50758
|
-
return /* @__PURE__ */
|
|
50872
|
+
return /* @__PURE__ */ jsx276(
|
|
50759
50873
|
"span",
|
|
50760
50874
|
{
|
|
50761
50875
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50770,7 +50884,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50770
50884
|
header: "Phone",
|
|
50771
50885
|
cell: ({ row }) => {
|
|
50772
50886
|
const account = row.original;
|
|
50773
|
-
return /* @__PURE__ */
|
|
50887
|
+
return /* @__PURE__ */ jsx276("span", { children: account?.phoneNumber || "N/A" });
|
|
50774
50888
|
}
|
|
50775
50889
|
},
|
|
50776
50890
|
{
|
|
@@ -50778,14 +50892,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50778
50892
|
header: "Balances",
|
|
50779
50893
|
cell: ({ row }) => {
|
|
50780
50894
|
const account = row.original;
|
|
50781
|
-
return /* @__PURE__ */
|
|
50782
|
-
([currency, data2]) => /* @__PURE__ */
|
|
50895
|
+
return /* @__PURE__ */ jsx276("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50896
|
+
([currency, data2]) => /* @__PURE__ */ jsxs245(
|
|
50783
50897
|
"div",
|
|
50784
50898
|
{
|
|
50785
50899
|
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",
|
|
50786
50900
|
children: [
|
|
50787
|
-
/* @__PURE__ */
|
|
50788
|
-
/* @__PURE__ */
|
|
50901
|
+
/* @__PURE__ */ jsx276("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50902
|
+
/* @__PURE__ */ jsx276(
|
|
50789
50903
|
"span",
|
|
50790
50904
|
{
|
|
50791
50905
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50804,8 +50918,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50804
50918
|
header: "Actions",
|
|
50805
50919
|
cell: ({ row }) => {
|
|
50806
50920
|
const data2 = row.original;
|
|
50807
|
-
return /* @__PURE__ */
|
|
50808
|
-
/* @__PURE__ */
|
|
50921
|
+
return /* @__PURE__ */ jsxs245("div", { className: "flex gap-4 items-center", children: [
|
|
50922
|
+
/* @__PURE__ */ jsx276(
|
|
50809
50923
|
"button",
|
|
50810
50924
|
{
|
|
50811
50925
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50813,7 +50927,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50813
50927
|
openState({
|
|
50814
50928
|
type: "credit",
|
|
50815
50929
|
closeOnOverlayClick: false,
|
|
50816
|
-
content: /* @__PURE__ */
|
|
50930
|
+
content: /* @__PURE__ */ jsx276(
|
|
50817
50931
|
Forex2FormTransaction_default,
|
|
50818
50932
|
{
|
|
50819
50933
|
close,
|
|
@@ -50829,7 +50943,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50829
50943
|
children: "Out"
|
|
50830
50944
|
}
|
|
50831
50945
|
),
|
|
50832
|
-
/* @__PURE__ */
|
|
50946
|
+
/* @__PURE__ */ jsx276(
|
|
50833
50947
|
"button",
|
|
50834
50948
|
{
|
|
50835
50949
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50837,7 +50951,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50837
50951
|
openState({
|
|
50838
50952
|
type: "debit",
|
|
50839
50953
|
closeOnOverlayClick: false,
|
|
50840
|
-
content: /* @__PURE__ */
|
|
50954
|
+
content: /* @__PURE__ */ jsx276(
|
|
50841
50955
|
Forex2FormTransaction_default,
|
|
50842
50956
|
{
|
|
50843
50957
|
close,
|
|
@@ -50853,13 +50967,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50853
50967
|
children: "In"
|
|
50854
50968
|
}
|
|
50855
50969
|
),
|
|
50856
|
-
/* @__PURE__ */
|
|
50970
|
+
/* @__PURE__ */ jsx276(
|
|
50857
50971
|
Dropdown,
|
|
50858
50972
|
{
|
|
50859
50973
|
className: "cursor-pointer w-[150px]",
|
|
50860
50974
|
items: items(data2),
|
|
50861
50975
|
triggerMode: "hover",
|
|
50862
|
-
children: /* @__PURE__ */
|
|
50976
|
+
children: /* @__PURE__ */ jsx276(EllipsisVertical49, {})
|
|
50863
50977
|
}
|
|
50864
50978
|
)
|
|
50865
50979
|
] });
|
|
@@ -50898,9 +51012,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50898
51012
|
};
|
|
50899
51013
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50900
51014
|
console.log(currencies);
|
|
50901
|
-
return /* @__PURE__ */
|
|
50902
|
-
/* @__PURE__ */
|
|
50903
|
-
/* @__PURE__ */
|
|
51015
|
+
return /* @__PURE__ */ jsxs245(Fragment141, { children: [
|
|
51016
|
+
/* @__PURE__ */ jsx276(Modal2, {}),
|
|
51017
|
+
/* @__PURE__ */ jsx276(
|
|
50904
51018
|
ConfirmModal,
|
|
50905
51019
|
{
|
|
50906
51020
|
isOpen: !!deleteAccount,
|
|
@@ -50913,9 +51027,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50913
51027
|
children: null
|
|
50914
51028
|
}
|
|
50915
51029
|
),
|
|
50916
|
-
/* @__PURE__ */
|
|
50917
|
-
/* @__PURE__ */
|
|
50918
|
-
/* @__PURE__ */
|
|
51030
|
+
/* @__PURE__ */ jsxs245("div", { children: [
|
|
51031
|
+
/* @__PURE__ */ jsx276(ForexAccountSummary_default, { currencies, isLoading }),
|
|
51032
|
+
/* @__PURE__ */ jsx276(
|
|
50919
51033
|
TransactionViewComponent,
|
|
50920
51034
|
{
|
|
50921
51035
|
columns,
|
|
@@ -50927,7 +51041,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50927
51041
|
onCreate: () => {
|
|
50928
51042
|
openState({
|
|
50929
51043
|
type: "forex account",
|
|
50930
|
-
content: /* @__PURE__ */
|
|
51044
|
+
content: /* @__PURE__ */ jsx276(ForexAccountForm_default, { close, reloads: reload }),
|
|
50931
51045
|
title: "Forex Account Form",
|
|
50932
51046
|
width: 800
|
|
50933
51047
|
});
|
|
@@ -50940,14 +51054,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50940
51054
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50941
51055
|
|
|
50942
51056
|
// src/components/reports/ProductList.tsx
|
|
50943
|
-
import { useParams as
|
|
50944
|
-
import { Fragment as
|
|
51057
|
+
import { useParams as useParams117 } from "react-router-dom";
|
|
51058
|
+
import { Fragment as Fragment142, jsx as jsx277, jsxs as jsxs246 } from "react/jsx-runtime";
|
|
50945
51059
|
var options9 = [
|
|
50946
51060
|
{ label: "Product", value: "product" },
|
|
50947
51061
|
{ label: "Pack", value: "pack" }
|
|
50948
51062
|
];
|
|
50949
51063
|
var ProductList2 = ({ value = false }) => {
|
|
50950
|
-
const { branchId } =
|
|
51064
|
+
const { branchId } = useParams117();
|
|
50951
51065
|
const { branches } = useAuth_default();
|
|
50952
51066
|
const { TransactionView } = useTransactionView_default();
|
|
50953
51067
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50969,7 +51083,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50969
51083
|
key: "name",
|
|
50970
51084
|
className: "text-xs whitespace-nowrap",
|
|
50971
51085
|
render: (row) => {
|
|
50972
|
-
return /* @__PURE__ */
|
|
51086
|
+
return /* @__PURE__ */ jsx277("div", { className: "", children: /* @__PURE__ */ jsx277("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
50973
51087
|
}
|
|
50974
51088
|
},
|
|
50975
51089
|
...value ? [
|
|
@@ -50977,14 +51091,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50977
51091
|
header: "Cost",
|
|
50978
51092
|
key: "cost",
|
|
50979
51093
|
className: "text-xs whitespace-nowrap text-right",
|
|
50980
|
-
render: (row) => /* @__PURE__ */
|
|
51094
|
+
render: (row) => /* @__PURE__ */ jsx277("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50981
51095
|
}
|
|
50982
51096
|
] : []
|
|
50983
51097
|
];
|
|
50984
51098
|
const datas = data?.data || [];
|
|
50985
|
-
return /* @__PURE__ */
|
|
50986
|
-
/* @__PURE__ */
|
|
50987
|
-
/* @__PURE__ */
|
|
51099
|
+
return /* @__PURE__ */ jsxs246(Fragment142, { children: [
|
|
51100
|
+
/* @__PURE__ */ jsx277(TransactionView, {}),
|
|
51101
|
+
/* @__PURE__ */ jsx277(
|
|
50988
51102
|
A4DataView,
|
|
50989
51103
|
{
|
|
50990
51104
|
columns,
|
|
@@ -50995,7 +51109,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50995
51109
|
tableTitle: "Stock List",
|
|
50996
51110
|
fixed: false,
|
|
50997
51111
|
startPage: 1e10,
|
|
50998
|
-
headers: /* @__PURE__ */
|
|
51112
|
+
headers: /* @__PURE__ */ jsx277(
|
|
50999
51113
|
Select,
|
|
51000
51114
|
{
|
|
51001
51115
|
options: options9,
|