warqadui 0.0.284 → 0.0.285
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +454 -317
- package/dist/index.mjs +405 -268
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48652,7 +48652,7 @@ var Expenses3Reports = () => {
|
|
|
48652
48652
|
const [startDate, setStartDate] = useState113(null);
|
|
48653
48653
|
const [endDate, setEndDate] = useState113(null);
|
|
48654
48654
|
const { A4DataView, data } = useA4DataView_default({
|
|
48655
|
-
url: `/transactions/get?
|
|
48655
|
+
url: `/transactions/get?type=expense-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48656
48656
|
v: 1
|
|
48657
48657
|
// No prefix
|
|
48658
48658
|
});
|
|
@@ -48777,18 +48777,155 @@ var Expenses3Reports = () => {
|
|
|
48777
48777
|
};
|
|
48778
48778
|
var Expenses3Reports_default = Expenses3Reports;
|
|
48779
48779
|
|
|
48780
|
+
// src/components/Transactions/3/reports/ExpensesJournal3.tsx
|
|
48781
|
+
import { useParams as useParams107 } from "react-router-dom";
|
|
48782
|
+
import { useMemo as useMemo53, useState as useState114 } from "react";
|
|
48783
|
+
import { DatePicker as DatePicker10 } from "antd";
|
|
48784
|
+
import dayjs12 from "dayjs";
|
|
48785
|
+
import { Fragment as Fragment134, jsx as jsx266, jsxs as jsxs235 } from "react/jsx-runtime";
|
|
48786
|
+
var Expenses3Reports2 = () => {
|
|
48787
|
+
const { branchId } = useParams107();
|
|
48788
|
+
const [startDate, setStartDate] = useState114(null);
|
|
48789
|
+
const [endDate, setEndDate] = useState114(null);
|
|
48790
|
+
const { A4DataView, data } = useA4DataView_default({
|
|
48791
|
+
url: `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48792
|
+
v: 1
|
|
48793
|
+
// No prefix
|
|
48794
|
+
});
|
|
48795
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48796
|
+
const { defaultCurrency } = useWarqadConfig()?.currencies;
|
|
48797
|
+
const columns = [
|
|
48798
|
+
{
|
|
48799
|
+
header: "Date",
|
|
48800
|
+
key: "date",
|
|
48801
|
+
className: "text-xs whitespace-nowrap",
|
|
48802
|
+
render: (row) => /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48803
|
+
/* @__PURE__ */ jsx266("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48804
|
+
/* @__PURE__ */ jsx266(
|
|
48805
|
+
"span",
|
|
48806
|
+
{
|
|
48807
|
+
onClick: () => {
|
|
48808
|
+
openTransaction({
|
|
48809
|
+
id: row?._id,
|
|
48810
|
+
type: row?.type
|
|
48811
|
+
});
|
|
48812
|
+
},
|
|
48813
|
+
className: "text-green-400 font-bold text-[8px] hover:underline cursor-pointer print:hidden",
|
|
48814
|
+
children: row?.ref
|
|
48815
|
+
}
|
|
48816
|
+
)
|
|
48817
|
+
] })
|
|
48818
|
+
},
|
|
48819
|
+
{
|
|
48820
|
+
header: "Description",
|
|
48821
|
+
key: "description",
|
|
48822
|
+
className: "text-xs whitespace-nowrap ",
|
|
48823
|
+
render: (row) => {
|
|
48824
|
+
return /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48825
|
+
/* @__PURE__ */ jsx266("p", { className: "font-bold capitalize text-black dark:text-white print:text-black", children: row.description }),
|
|
48826
|
+
row.note && /* @__PURE__ */ jsx266("p", { className: "font-medium italic text-xs capitalize text-gray-500 dark:text-white ", children: row.note })
|
|
48827
|
+
] });
|
|
48828
|
+
}
|
|
48829
|
+
},
|
|
48830
|
+
{
|
|
48831
|
+
header: "Amount",
|
|
48832
|
+
key: "changedAmountString",
|
|
48833
|
+
className: "text-xs whitespace-nowrap text-right",
|
|
48834
|
+
render: (row) => /* @__PURE__ */ jsx266("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.changedAmountString }),
|
|
48835
|
+
renderFooter: (data2) => {
|
|
48836
|
+
return /* @__PURE__ */ jsx266("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
48837
|
+
Math.abs(data2.reduce((acc, row) => acc + row.changedAmount, 0)),
|
|
48838
|
+
defaultCurrency
|
|
48839
|
+
) });
|
|
48840
|
+
}
|
|
48841
|
+
}
|
|
48842
|
+
];
|
|
48843
|
+
const datas = useMemo53(() => {
|
|
48844
|
+
let runningBalance = 0;
|
|
48845
|
+
let filteredData = data?.data || [];
|
|
48846
|
+
const mapped = filteredData.map((item) => {
|
|
48847
|
+
const changedAmount = item?.exchange?.amount ? item?.exchange?.amount : item.amount;
|
|
48848
|
+
runningBalance += changedAmount;
|
|
48849
|
+
return {
|
|
48850
|
+
...item,
|
|
48851
|
+
changedAmountString: Formats_default.Amount(changedAmount, false),
|
|
48852
|
+
changedAmount,
|
|
48853
|
+
runningBalance
|
|
48854
|
+
};
|
|
48855
|
+
});
|
|
48856
|
+
let filtered = mapped;
|
|
48857
|
+
if (startDate) {
|
|
48858
|
+
const startOfDay = startDate.startOf("day");
|
|
48859
|
+
filtered = filtered.filter((tx) => {
|
|
48860
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48861
|
+
if (!rawDate) return false;
|
|
48862
|
+
const txDate = dayjs12(rawDate);
|
|
48863
|
+
return txDate.isAfter(startOfDay) || txDate.isSame(startOfDay);
|
|
48864
|
+
});
|
|
48865
|
+
}
|
|
48866
|
+
if (endDate) {
|
|
48867
|
+
const endOfDay = endDate.endOf("day");
|
|
48868
|
+
filtered = filtered.filter((tx) => {
|
|
48869
|
+
const rawDate = tx.dateObj || tx.date;
|
|
48870
|
+
if (!rawDate) return false;
|
|
48871
|
+
const txDate = dayjs12(rawDate);
|
|
48872
|
+
return txDate.isBefore(endOfDay) || txDate.isSame(endOfDay);
|
|
48873
|
+
});
|
|
48874
|
+
}
|
|
48875
|
+
return filtered;
|
|
48876
|
+
}, [data, startDate, endDate]);
|
|
48877
|
+
return /* @__PURE__ */ jsxs235(Fragment134, { children: [
|
|
48878
|
+
/* @__PURE__ */ jsx266(TransactionView, {}),
|
|
48879
|
+
/* @__PURE__ */ jsx266(
|
|
48880
|
+
A4DataView,
|
|
48881
|
+
{
|
|
48882
|
+
columns,
|
|
48883
|
+
data: datas,
|
|
48884
|
+
index: true,
|
|
48885
|
+
title: `Expenses Journal Report`,
|
|
48886
|
+
subtitle: `All Expenses`,
|
|
48887
|
+
fixed: false,
|
|
48888
|
+
headers: /* @__PURE__ */ jsxs235("div", { className: "flex gap-2 items-center print:hidden flex-wrap", children: [
|
|
48889
|
+
/* @__PURE__ */ jsx266(
|
|
48890
|
+
DatePicker10,
|
|
48891
|
+
{
|
|
48892
|
+
placeholder: "Start Date",
|
|
48893
|
+
onChange: (date) => setStartDate(date),
|
|
48894
|
+
value: startDate,
|
|
48895
|
+
format: "DD/MM/YYYY",
|
|
48896
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48897
|
+
}
|
|
48898
|
+
),
|
|
48899
|
+
/* @__PURE__ */ jsx266(
|
|
48900
|
+
DatePicker10,
|
|
48901
|
+
{
|
|
48902
|
+
placeholder: "End Date",
|
|
48903
|
+
onChange: (date) => setEndDate(date),
|
|
48904
|
+
value: endDate,
|
|
48905
|
+
format: "DD/MM/YYYY",
|
|
48906
|
+
className: "min-w-[140px] max-w-[160px]"
|
|
48907
|
+
}
|
|
48908
|
+
)
|
|
48909
|
+
] })
|
|
48910
|
+
}
|
|
48911
|
+
)
|
|
48912
|
+
] });
|
|
48913
|
+
};
|
|
48914
|
+
var ExpensesJournal3_default = Expenses3Reports2;
|
|
48915
|
+
|
|
48780
48916
|
// src/components/Transactions/3/reports/index.tsx
|
|
48781
48917
|
var Reports3 = {
|
|
48782
|
-
expenses: Expenses3Reports_default
|
|
48918
|
+
expenses: Expenses3Reports_default,
|
|
48919
|
+
expensesJournal: ExpensesJournal3_default
|
|
48783
48920
|
};
|
|
48784
48921
|
var reports_default = Reports3;
|
|
48785
48922
|
|
|
48786
48923
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48787
|
-
import { useNavigate as useNavigate64, useParams as
|
|
48924
|
+
import { useNavigate as useNavigate64, useParams as useParams108 } from "react-router-dom";
|
|
48788
48925
|
import { EllipsisVertical as EllipsisVertical47, FilePenLine as FilePenLine43, Trash2 as Trash253 } from "lucide-react";
|
|
48789
|
-
import { Fragment as
|
|
48926
|
+
import { Fragment as Fragment135, jsx as jsx267, jsxs as jsxs236 } from "react/jsx-runtime";
|
|
48790
48927
|
function ExpensesJournal3({ url }) {
|
|
48791
|
-
const { branchId } =
|
|
48928
|
+
const { branchId } = useParams108();
|
|
48792
48929
|
const navigate = useNavigate64();
|
|
48793
48930
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48794
48931
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
@@ -48799,17 +48936,17 @@ function ExpensesJournal3({ url }) {
|
|
|
48799
48936
|
const items = (data2) => [
|
|
48800
48937
|
{
|
|
48801
48938
|
label: `View Expense`,
|
|
48802
|
-
icon: /* @__PURE__ */
|
|
48939
|
+
icon: /* @__PURE__ */ jsx267(FilePenLine43, { size: 16 }),
|
|
48803
48940
|
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48804
48941
|
},
|
|
48805
48942
|
{
|
|
48806
48943
|
label: `Edit Expense`,
|
|
48807
|
-
icon: /* @__PURE__ */
|
|
48944
|
+
icon: /* @__PURE__ */ jsx267(FilePenLine43, { size: 16 }),
|
|
48808
48945
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48809
48946
|
},
|
|
48810
48947
|
{
|
|
48811
48948
|
label: `Delete Expense`,
|
|
48812
|
-
icon: /* @__PURE__ */
|
|
48949
|
+
icon: /* @__PURE__ */ jsx267(Trash253, { className: "text-red-500", size: 16 }),
|
|
48813
48950
|
onClick: () => {
|
|
48814
48951
|
openTransaction({
|
|
48815
48952
|
id: data2?._id,
|
|
@@ -48825,9 +48962,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48825
48962
|
header: "Date",
|
|
48826
48963
|
cell: ({ row }) => {
|
|
48827
48964
|
const expense = row.original;
|
|
48828
|
-
return /* @__PURE__ */
|
|
48829
|
-
/* @__PURE__ */
|
|
48830
|
-
/* @__PURE__ */
|
|
48965
|
+
return /* @__PURE__ */ jsxs236("div", { className: "flex flex-col", children: [
|
|
48966
|
+
/* @__PURE__ */ jsx267("span", { children: expense?.date }),
|
|
48967
|
+
/* @__PURE__ */ jsx267(
|
|
48831
48968
|
"span",
|
|
48832
48969
|
{
|
|
48833
48970
|
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
@@ -48843,9 +48980,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48843
48980
|
header: "Description",
|
|
48844
48981
|
cell: ({ row }) => {
|
|
48845
48982
|
const expense = row.original;
|
|
48846
|
-
return /* @__PURE__ */
|
|
48847
|
-
/* @__PURE__ */
|
|
48848
|
-
expense?.note && /* @__PURE__ */
|
|
48983
|
+
return /* @__PURE__ */ jsxs236("div", { className: "flex flex-col", children: [
|
|
48984
|
+
/* @__PURE__ */ jsx267("span", { className: "capitalize", children: expense?.description }),
|
|
48985
|
+
expense?.note && /* @__PURE__ */ jsx267("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48849
48986
|
] });
|
|
48850
48987
|
}
|
|
48851
48988
|
},
|
|
@@ -48854,9 +48991,9 @@ function ExpensesJournal3({ url }) {
|
|
|
48854
48991
|
header: "Amount",
|
|
48855
48992
|
cell: ({ row }) => {
|
|
48856
48993
|
const expense = row.original;
|
|
48857
|
-
return /* @__PURE__ */
|
|
48858
|
-
/* @__PURE__ */
|
|
48859
|
-
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */
|
|
48994
|
+
return /* @__PURE__ */ jsxs236("div", { className: "", children: [
|
|
48995
|
+
/* @__PURE__ */ jsx267("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
48996
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ jsxs236("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48860
48997
|
"rate ",
|
|
48861
48998
|
expense?.exchange?.rate,
|
|
48862
48999
|
" ,",
|
|
@@ -48874,23 +49011,23 @@ function ExpensesJournal3({ url }) {
|
|
|
48874
49011
|
header: "Actions",
|
|
48875
49012
|
cell: ({ row }) => {
|
|
48876
49013
|
const data2 = row.original;
|
|
48877
|
-
return /* @__PURE__ */
|
|
49014
|
+
return /* @__PURE__ */ jsx267(
|
|
48878
49015
|
Dropdown,
|
|
48879
49016
|
{
|
|
48880
49017
|
className: "cursor-pointer w-[150px]",
|
|
48881
49018
|
items: items(data2),
|
|
48882
49019
|
triggerMode: "hover",
|
|
48883
|
-
children: /* @__PURE__ */
|
|
49020
|
+
children: /* @__PURE__ */ jsx267(EllipsisVertical47, {})
|
|
48884
49021
|
}
|
|
48885
49022
|
);
|
|
48886
49023
|
}
|
|
48887
49024
|
}
|
|
48888
49025
|
];
|
|
48889
49026
|
const expenses = data?.data || [];
|
|
48890
|
-
return /* @__PURE__ */
|
|
48891
|
-
/* @__PURE__ */
|
|
48892
|
-
/* @__PURE__ */
|
|
48893
|
-
/* @__PURE__ */
|
|
49027
|
+
return /* @__PURE__ */ jsxs236(Fragment135, { children: [
|
|
49028
|
+
/* @__PURE__ */ jsx267(TransactionView, {}),
|
|
49029
|
+
/* @__PURE__ */ jsx267(Modal2, {}),
|
|
49030
|
+
/* @__PURE__ */ jsx267(
|
|
48894
49031
|
TransactionViewComponent,
|
|
48895
49032
|
{
|
|
48896
49033
|
columns,
|
|
@@ -48909,8 +49046,8 @@ function ExpensesJournal3({ url }) {
|
|
|
48909
49046
|
var ExpensesJournal_default = ExpensesJournal3;
|
|
48910
49047
|
|
|
48911
49048
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48912
|
-
import { useEffect as useEffect114, useMemo as
|
|
48913
|
-
import { useParams as
|
|
49049
|
+
import { useEffect as useEffect114, useMemo as useMemo54, useState as useState115 } from "react";
|
|
49050
|
+
import { useParams as useParams109 } from "react-router-dom";
|
|
48914
49051
|
import { useForm as useForm58 } from "react-hook-form";
|
|
48915
49052
|
import { zodResolver as zodResolver57 } from "@hookform/resolvers/zod";
|
|
48916
49053
|
import { message as message85 } from "antd";
|
|
@@ -48928,13 +49065,13 @@ var expenseSchema5 = z49.object({
|
|
|
48928
49065
|
});
|
|
48929
49066
|
|
|
48930
49067
|
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48931
|
-
import { Fragment as
|
|
49068
|
+
import { Fragment as Fragment136, jsx as jsx268, jsxs as jsxs237 } from "react/jsx-runtime";
|
|
48932
49069
|
function ExpensesJournal3Form() {
|
|
48933
|
-
const { branchId } =
|
|
49070
|
+
const { branchId } = useParams109();
|
|
48934
49071
|
const { getQuery, navigate } = useApp_default();
|
|
48935
49072
|
const id = getQuery("id");
|
|
48936
49073
|
const isEdit = !!id;
|
|
48937
|
-
const [ref2, setRef] =
|
|
49074
|
+
const [ref2, setRef] = useState115("");
|
|
48938
49075
|
const { post, isLoading } = useApis_default();
|
|
48939
49076
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48940
49077
|
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
@@ -48953,7 +49090,7 @@ function ExpensesJournal3Form() {
|
|
|
48953
49090
|
const isRate = currency && currency !== defaultCurrency;
|
|
48954
49091
|
const amount = watch("amount");
|
|
48955
49092
|
const rate = watch("rate");
|
|
48956
|
-
const exchangedAmount2 =
|
|
49093
|
+
const exchangedAmount2 = useMemo54(() => {
|
|
48957
49094
|
if (isRate) {
|
|
48958
49095
|
const am = forex_default.exchangedAmount({
|
|
48959
49096
|
accountCurrency: defaultCurrency,
|
|
@@ -49004,25 +49141,25 @@ function ExpensesJournal3Form() {
|
|
|
49004
49141
|
fetches();
|
|
49005
49142
|
}
|
|
49006
49143
|
}, [id]);
|
|
49007
|
-
return /* @__PURE__ */
|
|
49144
|
+
return /* @__PURE__ */ jsxs237(
|
|
49008
49145
|
Card,
|
|
49009
49146
|
{
|
|
49010
49147
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49011
49148
|
isLoading: isLoadingGet,
|
|
49012
49149
|
loadingText: "Processing...",
|
|
49013
49150
|
children: [
|
|
49014
|
-
/* @__PURE__ */
|
|
49015
|
-
/* @__PURE__ */
|
|
49016
|
-
/* @__PURE__ */
|
|
49151
|
+
/* @__PURE__ */ jsxs237(Card.Header, { children: [
|
|
49152
|
+
/* @__PURE__ */ jsx268(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
49153
|
+
/* @__PURE__ */ jsx268(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
49017
49154
|
] }),
|
|
49018
|
-
/* @__PURE__ */
|
|
49155
|
+
/* @__PURE__ */ jsx268(Card.Content, { children: /* @__PURE__ */ jsxs237(
|
|
49019
49156
|
"form",
|
|
49020
49157
|
{
|
|
49021
49158
|
className: "space-y-4",
|
|
49022
49159
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49023
49160
|
children: [
|
|
49024
|
-
/* @__PURE__ */
|
|
49025
|
-
/* @__PURE__ */
|
|
49161
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49162
|
+
/* @__PURE__ */ jsx268(
|
|
49026
49163
|
Fields_default.Input,
|
|
49027
49164
|
{
|
|
49028
49165
|
label: "Description",
|
|
@@ -49032,7 +49169,7 @@ function ExpensesJournal3Form() {
|
|
|
49032
49169
|
required: true
|
|
49033
49170
|
}
|
|
49034
49171
|
),
|
|
49035
|
-
/* @__PURE__ */
|
|
49172
|
+
/* @__PURE__ */ jsx268(
|
|
49036
49173
|
Fields_default.Select,
|
|
49037
49174
|
{
|
|
49038
49175
|
label: "Currency",
|
|
@@ -49043,8 +49180,8 @@ function ExpensesJournal3Form() {
|
|
|
49043
49180
|
}
|
|
49044
49181
|
)
|
|
49045
49182
|
] }),
|
|
49046
|
-
/* @__PURE__ */
|
|
49047
|
-
/* @__PURE__ */
|
|
49183
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49184
|
+
/* @__PURE__ */ jsx268(
|
|
49048
49185
|
Fields_default.DateInput,
|
|
49049
49186
|
{
|
|
49050
49187
|
label: "Date",
|
|
@@ -49053,7 +49190,7 @@ function ExpensesJournal3Form() {
|
|
|
49053
49190
|
required: true
|
|
49054
49191
|
}
|
|
49055
49192
|
),
|
|
49056
|
-
/* @__PURE__ */
|
|
49193
|
+
/* @__PURE__ */ jsx268(
|
|
49057
49194
|
Fields_default.Input,
|
|
49058
49195
|
{
|
|
49059
49196
|
label: "Amount",
|
|
@@ -49064,8 +49201,8 @@ function ExpensesJournal3Form() {
|
|
|
49064
49201
|
required: true
|
|
49065
49202
|
}
|
|
49066
49203
|
),
|
|
49067
|
-
isRate && /* @__PURE__ */
|
|
49068
|
-
/* @__PURE__ */
|
|
49204
|
+
isRate && /* @__PURE__ */ jsxs237(Fragment136, { children: [
|
|
49205
|
+
/* @__PURE__ */ jsx268(
|
|
49069
49206
|
Fields_default.Input,
|
|
49070
49207
|
{
|
|
49071
49208
|
label: "Rate",
|
|
@@ -49076,7 +49213,7 @@ function ExpensesJournal3Form() {
|
|
|
49076
49213
|
required: true
|
|
49077
49214
|
}
|
|
49078
49215
|
),
|
|
49079
|
-
/* @__PURE__ */
|
|
49216
|
+
/* @__PURE__ */ jsx268(
|
|
49080
49217
|
Fields_default.Input,
|
|
49081
49218
|
{
|
|
49082
49219
|
label: "Exchanged Amount",
|
|
@@ -49088,7 +49225,7 @@ function ExpensesJournal3Form() {
|
|
|
49088
49225
|
)
|
|
49089
49226
|
] })
|
|
49090
49227
|
] }),
|
|
49091
|
-
/* @__PURE__ */
|
|
49228
|
+
/* @__PURE__ */ jsx268(
|
|
49092
49229
|
Fields_default.Textarea,
|
|
49093
49230
|
{
|
|
49094
49231
|
label: "Note",
|
|
@@ -49097,7 +49234,7 @@ function ExpensesJournal3Form() {
|
|
|
49097
49234
|
placeholder: "Add any additional details..."
|
|
49098
49235
|
}
|
|
49099
49236
|
),
|
|
49100
|
-
/* @__PURE__ */
|
|
49237
|
+
/* @__PURE__ */ jsx268("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx268(
|
|
49101
49238
|
Button,
|
|
49102
49239
|
{
|
|
49103
49240
|
isLoading,
|
|
@@ -49142,21 +49279,21 @@ var Transaction3 = {
|
|
|
49142
49279
|
var __default = Transaction3;
|
|
49143
49280
|
|
|
49144
49281
|
// src/components/reports/ItemReport.tsx
|
|
49145
|
-
import { useParams as
|
|
49282
|
+
import { useParams as useParams110 } from "react-router-dom";
|
|
49146
49283
|
import { z as z50 } from "zod";
|
|
49147
49284
|
import { useForm as useForm59 } from "react-hook-form";
|
|
49148
49285
|
import { zodResolver as zodResolver58 } from "@hookform/resolvers/zod";
|
|
49149
|
-
import { useState as
|
|
49286
|
+
import { useState as useState116 } from "react";
|
|
49150
49287
|
import { message as message86 } from "antd";
|
|
49151
|
-
import { Fragment as
|
|
49288
|
+
import { Fragment as Fragment137, jsx as jsx269, jsxs as jsxs238 } from "react/jsx-runtime";
|
|
49152
49289
|
var ItemReport = ({
|
|
49153
49290
|
value = false,
|
|
49154
49291
|
type
|
|
49155
49292
|
}) => {
|
|
49156
49293
|
const { apiConfig } = useWarqadConfig();
|
|
49157
|
-
const { branchId } =
|
|
49294
|
+
const { branchId } = useParams110();
|
|
49158
49295
|
const { branches } = useAuth_default();
|
|
49159
|
-
const [params, setParams] =
|
|
49296
|
+
const [params, setParams] = useState116({
|
|
49160
49297
|
id: "",
|
|
49161
49298
|
branch: "all"
|
|
49162
49299
|
});
|
|
@@ -49181,9 +49318,9 @@ var ItemReport = ({
|
|
|
49181
49318
|
header: "Date",
|
|
49182
49319
|
key: "date",
|
|
49183
49320
|
className: "text-xs whitespace-nowrap",
|
|
49184
|
-
render: (row) => /* @__PURE__ */
|
|
49185
|
-
/* @__PURE__ */
|
|
49186
|
-
/* @__PURE__ */
|
|
49321
|
+
render: (row) => /* @__PURE__ */ jsxs238("div", { className: "", children: [
|
|
49322
|
+
/* @__PURE__ */ jsx269("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49323
|
+
/* @__PURE__ */ jsx269(
|
|
49187
49324
|
"span",
|
|
49188
49325
|
{
|
|
49189
49326
|
onClick: () => {
|
|
@@ -49202,7 +49339,7 @@ var ItemReport = ({
|
|
|
49202
49339
|
header: "Description",
|
|
49203
49340
|
key: "description",
|
|
49204
49341
|
className: "text-xs whitespace-nowrap",
|
|
49205
|
-
render: (row) => /* @__PURE__ */
|
|
49342
|
+
render: (row) => /* @__PURE__ */ jsx269("div", { className: "", children: /* @__PURE__ */ jsx269("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
49206
49343
|
},
|
|
49207
49344
|
{
|
|
49208
49345
|
header: "Quantity",
|
|
@@ -49210,7 +49347,7 @@ var ItemReport = ({
|
|
|
49210
49347
|
className: "text-xs whitespace-nowrap",
|
|
49211
49348
|
render: (row) => {
|
|
49212
49349
|
const Qty = row.quantity;
|
|
49213
|
-
return /* @__PURE__ */
|
|
49350
|
+
return /* @__PURE__ */ jsxs238(
|
|
49214
49351
|
"div",
|
|
49215
49352
|
{
|
|
49216
49353
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -49227,7 +49364,7 @@ var ItemReport = ({
|
|
|
49227
49364
|
header: "Balance",
|
|
49228
49365
|
key: "runningBalance",
|
|
49229
49366
|
className: "text-xs whitespace-nowrap",
|
|
49230
|
-
render: (row) => /* @__PURE__ */
|
|
49367
|
+
render: (row) => /* @__PURE__ */ jsx269("div", { className: "", children: /* @__PURE__ */ jsx269("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
49231
49368
|
}
|
|
49232
49369
|
];
|
|
49233
49370
|
let runningBalance = 0;
|
|
@@ -49239,10 +49376,10 @@ var ItemReport = ({
|
|
|
49239
49376
|
};
|
|
49240
49377
|
});
|
|
49241
49378
|
const itemName = datas[0]?.name;
|
|
49242
|
-
return /* @__PURE__ */
|
|
49243
|
-
/* @__PURE__ */
|
|
49244
|
-
/* @__PURE__ */
|
|
49245
|
-
/* @__PURE__ */
|
|
49379
|
+
return /* @__PURE__ */ jsxs238(Fragment137, { children: [
|
|
49380
|
+
/* @__PURE__ */ jsx269(Modal2, {}),
|
|
49381
|
+
/* @__PURE__ */ jsx269(TransactionView, {}),
|
|
49382
|
+
/* @__PURE__ */ jsx269(
|
|
49246
49383
|
A4DataView,
|
|
49247
49384
|
{
|
|
49248
49385
|
columns,
|
|
@@ -49253,14 +49390,14 @@ var ItemReport = ({
|
|
|
49253
49390
|
tableTitle: `${type} Movement Report`,
|
|
49254
49391
|
fixed: false,
|
|
49255
49392
|
error: !id ? "Please select an item" : void 0,
|
|
49256
|
-
headers: /* @__PURE__ */
|
|
49393
|
+
headers: /* @__PURE__ */ jsx269(
|
|
49257
49394
|
Button,
|
|
49258
49395
|
{
|
|
49259
49396
|
type: "button",
|
|
49260
49397
|
size: "sm",
|
|
49261
49398
|
onClick: () => openState({
|
|
49262
49399
|
title: "Item Transactions",
|
|
49263
|
-
content: /* @__PURE__ */
|
|
49400
|
+
content: /* @__PURE__ */ jsx269(
|
|
49264
49401
|
ItemReportHeader2,
|
|
49265
49402
|
{
|
|
49266
49403
|
type,
|
|
@@ -49303,7 +49440,7 @@ function ItemReportHeader2({
|
|
|
49303
49440
|
label: b.name,
|
|
49304
49441
|
value: b._id
|
|
49305
49442
|
}));
|
|
49306
|
-
return /* @__PURE__ */
|
|
49443
|
+
return /* @__PURE__ */ jsxs238(
|
|
49307
49444
|
"form",
|
|
49308
49445
|
{
|
|
49309
49446
|
className: "space-y-3",
|
|
@@ -49321,8 +49458,8 @@ function ItemReportHeader2({
|
|
|
49321
49458
|
close();
|
|
49322
49459
|
}),
|
|
49323
49460
|
children: [
|
|
49324
|
-
/* @__PURE__ */
|
|
49325
|
-
/* @__PURE__ */
|
|
49461
|
+
/* @__PURE__ */ jsxs238("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49462
|
+
/* @__PURE__ */ jsx269(
|
|
49326
49463
|
Select,
|
|
49327
49464
|
{
|
|
49328
49465
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -49330,7 +49467,7 @@ function ItemReportHeader2({
|
|
|
49330
49467
|
name: "branch"
|
|
49331
49468
|
}
|
|
49332
49469
|
),
|
|
49333
|
-
type === "pack" ? /* @__PURE__ */
|
|
49470
|
+
type === "pack" ? /* @__PURE__ */ jsx269(
|
|
49334
49471
|
Pack_default.Pack,
|
|
49335
49472
|
{
|
|
49336
49473
|
api: "/packs/get",
|
|
@@ -49338,7 +49475,7 @@ function ItemReportHeader2({
|
|
|
49338
49475
|
form: methods,
|
|
49339
49476
|
name: "pack"
|
|
49340
49477
|
}
|
|
49341
|
-
) : /* @__PURE__ */
|
|
49478
|
+
) : /* @__PURE__ */ jsx269(
|
|
49342
49479
|
Feilds_default5.Product,
|
|
49343
49480
|
{
|
|
49344
49481
|
label: "",
|
|
@@ -49349,7 +49486,7 @@ function ItemReportHeader2({
|
|
|
49349
49486
|
}
|
|
49350
49487
|
)
|
|
49351
49488
|
] }),
|
|
49352
|
-
/* @__PURE__ */
|
|
49489
|
+
/* @__PURE__ */ jsx269("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ jsx269(Button, { type: "submit", children: "Filter" }) })
|
|
49353
49490
|
]
|
|
49354
49491
|
}
|
|
49355
49492
|
);
|
|
@@ -49357,9 +49494,9 @@ function ItemReportHeader2({
|
|
|
49357
49494
|
var ItemReport_default = ItemReport;
|
|
49358
49495
|
|
|
49359
49496
|
// src/components/accounts/LeaseCollection.tsx
|
|
49360
|
-
import { useNavigate as useNavigate65, useParams as
|
|
49361
|
-
import { useMemo as
|
|
49362
|
-
import { Fragment as
|
|
49497
|
+
import { useNavigate as useNavigate65, useParams as useParams111, useSearchParams as useSearchParams19 } from "react-router-dom";
|
|
49498
|
+
import { useMemo as useMemo55, useState as useState117, useEffect as useEffect115 } from "react";
|
|
49499
|
+
import { Fragment as Fragment138, jsx as jsx270, jsxs as jsxs239 } from "react/jsx-runtime";
|
|
49363
49500
|
var LeaseCollection = ({
|
|
49364
49501
|
leaseType,
|
|
49365
49502
|
defaultCurrency = "KES"
|
|
@@ -49367,9 +49504,9 @@ var LeaseCollection = ({
|
|
|
49367
49504
|
const navigate = useNavigate65();
|
|
49368
49505
|
const [searchParams] = useSearchParams19();
|
|
49369
49506
|
const { apiConfig } = useWarqadConfig();
|
|
49370
|
-
const { branchId } =
|
|
49507
|
+
const { branchId } = useParams111();
|
|
49371
49508
|
const { branches } = useAuth_default();
|
|
49372
|
-
const currentBranch =
|
|
49509
|
+
const currentBranch = useMemo55(
|
|
49373
49510
|
() => branches?.find((b) => b?._id === branchId),
|
|
49374
49511
|
[branches, branchId]
|
|
49375
49512
|
);
|
|
@@ -49377,10 +49514,10 @@ var LeaseCollection = ({
|
|
|
49377
49514
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
49378
49515
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49379
49516
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
49380
|
-
const [filter, setFilter] =
|
|
49517
|
+
const [filter, setFilter] = useState117(
|
|
49381
49518
|
initialFilter
|
|
49382
49519
|
);
|
|
49383
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
49520
|
+
const [currencyFilter, setCurrencyFilter] = useState117(initialCurrency);
|
|
49384
49521
|
useEffect115(() => {
|
|
49385
49522
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
49386
49523
|
setFilter(urlFilter);
|
|
@@ -49405,9 +49542,9 @@ var LeaseCollection = ({
|
|
|
49405
49542
|
key: "name",
|
|
49406
49543
|
className: "text-xs whitespace-nowrap ",
|
|
49407
49544
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
49408
|
-
render: (row) => /* @__PURE__ */
|
|
49409
|
-
/* @__PURE__ */
|
|
49410
|
-
row.unitNames && /* @__PURE__ */
|
|
49545
|
+
render: (row) => /* @__PURE__ */ jsxs239("div", { className: "space-y-1", children: [
|
|
49546
|
+
/* @__PURE__ */ jsx270("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49547
|
+
row.unitNames && /* @__PURE__ */ jsxs239("p", { className: "text-[9px]! capitalize", children: [
|
|
49411
49548
|
"(",
|
|
49412
49549
|
row.unitNames,
|
|
49413
49550
|
")"
|
|
@@ -49419,7 +49556,7 @@ var LeaseCollection = ({
|
|
|
49419
49556
|
key: "phoneNumber",
|
|
49420
49557
|
maxWidth: 70,
|
|
49421
49558
|
render: (row) => {
|
|
49422
|
-
return /* @__PURE__ */
|
|
49559
|
+
return /* @__PURE__ */ jsx270("p", { children: row?.phoneNumber || "N/A" });
|
|
49423
49560
|
}
|
|
49424
49561
|
},
|
|
49425
49562
|
// </span>
|
|
@@ -49429,11 +49566,11 @@ var LeaseCollection = ({
|
|
|
49429
49566
|
className: "text-xs whitespace-nowrap text-right",
|
|
49430
49567
|
render: (row) => {
|
|
49431
49568
|
const Amount = row.totalCollectionString;
|
|
49432
|
-
return /* @__PURE__ */
|
|
49569
|
+
return /* @__PURE__ */ jsx270("div", { className: "", children: /* @__PURE__ */ jsx270("p", { className: "font-bold ", children: Amount }) });
|
|
49433
49570
|
},
|
|
49434
49571
|
renderFooter: (data2) => {
|
|
49435
49572
|
if (currencyFilter === "all") return;
|
|
49436
|
-
return /* @__PURE__ */
|
|
49573
|
+
return /* @__PURE__ */ jsx270("span", { className: " font-bold", children: Formats_default.Price(
|
|
49437
49574
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
49438
49575
|
defaultCurrency,
|
|
49439
49576
|
false
|
|
@@ -49441,7 +49578,7 @@ var LeaseCollection = ({
|
|
|
49441
49578
|
}
|
|
49442
49579
|
}
|
|
49443
49580
|
];
|
|
49444
|
-
const datas =
|
|
49581
|
+
const datas = useMemo55(() => {
|
|
49445
49582
|
let runningBalance = 0;
|
|
49446
49583
|
let filteredData = data?.data || [];
|
|
49447
49584
|
const result = filteredData.map((item) => {
|
|
@@ -49454,9 +49591,9 @@ var LeaseCollection = ({
|
|
|
49454
49591
|
});
|
|
49455
49592
|
return result;
|
|
49456
49593
|
}, [filter, currencyFilter, data]);
|
|
49457
|
-
return /* @__PURE__ */
|
|
49458
|
-
/* @__PURE__ */
|
|
49459
|
-
/* @__PURE__ */
|
|
49594
|
+
return /* @__PURE__ */ jsxs239(Fragment138, { children: [
|
|
49595
|
+
/* @__PURE__ */ jsx270(TransactionView, {}),
|
|
49596
|
+
/* @__PURE__ */ jsx270(
|
|
49460
49597
|
A4DataView,
|
|
49461
49598
|
{
|
|
49462
49599
|
columns,
|
|
@@ -49466,7 +49603,7 @@ var LeaseCollection = ({
|
|
|
49466
49603
|
subtitle: `All Collections`,
|
|
49467
49604
|
fixed: false,
|
|
49468
49605
|
startPage: 1e9,
|
|
49469
|
-
headers: /* @__PURE__ */
|
|
49606
|
+
headers: /* @__PURE__ */ jsx270("div", { className: "flex gap-2" })
|
|
49470
49607
|
}
|
|
49471
49608
|
)
|
|
49472
49609
|
] });
|
|
@@ -49474,9 +49611,9 @@ var LeaseCollection = ({
|
|
|
49474
49611
|
var LeaseCollection_default = LeaseCollection;
|
|
49475
49612
|
|
|
49476
49613
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49477
|
-
import { useNavigate as useNavigate66, useParams as
|
|
49614
|
+
import { useNavigate as useNavigate66, useParams as useParams115 } from "react-router-dom";
|
|
49478
49615
|
import { EllipsisVertical as EllipsisVertical48, FilePenLine as FilePenLine44, Trash2 as Trash255 } from "lucide-react";
|
|
49479
|
-
import { useState as
|
|
49616
|
+
import { useState as useState119 } from "react";
|
|
49480
49617
|
import { message as message90 } from "antd";
|
|
49481
49618
|
|
|
49482
49619
|
// src/components/Transactions/cargoIM/schema.ts
|
|
@@ -49513,14 +49650,14 @@ import { useForm as useForm60 } from "react-hook-form";
|
|
|
49513
49650
|
import { zodResolver as zodResolver59 } from "@hookform/resolvers/zod";
|
|
49514
49651
|
import { message as message87 } from "antd";
|
|
49515
49652
|
import { useEffect as useEffect116 } from "react";
|
|
49516
|
-
import { useParams as
|
|
49517
|
-
import { jsx as
|
|
49653
|
+
import { useParams as useParams112 } from "react-router-dom";
|
|
49654
|
+
import { jsx as jsx271, jsxs as jsxs240 } from "react/jsx-runtime";
|
|
49518
49655
|
function AccountForm3({
|
|
49519
49656
|
onReload,
|
|
49520
49657
|
close,
|
|
49521
49658
|
id
|
|
49522
49659
|
}) {
|
|
49523
|
-
const { branchId } =
|
|
49660
|
+
const { branchId } = useParams112();
|
|
49524
49661
|
const { currencies } = useWarqadConfig();
|
|
49525
49662
|
const { stock } = currencies;
|
|
49526
49663
|
const isEdit = !!id;
|
|
@@ -49586,24 +49723,24 @@ function AccountForm3({
|
|
|
49586
49723
|
fetches();
|
|
49587
49724
|
}
|
|
49588
49725
|
}, [id]);
|
|
49589
|
-
return /* @__PURE__ */
|
|
49726
|
+
return /* @__PURE__ */ jsxs240(
|
|
49590
49727
|
Card,
|
|
49591
49728
|
{
|
|
49592
49729
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49593
49730
|
isLoading: isLoadingGet,
|
|
49594
49731
|
loadingText: "Processing...",
|
|
49595
49732
|
children: [
|
|
49596
|
-
/* @__PURE__ */
|
|
49597
|
-
/* @__PURE__ */
|
|
49598
|
-
/* @__PURE__ */
|
|
49733
|
+
/* @__PURE__ */ jsxs240(Card.Header, { children: [
|
|
49734
|
+
/* @__PURE__ */ jsx271(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49735
|
+
/* @__PURE__ */ jsx271(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49599
49736
|
] }),
|
|
49600
|
-
/* @__PURE__ */
|
|
49737
|
+
/* @__PURE__ */ jsx271(Card.Content, { children: /* @__PURE__ */ jsxs240(
|
|
49601
49738
|
"form",
|
|
49602
49739
|
{
|
|
49603
49740
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49604
49741
|
children: [
|
|
49605
|
-
/* @__PURE__ */
|
|
49606
|
-
/* @__PURE__ */
|
|
49742
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49743
|
+
/* @__PURE__ */ jsx271(
|
|
49607
49744
|
Fields_default.Input,
|
|
49608
49745
|
{
|
|
49609
49746
|
label: "Name",
|
|
@@ -49614,7 +49751,7 @@ function AccountForm3({
|
|
|
49614
49751
|
required: true
|
|
49615
49752
|
}
|
|
49616
49753
|
),
|
|
49617
|
-
/* @__PURE__ */
|
|
49754
|
+
/* @__PURE__ */ jsx271(
|
|
49618
49755
|
Fields_default.PhoneInput,
|
|
49619
49756
|
{
|
|
49620
49757
|
label: "Phone Number",
|
|
@@ -49623,7 +49760,7 @@ function AccountForm3({
|
|
|
49623
49760
|
placeholder: "Enter phone number"
|
|
49624
49761
|
}
|
|
49625
49762
|
),
|
|
49626
|
-
/* @__PURE__ */
|
|
49763
|
+
/* @__PURE__ */ jsx271(
|
|
49627
49764
|
Fields_default.Select,
|
|
49628
49765
|
{
|
|
49629
49766
|
label: "Currency",
|
|
@@ -49634,7 +49771,7 @@ function AccountForm3({
|
|
|
49634
49771
|
}
|
|
49635
49772
|
)
|
|
49636
49773
|
] }),
|
|
49637
|
-
/* @__PURE__ */
|
|
49774
|
+
/* @__PURE__ */ jsx271("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx271(
|
|
49638
49775
|
Button,
|
|
49639
49776
|
{
|
|
49640
49777
|
isLoading,
|
|
@@ -49655,36 +49792,36 @@ function AccountForm3({
|
|
|
49655
49792
|
var AccountForm_default3 = AccountForm3;
|
|
49656
49793
|
|
|
49657
49794
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49658
|
-
import { useEffect as useEffect117, useState as
|
|
49795
|
+
import { useEffect as useEffect117, useState as useState118 } from "react";
|
|
49659
49796
|
import { useForm as useForm61, useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
49660
49797
|
import { zodResolver as zodResolver60 } from "@hookform/resolvers/zod";
|
|
49661
|
-
import { useParams as
|
|
49798
|
+
import { useParams as useParams113 } from "react-router-dom";
|
|
49662
49799
|
import { message as message88 } from "antd";
|
|
49663
49800
|
import { Trash2 as Trash254, Plus as Plus6 } from "lucide-react";
|
|
49664
|
-
import
|
|
49665
|
-
import { jsx as
|
|
49801
|
+
import dayjs13 from "dayjs";
|
|
49802
|
+
import { jsx as jsx272, jsxs as jsxs241 } from "react/jsx-runtime";
|
|
49666
49803
|
function InvoiceForm2({
|
|
49667
49804
|
onReload,
|
|
49668
49805
|
close,
|
|
49669
49806
|
accountData,
|
|
49670
49807
|
id
|
|
49671
49808
|
}) {
|
|
49672
|
-
const { branchId } =
|
|
49673
|
-
const [ref2, setRef] =
|
|
49809
|
+
const { branchId } = useParams113();
|
|
49810
|
+
const [ref2, setRef] = useState118(void 0);
|
|
49674
49811
|
const { post, isLoading } = useApis_default();
|
|
49675
49812
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49676
49813
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49677
49814
|
const isEdit = !!id;
|
|
49678
49815
|
const { currencies } = useWarqadConfig();
|
|
49679
49816
|
const { stock: defaultCurrency } = currencies;
|
|
49680
|
-
const [itemName, setItemName] =
|
|
49681
|
-
const [itemQuantity, setItemQuantity] =
|
|
49682
|
-
const [itemPrice, setItemPrice] =
|
|
49817
|
+
const [itemName, setItemName] = useState118("");
|
|
49818
|
+
const [itemQuantity, setItemQuantity] = useState118("");
|
|
49819
|
+
const [itemPrice, setItemPrice] = useState118("");
|
|
49683
49820
|
const methods = useForm61({
|
|
49684
49821
|
resolver: zodResolver60(createInvoiceManagerValidation2),
|
|
49685
49822
|
defaultValues: {
|
|
49686
49823
|
invoices: [],
|
|
49687
|
-
date:
|
|
49824
|
+
date: dayjs13().format("DD/MM/YYYY"),
|
|
49688
49825
|
currency: defaultCurrency,
|
|
49689
49826
|
branch: branchId ? branchId : void 0
|
|
49690
49827
|
}
|
|
@@ -49783,25 +49920,25 @@ function InvoiceForm2({
|
|
|
49783
49920
|
e.preventDefault();
|
|
49784
49921
|
}
|
|
49785
49922
|
};
|
|
49786
|
-
return /* @__PURE__ */
|
|
49923
|
+
return /* @__PURE__ */ jsx272(
|
|
49787
49924
|
Card,
|
|
49788
49925
|
{
|
|
49789
49926
|
isLoading: getLoading,
|
|
49790
49927
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49791
|
-
children: /* @__PURE__ */
|
|
49792
|
-
/* @__PURE__ */
|
|
49793
|
-
/* @__PURE__ */
|
|
49928
|
+
children: /* @__PURE__ */ jsxs241(Card.Content, { children: [
|
|
49929
|
+
/* @__PURE__ */ jsx272("input", { type: "hidden", ...register("currency") }),
|
|
49930
|
+
/* @__PURE__ */ jsxs241(
|
|
49794
49931
|
"form",
|
|
49795
49932
|
{
|
|
49796
49933
|
onSubmit: handleSubmit(onSubmit),
|
|
49797
49934
|
onKeyDown: handleKeyDown,
|
|
49798
49935
|
className: "space-y-6",
|
|
49799
49936
|
children: [
|
|
49800
|
-
/* @__PURE__ */
|
|
49801
|
-
/* @__PURE__ */
|
|
49802
|
-
/* @__PURE__ */
|
|
49803
|
-
/* @__PURE__ */
|
|
49804
|
-
/* @__PURE__ */
|
|
49937
|
+
/* @__PURE__ */ jsxs241("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
49938
|
+
/* @__PURE__ */ jsx272("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49939
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49940
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49941
|
+
/* @__PURE__ */ jsx272(
|
|
49805
49942
|
Fields_default.Input,
|
|
49806
49943
|
{
|
|
49807
49944
|
label: "Container No",
|
|
@@ -49810,7 +49947,7 @@ function InvoiceForm2({
|
|
|
49810
49947
|
onChange: (val) => setItemName(val)
|
|
49811
49948
|
}
|
|
49812
49949
|
),
|
|
49813
|
-
/* @__PURE__ */
|
|
49950
|
+
/* @__PURE__ */ jsx272(
|
|
49814
49951
|
Fields_default.Input,
|
|
49815
49952
|
{
|
|
49816
49953
|
label: "Cbm",
|
|
@@ -49820,7 +49957,7 @@ function InvoiceForm2({
|
|
|
49820
49957
|
onChange: (val) => setItemQuantity(val)
|
|
49821
49958
|
}
|
|
49822
49959
|
),
|
|
49823
|
-
/* @__PURE__ */
|
|
49960
|
+
/* @__PURE__ */ jsx272(
|
|
49824
49961
|
Fields_default.Input,
|
|
49825
49962
|
{
|
|
49826
49963
|
label: "Price (KES)",
|
|
@@ -49831,7 +49968,7 @@ function InvoiceForm2({
|
|
|
49831
49968
|
}
|
|
49832
49969
|
)
|
|
49833
49970
|
] }),
|
|
49834
|
-
/* @__PURE__ */
|
|
49971
|
+
/* @__PURE__ */ jsxs241(
|
|
49835
49972
|
Button,
|
|
49836
49973
|
{
|
|
49837
49974
|
type: "button",
|
|
@@ -49839,23 +49976,23 @@ function InvoiceForm2({
|
|
|
49839
49976
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49840
49977
|
variant: "outline",
|
|
49841
49978
|
children: [
|
|
49842
|
-
/* @__PURE__ */
|
|
49979
|
+
/* @__PURE__ */ jsx272(Plus6, { size: 16 }),
|
|
49843
49980
|
" Add Item"
|
|
49844
49981
|
]
|
|
49845
49982
|
}
|
|
49846
49983
|
)
|
|
49847
49984
|
] })
|
|
49848
49985
|
] }),
|
|
49849
|
-
/* @__PURE__ */
|
|
49850
|
-
/* @__PURE__ */
|
|
49851
|
-
/* @__PURE__ */
|
|
49852
|
-
/* @__PURE__ */
|
|
49853
|
-
/* @__PURE__ */
|
|
49854
|
-
/* @__PURE__ */
|
|
49855
|
-
/* @__PURE__ */
|
|
49856
|
-
/* @__PURE__ */
|
|
49986
|
+
/* @__PURE__ */ jsxs241("div", { children: [
|
|
49987
|
+
/* @__PURE__ */ jsx272("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49988
|
+
/* @__PURE__ */ jsx272("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ jsx272("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs241("table", { className: "w-full text-left border-collapse", children: [
|
|
49989
|
+
/* @__PURE__ */ jsx272("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs241("tr", { children: [
|
|
49990
|
+
/* @__PURE__ */ jsx272("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
|
|
49991
|
+
/* @__PURE__ */ jsx272("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
|
|
49992
|
+
/* @__PURE__ */ jsx272("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
|
|
49993
|
+
/* @__PURE__ */ jsx272("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
|
|
49857
49994
|
] }) }),
|
|
49858
|
-
/* @__PURE__ */
|
|
49995
|
+
/* @__PURE__ */ jsx272("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ jsx272("tr", { children: /* @__PURE__ */ jsx272(
|
|
49859
49996
|
"td",
|
|
49860
49997
|
{
|
|
49861
49998
|
colSpan: 4,
|
|
@@ -49864,29 +50001,29 @@ function InvoiceForm2({
|
|
|
49864
50001
|
}
|
|
49865
50002
|
) }) : fields.map((item, index) => {
|
|
49866
50003
|
const total = item.quantity * item.amount;
|
|
49867
|
-
return /* @__PURE__ */
|
|
50004
|
+
return /* @__PURE__ */ jsxs241(
|
|
49868
50005
|
"tr",
|
|
49869
50006
|
{
|
|
49870
50007
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49871
50008
|
children: [
|
|
49872
|
-
/* @__PURE__ */
|
|
49873
|
-
/* @__PURE__ */
|
|
49874
|
-
/* @__PURE__ */
|
|
49875
|
-
/* @__PURE__ */
|
|
50009
|
+
/* @__PURE__ */ jsx272("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
|
|
50010
|
+
/* @__PURE__ */ jsxs241("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
50011
|
+
/* @__PURE__ */ jsx272("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
50012
|
+
/* @__PURE__ */ jsxs241("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49876
50013
|
item.quantity,
|
|
49877
50014
|
" Cbm @",
|
|
49878
50015
|
" ",
|
|
49879
50016
|
Formats_default.Price(item.amount, "KES")
|
|
49880
50017
|
] })
|
|
49881
50018
|
] }),
|
|
49882
|
-
/* @__PURE__ */
|
|
49883
|
-
/* @__PURE__ */
|
|
50019
|
+
/* @__PURE__ */ jsx272("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
|
|
50020
|
+
/* @__PURE__ */ jsx272("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ jsx272(
|
|
49884
50021
|
"button",
|
|
49885
50022
|
{
|
|
49886
50023
|
type: "button",
|
|
49887
50024
|
onClick: () => remove(index),
|
|
49888
50025
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49889
|
-
children: /* @__PURE__ */
|
|
50026
|
+
children: /* @__PURE__ */ jsx272(
|
|
49890
50027
|
Trash254,
|
|
49891
50028
|
{
|
|
49892
50029
|
size: 13,
|
|
@@ -49900,8 +50037,8 @@ function InvoiceForm2({
|
|
|
49900
50037
|
item.id
|
|
49901
50038
|
);
|
|
49902
50039
|
}) }),
|
|
49903
|
-
fields.length > 0 && /* @__PURE__ */
|
|
49904
|
-
/* @__PURE__ */
|
|
50040
|
+
fields.length > 0 && /* @__PURE__ */ jsx272("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs241("tr", { children: [
|
|
50041
|
+
/* @__PURE__ */ jsx272(
|
|
49905
50042
|
"td",
|
|
49906
50043
|
{
|
|
49907
50044
|
colSpan: 2,
|
|
@@ -49909,20 +50046,20 @@ function InvoiceForm2({
|
|
|
49909
50046
|
children: "Total"
|
|
49910
50047
|
}
|
|
49911
50048
|
),
|
|
49912
|
-
/* @__PURE__ */
|
|
50049
|
+
/* @__PURE__ */ jsx272("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
|
|
49913
50050
|
fields.reduce(
|
|
49914
50051
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49915
50052
|
0
|
|
49916
50053
|
),
|
|
49917
50054
|
"KES"
|
|
49918
50055
|
) }),
|
|
49919
|
-
/* @__PURE__ */
|
|
50056
|
+
/* @__PURE__ */ jsx272("td", {})
|
|
49920
50057
|
] }) })
|
|
49921
50058
|
] }) }) })
|
|
49922
50059
|
] }),
|
|
49923
|
-
/* @__PURE__ */
|
|
49924
|
-
/* @__PURE__ */
|
|
49925
|
-
/* @__PURE__ */
|
|
50060
|
+
/* @__PURE__ */ jsxs241("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
50061
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50062
|
+
/* @__PURE__ */ jsx272(
|
|
49926
50063
|
Fields_default.DateInput,
|
|
49927
50064
|
{
|
|
49928
50065
|
label: "Date",
|
|
@@ -49931,20 +50068,20 @@ function InvoiceForm2({
|
|
|
49931
50068
|
required: true
|
|
49932
50069
|
}
|
|
49933
50070
|
),
|
|
49934
|
-
/* @__PURE__ */
|
|
50071
|
+
/* @__PURE__ */ jsx272(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49935
50072
|
] }),
|
|
49936
|
-
/* @__PURE__ */
|
|
49937
|
-
/* @__PURE__ */
|
|
50073
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-between items-center mt-6", children: [
|
|
50074
|
+
/* @__PURE__ */ jsx272("div", { children: isEdit && /* @__PURE__ */ jsx272(
|
|
49938
50075
|
ConfirmModal,
|
|
49939
50076
|
{
|
|
49940
50077
|
title: "Reverse Transaction",
|
|
49941
|
-
description: /* @__PURE__ */
|
|
49942
|
-
/* @__PURE__ */
|
|
49943
|
-
/* @__PURE__ */
|
|
50078
|
+
description: /* @__PURE__ */ jsxs241("div", { className: "space-y-3 text-left", children: [
|
|
50079
|
+
/* @__PURE__ */ jsx272("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50080
|
+
/* @__PURE__ */ jsx272("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
49944
50081
|
] }),
|
|
49945
50082
|
confirmationWord: "delete",
|
|
49946
50083
|
onSubmit: onReverse,
|
|
49947
|
-
children: /* @__PURE__ */
|
|
50084
|
+
children: /* @__PURE__ */ jsx272(
|
|
49948
50085
|
Button,
|
|
49949
50086
|
{
|
|
49950
50087
|
type: "button",
|
|
@@ -49957,8 +50094,8 @@ function InvoiceForm2({
|
|
|
49957
50094
|
)
|
|
49958
50095
|
}
|
|
49959
50096
|
) }),
|
|
49960
|
-
/* @__PURE__ */
|
|
49961
|
-
close && /* @__PURE__ */
|
|
50097
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-end gap-3", children: [
|
|
50098
|
+
close && /* @__PURE__ */ jsx272(
|
|
49962
50099
|
Button,
|
|
49963
50100
|
{
|
|
49964
50101
|
type: "button",
|
|
@@ -49968,7 +50105,7 @@ function InvoiceForm2({
|
|
|
49968
50105
|
children: "Cancel"
|
|
49969
50106
|
}
|
|
49970
50107
|
),
|
|
49971
|
-
/* @__PURE__ */
|
|
50108
|
+
/* @__PURE__ */ jsx272(
|
|
49972
50109
|
Button,
|
|
49973
50110
|
{
|
|
49974
50111
|
isLoading,
|
|
@@ -49995,10 +50132,10 @@ var InvoiceForm_default2 = InvoiceForm2;
|
|
|
49995
50132
|
import React47 from "react";
|
|
49996
50133
|
import { useForm as useForm62 } from "react-hook-form";
|
|
49997
50134
|
import { zodResolver as zodResolver61 } from "@hookform/resolvers/zod";
|
|
49998
|
-
import { useParams as
|
|
50135
|
+
import { useParams as useParams114 } from "react-router-dom";
|
|
49999
50136
|
import { message as message89 } from "antd";
|
|
50000
|
-
import
|
|
50001
|
-
import { jsx as
|
|
50137
|
+
import dayjs14 from "dayjs";
|
|
50138
|
+
import { jsx as jsx273, jsxs as jsxs242 } from "react/jsx-runtime";
|
|
50002
50139
|
function JournalForm5({
|
|
50003
50140
|
onReload,
|
|
50004
50141
|
close,
|
|
@@ -50006,7 +50143,7 @@ function JournalForm5({
|
|
|
50006
50143
|
action = "debit",
|
|
50007
50144
|
id
|
|
50008
50145
|
}) {
|
|
50009
|
-
const { branchId } =
|
|
50146
|
+
const { branchId } = useParams114();
|
|
50010
50147
|
const { currencies } = useWarqadConfig();
|
|
50011
50148
|
const { stock: defaultCurrency } = currencies;
|
|
50012
50149
|
const [ref2, setRef] = React47.useState(void 0);
|
|
@@ -50017,7 +50154,7 @@ function JournalForm5({
|
|
|
50017
50154
|
const methods = useForm62({
|
|
50018
50155
|
resolver: zodResolver61(journalSchema5),
|
|
50019
50156
|
defaultValues: {
|
|
50020
|
-
date:
|
|
50157
|
+
date: dayjs14().format("DD/MM/YYYY"),
|
|
50021
50158
|
currency: defaultCurrency,
|
|
50022
50159
|
action,
|
|
50023
50160
|
description: "Payment ",
|
|
@@ -50089,19 +50226,19 @@ function JournalForm5({
|
|
|
50089
50226
|
e.preventDefault();
|
|
50090
50227
|
}
|
|
50091
50228
|
};
|
|
50092
|
-
return /* @__PURE__ */
|
|
50229
|
+
return /* @__PURE__ */ jsx273(
|
|
50093
50230
|
Card,
|
|
50094
50231
|
{
|
|
50095
50232
|
isLoading: getLoading,
|
|
50096
50233
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
50097
|
-
children: /* @__PURE__ */
|
|
50234
|
+
children: /* @__PURE__ */ jsx273(Card.Content, { children: /* @__PURE__ */ jsxs242(
|
|
50098
50235
|
"form",
|
|
50099
50236
|
{
|
|
50100
50237
|
onSubmit: handleSubmit(onSubmit),
|
|
50101
50238
|
onKeyDown: handleKeyDown,
|
|
50102
50239
|
className: "space-y-4",
|
|
50103
50240
|
children: [
|
|
50104
|
-
/* @__PURE__ */
|
|
50241
|
+
/* @__PURE__ */ jsx273(
|
|
50105
50242
|
Fields_default.Input,
|
|
50106
50243
|
{
|
|
50107
50244
|
label: "Description",
|
|
@@ -50112,8 +50249,8 @@ function JournalForm5({
|
|
|
50112
50249
|
placeholder: "Enter description"
|
|
50113
50250
|
}
|
|
50114
50251
|
),
|
|
50115
|
-
/* @__PURE__ */
|
|
50116
|
-
/* @__PURE__ */
|
|
50252
|
+
/* @__PURE__ */ jsxs242("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50253
|
+
/* @__PURE__ */ jsx273(
|
|
50117
50254
|
Fields_default.DateInput,
|
|
50118
50255
|
{
|
|
50119
50256
|
label: "Date",
|
|
@@ -50122,7 +50259,7 @@ function JournalForm5({
|
|
|
50122
50259
|
required: true
|
|
50123
50260
|
}
|
|
50124
50261
|
),
|
|
50125
|
-
/* @__PURE__ */
|
|
50262
|
+
/* @__PURE__ */ jsx273(
|
|
50126
50263
|
Fields_default.Input,
|
|
50127
50264
|
{
|
|
50128
50265
|
label: "Currency",
|
|
@@ -50132,8 +50269,8 @@ function JournalForm5({
|
|
|
50132
50269
|
}
|
|
50133
50270
|
)
|
|
50134
50271
|
] }),
|
|
50135
|
-
/* @__PURE__ */
|
|
50136
|
-
/* @__PURE__ */
|
|
50272
|
+
/* @__PURE__ */ jsxs242("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50273
|
+
/* @__PURE__ */ jsx273(
|
|
50137
50274
|
Fields_default.Input,
|
|
50138
50275
|
{
|
|
50139
50276
|
label: "Amount",
|
|
@@ -50144,7 +50281,7 @@ function JournalForm5({
|
|
|
50144
50281
|
placeholder: "0.00"
|
|
50145
50282
|
}
|
|
50146
50283
|
),
|
|
50147
|
-
/* @__PURE__ */
|
|
50284
|
+
/* @__PURE__ */ jsx273(
|
|
50148
50285
|
Fields_default.Select,
|
|
50149
50286
|
{
|
|
50150
50287
|
label: "Action",
|
|
@@ -50158,7 +50295,7 @@ function JournalForm5({
|
|
|
50158
50295
|
}
|
|
50159
50296
|
)
|
|
50160
50297
|
] }),
|
|
50161
|
-
/* @__PURE__ */
|
|
50298
|
+
/* @__PURE__ */ jsx273(
|
|
50162
50299
|
Fields_default.Textarea,
|
|
50163
50300
|
{
|
|
50164
50301
|
label: "Note",
|
|
@@ -50168,18 +50305,18 @@ function JournalForm5({
|
|
|
50168
50305
|
rows: 3
|
|
50169
50306
|
}
|
|
50170
50307
|
),
|
|
50171
|
-
/* @__PURE__ */
|
|
50172
|
-
/* @__PURE__ */
|
|
50308
|
+
/* @__PURE__ */ jsxs242("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
50309
|
+
/* @__PURE__ */ jsx273("div", { children: isEdit && /* @__PURE__ */ jsx273(
|
|
50173
50310
|
ConfirmModal,
|
|
50174
50311
|
{
|
|
50175
50312
|
title: "Reverse Transaction",
|
|
50176
|
-
description: /* @__PURE__ */
|
|
50177
|
-
/* @__PURE__ */
|
|
50178
|
-
/* @__PURE__ */
|
|
50313
|
+
description: /* @__PURE__ */ jsxs242("div", { className: "space-y-3 text-left", children: [
|
|
50314
|
+
/* @__PURE__ */ jsx273("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50315
|
+
/* @__PURE__ */ jsx273("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
50179
50316
|
] }),
|
|
50180
50317
|
confirmationWord: "delete",
|
|
50181
50318
|
onSubmit: onReverse,
|
|
50182
|
-
children: /* @__PURE__ */
|
|
50319
|
+
children: /* @__PURE__ */ jsx273(
|
|
50183
50320
|
Button,
|
|
50184
50321
|
{
|
|
50185
50322
|
type: "button",
|
|
@@ -50192,8 +50329,8 @@ function JournalForm5({
|
|
|
50192
50329
|
)
|
|
50193
50330
|
}
|
|
50194
50331
|
) }),
|
|
50195
|
-
/* @__PURE__ */
|
|
50196
|
-
close && /* @__PURE__ */
|
|
50332
|
+
/* @__PURE__ */ jsxs242("div", { className: "flex justify-end gap-3", children: [
|
|
50333
|
+
close && /* @__PURE__ */ jsx273(
|
|
50197
50334
|
Button,
|
|
50198
50335
|
{
|
|
50199
50336
|
type: "button",
|
|
@@ -50203,7 +50340,7 @@ function JournalForm5({
|
|
|
50203
50340
|
children: "Cancel"
|
|
50204
50341
|
}
|
|
50205
50342
|
),
|
|
50206
|
-
/* @__PURE__ */
|
|
50343
|
+
/* @__PURE__ */ jsx273(
|
|
50207
50344
|
Button,
|
|
50208
50345
|
{
|
|
50209
50346
|
isLoading,
|
|
@@ -50225,15 +50362,15 @@ function JournalForm5({
|
|
|
50225
50362
|
var journalForm_default2 = JournalForm5;
|
|
50226
50363
|
|
|
50227
50364
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
50228
|
-
import { Fragment as
|
|
50365
|
+
import { Fragment as Fragment139, jsx as jsx274, jsxs as jsxs243 } from "react/jsx-runtime";
|
|
50229
50366
|
function CargoIM({ v, url }) {
|
|
50230
|
-
const { branchId } =
|
|
50367
|
+
const { branchId } = useParams115();
|
|
50231
50368
|
const { apiConfig } = useWarqadConfig();
|
|
50232
50369
|
const { width } = useMediaSize();
|
|
50233
50370
|
const isLargeScreen = width > 768;
|
|
50234
50371
|
const navigate = useNavigate66();
|
|
50235
50372
|
const type = "supplier";
|
|
50236
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50373
|
+
const [deleteAccount, setDeleteAccount] = useState119(null);
|
|
50237
50374
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50238
50375
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50239
50376
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -50244,17 +50381,17 @@ function CargoIM({ v, url }) {
|
|
|
50244
50381
|
const items = (data2) => [
|
|
50245
50382
|
{
|
|
50246
50383
|
label: `Edit ${type}`,
|
|
50247
|
-
icon: /* @__PURE__ */
|
|
50384
|
+
icon: /* @__PURE__ */ jsx274(FilePenLine44, { size: 16 }),
|
|
50248
50385
|
onClick: () => openState({
|
|
50249
50386
|
type: "Account",
|
|
50250
|
-
content: /* @__PURE__ */
|
|
50387
|
+
content: /* @__PURE__ */ jsx274(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
50251
50388
|
title: "Account Form",
|
|
50252
50389
|
width: 800
|
|
50253
50390
|
})
|
|
50254
50391
|
},
|
|
50255
50392
|
{
|
|
50256
50393
|
label: `Delete ${type}`,
|
|
50257
|
-
icon: /* @__PURE__ */
|
|
50394
|
+
icon: /* @__PURE__ */ jsx274(Trash255, { className: "text-red-500", size: 16 }),
|
|
50258
50395
|
onClick: () => setDeleteAccount(data2)
|
|
50259
50396
|
}
|
|
50260
50397
|
].filter(Boolean);
|
|
@@ -50265,7 +50402,7 @@ function CargoIM({ v, url }) {
|
|
|
50265
50402
|
className: "w-full",
|
|
50266
50403
|
cell: ({ row }) => {
|
|
50267
50404
|
const account = row.original;
|
|
50268
|
-
return /* @__PURE__ */
|
|
50405
|
+
return /* @__PURE__ */ jsx274(
|
|
50269
50406
|
"span",
|
|
50270
50407
|
{
|
|
50271
50408
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -50294,8 +50431,8 @@ function CargoIM({ v, url }) {
|
|
|
50294
50431
|
className: "w-px whitespace-nowrap",
|
|
50295
50432
|
cell: ({ row }) => {
|
|
50296
50433
|
const data2 = row.original;
|
|
50297
|
-
return /* @__PURE__ */
|
|
50298
|
-
/* @__PURE__ */
|
|
50434
|
+
return /* @__PURE__ */ jsxs243("div", { className: "flex gap-4 items-center", children: [
|
|
50435
|
+
/* @__PURE__ */ jsx274(
|
|
50299
50436
|
"button",
|
|
50300
50437
|
{
|
|
50301
50438
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50303,7 +50440,7 @@ function CargoIM({ v, url }) {
|
|
|
50303
50440
|
openState({
|
|
50304
50441
|
type: "credit",
|
|
50305
50442
|
closeOnOverlayClick: false,
|
|
50306
|
-
content: /* @__PURE__ */
|
|
50443
|
+
content: /* @__PURE__ */ jsx274(
|
|
50307
50444
|
InvoiceForm_default2,
|
|
50308
50445
|
{
|
|
50309
50446
|
onReload: reload,
|
|
@@ -50318,7 +50455,7 @@ function CargoIM({ v, url }) {
|
|
|
50318
50455
|
children: "Inv"
|
|
50319
50456
|
}
|
|
50320
50457
|
),
|
|
50321
|
-
/* @__PURE__ */
|
|
50458
|
+
/* @__PURE__ */ jsx274(
|
|
50322
50459
|
"button",
|
|
50323
50460
|
{
|
|
50324
50461
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50326,7 +50463,7 @@ function CargoIM({ v, url }) {
|
|
|
50326
50463
|
openState({
|
|
50327
50464
|
type: "debit",
|
|
50328
50465
|
closeOnOverlayClick: false,
|
|
50329
|
-
content: /* @__PURE__ */
|
|
50466
|
+
content: /* @__PURE__ */ jsx274(
|
|
50330
50467
|
journalForm_default2,
|
|
50331
50468
|
{
|
|
50332
50469
|
onReload: reload,
|
|
@@ -50342,14 +50479,14 @@ function CargoIM({ v, url }) {
|
|
|
50342
50479
|
children: "Pay"
|
|
50343
50480
|
}
|
|
50344
50481
|
),
|
|
50345
|
-
/* @__PURE__ */
|
|
50482
|
+
/* @__PURE__ */ jsx274(
|
|
50346
50483
|
Dropdown,
|
|
50347
50484
|
{
|
|
50348
50485
|
className: "cursor-pointer",
|
|
50349
50486
|
width: "w-[150px]",
|
|
50350
50487
|
items: items(data2),
|
|
50351
50488
|
triggerMode: "hover",
|
|
50352
|
-
children: /* @__PURE__ */
|
|
50489
|
+
children: /* @__PURE__ */ jsx274(EllipsisVertical48, {})
|
|
50353
50490
|
}
|
|
50354
50491
|
)
|
|
50355
50492
|
] });
|
|
@@ -50373,9 +50510,9 @@ function CargoIM({ v, url }) {
|
|
|
50373
50510
|
return error;
|
|
50374
50511
|
}
|
|
50375
50512
|
};
|
|
50376
|
-
return /* @__PURE__ */
|
|
50377
|
-
/* @__PURE__ */
|
|
50378
|
-
/* @__PURE__ */
|
|
50513
|
+
return /* @__PURE__ */ jsxs243(Fragment139, { children: [
|
|
50514
|
+
/* @__PURE__ */ jsx274(Modal2, {}),
|
|
50515
|
+
/* @__PURE__ */ jsx274(
|
|
50379
50516
|
ConfirmModal,
|
|
50380
50517
|
{
|
|
50381
50518
|
isOpen: !!deleteAccount,
|
|
@@ -50388,7 +50525,7 @@ function CargoIM({ v, url }) {
|
|
|
50388
50525
|
children: null
|
|
50389
50526
|
}
|
|
50390
50527
|
),
|
|
50391
|
-
/* @__PURE__ */
|
|
50528
|
+
/* @__PURE__ */ jsx274("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ jsx274(
|
|
50392
50529
|
TransactionViewComponent,
|
|
50393
50530
|
{
|
|
50394
50531
|
columns,
|
|
@@ -50399,7 +50536,7 @@ function CargoIM({ v, url }) {
|
|
|
50399
50536
|
onCreate: () => {
|
|
50400
50537
|
openState({
|
|
50401
50538
|
type: "account",
|
|
50402
|
-
content: /* @__PURE__ */
|
|
50539
|
+
content: /* @__PURE__ */ jsx274(AccountForm_default3, { onReload: reload, close }),
|
|
50403
50540
|
title: "Account Form",
|
|
50404
50541
|
width: 800
|
|
50405
50542
|
});
|
|
@@ -50412,8 +50549,8 @@ var CargoIM_default = CargoIM;
|
|
|
50412
50549
|
|
|
50413
50550
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
50414
50551
|
import { useSearchParams as useSearchParams20 } from "react-router-dom";
|
|
50415
|
-
import { useMemo as
|
|
50416
|
-
import { Fragment as
|
|
50552
|
+
import { useMemo as useMemo56, useState as useState120, useEffect as useEffect118 } from "react";
|
|
50553
|
+
import { Fragment as Fragment140, jsx as jsx275, jsxs as jsxs244 } from "react/jsx-runtime";
|
|
50417
50554
|
var CargoIMReport = () => {
|
|
50418
50555
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
50419
50556
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -50429,7 +50566,7 @@ var CargoIMReport = () => {
|
|
|
50429
50566
|
const [searchParams, setSearchParams] = useSearchParams20();
|
|
50430
50567
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
50431
50568
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
50432
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
50569
|
+
const [currencyFilter, setCurrencyFilter] = useState120(initialCurrency);
|
|
50433
50570
|
const handleCurrencyChange = (value) => {
|
|
50434
50571
|
setCurrencyFilter(value);
|
|
50435
50572
|
setSearchParams((prev) => {
|
|
@@ -50457,9 +50594,9 @@ var CargoIMReport = () => {
|
|
|
50457
50594
|
header: "Date",
|
|
50458
50595
|
key: "date",
|
|
50459
50596
|
className: "text-xs whitespace-nowrap",
|
|
50460
|
-
render: (row) => /* @__PURE__ */
|
|
50461
|
-
/* @__PURE__ */
|
|
50462
|
-
/* @__PURE__ */
|
|
50597
|
+
render: (row) => /* @__PURE__ */ jsxs244("div", { className: "", children: [
|
|
50598
|
+
/* @__PURE__ */ jsx275("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50599
|
+
/* @__PURE__ */ jsx275(
|
|
50463
50600
|
"span",
|
|
50464
50601
|
{
|
|
50465
50602
|
onClick: () => {
|
|
@@ -50478,13 +50615,13 @@ var CargoIMReport = () => {
|
|
|
50478
50615
|
header: "Container No",
|
|
50479
50616
|
key: "description",
|
|
50480
50617
|
className: "text-xs w-full break-words",
|
|
50481
|
-
render: (row) => /* @__PURE__ */
|
|
50618
|
+
render: (row) => /* @__PURE__ */ jsx275("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50482
50619
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50483
50620
|
/[^a-zA-Z0-9]/g,
|
|
50484
50621
|
""
|
|
50485
50622
|
);
|
|
50486
50623
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50487
|
-
return /* @__PURE__ */
|
|
50624
|
+
return /* @__PURE__ */ jsx275(
|
|
50488
50625
|
"div",
|
|
50489
50626
|
{
|
|
50490
50627
|
className: `${lineClass} min-h-[24px] py-1 flex items-center font-bold capitalize text-black dark:text-white print:text-black whitespace-normal break-words`,
|
|
@@ -50498,13 +50635,13 @@ var CargoIMReport = () => {
|
|
|
50498
50635
|
header: "Cbm",
|
|
50499
50636
|
key: "cbm",
|
|
50500
50637
|
className: "text-xs whitespace-nowrap text-right",
|
|
50501
|
-
render: (row) => /* @__PURE__ */
|
|
50638
|
+
render: (row) => /* @__PURE__ */ jsx275("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50502
50639
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50503
50640
|
/[^a-zA-Z0-9]/g,
|
|
50504
50641
|
""
|
|
50505
50642
|
);
|
|
50506
50643
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50507
|
-
return /* @__PURE__ */
|
|
50644
|
+
return /* @__PURE__ */ jsx275(
|
|
50508
50645
|
"div",
|
|
50509
50646
|
{
|
|
50510
50647
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50521,20 +50658,20 @@ var CargoIMReport = () => {
|
|
|
50521
50658
|
),
|
|
50522
50659
|
0
|
|
50523
50660
|
);
|
|
50524
|
-
return totalCbm > 0 ? /* @__PURE__ */
|
|
50661
|
+
return totalCbm > 0 ? /* @__PURE__ */ jsx275("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50525
50662
|
}
|
|
50526
50663
|
},
|
|
50527
50664
|
{
|
|
50528
50665
|
header: "Price",
|
|
50529
50666
|
key: "price",
|
|
50530
50667
|
className: "text-xs whitespace-nowrap text-right",
|
|
50531
|
-
render: (row) => /* @__PURE__ */
|
|
50668
|
+
render: (row) => /* @__PURE__ */ jsx275("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50532
50669
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50533
50670
|
/[^a-zA-Z0-9]/g,
|
|
50534
50671
|
""
|
|
50535
50672
|
);
|
|
50536
50673
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50537
|
-
return /* @__PURE__ */
|
|
50674
|
+
return /* @__PURE__ */ jsx275(
|
|
50538
50675
|
"div",
|
|
50539
50676
|
{
|
|
50540
50677
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50548,13 +50685,13 @@ var CargoIMReport = () => {
|
|
|
50548
50685
|
header: "Credit",
|
|
50549
50686
|
key: "credit",
|
|
50550
50687
|
className: "text-xs whitespace-nowrap text-right",
|
|
50551
|
-
render: (row) => /* @__PURE__ */
|
|
50688
|
+
render: (row) => /* @__PURE__ */ jsx275("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50552
50689
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50553
50690
|
/[^a-zA-Z0-9]/g,
|
|
50554
50691
|
""
|
|
50555
50692
|
);
|
|
50556
50693
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50557
|
-
return /* @__PURE__ */
|
|
50694
|
+
return /* @__PURE__ */ jsx275(
|
|
50558
50695
|
"div",
|
|
50559
50696
|
{
|
|
50560
50697
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-green-500 dark:text-green-500 print:text-green-500 whitespace-nowrap`,
|
|
@@ -50563,7 +50700,7 @@ var CargoIMReport = () => {
|
|
|
50563
50700
|
idx
|
|
50564
50701
|
);
|
|
50565
50702
|
}) }),
|
|
50566
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50703
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx275("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50567
50704
|
data2.reduce(
|
|
50568
50705
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50569
50706
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50577,13 +50714,13 @@ var CargoIMReport = () => {
|
|
|
50577
50714
|
header: "Debit",
|
|
50578
50715
|
key: "debit",
|
|
50579
50716
|
className: "text-xs whitespace-nowrap text-right",
|
|
50580
|
-
render: (row) => /* @__PURE__ */
|
|
50717
|
+
render: (row) => /* @__PURE__ */ jsx275("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50581
50718
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50582
50719
|
/[^a-zA-Z0-9]/g,
|
|
50583
50720
|
""
|
|
50584
50721
|
);
|
|
50585
50722
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50586
|
-
return /* @__PURE__ */
|
|
50723
|
+
return /* @__PURE__ */ jsx275(
|
|
50587
50724
|
"div",
|
|
50588
50725
|
{
|
|
50589
50726
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-red-500 dark:text-red-500 print:text-red-500 whitespace-nowrap`,
|
|
@@ -50592,7 +50729,7 @@ var CargoIMReport = () => {
|
|
|
50592
50729
|
idx
|
|
50593
50730
|
);
|
|
50594
50731
|
}) }),
|
|
50595
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50732
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx275("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50596
50733
|
data2.reduce(
|
|
50597
50734
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50598
50735
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50606,14 +50743,14 @@ var CargoIMReport = () => {
|
|
|
50606
50743
|
header: "Balance",
|
|
50607
50744
|
key: "runningBalance",
|
|
50608
50745
|
className: "text-xs whitespace-nowrap text-right",
|
|
50609
|
-
render: (row) => /* @__PURE__ */
|
|
50610
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50746
|
+
render: (row) => /* @__PURE__ */ jsx275("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50747
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx275("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50611
50748
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50612
50749
|
currency
|
|
50613
50750
|
) })
|
|
50614
50751
|
}
|
|
50615
50752
|
];
|
|
50616
|
-
const datas =
|
|
50753
|
+
const datas = useMemo56(() => {
|
|
50617
50754
|
let runningBalance = 0;
|
|
50618
50755
|
const transactions = data?.data?.transactions;
|
|
50619
50756
|
const res = (transactions || []).map((item) => {
|
|
@@ -50650,10 +50787,10 @@ var CargoIMReport = () => {
|
|
|
50650
50787
|
{ label: "Account Type", value: data?.data?.type },
|
|
50651
50788
|
{ label: "Currency", value: currencyFilter }
|
|
50652
50789
|
];
|
|
50653
|
-
return /* @__PURE__ */
|
|
50654
|
-
/* @__PURE__ */
|
|
50655
|
-
/* @__PURE__ */
|
|
50656
|
-
/* @__PURE__ */
|
|
50790
|
+
return /* @__PURE__ */ jsxs244(Fragment140, { children: [
|
|
50791
|
+
/* @__PURE__ */ jsx275(Modal2, {}),
|
|
50792
|
+
/* @__PURE__ */ jsx275(TransactionView, {}),
|
|
50793
|
+
/* @__PURE__ */ jsx275(
|
|
50657
50794
|
A4DataView,
|
|
50658
50795
|
{
|
|
50659
50796
|
columns,
|
|
@@ -50668,7 +50805,7 @@ var CargoIMReport = () => {
|
|
|
50668
50805
|
openState({
|
|
50669
50806
|
type: "debit",
|
|
50670
50807
|
closeOnOverlayClick: false,
|
|
50671
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */
|
|
50808
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ jsx275(
|
|
50672
50809
|
InvoiceForm_default2,
|
|
50673
50810
|
{
|
|
50674
50811
|
close: closeTransaction,
|
|
@@ -50676,7 +50813,7 @@ var CargoIMReport = () => {
|
|
|
50676
50813
|
onReload: reload,
|
|
50677
50814
|
id: row._id
|
|
50678
50815
|
}
|
|
50679
|
-
) : /* @__PURE__ */
|
|
50816
|
+
) : /* @__PURE__ */ jsx275(
|
|
50680
50817
|
journalForm_default2,
|
|
50681
50818
|
{
|
|
50682
50819
|
close: closeTransaction,
|
|
@@ -50689,7 +50826,7 @@ var CargoIMReport = () => {
|
|
|
50689
50826
|
width: 800
|
|
50690
50827
|
});
|
|
50691
50828
|
},
|
|
50692
|
-
headers: /* @__PURE__ */
|
|
50829
|
+
headers: /* @__PURE__ */ jsx275("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx275(
|
|
50693
50830
|
Fields_default.Select,
|
|
50694
50831
|
{
|
|
50695
50832
|
options: currencies,
|
|
@@ -50705,21 +50842,21 @@ var CargoIMReport = () => {
|
|
|
50705
50842
|
var cargoIMReport_default = CargoIMReport;
|
|
50706
50843
|
|
|
50707
50844
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50708
|
-
import { useNavigate as useNavigate67, useParams as
|
|
50845
|
+
import { useNavigate as useNavigate67, useParams as useParams116 } from "react-router-dom";
|
|
50709
50846
|
import {
|
|
50710
50847
|
EllipsisVertical as EllipsisVertical49,
|
|
50711
50848
|
FileChartLine as FileChartLine2,
|
|
50712
50849
|
FilePenLine as FilePenLine45,
|
|
50713
50850
|
Trash2 as Trash256
|
|
50714
50851
|
} from "lucide-react";
|
|
50715
|
-
import { useState as
|
|
50852
|
+
import { useState as useState121 } from "react";
|
|
50716
50853
|
import { message as message91 } from "antd";
|
|
50717
|
-
import { Fragment as
|
|
50854
|
+
import { Fragment as Fragment141, jsx as jsx276, jsxs as jsxs245 } from "react/jsx-runtime";
|
|
50718
50855
|
function Forex2Accounts({ v, url }) {
|
|
50719
|
-
const { branchId } =
|
|
50856
|
+
const { branchId } = useParams116();
|
|
50720
50857
|
const navigate = useNavigate67();
|
|
50721
50858
|
const type = "account";
|
|
50722
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50859
|
+
const [deleteAccount, setDeleteAccount] = useState121(null);
|
|
50723
50860
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50724
50861
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50725
50862
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50730,22 +50867,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50730
50867
|
const items = (data2) => [
|
|
50731
50868
|
{
|
|
50732
50869
|
label: `Currency Report`,
|
|
50733
|
-
icon: /* @__PURE__ */
|
|
50870
|
+
icon: /* @__PURE__ */ jsx276(FileChartLine2, { size: 16 }),
|
|
50734
50871
|
onClick: () => navigate(data2?._id)
|
|
50735
50872
|
},
|
|
50736
50873
|
{
|
|
50737
50874
|
label: `Edit ${type}`,
|
|
50738
|
-
icon: /* @__PURE__ */
|
|
50875
|
+
icon: /* @__PURE__ */ jsx276(FilePenLine45, { size: 16 }),
|
|
50739
50876
|
onClick: () => openState({
|
|
50740
50877
|
type: "forex account",
|
|
50741
|
-
content: /* @__PURE__ */
|
|
50878
|
+
content: /* @__PURE__ */ jsx276(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50742
50879
|
title: "Forex Account Form",
|
|
50743
50880
|
width: 800
|
|
50744
50881
|
})
|
|
50745
50882
|
},
|
|
50746
50883
|
{
|
|
50747
50884
|
label: `Delete ${type}`,
|
|
50748
|
-
icon: /* @__PURE__ */
|
|
50885
|
+
icon: /* @__PURE__ */ jsx276(Trash256, { className: "text-red-500", size: 16 }),
|
|
50749
50886
|
onClick: () => setDeleteAccount(data2)
|
|
50750
50887
|
}
|
|
50751
50888
|
].filter(Boolean);
|
|
@@ -50755,7 +50892,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50755
50892
|
header: "Name",
|
|
50756
50893
|
cell: ({ row }) => {
|
|
50757
50894
|
const account = row.original;
|
|
50758
|
-
return /* @__PURE__ */
|
|
50895
|
+
return /* @__PURE__ */ jsx276(
|
|
50759
50896
|
"span",
|
|
50760
50897
|
{
|
|
50761
50898
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50770,7 +50907,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50770
50907
|
header: "Phone",
|
|
50771
50908
|
cell: ({ row }) => {
|
|
50772
50909
|
const account = row.original;
|
|
50773
|
-
return /* @__PURE__ */
|
|
50910
|
+
return /* @__PURE__ */ jsx276("span", { children: account?.phoneNumber || "N/A" });
|
|
50774
50911
|
}
|
|
50775
50912
|
},
|
|
50776
50913
|
{
|
|
@@ -50778,14 +50915,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50778
50915
|
header: "Balances",
|
|
50779
50916
|
cell: ({ row }) => {
|
|
50780
50917
|
const account = row.original;
|
|
50781
|
-
return /* @__PURE__ */
|
|
50782
|
-
([currency, data2]) => /* @__PURE__ */
|
|
50918
|
+
return /* @__PURE__ */ jsx276("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50919
|
+
([currency, data2]) => /* @__PURE__ */ jsxs245(
|
|
50783
50920
|
"div",
|
|
50784
50921
|
{
|
|
50785
50922
|
className: "flex items-center gap-1.5 px-2 py-0.5 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-100 dark:border-gray-700",
|
|
50786
50923
|
children: [
|
|
50787
|
-
/* @__PURE__ */
|
|
50788
|
-
/* @__PURE__ */
|
|
50924
|
+
/* @__PURE__ */ jsx276("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50925
|
+
/* @__PURE__ */ jsx276(
|
|
50789
50926
|
"span",
|
|
50790
50927
|
{
|
|
50791
50928
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50804,8 +50941,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50804
50941
|
header: "Actions",
|
|
50805
50942
|
cell: ({ row }) => {
|
|
50806
50943
|
const data2 = row.original;
|
|
50807
|
-
return /* @__PURE__ */
|
|
50808
|
-
/* @__PURE__ */
|
|
50944
|
+
return /* @__PURE__ */ jsxs245("div", { className: "flex gap-4 items-center", children: [
|
|
50945
|
+
/* @__PURE__ */ jsx276(
|
|
50809
50946
|
"button",
|
|
50810
50947
|
{
|
|
50811
50948
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50813,7 +50950,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50813
50950
|
openState({
|
|
50814
50951
|
type: "credit",
|
|
50815
50952
|
closeOnOverlayClick: false,
|
|
50816
|
-
content: /* @__PURE__ */
|
|
50953
|
+
content: /* @__PURE__ */ jsx276(
|
|
50817
50954
|
Forex2FormTransaction_default,
|
|
50818
50955
|
{
|
|
50819
50956
|
close,
|
|
@@ -50829,7 +50966,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50829
50966
|
children: "Out"
|
|
50830
50967
|
}
|
|
50831
50968
|
),
|
|
50832
|
-
/* @__PURE__ */
|
|
50969
|
+
/* @__PURE__ */ jsx276(
|
|
50833
50970
|
"button",
|
|
50834
50971
|
{
|
|
50835
50972
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50837,7 +50974,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50837
50974
|
openState({
|
|
50838
50975
|
type: "debit",
|
|
50839
50976
|
closeOnOverlayClick: false,
|
|
50840
|
-
content: /* @__PURE__ */
|
|
50977
|
+
content: /* @__PURE__ */ jsx276(
|
|
50841
50978
|
Forex2FormTransaction_default,
|
|
50842
50979
|
{
|
|
50843
50980
|
close,
|
|
@@ -50853,13 +50990,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50853
50990
|
children: "In"
|
|
50854
50991
|
}
|
|
50855
50992
|
),
|
|
50856
|
-
/* @__PURE__ */
|
|
50993
|
+
/* @__PURE__ */ jsx276(
|
|
50857
50994
|
Dropdown,
|
|
50858
50995
|
{
|
|
50859
50996
|
className: "cursor-pointer w-[150px]",
|
|
50860
50997
|
items: items(data2),
|
|
50861
50998
|
triggerMode: "hover",
|
|
50862
|
-
children: /* @__PURE__ */
|
|
50999
|
+
children: /* @__PURE__ */ jsx276(EllipsisVertical49, {})
|
|
50863
51000
|
}
|
|
50864
51001
|
)
|
|
50865
51002
|
] });
|
|
@@ -50898,9 +51035,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50898
51035
|
};
|
|
50899
51036
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50900
51037
|
console.log(currencies);
|
|
50901
|
-
return /* @__PURE__ */
|
|
50902
|
-
/* @__PURE__ */
|
|
50903
|
-
/* @__PURE__ */
|
|
51038
|
+
return /* @__PURE__ */ jsxs245(Fragment141, { children: [
|
|
51039
|
+
/* @__PURE__ */ jsx276(Modal2, {}),
|
|
51040
|
+
/* @__PURE__ */ jsx276(
|
|
50904
51041
|
ConfirmModal,
|
|
50905
51042
|
{
|
|
50906
51043
|
isOpen: !!deleteAccount,
|
|
@@ -50913,9 +51050,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50913
51050
|
children: null
|
|
50914
51051
|
}
|
|
50915
51052
|
),
|
|
50916
|
-
/* @__PURE__ */
|
|
50917
|
-
/* @__PURE__ */
|
|
50918
|
-
/* @__PURE__ */
|
|
51053
|
+
/* @__PURE__ */ jsxs245("div", { children: [
|
|
51054
|
+
/* @__PURE__ */ jsx276(ForexAccountSummary_default, { currencies, isLoading }),
|
|
51055
|
+
/* @__PURE__ */ jsx276(
|
|
50919
51056
|
TransactionViewComponent,
|
|
50920
51057
|
{
|
|
50921
51058
|
columns,
|
|
@@ -50927,7 +51064,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50927
51064
|
onCreate: () => {
|
|
50928
51065
|
openState({
|
|
50929
51066
|
type: "forex account",
|
|
50930
|
-
content: /* @__PURE__ */
|
|
51067
|
+
content: /* @__PURE__ */ jsx276(ForexAccountForm_default, { close, reloads: reload }),
|
|
50931
51068
|
title: "Forex Account Form",
|
|
50932
51069
|
width: 800
|
|
50933
51070
|
});
|
|
@@ -50940,14 +51077,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50940
51077
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50941
51078
|
|
|
50942
51079
|
// src/components/reports/ProductList.tsx
|
|
50943
|
-
import { useParams as
|
|
50944
|
-
import { Fragment as
|
|
51080
|
+
import { useParams as useParams117 } from "react-router-dom";
|
|
51081
|
+
import { Fragment as Fragment142, jsx as jsx277, jsxs as jsxs246 } from "react/jsx-runtime";
|
|
50945
51082
|
var options9 = [
|
|
50946
51083
|
{ label: "Product", value: "product" },
|
|
50947
51084
|
{ label: "Pack", value: "pack" }
|
|
50948
51085
|
];
|
|
50949
51086
|
var ProductList2 = ({ value = false }) => {
|
|
50950
|
-
const { branchId } =
|
|
51087
|
+
const { branchId } = useParams117();
|
|
50951
51088
|
const { branches } = useAuth_default();
|
|
50952
51089
|
const { TransactionView } = useTransactionView_default();
|
|
50953
51090
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50969,7 +51106,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50969
51106
|
key: "name",
|
|
50970
51107
|
className: "text-xs whitespace-nowrap",
|
|
50971
51108
|
render: (row) => {
|
|
50972
|
-
return /* @__PURE__ */
|
|
51109
|
+
return /* @__PURE__ */ jsx277("div", { className: "", children: /* @__PURE__ */ jsx277("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
50973
51110
|
}
|
|
50974
51111
|
},
|
|
50975
51112
|
...value ? [
|
|
@@ -50977,14 +51114,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50977
51114
|
header: "Cost",
|
|
50978
51115
|
key: "cost",
|
|
50979
51116
|
className: "text-xs whitespace-nowrap text-right",
|
|
50980
|
-
render: (row) => /* @__PURE__ */
|
|
51117
|
+
render: (row) => /* @__PURE__ */ jsx277("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50981
51118
|
}
|
|
50982
51119
|
] : []
|
|
50983
51120
|
];
|
|
50984
51121
|
const datas = data?.data || [];
|
|
50985
|
-
return /* @__PURE__ */
|
|
50986
|
-
/* @__PURE__ */
|
|
50987
|
-
/* @__PURE__ */
|
|
51122
|
+
return /* @__PURE__ */ jsxs246(Fragment142, { children: [
|
|
51123
|
+
/* @__PURE__ */ jsx277(TransactionView, {}),
|
|
51124
|
+
/* @__PURE__ */ jsx277(
|
|
50988
51125
|
A4DataView,
|
|
50989
51126
|
{
|
|
50990
51127
|
columns,
|
|
@@ -50995,7 +51132,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50995
51132
|
tableTitle: "Stock List",
|
|
50996
51133
|
fixed: false,
|
|
50997
51134
|
startPage: 1e10,
|
|
50998
|
-
headers: /* @__PURE__ */
|
|
51135
|
+
headers: /* @__PURE__ */ jsx277(
|
|
50999
51136
|
Select,
|
|
51000
51137
|
{
|
|
51001
51138
|
options: options9,
|