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