warqadui 0.0.104 → 0.0.105
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 +52 -7
- package/dist/index.d.ts +52 -7
- package/dist/index.js +1332 -699
- package/dist/index.mjs +1323 -684
- package/dist/styles.js +27 -0
- package/dist/styles.mjs +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,6 +64,8 @@ __export(index_exports, {
|
|
|
64
64
|
ExpenseForm: () => ExpenseForm_default,
|
|
65
65
|
Expenses: () => Expenses_default,
|
|
66
66
|
Fields: () => Fields_default,
|
|
67
|
+
ForexTransferForm: () => ForexTransferForm_default,
|
|
68
|
+
ForexTransfers: () => ForexTransfers_default,
|
|
67
69
|
Guard: () => Guard,
|
|
68
70
|
InfoGrid: () => InfoGrid,
|
|
69
71
|
Input: () => Input,
|
|
@@ -130,6 +132,7 @@ __export(index_exports, {
|
|
|
130
132
|
createUserSchema: () => createUserSchema,
|
|
131
133
|
createWalletSchema: () => createWalletSchema,
|
|
132
134
|
expenseSchema: () => expenseSchema,
|
|
135
|
+
forexTransferSchema: () => forexTransferSchema,
|
|
133
136
|
generatePdf: () => generatePdf,
|
|
134
137
|
journalSchema: () => journalSchema,
|
|
135
138
|
linkUserSchema: () => linkUserSchema,
|
|
@@ -465,7 +468,7 @@ var Enums = {
|
|
|
465
468
|
verificationTypes: ["email_verification", "password_reset"],
|
|
466
469
|
auditActions: ["create", "update", "delete", "login", "logout"],
|
|
467
470
|
walletTypes: ["bank", "cash", "mobile"],
|
|
468
|
-
currencies: ["USD", "TZS", "KES", "
|
|
471
|
+
currencies: ["USD", "TZS", "KES", "RMB"],
|
|
469
472
|
packTypes: ["pressure", "bag", "boxes"],
|
|
470
473
|
journalTypes: ["journal"],
|
|
471
474
|
viaTypes: ["direct", "via account"],
|
|
@@ -475,7 +478,8 @@ var Enums = {
|
|
|
475
478
|
"payment",
|
|
476
479
|
"money transfer",
|
|
477
480
|
"expense",
|
|
478
|
-
"adjustment"
|
|
481
|
+
"adjustment",
|
|
482
|
+
"forex transfer"
|
|
479
483
|
]
|
|
480
484
|
};
|
|
481
485
|
var Enums_default = Enums;
|
|
@@ -1524,13 +1528,13 @@ var Input = (0, import_react10.forwardRef)(
|
|
|
1524
1528
|
}
|
|
1525
1529
|
}
|
|
1526
1530
|
}, [props.value, name, form]);
|
|
1527
|
-
let
|
|
1531
|
+
let message31 = error;
|
|
1528
1532
|
if (form && name) {
|
|
1529
1533
|
const {
|
|
1530
1534
|
formState: { errors }
|
|
1531
1535
|
} = form;
|
|
1532
1536
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1533
|
-
|
|
1537
|
+
message31 = errorObj?.message;
|
|
1534
1538
|
}
|
|
1535
1539
|
const watchedValue = form?.watch(name);
|
|
1536
1540
|
(0, import_react10.useEffect)(() => {
|
|
@@ -1599,7 +1603,7 @@ var Input = (0, import_react10.forwardRef)(
|
|
|
1599
1603
|
}
|
|
1600
1604
|
)
|
|
1601
1605
|
] }),
|
|
1602
|
-
|
|
1606
|
+
message31 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message31 })
|
|
1603
1607
|
]
|
|
1604
1608
|
}
|
|
1605
1609
|
);
|
|
@@ -1933,7 +1937,7 @@ var PhoneInput = (0, import_react13.forwardRef)(
|
|
|
1933
1937
|
const [isFocused, setIsFocused] = (0, import_react13.useState)(false);
|
|
1934
1938
|
const { theme } = useWarqadConfig();
|
|
1935
1939
|
const primaryColor = theme?.primaryColor;
|
|
1936
|
-
let
|
|
1940
|
+
let message31 = error;
|
|
1937
1941
|
if (form && name) {
|
|
1938
1942
|
const {
|
|
1939
1943
|
formState: { errors }
|
|
@@ -1943,7 +1947,7 @@ var PhoneInput = (0, import_react13.forwardRef)(
|
|
|
1943
1947
|
for (const part of nameParts) {
|
|
1944
1948
|
currentError = currentError?.[part];
|
|
1945
1949
|
}
|
|
1946
|
-
|
|
1950
|
+
message31 = currentError?.message || message31;
|
|
1947
1951
|
}
|
|
1948
1952
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1949
1953
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
@@ -1994,7 +1998,7 @@ var PhoneInput = (0, import_react13.forwardRef)(
|
|
|
1994
1998
|
}
|
|
1995
1999
|
)
|
|
1996
2000
|
] }),
|
|
1997
|
-
|
|
2001
|
+
message31 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message31 })
|
|
1998
2002
|
] });
|
|
1999
2003
|
if (form && name) {
|
|
2000
2004
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -2167,7 +2171,7 @@ var SelectRoot = ({
|
|
|
2167
2171
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2168
2172
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2169
2173
|
}, [fieldInternalProps]);
|
|
2170
|
-
let
|
|
2174
|
+
let message31 = error;
|
|
2171
2175
|
if (form && name) {
|
|
2172
2176
|
const {
|
|
2173
2177
|
formState: { errors }
|
|
@@ -2177,7 +2181,7 @@ var SelectRoot = ({
|
|
|
2177
2181
|
for (const part of nameParts) {
|
|
2178
2182
|
currentError = currentError?.[part];
|
|
2179
2183
|
}
|
|
2180
|
-
|
|
2184
|
+
message31 = currentError?.message || message31;
|
|
2181
2185
|
}
|
|
2182
2186
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
2183
2187
|
const valueCtx = {
|
|
@@ -2238,7 +2242,7 @@ var SelectRoot = ({
|
|
|
2238
2242
|
String(opt.value) || index
|
|
2239
2243
|
)) })
|
|
2240
2244
|
] }),
|
|
2241
|
-
|
|
2245
|
+
message31 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message31 })
|
|
2242
2246
|
]
|
|
2243
2247
|
}
|
|
2244
2248
|
) });
|
|
@@ -2474,13 +2478,13 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
2474
2478
|
const [isFocused, setIsFocused] = (0, import_react15.useState)(false);
|
|
2475
2479
|
const { theme } = useWarqadConfig();
|
|
2476
2480
|
const primaryColor = theme?.primaryColor;
|
|
2477
|
-
let
|
|
2481
|
+
let message31 = error;
|
|
2478
2482
|
if (form && name) {
|
|
2479
2483
|
const {
|
|
2480
2484
|
formState: { errors }
|
|
2481
2485
|
} = form;
|
|
2482
2486
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2483
|
-
|
|
2487
|
+
message31 = errorObj?.message;
|
|
2484
2488
|
}
|
|
2485
2489
|
const renderInput = (inputProps, ref2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
2486
2490
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
@@ -2518,7 +2522,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
2518
2522
|
}
|
|
2519
2523
|
}
|
|
2520
2524
|
) }),
|
|
2521
|
-
|
|
2525
|
+
message31 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message31 })
|
|
2522
2526
|
] });
|
|
2523
2527
|
(0, import_react15.useEffect)(() => {
|
|
2524
2528
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -2837,7 +2841,7 @@ var SearchApiRoot = ({
|
|
|
2837
2841
|
const filteredOptions = options3.filter(
|
|
2838
2842
|
(option) => !filter.includes(getOptionValue(option))
|
|
2839
2843
|
);
|
|
2840
|
-
let
|
|
2844
|
+
let message31 = error || errorMessage;
|
|
2841
2845
|
if (form && name) {
|
|
2842
2846
|
const {
|
|
2843
2847
|
formState: { errors }
|
|
@@ -2847,7 +2851,7 @@ var SearchApiRoot = ({
|
|
|
2847
2851
|
for (const part of nameParts) {
|
|
2848
2852
|
currentError = currentError?.[part];
|
|
2849
2853
|
}
|
|
2850
|
-
|
|
2854
|
+
message31 = currentError?.message || message31;
|
|
2851
2855
|
}
|
|
2852
2856
|
const valueCtx = {
|
|
2853
2857
|
isOpen,
|
|
@@ -2881,7 +2885,7 @@ var SearchApiRoot = ({
|
|
|
2881
2885
|
form,
|
|
2882
2886
|
name,
|
|
2883
2887
|
obj,
|
|
2884
|
-
error:
|
|
2888
|
+
error: message31,
|
|
2885
2889
|
onSelect,
|
|
2886
2890
|
onClear
|
|
2887
2891
|
};
|
|
@@ -3248,19 +3252,19 @@ var DateInput = (0, import_react17.forwardRef)(
|
|
|
3248
3252
|
const { theme } = useWarqadConfig();
|
|
3249
3253
|
const primaryColor = theme?.primaryColor;
|
|
3250
3254
|
const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
|
|
3251
|
-
let
|
|
3255
|
+
let message31 = error;
|
|
3252
3256
|
if (form && name) {
|
|
3253
3257
|
const {
|
|
3254
3258
|
formState: { errors }
|
|
3255
3259
|
} = form;
|
|
3256
3260
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
3257
|
-
|
|
3261
|
+
message31 = errorObj?.message;
|
|
3258
3262
|
}
|
|
3259
3263
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
3260
3264
|
bg-white! dark:bg-zinc-900!
|
|
3261
3265
|
text-gray-900! dark:text-zinc-100!
|
|
3262
3266
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
3263
|
-
${
|
|
3267
|
+
${message31 ? "border-red-500 hover:border-red-500 [&.ant-picker-focused]:border-red-500 [&.ant-picker-focused]:ring-red-500/20" : "border-gray-200 dark:border-zinc-700 hover:border-gray-200 dark:hover:border-zinc-700 [&.ant-picker-focused]:ring-2"}
|
|
3264
3268
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
3265
3269
|
${className}`;
|
|
3266
3270
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
@@ -3283,8 +3287,8 @@ var DateInput = (0, import_react17.forwardRef)(
|
|
|
3283
3287
|
needConfirm: false,
|
|
3284
3288
|
style: {
|
|
3285
3289
|
height: "var(--input-height, 40px)",
|
|
3286
|
-
borderColor: isFocused && !
|
|
3287
|
-
boxShadow: isFocused && !
|
|
3290
|
+
borderColor: isFocused && !message31 ? primaryColor : void 0,
|
|
3291
|
+
boxShadow: isFocused && !message31 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
3288
3292
|
},
|
|
3289
3293
|
classNames: { popup: { root: "z-50" } },
|
|
3290
3294
|
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -3314,7 +3318,7 @@ var DateInput = (0, import_react17.forwardRef)(
|
|
|
3314
3318
|
{
|
|
3315
3319
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
3316
3320
|
style: {
|
|
3317
|
-
color:
|
|
3321
|
+
color: message31 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3318
3322
|
},
|
|
3319
3323
|
children: [
|
|
3320
3324
|
label,
|
|
@@ -3335,7 +3339,7 @@ var DateInput = (0, import_react17.forwardRef)(
|
|
|
3335
3339
|
)
|
|
3336
3340
|
}
|
|
3337
3341
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
3338
|
-
|
|
3342
|
+
message31 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message31 })
|
|
3339
3343
|
] });
|
|
3340
3344
|
}
|
|
3341
3345
|
);
|
|
@@ -7842,17 +7846,17 @@ var preWarningFns = [];
|
|
|
7842
7846
|
var preMessage = (fn) => {
|
|
7843
7847
|
preWarningFns.push(fn);
|
|
7844
7848
|
};
|
|
7845
|
-
function warning(valid,
|
|
7849
|
+
function warning(valid, message31) {
|
|
7846
7850
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
7847
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
7851
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message31);
|
|
7848
7852
|
if (finalMessage) {
|
|
7849
7853
|
console.error(`Warning: ${finalMessage}`);
|
|
7850
7854
|
}
|
|
7851
7855
|
}
|
|
7852
7856
|
}
|
|
7853
|
-
function note(valid,
|
|
7857
|
+
function note(valid, message31) {
|
|
7854
7858
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
7855
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
7859
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message31);
|
|
7856
7860
|
if (finalMessage) {
|
|
7857
7861
|
console.warn(`Note: ${finalMessage}`);
|
|
7858
7862
|
}
|
|
@@ -7861,17 +7865,17 @@ function note(valid, message30) {
|
|
|
7861
7865
|
function resetWarned() {
|
|
7862
7866
|
warned = {};
|
|
7863
7867
|
}
|
|
7864
|
-
function call(method, valid,
|
|
7865
|
-
if (!valid && !warned[
|
|
7866
|
-
method(false,
|
|
7867
|
-
warned[
|
|
7868
|
+
function call(method, valid, message31) {
|
|
7869
|
+
if (!valid && !warned[message31]) {
|
|
7870
|
+
method(false, message31);
|
|
7871
|
+
warned[message31] = true;
|
|
7868
7872
|
}
|
|
7869
7873
|
}
|
|
7870
|
-
function warningOnce(valid,
|
|
7871
|
-
call(warning, valid,
|
|
7874
|
+
function warningOnce(valid, message31) {
|
|
7875
|
+
call(warning, valid, message31);
|
|
7872
7876
|
}
|
|
7873
|
-
function noteOnce(valid,
|
|
7874
|
-
call(note, valid,
|
|
7877
|
+
function noteOnce(valid, message31) {
|
|
7878
|
+
call(note, valid, message31);
|
|
7875
7879
|
}
|
|
7876
7880
|
warningOnce.preMessage = preMessage;
|
|
7877
7881
|
warningOnce.resetWarned = resetWarned;
|
|
@@ -7882,8 +7886,8 @@ var import_react31 = __toESM(require("react"));
|
|
|
7882
7886
|
function camelCase(input) {
|
|
7883
7887
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
7884
7888
|
}
|
|
7885
|
-
function warning2(valid,
|
|
7886
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
7889
|
+
function warning2(valid, message31) {
|
|
7890
|
+
warningOnce(valid, `[@ant-design/icons] ${message31}`);
|
|
7887
7891
|
}
|
|
7888
7892
|
function isIconDefinition(target) {
|
|
7889
7893
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -9277,7 +9281,7 @@ var ExpenseView_default = ExpenseView;
|
|
|
9277
9281
|
|
|
9278
9282
|
// src/components/Views/Transaction.tsx
|
|
9279
9283
|
var import_antd6 = require("antd");
|
|
9280
|
-
var
|
|
9284
|
+
var import_lucide_react26 = require("lucide-react");
|
|
9281
9285
|
|
|
9282
9286
|
// src/components/Views/TransactionViewComponents/WalletAdjustmentView.tsx
|
|
9283
9287
|
var import_lucide_react24 = require("lucide-react");
|
|
@@ -9468,8 +9472,219 @@ function WalletAdjustmentView({
|
|
|
9468
9472
|
}
|
|
9469
9473
|
var WalletAdjustmentView_default = WalletAdjustmentView;
|
|
9470
9474
|
|
|
9471
|
-
// src/components/Views/
|
|
9475
|
+
// src/components/Views/TransactionViewComponents/ForexTransferView.tsx
|
|
9476
|
+
var import_lucide_react25 = require("lucide-react");
|
|
9472
9477
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9478
|
+
function ForexTransferView({
|
|
9479
|
+
data,
|
|
9480
|
+
isLoading
|
|
9481
|
+
}) {
|
|
9482
|
+
const Skeleton = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9483
|
+
"div",
|
|
9484
|
+
{
|
|
9485
|
+
className: `animate-pulse bg-gray-200 dark:bg-zinc-800 rounded ${className}`
|
|
9486
|
+
}
|
|
9487
|
+
);
|
|
9488
|
+
const InfoSection = ({ title, icon: Icon2, children }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "bg-white dark:bg-zinc-900/30 rounded-xl border border-gray-100 dark:border-zinc-800/50 p-5 space-y-4", children: [
|
|
9489
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2 pb-3 border-b border-gray-50 dark:border-zinc-800/50", children: [
|
|
9490
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "p-1.5 bg-gray-50 dark:bg-zinc-800 rounded-lg text-gray-500 dark:text-zinc-400", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon2, { size: 18 }) }),
|
|
9491
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h3", { className: "font-semibold text-gray-900 dark:text-zinc-100", children: title })
|
|
9492
|
+
] }),
|
|
9493
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-5", children })
|
|
9494
|
+
] });
|
|
9495
|
+
const DataItem = ({
|
|
9496
|
+
label,
|
|
9497
|
+
value,
|
|
9498
|
+
subValue,
|
|
9499
|
+
className = "",
|
|
9500
|
+
isSkeleton
|
|
9501
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: `space-y-1 ${className}`, children: [
|
|
9502
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[10px] font-bold text-gray-400 dark:text-zinc-500 uppercase tracking-widest", children: label }),
|
|
9503
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex flex-col gap-1.5", children: isSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9504
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-4 w-3/4" }),
|
|
9505
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-3 w-1/2" })
|
|
9506
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9507
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-sm font-semibold text-gray-800 dark:text-zinc-200", children: value || "---" }),
|
|
9508
|
+
subValue && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-[11px] text-gray-400 dark:text-zinc-500 font-medium", children: subValue })
|
|
9509
|
+
] }) })
|
|
9510
|
+
] });
|
|
9511
|
+
if (isLoading) {
|
|
9512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-2 space-y-6", children: [
|
|
9513
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "bg-white dark:bg-zinc-900 rounded-2xl border border-gray-100 dark:border-zinc-800 p-6 flex flex-wrap items-center justify-between gap-6", children: [
|
|
9514
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-5", children: [
|
|
9515
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "w-14 h-14 rounded-2xl" }),
|
|
9516
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "space-y-3", children: [
|
|
9517
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-7 w-48" }),
|
|
9518
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-4 w-32" })
|
|
9519
|
+
] })
|
|
9520
|
+
] }),
|
|
9521
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "text-right space-y-3", children: [
|
|
9522
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-8 w-40 ml-auto" }),
|
|
9523
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-4 w-20 ml-auto" })
|
|
9524
|
+
] })
|
|
9525
|
+
] }),
|
|
9526
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
9527
|
+
InfoSection,
|
|
9528
|
+
{
|
|
9529
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Skeleton, { className: "h-5 w-32" }),
|
|
9530
|
+
icon: import_lucide_react25.FileText,
|
|
9531
|
+
children: [
|
|
9532
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DataItem, { isSkeleton: true, label: "Loading..." }),
|
|
9533
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DataItem, { isSkeleton: true, label: "Loading..." })
|
|
9534
|
+
]
|
|
9535
|
+
},
|
|
9536
|
+
i
|
|
9537
|
+
)) })
|
|
9538
|
+
] });
|
|
9539
|
+
}
|
|
9540
|
+
if (!data) return null;
|
|
9541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-2 space-y-6", children: [
|
|
9542
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "relative overflow-hidden bg-white dark:bg-zinc-900 rounded-2xl border border-gray-100 dark:border-zinc-800", children: [
|
|
9543
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "absolute top-0 left-0 w-1.5 h-full bg-indigo-500" }),
|
|
9544
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "p-6 flex flex-wrap items-center justify-between gap-6", children: [
|
|
9545
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-5", children: [
|
|
9546
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "p-4 rounded-2xl bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react25.RefreshCw, { size: 28, strokeWidth: 1.5 }) }),
|
|
9547
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "space-y-1", children: [
|
|
9548
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
9549
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("h1", { className: "text-2xl font-black tracking-tight text-gray-900 dark:text-zinc-100", children: data.ref }),
|
|
9550
|
+
data.isDeleted && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-black uppercase tracking-wider border bg-red-50 text-red-600 border-red-200 shadow-sm shadow-red-100", children: [
|
|
9551
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react25.AlertCircle, { size: 12 }),
|
|
9552
|
+
"REVERSED"
|
|
9553
|
+
] })
|
|
9554
|
+
] }),
|
|
9555
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs font-bold text-gray-500 dark:text-zinc-400 uppercase tracking-tight truncate max-w-md", children: data.description })
|
|
9556
|
+
] })
|
|
9557
|
+
] }),
|
|
9558
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "text-right space-y-1", children: [
|
|
9559
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-3xl font-black tracking-tighter text-gray-900 dark:text-zinc-50", children: Formats_default.Price(data.amount || 0, data.currency || "USD") }),
|
|
9560
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-xs font-black uppercase tracking-[0.2em] text-indigo-500", children: "Forex Transfer" })
|
|
9561
|
+
] })
|
|
9562
|
+
] })
|
|
9563
|
+
] }),
|
|
9564
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [
|
|
9565
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(InfoSection, { title: "Transfer & Exchange", icon: import_lucide_react25.RefreshCw, children: [
|
|
9566
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DataItem, { label: "Transaction Date", value: data.date }),
|
|
9567
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DataItem, { label: "Reference ID", value: data.ref }),
|
|
9568
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9569
|
+
DataItem,
|
|
9570
|
+
{
|
|
9571
|
+
label: "Exchange Rate",
|
|
9572
|
+
value: data.exchange?.rate ? `1 ${data.exchange.currency} = ${data.exchange.rate} ${data.currency}` : "N/A",
|
|
9573
|
+
className: "col-span-full bg-indigo-50/50 dark:bg-indigo-500/5 p-3 rounded-lg border border-indigo-100 dark:border-indigo-500/20"
|
|
9574
|
+
}
|
|
9575
|
+
),
|
|
9576
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9577
|
+
DataItem,
|
|
9578
|
+
{
|
|
9579
|
+
label: "Original Amount",
|
|
9580
|
+
value: Formats_default.Price(data.amount, data.currency)
|
|
9581
|
+
}
|
|
9582
|
+
),
|
|
9583
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9584
|
+
DataItem,
|
|
9585
|
+
{
|
|
9586
|
+
label: "Exchanged Amount",
|
|
9587
|
+
value: data.exchange ? Formats_default.Price(data.exchange.amount, data.exchange.currency) : "N/A"
|
|
9588
|
+
}
|
|
9589
|
+
)
|
|
9590
|
+
] }),
|
|
9591
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(InfoSection, { title: "Source & Destination", icon: import_lucide_react25.ArrowRight, children: [
|
|
9592
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9593
|
+
DataItem,
|
|
9594
|
+
{
|
|
9595
|
+
label: "From Wallet (Source)",
|
|
9596
|
+
value: data.fromWalletData?.name || "N/A",
|
|
9597
|
+
subValue: `Currency: ${data.fromWalletData?.currency || "N/A"}`
|
|
9598
|
+
}
|
|
9599
|
+
),
|
|
9600
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9601
|
+
DataItem,
|
|
9602
|
+
{
|
|
9603
|
+
label: "To Account (Destination)",
|
|
9604
|
+
value: data.accountData?.name || "N/A",
|
|
9605
|
+
subValue: `Currency: ${data.accountData?.currency || "N/A"}`
|
|
9606
|
+
}
|
|
9607
|
+
),
|
|
9608
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9609
|
+
DataItem,
|
|
9610
|
+
{
|
|
9611
|
+
label: "Wallet Account No.",
|
|
9612
|
+
value: data.fromWalletData?.accountNo || "---"
|
|
9613
|
+
}
|
|
9614
|
+
),
|
|
9615
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9616
|
+
DataItem,
|
|
9617
|
+
{
|
|
9618
|
+
label: "Destination Type",
|
|
9619
|
+
value: data.accountData?.type || "---",
|
|
9620
|
+
className: "capitalize"
|
|
9621
|
+
}
|
|
9622
|
+
)
|
|
9623
|
+
] }),
|
|
9624
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(InfoSection, { title: "Fees & Calculations", icon: import_lucide_react25.Percent, children: [
|
|
9625
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9626
|
+
DataItem,
|
|
9627
|
+
{
|
|
9628
|
+
label: "Fee (%)",
|
|
9629
|
+
value: data.fee ? `${data.fee}%` : "0%"
|
|
9630
|
+
}
|
|
9631
|
+
),
|
|
9632
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9633
|
+
DataItem,
|
|
9634
|
+
{
|
|
9635
|
+
label: "Fee Amount",
|
|
9636
|
+
value: data.feeAmount ? Formats_default.Price(
|
|
9637
|
+
data.feeAmount - (data.exchange?.amount || 0),
|
|
9638
|
+
data.exchange?.currency || data.currency
|
|
9639
|
+
) : Formats_default.Price(0, data.exchange?.currency || data.currency)
|
|
9640
|
+
}
|
|
9641
|
+
),
|
|
9642
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9643
|
+
DataItem,
|
|
9644
|
+
{
|
|
9645
|
+
label: "Total Amount (Inc. Fee)",
|
|
9646
|
+
value: data.feeAmount ? Formats_default.Price(data.feeAmount, data.exchange?.currency || data.currency) : Formats_default.Price(data.amount, data.currency),
|
|
9647
|
+
className: "col-span-full font-bold text-gray-900 dark:text-white bg-gray-50 dark:bg-white/5 p-3 rounded-lg"
|
|
9648
|
+
}
|
|
9649
|
+
)
|
|
9650
|
+
] }),
|
|
9651
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(InfoSection, { title: "Additional Information", icon: import_lucide_react25.Calendar, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9652
|
+
DataItem,
|
|
9653
|
+
{
|
|
9654
|
+
label: "Note",
|
|
9655
|
+
value: data.note || "No additional notes provided",
|
|
9656
|
+
className: "col-span-full"
|
|
9657
|
+
}
|
|
9658
|
+
) })
|
|
9659
|
+
] }),
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-6 p-6 bg-gray-50/50 dark:bg-zinc-900/20 rounded-2xl border border-gray-100 dark:border-zinc-800", children: [
|
|
9661
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-8", children: [
|
|
9662
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
9663
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react25.Clock, { size: 16, className: "text-gray-400 dark:text-zinc-500" }),
|
|
9664
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col", children: [
|
|
9665
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-[9px] font-bold text-gray-400 dark:text-zinc-500 uppercase", children: "Date Created" }),
|
|
9666
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xs font-semibold text-gray-600 dark:text-zinc-300", children: data.createdAt ? new Date(data.createdAt).toLocaleString() : "---" })
|
|
9667
|
+
] })
|
|
9668
|
+
] }),
|
|
9669
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
9670
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react25.User, { size: 16, className: "text-gray-400 dark:text-zinc-500" }),
|
|
9671
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col", children: [
|
|
9672
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-[9px] font-bold text-gray-400 dark:text-zinc-500 uppercase", children: "Created By" }),
|
|
9673
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xs font-semibold text-gray-600 dark:text-zinc-300", children: data.by?.name || "System" })
|
|
9674
|
+
] })
|
|
9675
|
+
] })
|
|
9676
|
+
] }),
|
|
9677
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "px-4 py-2 bg-gray-100 dark:bg-zinc-800 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-[10px] font-mono text-gray-500 dark:text-zinc-400 uppercase tracking-tighter", children: [
|
|
9678
|
+
"Transaction ID: ",
|
|
9679
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-bold", children: data._id })
|
|
9680
|
+
] }) })
|
|
9681
|
+
] })
|
|
9682
|
+
] });
|
|
9683
|
+
}
|
|
9684
|
+
var ForexTransferView_default = ForexTransferView;
|
|
9685
|
+
|
|
9686
|
+
// src/components/Views/Transaction.tsx
|
|
9687
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
9473
9688
|
var Transaction = ({
|
|
9474
9689
|
id,
|
|
9475
9690
|
type,
|
|
@@ -9517,35 +9732,35 @@ var Transaction = ({
|
|
|
9517
9732
|
value: h.ref
|
|
9518
9733
|
}));
|
|
9519
9734
|
}, [data?.history]);
|
|
9520
|
-
return /* @__PURE__ */ (0,
|
|
9735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
9521
9736
|
Modal,
|
|
9522
9737
|
{
|
|
9523
9738
|
isOpen: true,
|
|
9524
9739
|
onClose: close,
|
|
9525
|
-
title: /* @__PURE__ */ (0,
|
|
9526
|
-
/* @__PURE__ */ (0,
|
|
9527
|
-
/* @__PURE__ */ (0,
|
|
9740
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center justify-between w-full ", children: [
|
|
9741
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
9742
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "capitalize", children: [
|
|
9528
9743
|
type,
|
|
9529
9744
|
" Transaction"
|
|
9530
9745
|
] }),
|
|
9531
|
-
!isLoading && data?.data?.ref && /* @__PURE__ */ (0,
|
|
9746
|
+
!isLoading && data?.data?.ref && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "text-xs font-mono bg-gray-100 dark:bg-zinc-800 px-2 py-1 rounded text-gray-500 uppercase", children: data.data.ref })
|
|
9532
9747
|
] }),
|
|
9533
|
-
reverseable?.reload && /* @__PURE__ */ (0,
|
|
9534
|
-
!isLoading && data?.data && !data.data.isDeleted && /* @__PURE__ */ (0,
|
|
9748
|
+
reverseable?.reload && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
9749
|
+
!isLoading && data?.data && !data.data.isDeleted && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9535
9750
|
import_antd6.Button,
|
|
9536
9751
|
{
|
|
9537
9752
|
danger: true,
|
|
9538
9753
|
type: "primary",
|
|
9539
9754
|
size: "small",
|
|
9540
|
-
icon: /* @__PURE__ */ (0,
|
|
9755
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react26.RotateCcw, { size: 14 }),
|
|
9541
9756
|
className: "flex items-center gap-1.5 font-bold uppercase text-[10px] px-3 transition-all hover:scale-105",
|
|
9542
9757
|
onClick: () => setShowReverseModal(true),
|
|
9543
9758
|
children: "Reverse Transaction"
|
|
9544
9759
|
}
|
|
9545
9760
|
),
|
|
9546
|
-
historyOptions.length > 1 && /* @__PURE__ */ (0,
|
|
9547
|
-
/* @__PURE__ */ (0,
|
|
9548
|
-
/* @__PURE__ */ (0,
|
|
9761
|
+
historyOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9762
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react26.History, { size: 14, className: "text-gray-400" }),
|
|
9763
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9549
9764
|
import_antd6.Select,
|
|
9550
9765
|
{
|
|
9551
9766
|
value: data?.data?.ref,
|
|
@@ -9562,27 +9777,28 @@ var Transaction = ({
|
|
|
9562
9777
|
] }),
|
|
9563
9778
|
width: 1100,
|
|
9564
9779
|
children: [
|
|
9565
|
-
!type && /* @__PURE__ */ (0,
|
|
9566
|
-
type === "journal" && /* @__PURE__ */ (0,
|
|
9567
|
-
type === "payment" && /* @__PURE__ */ (0,
|
|
9568
|
-
type === "money transfer" && /* @__PURE__ */ (0,
|
|
9569
|
-
type === "expense" && /* @__PURE__ */ (0,
|
|
9570
|
-
type === "adjustment" && /* @__PURE__ */ (0,
|
|
9571
|
-
/* @__PURE__ */ (0,
|
|
9780
|
+
!type && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { children: "No transaction type" }),
|
|
9781
|
+
type === "journal" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(JournalView_default, { data: data?.data, isLoading }),
|
|
9782
|
+
type === "payment" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PaymentView_default, { data: data?.data, isLoading }),
|
|
9783
|
+
type === "money transfer" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MoneyTransfer_default, { data: data?.data, isLoading }),
|
|
9784
|
+
type === "expense" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ExpenseView_default, { data: data?.data, isLoading }),
|
|
9785
|
+
type === "adjustment" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WalletAdjustmentView_default, { data: data?.data, isLoading }),
|
|
9786
|
+
type === "forex transfer" && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ForexTransferView_default, { data: data?.data, isLoading }),
|
|
9787
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9572
9788
|
ConfirmModal,
|
|
9573
9789
|
{
|
|
9574
9790
|
isOpen: showReverseModal,
|
|
9575
9791
|
isLoading: isActionLoading,
|
|
9576
9792
|
onClose: () => setShowReverseModal(false),
|
|
9577
9793
|
title: "Reverse Transaction",
|
|
9578
|
-
description: /* @__PURE__ */ (0,
|
|
9579
|
-
/* @__PURE__ */ (0,
|
|
9794
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "space-y-3", children: [
|
|
9795
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { children: [
|
|
9580
9796
|
"Are you sure you want to reverse",
|
|
9581
9797
|
" ",
|
|
9582
|
-
/* @__PURE__ */ (0,
|
|
9798
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-bold text-red-600 underline", children: data?.data?.ref }),
|
|
9583
9799
|
"?"
|
|
9584
9800
|
] }),
|
|
9585
|
-
/* @__PURE__ */ (0,
|
|
9801
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 p-3 rounded-lg border border-gray-100 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
9586
9802
|
] }),
|
|
9587
9803
|
confirmationWord: "reverse",
|
|
9588
9804
|
onSubmit: onReverse,
|
|
@@ -9706,7 +9922,7 @@ var useAuth = () => {
|
|
|
9706
9922
|
var useAuth_default = useAuth;
|
|
9707
9923
|
|
|
9708
9924
|
// src/components/Guard.tsx
|
|
9709
|
-
var
|
|
9925
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
9710
9926
|
var Guard = () => {
|
|
9711
9927
|
const { get } = useApis_default();
|
|
9712
9928
|
const location = (0, import_react_router_dom5.useLocation)();
|
|
@@ -9730,18 +9946,18 @@ var Guard = () => {
|
|
|
9730
9946
|
fetchProfile();
|
|
9731
9947
|
}, [location.pathname]);
|
|
9732
9948
|
if (!isFetched) {
|
|
9733
|
-
return /* @__PURE__ */ (0,
|
|
9949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(LoadingSpin, { size: "lg" }) });
|
|
9734
9950
|
}
|
|
9735
|
-
return /* @__PURE__ */ (0,
|
|
9951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Outlet, {});
|
|
9736
9952
|
};
|
|
9737
9953
|
var ProtectedRoute = () => {
|
|
9738
9954
|
const { isLoggedIn } = useAuth();
|
|
9739
9955
|
const location = (0, import_react_router_dom5.useLocation)();
|
|
9740
|
-
return isLoggedIn ? /* @__PURE__ */ (0,
|
|
9956
|
+
return isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Outlet, {}) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
9741
9957
|
};
|
|
9742
9958
|
var UnProtectedRoute = () => {
|
|
9743
9959
|
const { isLoggedIn, user } = useAuth();
|
|
9744
|
-
return !isLoggedIn ? /* @__PURE__ */ (0,
|
|
9960
|
+
return !isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Outlet, {}) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Navigate, { to: user?.homePath || "/", replace: true });
|
|
9745
9961
|
};
|
|
9746
9962
|
var AdminProtectedRoute = () => {
|
|
9747
9963
|
const { role } = useAuth();
|
|
@@ -9750,15 +9966,15 @@ var AdminProtectedRoute = () => {
|
|
|
9750
9966
|
import_antd7.message.error("Only admin can access this page");
|
|
9751
9967
|
}
|
|
9752
9968
|
}, [role]);
|
|
9753
|
-
return role && ["admin"].includes(role) ? /* @__PURE__ */ (0,
|
|
9969
|
+
return role && ["admin"].includes(role) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Outlet, {}) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_router_dom5.Navigate, { to: "/", replace: true });
|
|
9754
9970
|
};
|
|
9755
9971
|
|
|
9756
9972
|
// src/components/accounts/Accounts.tsx
|
|
9757
9973
|
var import_react_router_dom6 = require("react-router-dom");
|
|
9758
|
-
var
|
|
9974
|
+
var import_lucide_react27 = require("lucide-react");
|
|
9759
9975
|
var import_react35 = require("react");
|
|
9760
9976
|
var import_antd8 = require("antd");
|
|
9761
|
-
var
|
|
9977
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9762
9978
|
function Accounts({ v, url }) {
|
|
9763
9979
|
const { enums } = useWarqadConfig();
|
|
9764
9980
|
const { branchId } = (0, import_react_router_dom6.useParams)();
|
|
@@ -9779,17 +9995,17 @@ function Accounts({ v, url }) {
|
|
|
9779
9995
|
const items = (data2) => [
|
|
9780
9996
|
{
|
|
9781
9997
|
label: `Edit ${type}`,
|
|
9782
|
-
icon: /* @__PURE__ */ (0,
|
|
9998
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react27.FilePenLine, { size: 16 }),
|
|
9783
9999
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
9784
10000
|
},
|
|
9785
10001
|
{
|
|
9786
10002
|
label: `Delete ${type}`,
|
|
9787
|
-
icon: /* @__PURE__ */ (0,
|
|
10003
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react27.Trash2, { className: "text-red-500", size: 16 }),
|
|
9788
10004
|
onClick: () => setDeleteAccount(data2)
|
|
9789
10005
|
},
|
|
9790
10006
|
isEmployee && !data2?.user && {
|
|
9791
10007
|
label: `Link User`,
|
|
9792
|
-
icon: /* @__PURE__ */ (0,
|
|
10008
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react27.Cable, { size: 16 }),
|
|
9793
10009
|
onClick: () => navigate(`link-user?id=${data2?._id}`)
|
|
9794
10010
|
}
|
|
9795
10011
|
].filter(Boolean);
|
|
@@ -9799,7 +10015,7 @@ function Accounts({ v, url }) {
|
|
|
9799
10015
|
header: "Name",
|
|
9800
10016
|
cell: ({ row }) => {
|
|
9801
10017
|
const account = row.original;
|
|
9802
|
-
return /* @__PURE__ */ (0,
|
|
10018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9803
10019
|
"span",
|
|
9804
10020
|
{
|
|
9805
10021
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -9814,7 +10030,7 @@ function Accounts({ v, url }) {
|
|
|
9814
10030
|
header: "Sex",
|
|
9815
10031
|
cell: ({ row }) => {
|
|
9816
10032
|
const account = row.original;
|
|
9817
|
-
return /* @__PURE__ */ (0,
|
|
10033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: account?.sex || "N/A" });
|
|
9818
10034
|
}
|
|
9819
10035
|
},
|
|
9820
10036
|
{
|
|
@@ -9822,7 +10038,7 @@ function Accounts({ v, url }) {
|
|
|
9822
10038
|
header: "Email",
|
|
9823
10039
|
cell: ({ row }) => {
|
|
9824
10040
|
const account = row.original;
|
|
9825
|
-
return /* @__PURE__ */ (0,
|
|
10041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: account?.email || "N/A" });
|
|
9826
10042
|
}
|
|
9827
10043
|
},
|
|
9828
10044
|
{
|
|
@@ -9830,7 +10046,7 @@ function Accounts({ v, url }) {
|
|
|
9830
10046
|
header: "Phone",
|
|
9831
10047
|
cell: ({ row }) => {
|
|
9832
10048
|
const account = row.original;
|
|
9833
|
-
return /* @__PURE__ */ (0,
|
|
10049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: account?.phoneNumber || "N/A" });
|
|
9834
10050
|
}
|
|
9835
10051
|
},
|
|
9836
10052
|
isEmployee && {
|
|
@@ -9838,7 +10054,7 @@ function Accounts({ v, url }) {
|
|
|
9838
10054
|
header: "User",
|
|
9839
10055
|
cell: ({ row }) => {
|
|
9840
10056
|
const account = row.original;
|
|
9841
|
-
return /* @__PURE__ */ (0,
|
|
10057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Badge, { variant: account?.user ? "success" : "danger", size: "sm", children: account?.user ? "Linked" : "Not Linked" });
|
|
9842
10058
|
}
|
|
9843
10059
|
},
|
|
9844
10060
|
{
|
|
@@ -9846,13 +10062,13 @@ function Accounts({ v, url }) {
|
|
|
9846
10062
|
header: "Actions",
|
|
9847
10063
|
cell: ({ row }) => {
|
|
9848
10064
|
const data2 = row.original;
|
|
9849
|
-
return /* @__PURE__ */ (0,
|
|
10065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9850
10066
|
Dropdown,
|
|
9851
10067
|
{
|
|
9852
10068
|
className: "cursor-pointer w-[150px]",
|
|
9853
10069
|
items: items(data2),
|
|
9854
10070
|
triggerMode: "hover",
|
|
9855
|
-
children: /* @__PURE__ */ (0,
|
|
10071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react27.EllipsisVertical, {})
|
|
9856
10072
|
}
|
|
9857
10073
|
);
|
|
9858
10074
|
}
|
|
@@ -9870,9 +10086,9 @@ function Accounts({ v, url }) {
|
|
|
9870
10086
|
return error;
|
|
9871
10087
|
}
|
|
9872
10088
|
};
|
|
9873
|
-
return /* @__PURE__ */ (0,
|
|
9874
|
-
/* @__PURE__ */ (0,
|
|
9875
|
-
/* @__PURE__ */ (0,
|
|
10089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
10090
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Modal2, {}),
|
|
10091
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9876
10092
|
ConfirmModal,
|
|
9877
10093
|
{
|
|
9878
10094
|
isOpen: !!deleteAccount,
|
|
@@ -9885,7 +10101,7 @@ function Accounts({ v, url }) {
|
|
|
9885
10101
|
children: null
|
|
9886
10102
|
}
|
|
9887
10103
|
),
|
|
9888
|
-
/* @__PURE__ */ (0,
|
|
10104
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9889
10105
|
TransactionViewComponent,
|
|
9890
10106
|
{
|
|
9891
10107
|
columns,
|
|
@@ -9946,7 +10162,7 @@ var import_react37 = require("react");
|
|
|
9946
10162
|
|
|
9947
10163
|
// src/hooks/useAccountBalance.tsx
|
|
9948
10164
|
var import_react36 = require("react");
|
|
9949
|
-
var
|
|
10165
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
9950
10166
|
var useAccountbalance = ({
|
|
9951
10167
|
url,
|
|
9952
10168
|
showBalance,
|
|
@@ -9980,15 +10196,15 @@ var useAccountbalance = ({
|
|
|
9980
10196
|
return null;
|
|
9981
10197
|
}
|
|
9982
10198
|
if (isLoading) {
|
|
9983
|
-
return /* @__PURE__ */ (0,
|
|
10199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h2", { className: "text-gray-500", children: "Getting Balance..." });
|
|
9984
10200
|
}
|
|
9985
10201
|
if (error) {
|
|
9986
|
-
return /* @__PURE__ */ (0,
|
|
10202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("h2", { className: "text-red-500", children: [
|
|
9987
10203
|
"Error: ",
|
|
9988
10204
|
error
|
|
9989
10205
|
] });
|
|
9990
10206
|
}
|
|
9991
|
-
return /* @__PURE__ */ (0,
|
|
10207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9992
10208
|
"h2",
|
|
9993
10209
|
{
|
|
9994
10210
|
className: `${balance.startsWith("-") ? "text-red-500" : "text-green-500"}`,
|
|
@@ -10005,7 +10221,7 @@ var useAccountBalance_default = useAccountbalance;
|
|
|
10005
10221
|
|
|
10006
10222
|
// src/components/accounts/Feilds/Account.tsx
|
|
10007
10223
|
var import_react_router_dom8 = require("react-router-dom");
|
|
10008
|
-
var
|
|
10224
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10009
10225
|
function Account({
|
|
10010
10226
|
name,
|
|
10011
10227
|
label,
|
|
@@ -10027,8 +10243,8 @@ function Account({
|
|
|
10027
10243
|
showBalance,
|
|
10028
10244
|
accountId
|
|
10029
10245
|
});
|
|
10030
|
-
return /* @__PURE__ */ (0,
|
|
10031
|
-
/* @__PURE__ */ (0,
|
|
10246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
10247
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10032
10248
|
Fields_default.SearchApi,
|
|
10033
10249
|
{
|
|
10034
10250
|
name,
|
|
@@ -10046,13 +10262,13 @@ function Account({
|
|
|
10046
10262
|
obj
|
|
10047
10263
|
}
|
|
10048
10264
|
),
|
|
10049
|
-
/* @__PURE__ */ (0,
|
|
10265
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(BalanceView, {})
|
|
10050
10266
|
] });
|
|
10051
10267
|
}
|
|
10052
10268
|
var Account_default = Account;
|
|
10053
10269
|
|
|
10054
10270
|
// src/components/accounts/Feilds/Customers.tsx
|
|
10055
|
-
var
|
|
10271
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10056
10272
|
function Customer({
|
|
10057
10273
|
name = "customer",
|
|
10058
10274
|
label = "Customer",
|
|
@@ -10066,7 +10282,7 @@ function Customer({
|
|
|
10066
10282
|
v,
|
|
10067
10283
|
obj
|
|
10068
10284
|
}) {
|
|
10069
|
-
return /* @__PURE__ */ (0,
|
|
10285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10070
10286
|
Account_default,
|
|
10071
10287
|
{
|
|
10072
10288
|
name,
|
|
@@ -10086,7 +10302,7 @@ function Customer({
|
|
|
10086
10302
|
var Customers_default = Customer;
|
|
10087
10303
|
|
|
10088
10304
|
// src/components/accounts/Feilds/Employee.tsx
|
|
10089
|
-
var
|
|
10305
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10090
10306
|
function Employee({
|
|
10091
10307
|
name = "employee",
|
|
10092
10308
|
label = "Employee",
|
|
@@ -10100,7 +10316,7 @@ function Employee({
|
|
|
10100
10316
|
obj,
|
|
10101
10317
|
v
|
|
10102
10318
|
}) {
|
|
10103
|
-
return /* @__PURE__ */ (0,
|
|
10319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10104
10320
|
Account_default,
|
|
10105
10321
|
{
|
|
10106
10322
|
name,
|
|
@@ -10120,7 +10336,7 @@ function Employee({
|
|
|
10120
10336
|
var Employee_default = Employee;
|
|
10121
10337
|
|
|
10122
10338
|
// src/components/accounts/Feilds/Branches.tsx
|
|
10123
|
-
var
|
|
10339
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
10124
10340
|
function Branches({
|
|
10125
10341
|
name = "branch",
|
|
10126
10342
|
label = "Branch",
|
|
@@ -10133,7 +10349,7 @@ function Branches({
|
|
|
10133
10349
|
v,
|
|
10134
10350
|
disabled
|
|
10135
10351
|
}) {
|
|
10136
|
-
return /* @__PURE__ */ (0,
|
|
10352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10137
10353
|
Account_default,
|
|
10138
10354
|
{
|
|
10139
10355
|
name,
|
|
@@ -10162,7 +10378,7 @@ var Feilds_default = AccountFields;
|
|
|
10162
10378
|
|
|
10163
10379
|
// src/components/accounts/AccountForm.tsx
|
|
10164
10380
|
var import_react_router_dom9 = require("react-router-dom");
|
|
10165
|
-
var
|
|
10381
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
10166
10382
|
function AccountForm() {
|
|
10167
10383
|
const { enums } = useWarqadConfig();
|
|
10168
10384
|
const { branchId } = (0, import_react_router_dom9.useParams)();
|
|
@@ -10227,24 +10443,24 @@ function AccountForm() {
|
|
|
10227
10443
|
fetches();
|
|
10228
10444
|
}
|
|
10229
10445
|
}, [id]);
|
|
10230
|
-
return /* @__PURE__ */ (0,
|
|
10446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10231
10447
|
Card,
|
|
10232
10448
|
{
|
|
10233
10449
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
10234
10450
|
isLoading: isLoadingGet,
|
|
10235
10451
|
loadingText: "Processing...",
|
|
10236
10452
|
children: [
|
|
10237
|
-
/* @__PURE__ */ (0,
|
|
10238
|
-
/* @__PURE__ */ (0,
|
|
10239
|
-
/* @__PURE__ */ (0,
|
|
10453
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Card.Header, { children: [
|
|
10454
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
10455
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
10240
10456
|
] }),
|
|
10241
|
-
/* @__PURE__ */ (0,
|
|
10457
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
10242
10458
|
"form",
|
|
10243
10459
|
{
|
|
10244
10460
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
10245
10461
|
children: [
|
|
10246
|
-
/* @__PURE__ */ (0,
|
|
10247
|
-
/* @__PURE__ */ (0,
|
|
10462
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
10463
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10248
10464
|
Fields_default.Input,
|
|
10249
10465
|
{
|
|
10250
10466
|
label: "Name",
|
|
@@ -10255,7 +10471,7 @@ function AccountForm() {
|
|
|
10255
10471
|
required: true
|
|
10256
10472
|
}
|
|
10257
10473
|
),
|
|
10258
|
-
/* @__PURE__ */ (0,
|
|
10474
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10259
10475
|
Fields_default.Select,
|
|
10260
10476
|
{
|
|
10261
10477
|
label: "Sex",
|
|
@@ -10264,7 +10480,7 @@ function AccountForm() {
|
|
|
10264
10480
|
enumName: "sex"
|
|
10265
10481
|
}
|
|
10266
10482
|
),
|
|
10267
|
-
/* @__PURE__ */ (0,
|
|
10483
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10268
10484
|
Fields_default.Input,
|
|
10269
10485
|
{
|
|
10270
10486
|
label: "Email",
|
|
@@ -10274,7 +10490,7 @@ function AccountForm() {
|
|
|
10274
10490
|
placeholder: "e.g maoo@exapmle.com"
|
|
10275
10491
|
}
|
|
10276
10492
|
),
|
|
10277
|
-
/* @__PURE__ */ (0,
|
|
10493
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10278
10494
|
Fields_default.PhoneInput,
|
|
10279
10495
|
{
|
|
10280
10496
|
label: "Phone Number",
|
|
@@ -10283,7 +10499,7 @@ function AccountForm() {
|
|
|
10283
10499
|
placeholder: "Enter phone number"
|
|
10284
10500
|
}
|
|
10285
10501
|
),
|
|
10286
|
-
!branchId && /* @__PURE__ */ (0,
|
|
10502
|
+
!branchId && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10287
10503
|
Feilds_default.Branches,
|
|
10288
10504
|
{
|
|
10289
10505
|
label: "Branch",
|
|
@@ -10293,7 +10509,7 @@ function AccountForm() {
|
|
|
10293
10509
|
api: "/branches/get?noStore=true"
|
|
10294
10510
|
}
|
|
10295
10511
|
),
|
|
10296
|
-
/* @__PURE__ */ (0,
|
|
10512
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10297
10513
|
Fields_default.Select,
|
|
10298
10514
|
{
|
|
10299
10515
|
label: "Currency",
|
|
@@ -10303,7 +10519,7 @@ function AccountForm() {
|
|
|
10303
10519
|
}
|
|
10304
10520
|
)
|
|
10305
10521
|
] }),
|
|
10306
|
-
/* @__PURE__ */ (0,
|
|
10522
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
10307
10523
|
Button,
|
|
10308
10524
|
{
|
|
10309
10525
|
isLoading,
|
|
@@ -10362,7 +10578,7 @@ var import_react_hook_form9 = require("react-hook-form");
|
|
|
10362
10578
|
var import_zod5 = require("@hookform/resolvers/zod");
|
|
10363
10579
|
var import_antd10 = require("antd");
|
|
10364
10580
|
var import_react38 = require("react");
|
|
10365
|
-
var
|
|
10581
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10366
10582
|
function LinkUser({ type: initialType = "employee" }) {
|
|
10367
10583
|
const { getQuery, navigate, getParams } = useApp_default();
|
|
10368
10584
|
const id = getQuery("id");
|
|
@@ -10418,26 +10634,26 @@ function LinkUser({ type: initialType = "employee" }) {
|
|
|
10418
10634
|
navigate(-1);
|
|
10419
10635
|
}
|
|
10420
10636
|
}, [id]);
|
|
10421
|
-
return /* @__PURE__ */ (0,
|
|
10637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
10422
10638
|
Card,
|
|
10423
10639
|
{
|
|
10424
10640
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
10425
10641
|
isLoading: isLoadingGet,
|
|
10426
10642
|
loadingText: "Processing...",
|
|
10427
10643
|
children: [
|
|
10428
|
-
/* @__PURE__ */ (0,
|
|
10429
|
-
/* @__PURE__ */ (0,
|
|
10430
|
-
/* @__PURE__ */ (0,
|
|
10644
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Card.Header, { children: [
|
|
10645
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Card.Title, { children: `Link User ` }),
|
|
10646
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Card.Description, { children: "Link User Employee and add it to your list" })
|
|
10431
10647
|
] }),
|
|
10432
|
-
/* @__PURE__ */ (0,
|
|
10648
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
10433
10649
|
"form",
|
|
10434
10650
|
{
|
|
10435
10651
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
10436
10652
|
className: "space-y-4",
|
|
10437
10653
|
children: [
|
|
10438
|
-
/* @__PURE__ */ (0,
|
|
10654
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
10439
10655
|
" ",
|
|
10440
|
-
/* @__PURE__ */ (0,
|
|
10656
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
10441
10657
|
Fields_default.Input,
|
|
10442
10658
|
{
|
|
10443
10659
|
label: "Name",
|
|
@@ -10448,7 +10664,7 @@ function LinkUser({ type: initialType = "employee" }) {
|
|
|
10448
10664
|
disabled: true
|
|
10449
10665
|
}
|
|
10450
10666
|
),
|
|
10451
|
-
/* @__PURE__ */ (0,
|
|
10667
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
10452
10668
|
Fields_default.Input,
|
|
10453
10669
|
{
|
|
10454
10670
|
label: "Email",
|
|
@@ -10459,7 +10675,7 @@ function LinkUser({ type: initialType = "employee" }) {
|
|
|
10459
10675
|
required: true
|
|
10460
10676
|
}
|
|
10461
10677
|
),
|
|
10462
|
-
/* @__PURE__ */ (0,
|
|
10678
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
10463
10679
|
Fields_default.Select,
|
|
10464
10680
|
{
|
|
10465
10681
|
label: "Role",
|
|
@@ -10470,7 +10686,7 @@ function LinkUser({ type: initialType = "employee" }) {
|
|
|
10470
10686
|
}
|
|
10471
10687
|
)
|
|
10472
10688
|
] }),
|
|
10473
|
-
/* @__PURE__ */ (0,
|
|
10689
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
10474
10690
|
Button,
|
|
10475
10691
|
{
|
|
10476
10692
|
isLoading,
|
|
@@ -10492,14 +10708,14 @@ var linkUser_default = LinkUser;
|
|
|
10492
10708
|
|
|
10493
10709
|
// src/components/users/users.tsx
|
|
10494
10710
|
var import_react42 = require("react");
|
|
10495
|
-
var
|
|
10711
|
+
var import_lucide_react28 = require("lucide-react");
|
|
10496
10712
|
|
|
10497
10713
|
// src/components/users/VerifyEmailForm.tsx
|
|
10498
10714
|
var import_react_hook_form10 = require("react-hook-form");
|
|
10499
10715
|
var import_zod6 = require("@hookform/resolvers/zod");
|
|
10500
10716
|
var import_antd11 = require("antd");
|
|
10501
10717
|
var import_react39 = require("react");
|
|
10502
|
-
var
|
|
10718
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10503
10719
|
var { Countdown } = import_antd11.Statistic;
|
|
10504
10720
|
function VerifyEmailForm({
|
|
10505
10721
|
data,
|
|
@@ -10567,9 +10783,9 @@ function VerifyEmailForm({
|
|
|
10567
10783
|
import_antd11.message.error(error?.message || "Something went wrong");
|
|
10568
10784
|
}
|
|
10569
10785
|
};
|
|
10570
|
-
return /* @__PURE__ */ (0,
|
|
10571
|
-
/* @__PURE__ */ (0,
|
|
10572
|
-
oldEmail && /* @__PURE__ */ (0,
|
|
10786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("form", { onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)), children: [
|
|
10787
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "space-y-2", children: [
|
|
10788
|
+
oldEmail && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "border-b-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10573
10789
|
Fields_default.Input,
|
|
10574
10790
|
{
|
|
10575
10791
|
label: "Current Email",
|
|
@@ -10579,7 +10795,7 @@ function VerifyEmailForm({
|
|
|
10579
10795
|
disabled: true
|
|
10580
10796
|
}
|
|
10581
10797
|
) }),
|
|
10582
|
-
/* @__PURE__ */ (0,
|
|
10798
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10583
10799
|
Fields_default.Input,
|
|
10584
10800
|
{
|
|
10585
10801
|
label: "New Email",
|
|
@@ -10590,7 +10806,7 @@ function VerifyEmailForm({
|
|
|
10590
10806
|
disabled: true
|
|
10591
10807
|
}
|
|
10592
10808
|
),
|
|
10593
|
-
/* @__PURE__ */ (0,
|
|
10809
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10594
10810
|
Fields_default.Input,
|
|
10595
10811
|
{
|
|
10596
10812
|
label: "Token",
|
|
@@ -10601,19 +10817,19 @@ function VerifyEmailForm({
|
|
|
10601
10817
|
}
|
|
10602
10818
|
)
|
|
10603
10819
|
] }),
|
|
10604
|
-
/* @__PURE__ */ (0,
|
|
10605
|
-
/* @__PURE__ */ (0,
|
|
10820
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
10821
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("h1", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
|
|
10606
10822
|
"Didn't receive a verification token or expired?",
|
|
10607
10823
|
" "
|
|
10608
10824
|
] }),
|
|
10609
|
-
hasPassed || !threeMinutesLater ? /* @__PURE__ */ (0,
|
|
10825
|
+
hasPassed || !threeMinutesLater ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10610
10826
|
"span",
|
|
10611
10827
|
{
|
|
10612
10828
|
onClick: resend,
|
|
10613
10829
|
className: "text-blue-600 cursor-pointer underline text-sm",
|
|
10614
10830
|
children: "Resend"
|
|
10615
10831
|
}
|
|
10616
|
-
) : /* @__PURE__ */ (0,
|
|
10832
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-blue-600 cursor-pointer underline text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10617
10833
|
Countdown,
|
|
10618
10834
|
{
|
|
10619
10835
|
styles: { content: { fontSize: 14, color: "#3b82f6" } },
|
|
@@ -10623,7 +10839,7 @@ function VerifyEmailForm({
|
|
|
10623
10839
|
threeMinutesLater
|
|
10624
10840
|
) })
|
|
10625
10841
|
] }),
|
|
10626
|
-
/* @__PURE__ */ (0,
|
|
10842
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
10627
10843
|
Button,
|
|
10628
10844
|
{
|
|
10629
10845
|
isLoading,
|
|
@@ -10641,7 +10857,7 @@ var VerifyEmailForm_default = VerifyEmailForm;
|
|
|
10641
10857
|
var import_react_hook_form11 = require("react-hook-form");
|
|
10642
10858
|
var import_zod7 = require("@hookform/resolvers/zod");
|
|
10643
10859
|
var import_antd12 = require("antd");
|
|
10644
|
-
var
|
|
10860
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10645
10861
|
function UpdateEmailForm({
|
|
10646
10862
|
data,
|
|
10647
10863
|
close,
|
|
@@ -10674,9 +10890,9 @@ function UpdateEmailForm({
|
|
|
10674
10890
|
import_antd12.message.error(error?.message || "Something went wrong");
|
|
10675
10891
|
}
|
|
10676
10892
|
};
|
|
10677
|
-
return /* @__PURE__ */ (0,
|
|
10678
|
-
/* @__PURE__ */ (0,
|
|
10679
|
-
/* @__PURE__ */ (0,
|
|
10893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [
|
|
10894
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "space-y-4", children: [
|
|
10895
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10680
10896
|
Fields_default.Input,
|
|
10681
10897
|
{
|
|
10682
10898
|
label: "Current Email",
|
|
@@ -10685,7 +10901,7 @@ function UpdateEmailForm({
|
|
|
10685
10901
|
disabled: true
|
|
10686
10902
|
}
|
|
10687
10903
|
),
|
|
10688
|
-
/* @__PURE__ */ (0,
|
|
10904
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10689
10905
|
Fields_default.Input,
|
|
10690
10906
|
{
|
|
10691
10907
|
label: "New Email Address",
|
|
@@ -10696,10 +10912,10 @@ function UpdateEmailForm({
|
|
|
10696
10912
|
required: true
|
|
10697
10913
|
}
|
|
10698
10914
|
),
|
|
10699
|
-
/* @__PURE__ */ (0,
|
|
10915
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-blue-50 dark:bg-blue-900/10 border-l-4 border-blue-400 p-3 rounded", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-blue-700 dark:text-blue-400", children: "Note: You will need to verify the new email address before it becomes primary." }) })
|
|
10700
10916
|
] }),
|
|
10701
|
-
/* @__PURE__ */ (0,
|
|
10702
|
-
/* @__PURE__ */ (0,
|
|
10917
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("footer", { className: "flex justify-end mt-6 gap-3", children: [
|
|
10918
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10703
10919
|
Button,
|
|
10704
10920
|
{
|
|
10705
10921
|
type: "button",
|
|
@@ -10709,7 +10925,7 @@ function UpdateEmailForm({
|
|
|
10709
10925
|
children: "Cancel"
|
|
10710
10926
|
}
|
|
10711
10927
|
),
|
|
10712
|
-
/* @__PURE__ */ (0,
|
|
10928
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10713
10929
|
Button,
|
|
10714
10930
|
{
|
|
10715
10931
|
isLoading,
|
|
@@ -10728,7 +10944,7 @@ var UpdateEmailForm_default = UpdateEmailForm;
|
|
|
10728
10944
|
var import_react_hook_form12 = require("react-hook-form");
|
|
10729
10945
|
var import_antd13 = require("antd");
|
|
10730
10946
|
var import_react40 = require("react");
|
|
10731
|
-
var
|
|
10947
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10732
10948
|
var { Countdown: Countdown2 } = import_antd13.Statistic;
|
|
10733
10949
|
function ResetPasswordForm({
|
|
10734
10950
|
data,
|
|
@@ -10783,9 +10999,9 @@ function ResetPasswordForm({
|
|
|
10783
10999
|
import_antd13.message.error(error?.message || "Something went wrong");
|
|
10784
11000
|
}
|
|
10785
11001
|
};
|
|
10786
|
-
return /* @__PURE__ */ (0,
|
|
10787
|
-
/* @__PURE__ */ (0,
|
|
10788
|
-
/* @__PURE__ */ (0,
|
|
11002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [
|
|
11003
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "space-y-4", children: [
|
|
11004
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "border-b-2 pb-4 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10789
11005
|
Fields_default.Input,
|
|
10790
11006
|
{
|
|
10791
11007
|
label: "Target Email",
|
|
@@ -10794,10 +11010,10 @@ function ResetPasswordForm({
|
|
|
10794
11010
|
disabled: true
|
|
10795
11011
|
}
|
|
10796
11012
|
) }),
|
|
10797
|
-
/* @__PURE__ */ (0,
|
|
10798
|
-
!hasPassed && threeMinutesLater && /* @__PURE__ */ (0,
|
|
10799
|
-
/* @__PURE__ */ (0,
|
|
10800
|
-
/* @__PURE__ */ (0,
|
|
11013
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "bg-orange-50 dark:bg-orange-900/10 border-l-4 border-orange-400 p-4 rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-sm text-orange-700 dark:text-orange-300", children: "Click context below to send a secure password reset link to this user." }) }),
|
|
11014
|
+
!hasPassed && threeMinutesLater && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-2 mt-2 bg-blue-50 dark:bg-blue-900/10 p-2 rounded-lg", children: [
|
|
11015
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs text-blue-600 dark:text-blue-400 font-medium", children: "You can request another link in:" }),
|
|
11016
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-blue-600 font-bold text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10801
11017
|
Countdown2,
|
|
10802
11018
|
{
|
|
10803
11019
|
styles: { content: { fontSize: 12, color: "#3b82f6" } },
|
|
@@ -10808,8 +11024,8 @@ function ResetPasswordForm({
|
|
|
10808
11024
|
) })
|
|
10809
11025
|
] })
|
|
10810
11026
|
] }),
|
|
10811
|
-
/* @__PURE__ */ (0,
|
|
10812
|
-
/* @__PURE__ */ (0,
|
|
11027
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("footer", { className: "flex justify-end mt-8 gap-3", children: [
|
|
11028
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10813
11029
|
Button,
|
|
10814
11030
|
{
|
|
10815
11031
|
type: "button",
|
|
@@ -10819,7 +11035,7 @@ function ResetPasswordForm({
|
|
|
10819
11035
|
children: "Cancel"
|
|
10820
11036
|
}
|
|
10821
11037
|
),
|
|
10822
|
-
/* @__PURE__ */ (0,
|
|
11038
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10823
11039
|
Button,
|
|
10824
11040
|
{
|
|
10825
11041
|
isLoading,
|
|
@@ -10837,11 +11053,11 @@ var ResetPasswordForm_default = ResetPasswordForm;
|
|
|
10837
11053
|
// src/components/users/Activate.tsx
|
|
10838
11054
|
var import_antd14 = require("antd");
|
|
10839
11055
|
var import_react41 = require("react");
|
|
10840
|
-
var
|
|
11056
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10841
11057
|
var ActivateUser = ({ data }) => {
|
|
10842
11058
|
const [checked, setChecked] = (0, import_react41.useState)(data?.isActive);
|
|
10843
11059
|
const { put, isLoading } = useApis_default();
|
|
10844
|
-
return /* @__PURE__ */ (0,
|
|
11060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10845
11061
|
import_antd14.Switch,
|
|
10846
11062
|
{
|
|
10847
11063
|
onChange: async (e) => {
|
|
@@ -10869,7 +11085,7 @@ var Activate_default = ActivateUser;
|
|
|
10869
11085
|
|
|
10870
11086
|
// src/components/users/users.tsx
|
|
10871
11087
|
var import_react_router_dom10 = require("react-router-dom");
|
|
10872
|
-
var
|
|
11088
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10873
11089
|
function Users() {
|
|
10874
11090
|
const navigate = (0, import_react_router_dom10.useNavigate)();
|
|
10875
11091
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
@@ -10881,11 +11097,11 @@ function Users() {
|
|
|
10881
11097
|
const items = (data2) => [
|
|
10882
11098
|
{
|
|
10883
11099
|
label: `Reset Password`,
|
|
10884
|
-
icon: /* @__PURE__ */ (0,
|
|
11100
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react28.Key, { size: 16 }),
|
|
10885
11101
|
onClick: () => openState({
|
|
10886
11102
|
title: "Request Password Reset",
|
|
10887
11103
|
type: "form",
|
|
10888
|
-
content: /* @__PURE__ */ (0,
|
|
11104
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10889
11105
|
ResetPasswordForm_default,
|
|
10890
11106
|
{
|
|
10891
11107
|
data: data2,
|
|
@@ -10898,11 +11114,11 @@ function Users() {
|
|
|
10898
11114
|
},
|
|
10899
11115
|
{
|
|
10900
11116
|
label: `Update Email`,
|
|
10901
|
-
icon: /* @__PURE__ */ (0,
|
|
11117
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react28.Mail, { size: 16 }),
|
|
10902
11118
|
onClick: () => openState({
|
|
10903
11119
|
title: "Update Email Address",
|
|
10904
11120
|
type: "form",
|
|
10905
|
-
content: /* @__PURE__ */ (0,
|
|
11121
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10906
11122
|
UpdateEmailForm_default,
|
|
10907
11123
|
{
|
|
10908
11124
|
data: data2,
|
|
@@ -10915,11 +11131,11 @@ function Users() {
|
|
|
10915
11131
|
},
|
|
10916
11132
|
data2?.emailVerification && {
|
|
10917
11133
|
label: `Verify Email`,
|
|
10918
|
-
icon: /* @__PURE__ */ (0,
|
|
11134
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react28.ShieldCheck, {}),
|
|
10919
11135
|
onClick: () => openState({
|
|
10920
11136
|
title: "Verify Email",
|
|
10921
11137
|
type: "form",
|
|
10922
|
-
content: /* @__PURE__ */ (0,
|
|
11138
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10923
11139
|
VerifyEmailForm_default,
|
|
10924
11140
|
{
|
|
10925
11141
|
data: data2,
|
|
@@ -10940,16 +11156,16 @@ function Users() {
|
|
|
10940
11156
|
const data2 = row.original;
|
|
10941
11157
|
const emailVerification = data2?.emailVerification;
|
|
10942
11158
|
const newEmail = emailVerification?.email !== data2?.email ? emailVerification?.email : null;
|
|
10943
|
-
return /* @__PURE__ */ (0,
|
|
10944
|
-
/* @__PURE__ */ (0,
|
|
11159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "space-y-1", children: [
|
|
11160
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "flex items-center gap-2", children: [
|
|
10945
11161
|
" ",
|
|
10946
|
-
/* @__PURE__ */ (0,
|
|
10947
|
-
data2?.isEmailVerified && /* @__PURE__ */ (0,
|
|
10948
|
-
!data2?.isEmailVerified && /* @__PURE__ */ (0,
|
|
11162
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { children: data2?.email }),
|
|
11163
|
+
data2?.isEmailVerified && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Badge, { variant: "success", size: "sm", children: "Verified" }),
|
|
11164
|
+
!data2?.isEmailVerified && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Badge, { variant: "warning", size: "sm", children: "Not Verified" })
|
|
10949
11165
|
] }),
|
|
10950
|
-
newEmail && /* @__PURE__ */ (0,
|
|
10951
|
-
/* @__PURE__ */ (0,
|
|
10952
|
-
/* @__PURE__ */ (0,
|
|
11166
|
+
newEmail && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "flex items-center gap-2", children: [
|
|
11167
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react28.Info, { size: 16, className: "text-orange-600" }),
|
|
11168
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { children: newEmail })
|
|
10953
11169
|
] })
|
|
10954
11170
|
] });
|
|
10955
11171
|
}
|
|
@@ -10959,7 +11175,7 @@ function Users() {
|
|
|
10959
11175
|
header: "Role",
|
|
10960
11176
|
cell: ({ row }) => {
|
|
10961
11177
|
const data2 = row.original;
|
|
10962
|
-
return /* @__PURE__ */ (0,
|
|
11178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10963
11179
|
Badge,
|
|
10964
11180
|
{
|
|
10965
11181
|
variant: data2?.role === "admin" ? "primary" : "warning",
|
|
@@ -10974,7 +11190,7 @@ function Users() {
|
|
|
10974
11190
|
header: "Employee Name",
|
|
10975
11191
|
cell: ({ row }) => {
|
|
10976
11192
|
const account = row.original?.account;
|
|
10977
|
-
return /* @__PURE__ */ (0,
|
|
11193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: account?.name || "N/A" });
|
|
10978
11194
|
}
|
|
10979
11195
|
},
|
|
10980
11196
|
{
|
|
@@ -10982,7 +11198,7 @@ function Users() {
|
|
|
10982
11198
|
header: "Status",
|
|
10983
11199
|
cell: ({ row }) => {
|
|
10984
11200
|
const data2 = row.original;
|
|
10985
|
-
return /* @__PURE__ */ (0,
|
|
11201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Activate_default, { data: data2 });
|
|
10986
11202
|
}
|
|
10987
11203
|
},
|
|
10988
11204
|
{
|
|
@@ -10990,13 +11206,13 @@ function Users() {
|
|
|
10990
11206
|
header: "Actions",
|
|
10991
11207
|
cell: ({ row }) => {
|
|
10992
11208
|
const data2 = row.original;
|
|
10993
|
-
return /* @__PURE__ */ (0,
|
|
11209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10994
11210
|
Dropdown,
|
|
10995
11211
|
{
|
|
10996
11212
|
className: "w-fit! cursor-pointer",
|
|
10997
11213
|
items: items(data2),
|
|
10998
11214
|
triggerMode: "hover",
|
|
10999
|
-
children: /* @__PURE__ */ (0,
|
|
11215
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react28.EllipsisVertical, {})
|
|
11000
11216
|
}
|
|
11001
11217
|
);
|
|
11002
11218
|
}
|
|
@@ -11005,9 +11221,9 @@ function Users() {
|
|
|
11005
11221
|
[items]
|
|
11006
11222
|
);
|
|
11007
11223
|
const users = data?.data || [];
|
|
11008
|
-
return /* @__PURE__ */ (0,
|
|
11009
|
-
/* @__PURE__ */ (0,
|
|
11010
|
-
/* @__PURE__ */ (0,
|
|
11224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
11225
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Modal2, {}),
|
|
11226
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
11011
11227
|
TransactionViewComponent,
|
|
11012
11228
|
{
|
|
11013
11229
|
columns,
|
|
@@ -11028,7 +11244,7 @@ var users_default = Users;
|
|
|
11028
11244
|
var import_react_hook_form13 = require("react-hook-form");
|
|
11029
11245
|
var import_zod8 = require("@hookform/resolvers/zod");
|
|
11030
11246
|
var import_antd15 = require("antd");
|
|
11031
|
-
var
|
|
11247
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
11032
11248
|
function UserForm() {
|
|
11033
11249
|
const { navigate } = useApp_default();
|
|
11034
11250
|
const { post, isLoading } = useApis_default();
|
|
@@ -11053,14 +11269,14 @@ function UserForm() {
|
|
|
11053
11269
|
import_antd15.message.error(error?.message || "Something went wrong");
|
|
11054
11270
|
}
|
|
11055
11271
|
};
|
|
11056
|
-
return /* @__PURE__ */ (0,
|
|
11057
|
-
/* @__PURE__ */ (0,
|
|
11058
|
-
/* @__PURE__ */ (0,
|
|
11059
|
-
/* @__PURE__ */ (0,
|
|
11272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Card, { className: "max-w-xl mx-auto mt-10 relative", children: [
|
|
11273
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Card.Header, { children: [
|
|
11274
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Card.Title, { children: "Add User" }),
|
|
11275
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Card.Description, { children: "Create a new user by providing their email and phone number." })
|
|
11060
11276
|
] }),
|
|
11061
|
-
/* @__PURE__ */ (0,
|
|
11062
|
-
/* @__PURE__ */ (0,
|
|
11063
|
-
/* @__PURE__ */ (0,
|
|
11277
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [
|
|
11278
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "space-y-4", children: [
|
|
11279
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11064
11280
|
Fields_default.Input,
|
|
11065
11281
|
{
|
|
11066
11282
|
label: "Email",
|
|
@@ -11071,7 +11287,7 @@ function UserForm() {
|
|
|
11071
11287
|
required: true
|
|
11072
11288
|
}
|
|
11073
11289
|
),
|
|
11074
|
-
/* @__PURE__ */ (0,
|
|
11290
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11075
11291
|
Fields_default.PhoneInput,
|
|
11076
11292
|
{
|
|
11077
11293
|
label: "Phone Number",
|
|
@@ -11080,7 +11296,7 @@ function UserForm() {
|
|
|
11080
11296
|
placeholder: "Enter phone number"
|
|
11081
11297
|
}
|
|
11082
11298
|
),
|
|
11083
|
-
/* @__PURE__ */ (0,
|
|
11299
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11084
11300
|
Fields_default.Select,
|
|
11085
11301
|
{
|
|
11086
11302
|
label: "Role",
|
|
@@ -11091,7 +11307,7 @@ function UserForm() {
|
|
|
11091
11307
|
}
|
|
11092
11308
|
)
|
|
11093
11309
|
] }),
|
|
11094
|
-
/* @__PURE__ */ (0,
|
|
11310
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("footer", { className: "flex justify-end mt-6", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11095
11311
|
Button,
|
|
11096
11312
|
{
|
|
11097
11313
|
isLoading,
|
|
@@ -11109,12 +11325,12 @@ var UserForm_default = UserForm;
|
|
|
11109
11325
|
// src/components/users/ResetPasswordPage.tsx
|
|
11110
11326
|
var import_react43 = require("react");
|
|
11111
11327
|
var import_react_router_dom11 = require("react-router-dom");
|
|
11112
|
-
var
|
|
11328
|
+
var import_lucide_react29 = require("lucide-react");
|
|
11113
11329
|
var import_react_hook_form14 = require("react-hook-form");
|
|
11114
11330
|
var import_zod9 = require("@hookform/resolvers/zod");
|
|
11115
11331
|
var z4 = __toESM(require("zod"));
|
|
11116
11332
|
var import_antd16 = require("antd");
|
|
11117
|
-
var
|
|
11333
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11118
11334
|
var resetPageSchema = z4.object({
|
|
11119
11335
|
password: z4.string().min(6, "Password must be at least 6 characters"),
|
|
11120
11336
|
confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
|
|
@@ -11180,14 +11396,14 @@ function ResetPasswordPage() {
|
|
|
11180
11396
|
}
|
|
11181
11397
|
};
|
|
11182
11398
|
if (verifying) {
|
|
11183
|
-
return /* @__PURE__ */ (0,
|
|
11184
|
-
/* @__PURE__ */ (0,
|
|
11185
|
-
/* @__PURE__ */ (0,
|
|
11399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "h-screen w-full flex items-center justify-center bg-slate-50 dark:bg-[#0A0B10]", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "text-center space-y-4", children: [
|
|
11400
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_antd16.Spin, { size: "large" }),
|
|
11401
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
|
|
11186
11402
|
] }) });
|
|
11187
11403
|
}
|
|
11188
|
-
return /* @__PURE__ */ (0,
|
|
11189
|
-
/* @__PURE__ */ (0,
|
|
11190
|
-
/* @__PURE__ */ (0,
|
|
11404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
|
|
11405
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
|
|
11406
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11191
11407
|
"div",
|
|
11192
11408
|
{
|
|
11193
11409
|
className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
|
|
@@ -11196,35 +11412,35 @@ function ResetPasswordPage() {
|
|
|
11196
11412
|
}
|
|
11197
11413
|
}
|
|
11198
11414
|
),
|
|
11199
|
-
/* @__PURE__ */ (0,
|
|
11200
|
-
/* @__PURE__ */ (0,
|
|
11201
|
-
/* @__PURE__ */ (0,
|
|
11202
|
-
/* @__PURE__ */ (0,
|
|
11203
|
-
/* @__PURE__ */ (0,
|
|
11415
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
|
|
11416
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
|
|
11417
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
11418
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-indigo-500/20 shadow-xl", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react29.Terminal, { className: "text-white w-6 h-6" }) }),
|
|
11419
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
|
|
11204
11420
|
] }),
|
|
11205
|
-
/* @__PURE__ */ (0,
|
|
11206
|
-
/* @__PURE__ */ (0,
|
|
11421
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "max-w-md", children: [
|
|
11422
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
|
|
11207
11423
|
"Secure ",
|
|
11208
|
-
/* @__PURE__ */ (0,
|
|
11424
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "text-indigo-400", children: "Access" }),
|
|
11209
11425
|
" ",
|
|
11210
|
-
/* @__PURE__ */ (0,
|
|
11426
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("br", {}),
|
|
11211
11427
|
" ",
|
|
11212
11428
|
"Simplified."
|
|
11213
11429
|
] }),
|
|
11214
|
-
/* @__PURE__ */ (0,
|
|
11430
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
|
|
11215
11431
|
] }),
|
|
11216
|
-
/* @__PURE__ */ (0,
|
|
11432
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
|
|
11217
11433
|
] })
|
|
11218
11434
|
] }),
|
|
11219
|
-
/* @__PURE__ */ (0,
|
|
11220
|
-
/* @__PURE__ */ (0,
|
|
11221
|
-
/* @__PURE__ */ (0,
|
|
11222
|
-
/* @__PURE__ */ (0,
|
|
11223
|
-
/* @__PURE__ */ (0,
|
|
11224
|
-
/* @__PURE__ */ (0,
|
|
11225
|
-
/* @__PURE__ */ (0,
|
|
11435
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "w-full lg:w-1/2 p-8 lg:p-16 flex flex-col justify-center bg-white dark:bg-[#0A0B10] relative", children: [
|
|
11436
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ThemeToggle, {}) }),
|
|
11437
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "text-center space-y-6", children: [
|
|
11438
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "mx-auto w-16 h-16 bg-red-100 dark:bg-red-900/20 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react29.ShieldCheck, { className: "text-red-600 dark:text-red-400 w-8 h-8" }) }),
|
|
11439
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { children: [
|
|
11440
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
|
|
11441
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
|
|
11226
11442
|
] }),
|
|
11227
|
-
/* @__PURE__ */ (0,
|
|
11443
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11228
11444
|
Button,
|
|
11229
11445
|
{
|
|
11230
11446
|
onClick: () => navigate("/login"),
|
|
@@ -11232,22 +11448,22 @@ function ResetPasswordPage() {
|
|
|
11232
11448
|
children: "Back to Login"
|
|
11233
11449
|
}
|
|
11234
11450
|
)
|
|
11235
|
-
] }) : /* @__PURE__ */ (0,
|
|
11236
|
-
/* @__PURE__ */ (0,
|
|
11237
|
-
/* @__PURE__ */ (0,
|
|
11238
|
-
/* @__PURE__ */ (0,
|
|
11451
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
11452
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "mb-10", children: [
|
|
11453
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
|
|
11454
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("p", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
11239
11455
|
"Set a new, strong password for",
|
|
11240
11456
|
" ",
|
|
11241
|
-
/* @__PURE__ */ (0,
|
|
11457
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "text-indigo-600 font-medium", children: email })
|
|
11242
11458
|
] })
|
|
11243
11459
|
] }),
|
|
11244
|
-
/* @__PURE__ */ (0,
|
|
11460
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11245
11461
|
"form",
|
|
11246
11462
|
{
|
|
11247
11463
|
onSubmit: methods.handleSubmit(onSubmit),
|
|
11248
11464
|
className: "space-y-6",
|
|
11249
11465
|
children: [
|
|
11250
|
-
/* @__PURE__ */ (0,
|
|
11466
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11251
11467
|
Fields_default.Input,
|
|
11252
11468
|
{
|
|
11253
11469
|
form: methods,
|
|
@@ -11256,11 +11472,11 @@ function ResetPasswordPage() {
|
|
|
11256
11472
|
type: "password",
|
|
11257
11473
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
11258
11474
|
required: true,
|
|
11259
|
-
icon: /* @__PURE__ */ (0,
|
|
11475
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react29.Lock, { size: 18, className: "text-slate-400" }),
|
|
11260
11476
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
11261
11477
|
}
|
|
11262
11478
|
),
|
|
11263
|
-
/* @__PURE__ */ (0,
|
|
11479
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11264
11480
|
Fields_default.Input,
|
|
11265
11481
|
{
|
|
11266
11482
|
form: methods,
|
|
@@ -11269,11 +11485,11 @@ function ResetPasswordPage() {
|
|
|
11269
11485
|
type: "password",
|
|
11270
11486
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
11271
11487
|
required: true,
|
|
11272
|
-
icon: /* @__PURE__ */ (0,
|
|
11488
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react29.ShieldCheck, { size: 18, className: "text-slate-400" }),
|
|
11273
11489
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
11274
11490
|
}
|
|
11275
11491
|
),
|
|
11276
|
-
/* @__PURE__ */ (0,
|
|
11492
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
11277
11493
|
Button,
|
|
11278
11494
|
{
|
|
11279
11495
|
type: "submit",
|
|
@@ -11281,7 +11497,7 @@ function ResetPasswordPage() {
|
|
|
11281
11497
|
className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
|
|
11282
11498
|
children: [
|
|
11283
11499
|
"Update Password",
|
|
11284
|
-
!isLoading && /* @__PURE__ */ (0,
|
|
11500
|
+
!isLoading && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react29.ArrowRight, { size: 18 })
|
|
11285
11501
|
]
|
|
11286
11502
|
}
|
|
11287
11503
|
)
|
|
@@ -11295,10 +11511,10 @@ function ResetPasswordPage() {
|
|
|
11295
11511
|
var ResetPasswordPage_default = ResetPasswordPage;
|
|
11296
11512
|
|
|
11297
11513
|
// src/components/users/UserProfile.tsx
|
|
11298
|
-
var
|
|
11514
|
+
var import_lucide_react30 = require("lucide-react");
|
|
11299
11515
|
var import_react_router_dom12 = require("react-router-dom");
|
|
11300
11516
|
var import_antd17 = require("antd");
|
|
11301
|
-
var
|
|
11517
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11302
11518
|
var UserProfile = ({
|
|
11303
11519
|
items,
|
|
11304
11520
|
name,
|
|
@@ -11331,21 +11547,21 @@ var UserProfile = ({
|
|
|
11331
11547
|
const defaultItems = [
|
|
11332
11548
|
{
|
|
11333
11549
|
label: "My Profile",
|
|
11334
|
-
icon: /* @__PURE__ */ (0,
|
|
11550
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_lucide_react30.User, { size: 18 }),
|
|
11335
11551
|
onClick: () => navigate("profile"),
|
|
11336
11552
|
className: "min-w-[150px]"
|
|
11337
11553
|
},
|
|
11338
11554
|
{
|
|
11339
11555
|
label: "Logout",
|
|
11340
|
-
icon: /* @__PURE__ */ (0,
|
|
11556
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_lucide_react30.LogOut, { size: 18 }),
|
|
11341
11557
|
onClick: logout,
|
|
11342
11558
|
className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
|
|
11343
11559
|
}
|
|
11344
11560
|
];
|
|
11345
|
-
return /* @__PURE__ */ (0,
|
|
11346
|
-
showThemeToggle && /* @__PURE__ */ (0,
|
|
11347
|
-
showThemeToggle && /* @__PURE__ */ (0,
|
|
11348
|
-
/* @__PURE__ */ (0,
|
|
11561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
11562
|
+
showThemeToggle && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ThemeToggle, {}),
|
|
11563
|
+
showThemeToggle && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
|
|
11564
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11349
11565
|
ProfileDropdown,
|
|
11350
11566
|
{
|
|
11351
11567
|
name: name || account?.name || "User",
|
|
@@ -11362,13 +11578,13 @@ var UserProfile_default = UserProfile;
|
|
|
11362
11578
|
|
|
11363
11579
|
// src/components/users/ProfilePage.tsx
|
|
11364
11580
|
var import_react_router_dom13 = require("react-router-dom");
|
|
11365
|
-
var
|
|
11366
|
-
var
|
|
11581
|
+
var import_lucide_react31 = require("lucide-react");
|
|
11582
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11367
11583
|
var ProfilePage = () => {
|
|
11368
11584
|
const navigate = (0, import_react_router_dom13.useNavigate)();
|
|
11369
11585
|
const { user, account } = useAuth();
|
|
11370
11586
|
if (!user) {
|
|
11371
|
-
return /* @__PURE__ */ (0,
|
|
11587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h1", { children: "Please login to view your profile" }) });
|
|
11372
11588
|
}
|
|
11373
11589
|
const extraInfo = [
|
|
11374
11590
|
{
|
|
@@ -11387,19 +11603,19 @@ var ProfilePage = () => {
|
|
|
11387
11603
|
copiable: false
|
|
11388
11604
|
}
|
|
11389
11605
|
];
|
|
11390
|
-
return /* @__PURE__ */ (0,
|
|
11391
|
-
/* @__PURE__ */ (0,
|
|
11606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "p-4 sm:p-8 space-y-6", children: [
|
|
11607
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11392
11608
|
Button,
|
|
11393
11609
|
{
|
|
11394
11610
|
variant: "outline",
|
|
11395
11611
|
size: "sm",
|
|
11396
11612
|
onClick: () => navigate(-1),
|
|
11397
|
-
icon: /* @__PURE__ */ (0,
|
|
11613
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react31.ArrowLeft, { size: 16 }),
|
|
11398
11614
|
className: "rounded-full font-bold px-5",
|
|
11399
11615
|
children: "Back"
|
|
11400
11616
|
}
|
|
11401
11617
|
) }),
|
|
11402
|
-
/* @__PURE__ */ (0,
|
|
11618
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11403
11619
|
ProfileView,
|
|
11404
11620
|
{
|
|
11405
11621
|
name: account?.name || "User Account",
|
|
@@ -11416,10 +11632,10 @@ var ProfilePage_default = ProfilePage;
|
|
|
11416
11632
|
|
|
11417
11633
|
// src/components/wallets/Wallets.tsx
|
|
11418
11634
|
var import_react_router_dom14 = require("react-router-dom");
|
|
11419
|
-
var
|
|
11635
|
+
var import_lucide_react32 = require("lucide-react");
|
|
11420
11636
|
var import_react44 = require("react");
|
|
11421
11637
|
var import_antd18 = require("antd");
|
|
11422
|
-
var
|
|
11638
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11423
11639
|
function Wallets({ v, url }) {
|
|
11424
11640
|
const { branchId } = (0, import_react_router_dom14.useParams)();
|
|
11425
11641
|
const [deleteWallet, setDeleteWallet] = (0, import_react44.useState)(null);
|
|
@@ -11434,12 +11650,12 @@ function Wallets({ v, url }) {
|
|
|
11434
11650
|
const items = (data2) => [
|
|
11435
11651
|
{
|
|
11436
11652
|
label: `Edit Wallet`,
|
|
11437
|
-
icon: /* @__PURE__ */ (0,
|
|
11653
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_lucide_react32.FilePenLine, { size: 16 }),
|
|
11438
11654
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
11439
11655
|
},
|
|
11440
11656
|
{
|
|
11441
11657
|
label: `Delete Wallet`,
|
|
11442
|
-
icon: /* @__PURE__ */ (0,
|
|
11658
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_lucide_react32.Trash2, { className: "text-red-500", size: 16 }),
|
|
11443
11659
|
onClick: () => setDeleteWallet(data2)
|
|
11444
11660
|
}
|
|
11445
11661
|
].filter(Boolean);
|
|
@@ -11449,7 +11665,7 @@ function Wallets({ v, url }) {
|
|
|
11449
11665
|
header: "Name",
|
|
11450
11666
|
cell: ({ row }) => {
|
|
11451
11667
|
const wallet = row.original;
|
|
11452
|
-
return /* @__PURE__ */ (0,
|
|
11668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11453
11669
|
"span",
|
|
11454
11670
|
{
|
|
11455
11671
|
onClick: () => navigate(`statements/${wallet?._id}`),
|
|
@@ -11464,7 +11680,7 @@ function Wallets({ v, url }) {
|
|
|
11464
11680
|
header: "Type",
|
|
11465
11681
|
cell: ({ row }) => {
|
|
11466
11682
|
const wallet = row.original;
|
|
11467
|
-
return /* @__PURE__ */ (0,
|
|
11683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "capitalize", children: wallet?.type });
|
|
11468
11684
|
}
|
|
11469
11685
|
},
|
|
11470
11686
|
{
|
|
@@ -11472,7 +11688,7 @@ function Wallets({ v, url }) {
|
|
|
11472
11688
|
header: "Currency",
|
|
11473
11689
|
cell: ({ row }) => {
|
|
11474
11690
|
const wallet = row.original;
|
|
11475
|
-
return /* @__PURE__ */ (0,
|
|
11691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: wallet?.currency });
|
|
11476
11692
|
}
|
|
11477
11693
|
},
|
|
11478
11694
|
{
|
|
@@ -11480,7 +11696,7 @@ function Wallets({ v, url }) {
|
|
|
11480
11696
|
header: "Account No",
|
|
11481
11697
|
cell: ({ row }) => {
|
|
11482
11698
|
const wallet = row.original;
|
|
11483
|
-
return /* @__PURE__ */ (0,
|
|
11699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { children: wallet?.accountNo || "N/A" });
|
|
11484
11700
|
}
|
|
11485
11701
|
},
|
|
11486
11702
|
{
|
|
@@ -11488,13 +11704,13 @@ function Wallets({ v, url }) {
|
|
|
11488
11704
|
header: "Actions",
|
|
11489
11705
|
cell: ({ row }) => {
|
|
11490
11706
|
const data2 = row.original;
|
|
11491
|
-
return /* @__PURE__ */ (0,
|
|
11707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11492
11708
|
Dropdown,
|
|
11493
11709
|
{
|
|
11494
11710
|
className: "cursor-pointer w-[150px]",
|
|
11495
11711
|
items: items(data2),
|
|
11496
11712
|
triggerMode: "hover",
|
|
11497
|
-
children: /* @__PURE__ */ (0,
|
|
11713
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_lucide_react32.EllipsisVertical, {})
|
|
11498
11714
|
}
|
|
11499
11715
|
);
|
|
11500
11716
|
}
|
|
@@ -11512,9 +11728,9 @@ function Wallets({ v, url }) {
|
|
|
11512
11728
|
return error;
|
|
11513
11729
|
}
|
|
11514
11730
|
};
|
|
11515
|
-
return /* @__PURE__ */ (0,
|
|
11516
|
-
/* @__PURE__ */ (0,
|
|
11517
|
-
/* @__PURE__ */ (0,
|
|
11731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
11732
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Modal2, {}),
|
|
11733
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11518
11734
|
ConfirmModal,
|
|
11519
11735
|
{
|
|
11520
11736
|
isOpen: !!deleteWallet,
|
|
@@ -11527,7 +11743,7 @@ function Wallets({ v, url }) {
|
|
|
11527
11743
|
children: null
|
|
11528
11744
|
}
|
|
11529
11745
|
),
|
|
11530
|
-
/* @__PURE__ */ (0,
|
|
11746
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
11531
11747
|
TransactionViewComponent,
|
|
11532
11748
|
{
|
|
11533
11749
|
columns,
|
|
@@ -11561,7 +11777,7 @@ var import_zod11 = require("@hookform/resolvers/zod");
|
|
|
11561
11777
|
var import_antd19 = require("antd");
|
|
11562
11778
|
var import_react45 = require("react");
|
|
11563
11779
|
var import_react_router_dom15 = require("react-router-dom");
|
|
11564
|
-
var
|
|
11780
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11565
11781
|
function WalletForm() {
|
|
11566
11782
|
const { enums } = useWarqadConfig();
|
|
11567
11783
|
const { branchId } = (0, import_react_router_dom15.useParams)();
|
|
@@ -11623,24 +11839,24 @@ function WalletForm() {
|
|
|
11623
11839
|
fetches();
|
|
11624
11840
|
}
|
|
11625
11841
|
}, [id]);
|
|
11626
|
-
return /* @__PURE__ */ (0,
|
|
11842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
11627
11843
|
Card,
|
|
11628
11844
|
{
|
|
11629
11845
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
11630
11846
|
isLoading: isLoadingGet,
|
|
11631
11847
|
loadingText: "Processing...",
|
|
11632
11848
|
children: [
|
|
11633
|
-
/* @__PURE__ */ (0,
|
|
11634
|
-
/* @__PURE__ */ (0,
|
|
11635
|
-
/* @__PURE__ */ (0,
|
|
11849
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Card.Header, { children: [
|
|
11850
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Wallet` }),
|
|
11851
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Card.Description, { children: isEdit ? `Update the details for this wallet` : `Create a new wallet and add it to your list` })
|
|
11636
11852
|
] }),
|
|
11637
|
-
/* @__PURE__ */ (0,
|
|
11853
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
11638
11854
|
"form",
|
|
11639
11855
|
{
|
|
11640
11856
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
11641
11857
|
children: [
|
|
11642
|
-
/* @__PURE__ */ (0,
|
|
11643
|
-
/* @__PURE__ */ (0,
|
|
11858
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
11859
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11644
11860
|
Fields_default.Input,
|
|
11645
11861
|
{
|
|
11646
11862
|
label: "Name",
|
|
@@ -11651,7 +11867,7 @@ function WalletForm() {
|
|
|
11651
11867
|
required: true
|
|
11652
11868
|
}
|
|
11653
11869
|
),
|
|
11654
|
-
/* @__PURE__ */ (0,
|
|
11870
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11655
11871
|
Fields_default.Select,
|
|
11656
11872
|
{
|
|
11657
11873
|
label: "Wallet Type",
|
|
@@ -11661,7 +11877,7 @@ function WalletForm() {
|
|
|
11661
11877
|
enumName: "walletTypes"
|
|
11662
11878
|
}
|
|
11663
11879
|
),
|
|
11664
|
-
/* @__PURE__ */ (0,
|
|
11880
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11665
11881
|
Fields_default.Select,
|
|
11666
11882
|
{
|
|
11667
11883
|
label: "Currency",
|
|
@@ -11671,7 +11887,7 @@ function WalletForm() {
|
|
|
11671
11887
|
enumName: "currencies"
|
|
11672
11888
|
}
|
|
11673
11889
|
),
|
|
11674
|
-
/* @__PURE__ */ (0,
|
|
11890
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11675
11891
|
Fields_default.Input,
|
|
11676
11892
|
{
|
|
11677
11893
|
label: "Account Number",
|
|
@@ -11681,7 +11897,7 @@ function WalletForm() {
|
|
|
11681
11897
|
placeholder: "Enter account number (optional)"
|
|
11682
11898
|
}
|
|
11683
11899
|
),
|
|
11684
|
-
!branchId && /* @__PURE__ */ (0,
|
|
11900
|
+
!branchId && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11685
11901
|
Feilds_default.Branches,
|
|
11686
11902
|
{
|
|
11687
11903
|
label: "Branch",
|
|
@@ -11692,7 +11908,7 @@ function WalletForm() {
|
|
|
11692
11908
|
}
|
|
11693
11909
|
)
|
|
11694
11910
|
] }),
|
|
11695
|
-
/* @__PURE__ */ (0,
|
|
11911
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
11696
11912
|
Button,
|
|
11697
11913
|
{
|
|
11698
11914
|
isLoading,
|
|
@@ -11714,8 +11930,8 @@ var WalletForm_default = WalletForm;
|
|
|
11714
11930
|
|
|
11715
11931
|
// src/components/wallets/Feilds/Wallet.tsx
|
|
11716
11932
|
var import_react_router_dom16 = require("react-router-dom");
|
|
11717
|
-
var
|
|
11718
|
-
function
|
|
11933
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
11934
|
+
function Wallet6({
|
|
11719
11935
|
name,
|
|
11720
11936
|
label,
|
|
11721
11937
|
placeholder,
|
|
@@ -11736,8 +11952,8 @@ function Wallet5({
|
|
|
11736
11952
|
showBalance,
|
|
11737
11953
|
accountId: walletId
|
|
11738
11954
|
});
|
|
11739
|
-
return /* @__PURE__ */ (0,
|
|
11740
|
-
/* @__PURE__ */ (0,
|
|
11955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
11956
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
11741
11957
|
Fields_default.SearchApi,
|
|
11742
11958
|
{
|
|
11743
11959
|
name,
|
|
@@ -11755,10 +11971,10 @@ function Wallet5({
|
|
|
11755
11971
|
obj
|
|
11756
11972
|
}
|
|
11757
11973
|
),
|
|
11758
|
-
/* @__PURE__ */ (0,
|
|
11974
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BalanceView, {})
|
|
11759
11975
|
] });
|
|
11760
11976
|
}
|
|
11761
|
-
var Wallet_default =
|
|
11977
|
+
var Wallet_default = Wallet6;
|
|
11762
11978
|
|
|
11763
11979
|
// src/components/wallets/Feilds/index.tsx
|
|
11764
11980
|
var WalletField = {
|
|
@@ -11768,10 +11984,10 @@ var Feilds_default2 = WalletField;
|
|
|
11768
11984
|
|
|
11769
11985
|
// src/components/brands/Brands.tsx
|
|
11770
11986
|
var import_react_router_dom17 = require("react-router-dom");
|
|
11771
|
-
var
|
|
11987
|
+
var import_lucide_react33 = require("lucide-react");
|
|
11772
11988
|
var import_react46 = require("react");
|
|
11773
11989
|
var import_antd20 = require("antd");
|
|
11774
|
-
var
|
|
11990
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
11775
11991
|
function Brands({ v, url }) {
|
|
11776
11992
|
const [deleteBrand, setDeleteBrand] = (0, import_react46.useState)(null);
|
|
11777
11993
|
const { isLoading, remove } = useApis_default();
|
|
@@ -11785,12 +12001,12 @@ function Brands({ v, url }) {
|
|
|
11785
12001
|
const items = (data2) => [
|
|
11786
12002
|
{
|
|
11787
12003
|
label: `Edit Brand`,
|
|
11788
|
-
icon: /* @__PURE__ */ (0,
|
|
12004
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_lucide_react33.FilePenLine, { size: 16 }),
|
|
11789
12005
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
11790
12006
|
},
|
|
11791
12007
|
{
|
|
11792
12008
|
label: `Delete Brand`,
|
|
11793
|
-
icon: /* @__PURE__ */ (0,
|
|
12009
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_lucide_react33.Trash2, { className: "text-red-500", size: 16 }),
|
|
11794
12010
|
onClick: () => setDeleteBrand(data2)
|
|
11795
12011
|
}
|
|
11796
12012
|
].filter(Boolean);
|
|
@@ -11800,7 +12016,7 @@ function Brands({ v, url }) {
|
|
|
11800
12016
|
header: "Name",
|
|
11801
12017
|
cell: ({ row }) => {
|
|
11802
12018
|
const brand = row.original;
|
|
11803
|
-
return /* @__PURE__ */ (0,
|
|
12019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: brand?.name });
|
|
11804
12020
|
}
|
|
11805
12021
|
},
|
|
11806
12022
|
{
|
|
@@ -11808,13 +12024,13 @@ function Brands({ v, url }) {
|
|
|
11808
12024
|
header: "Actions",
|
|
11809
12025
|
cell: ({ row }) => {
|
|
11810
12026
|
const data2 = row.original;
|
|
11811
|
-
return /* @__PURE__ */ (0,
|
|
12027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
11812
12028
|
Dropdown,
|
|
11813
12029
|
{
|
|
11814
12030
|
className: "cursor-pointer w-[150px]",
|
|
11815
12031
|
items: items(data2),
|
|
11816
12032
|
triggerMode: "hover",
|
|
11817
|
-
children: /* @__PURE__ */ (0,
|
|
12033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_lucide_react33.EllipsisVertical, {})
|
|
11818
12034
|
}
|
|
11819
12035
|
);
|
|
11820
12036
|
}
|
|
@@ -11832,9 +12048,9 @@ function Brands({ v, url }) {
|
|
|
11832
12048
|
return error;
|
|
11833
12049
|
}
|
|
11834
12050
|
};
|
|
11835
|
-
return /* @__PURE__ */ (0,
|
|
11836
|
-
/* @__PURE__ */ (0,
|
|
11837
|
-
/* @__PURE__ */ (0,
|
|
12051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
12052
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Modal2, {}),
|
|
12053
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
11838
12054
|
ConfirmModal,
|
|
11839
12055
|
{
|
|
11840
12056
|
isOpen: !!deleteBrand,
|
|
@@ -11847,7 +12063,7 @@ function Brands({ v, url }) {
|
|
|
11847
12063
|
children: null
|
|
11848
12064
|
}
|
|
11849
12065
|
),
|
|
11850
|
-
/* @__PURE__ */ (0,
|
|
12066
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
11851
12067
|
TransactionViewComponent,
|
|
11852
12068
|
{
|
|
11853
12069
|
columns,
|
|
@@ -11876,7 +12092,7 @@ var import_react_hook_form16 = require("react-hook-form");
|
|
|
11876
12092
|
var import_zod13 = require("@hookform/resolvers/zod");
|
|
11877
12093
|
var import_antd21 = require("antd");
|
|
11878
12094
|
var import_react47 = require("react");
|
|
11879
|
-
var
|
|
12095
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
11880
12096
|
function BrandForm() {
|
|
11881
12097
|
const { getQuery, navigate } = useApp_default();
|
|
11882
12098
|
const id = getQuery("id");
|
|
@@ -11926,23 +12142,23 @@ function BrandForm() {
|
|
|
11926
12142
|
fetches();
|
|
11927
12143
|
}
|
|
11928
12144
|
}, [id]);
|
|
11929
|
-
return /* @__PURE__ */ (0,
|
|
12145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
11930
12146
|
Card,
|
|
11931
12147
|
{
|
|
11932
12148
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
11933
12149
|
isLoading: isLoadingGet,
|
|
11934
12150
|
loadingText: "Processing...",
|
|
11935
12151
|
children: [
|
|
11936
|
-
/* @__PURE__ */ (0,
|
|
11937
|
-
/* @__PURE__ */ (0,
|
|
11938
|
-
/* @__PURE__ */ (0,
|
|
12152
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Card.Header, { children: [
|
|
12153
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Brand` }),
|
|
12154
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Card.Description, { children: isEdit ? `Update the details for this brand` : `Create a new brand and add it to your list` })
|
|
11939
12155
|
] }),
|
|
11940
|
-
/* @__PURE__ */ (0,
|
|
12156
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
11941
12157
|
"form",
|
|
11942
12158
|
{
|
|
11943
12159
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
11944
12160
|
children: [
|
|
11945
|
-
/* @__PURE__ */ (0,
|
|
12161
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
11946
12162
|
Fields_default.Input,
|
|
11947
12163
|
{
|
|
11948
12164
|
label: "Name",
|
|
@@ -11953,7 +12169,7 @@ function BrandForm() {
|
|
|
11953
12169
|
required: true
|
|
11954
12170
|
}
|
|
11955
12171
|
) }),
|
|
11956
|
-
/* @__PURE__ */ (0,
|
|
12172
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
11957
12173
|
Button,
|
|
11958
12174
|
{
|
|
11959
12175
|
isLoading,
|
|
@@ -11975,7 +12191,7 @@ var BrandForm_default = BrandForm;
|
|
|
11975
12191
|
|
|
11976
12192
|
// src/components/brands/Feilds/Brand.tsx
|
|
11977
12193
|
var import_react_router_dom18 = require("react-router-dom");
|
|
11978
|
-
var
|
|
12194
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11979
12195
|
function Brand({
|
|
11980
12196
|
name,
|
|
11981
12197
|
label,
|
|
@@ -11988,7 +12204,7 @@ function Brand({
|
|
|
11988
12204
|
disabled
|
|
11989
12205
|
}) {
|
|
11990
12206
|
const { branchId } = (0, import_react_router_dom18.useParams)();
|
|
11991
|
-
return /* @__PURE__ */ (0,
|
|
12207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
11992
12208
|
Fields_default.SearchApi,
|
|
11993
12209
|
{
|
|
11994
12210
|
name,
|
|
@@ -12016,10 +12232,10 @@ var Feilds_default3 = BrandField;
|
|
|
12016
12232
|
|
|
12017
12233
|
// src/components/categories/Categories.tsx
|
|
12018
12234
|
var import_react_router_dom19 = require("react-router-dom");
|
|
12019
|
-
var
|
|
12235
|
+
var import_lucide_react34 = require("lucide-react");
|
|
12020
12236
|
var import_react48 = require("react");
|
|
12021
12237
|
var import_antd22 = require("antd");
|
|
12022
|
-
var
|
|
12238
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
12023
12239
|
function Categories({ v, url }) {
|
|
12024
12240
|
const [deleteCategory, setDeleteCategory] = (0, import_react48.useState)(null);
|
|
12025
12241
|
const { isLoading, remove } = useApis_default();
|
|
@@ -12033,12 +12249,12 @@ function Categories({ v, url }) {
|
|
|
12033
12249
|
const items = (data2) => [
|
|
12034
12250
|
{
|
|
12035
12251
|
label: `Edit Category`,
|
|
12036
|
-
icon: /* @__PURE__ */ (0,
|
|
12252
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_lucide_react34.FilePenLine, { size: 16 }),
|
|
12037
12253
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
12038
12254
|
},
|
|
12039
12255
|
{
|
|
12040
12256
|
label: `Delete Category`,
|
|
12041
|
-
icon: /* @__PURE__ */ (0,
|
|
12257
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_lucide_react34.Trash2, { className: "text-red-500", size: 16 }),
|
|
12042
12258
|
onClick: () => setDeleteCategory(data2)
|
|
12043
12259
|
}
|
|
12044
12260
|
].filter(Boolean);
|
|
@@ -12048,7 +12264,7 @@ function Categories({ v, url }) {
|
|
|
12048
12264
|
header: "Name",
|
|
12049
12265
|
cell: ({ row }) => {
|
|
12050
12266
|
const category = row.original;
|
|
12051
|
-
return /* @__PURE__ */ (0,
|
|
12267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { children: category?.name });
|
|
12052
12268
|
}
|
|
12053
12269
|
},
|
|
12054
12270
|
{
|
|
@@ -12056,13 +12272,13 @@ function Categories({ v, url }) {
|
|
|
12056
12272
|
header: "Actions",
|
|
12057
12273
|
cell: ({ row }) => {
|
|
12058
12274
|
const data2 = row.original;
|
|
12059
|
-
return /* @__PURE__ */ (0,
|
|
12275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12060
12276
|
Dropdown,
|
|
12061
12277
|
{
|
|
12062
12278
|
className: "cursor-pointer w-[150px]",
|
|
12063
12279
|
items: items(data2),
|
|
12064
12280
|
triggerMode: "hover",
|
|
12065
|
-
children: /* @__PURE__ */ (0,
|
|
12281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_lucide_react34.EllipsisVertical, {})
|
|
12066
12282
|
}
|
|
12067
12283
|
);
|
|
12068
12284
|
}
|
|
@@ -12080,9 +12296,9 @@ function Categories({ v, url }) {
|
|
|
12080
12296
|
return error;
|
|
12081
12297
|
}
|
|
12082
12298
|
};
|
|
12083
|
-
return /* @__PURE__ */ (0,
|
|
12084
|
-
/* @__PURE__ */ (0,
|
|
12085
|
-
/* @__PURE__ */ (0,
|
|
12299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
12300
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Modal2, {}),
|
|
12301
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12086
12302
|
ConfirmModal,
|
|
12087
12303
|
{
|
|
12088
12304
|
isOpen: !!deleteCategory,
|
|
@@ -12095,7 +12311,7 @@ function Categories({ v, url }) {
|
|
|
12095
12311
|
children: null
|
|
12096
12312
|
}
|
|
12097
12313
|
),
|
|
12098
|
-
/* @__PURE__ */ (0,
|
|
12314
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12099
12315
|
TransactionViewComponent,
|
|
12100
12316
|
{
|
|
12101
12317
|
columns,
|
|
@@ -12124,7 +12340,7 @@ var import_react_hook_form17 = require("react-hook-form");
|
|
|
12124
12340
|
var import_zod15 = require("@hookform/resolvers/zod");
|
|
12125
12341
|
var import_antd23 = require("antd");
|
|
12126
12342
|
var import_react49 = require("react");
|
|
12127
|
-
var
|
|
12343
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
12128
12344
|
function CategoryForm() {
|
|
12129
12345
|
const { getQuery, navigate } = useApp_default();
|
|
12130
12346
|
const id = getQuery("id");
|
|
@@ -12174,23 +12390,23 @@ function CategoryForm() {
|
|
|
12174
12390
|
fetches();
|
|
12175
12391
|
}
|
|
12176
12392
|
}, [id]);
|
|
12177
|
-
return /* @__PURE__ */ (0,
|
|
12393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
12178
12394
|
Card,
|
|
12179
12395
|
{
|
|
12180
12396
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
12181
12397
|
isLoading: isLoadingGet,
|
|
12182
12398
|
loadingText: "Processing...",
|
|
12183
12399
|
children: [
|
|
12184
|
-
/* @__PURE__ */ (0,
|
|
12185
|
-
/* @__PURE__ */ (0,
|
|
12186
|
-
/* @__PURE__ */ (0,
|
|
12400
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(Card.Header, { children: [
|
|
12401
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Category` }),
|
|
12402
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Card.Description, { children: isEdit ? `Update the details for this category` : `Create a new category and add it to your list` })
|
|
12187
12403
|
] }),
|
|
12188
|
-
/* @__PURE__ */ (0,
|
|
12404
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
12189
12405
|
"form",
|
|
12190
12406
|
{
|
|
12191
12407
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
12192
12408
|
children: [
|
|
12193
|
-
/* @__PURE__ */ (0,
|
|
12409
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12194
12410
|
Fields_default.Input,
|
|
12195
12411
|
{
|
|
12196
12412
|
label: "Name",
|
|
@@ -12201,7 +12417,7 @@ function CategoryForm() {
|
|
|
12201
12417
|
required: true
|
|
12202
12418
|
}
|
|
12203
12419
|
) }),
|
|
12204
|
-
/* @__PURE__ */ (0,
|
|
12420
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12205
12421
|
Button,
|
|
12206
12422
|
{
|
|
12207
12423
|
isLoading,
|
|
@@ -12223,7 +12439,7 @@ var CategoryForm_default = CategoryForm;
|
|
|
12223
12439
|
|
|
12224
12440
|
// src/components/categories/Feilds/Category.tsx
|
|
12225
12441
|
var import_react_router_dom20 = require("react-router-dom");
|
|
12226
|
-
var
|
|
12442
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
12227
12443
|
function Category({
|
|
12228
12444
|
name,
|
|
12229
12445
|
label,
|
|
@@ -12236,7 +12452,7 @@ function Category({
|
|
|
12236
12452
|
disabled
|
|
12237
12453
|
}) {
|
|
12238
12454
|
const { branchId } = (0, import_react_router_dom20.useParams)();
|
|
12239
|
-
return /* @__PURE__ */ (0,
|
|
12455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
12240
12456
|
Fields_default.SearchApi,
|
|
12241
12457
|
{
|
|
12242
12458
|
name,
|
|
@@ -12264,10 +12480,10 @@ var Feilds_default4 = CategoryField;
|
|
|
12264
12480
|
|
|
12265
12481
|
// src/components/products/Products.tsx
|
|
12266
12482
|
var import_react_router_dom21 = require("react-router-dom");
|
|
12267
|
-
var
|
|
12483
|
+
var import_lucide_react35 = require("lucide-react");
|
|
12268
12484
|
var import_react50 = require("react");
|
|
12269
12485
|
var import_antd24 = require("antd");
|
|
12270
|
-
var
|
|
12486
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
12271
12487
|
function Products({ v, url }) {
|
|
12272
12488
|
const [deleteProduct, setDeleteProduct] = (0, import_react50.useState)(null);
|
|
12273
12489
|
const { isLoading, remove } = useApis_default();
|
|
@@ -12281,12 +12497,12 @@ function Products({ v, url }) {
|
|
|
12281
12497
|
const items = (data2) => [
|
|
12282
12498
|
{
|
|
12283
12499
|
label: `Edit Product`,
|
|
12284
|
-
icon: /* @__PURE__ */ (0,
|
|
12500
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react35.FilePenLine, { size: 16 }),
|
|
12285
12501
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
12286
12502
|
},
|
|
12287
12503
|
{
|
|
12288
12504
|
label: `Delete Product`,
|
|
12289
|
-
icon: /* @__PURE__ */ (0,
|
|
12505
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react35.Trash2, { className: "text-red-500", size: 16 }),
|
|
12290
12506
|
onClick: () => setDeleteProduct(data2)
|
|
12291
12507
|
}
|
|
12292
12508
|
].filter(Boolean);
|
|
@@ -12296,7 +12512,7 @@ function Products({ v, url }) {
|
|
|
12296
12512
|
header: "Name",
|
|
12297
12513
|
cell: ({ row }) => {
|
|
12298
12514
|
const product = row.original;
|
|
12299
|
-
return /* @__PURE__ */ (0,
|
|
12515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: product?.name });
|
|
12300
12516
|
}
|
|
12301
12517
|
},
|
|
12302
12518
|
{
|
|
@@ -12304,7 +12520,7 @@ function Products({ v, url }) {
|
|
|
12304
12520
|
header: "Category",
|
|
12305
12521
|
cell: ({ row }) => {
|
|
12306
12522
|
const product = row.original;
|
|
12307
|
-
return /* @__PURE__ */ (0,
|
|
12523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: product?.categoryData?.name || "N/A" });
|
|
12308
12524
|
}
|
|
12309
12525
|
},
|
|
12310
12526
|
{
|
|
@@ -12312,7 +12528,7 @@ function Products({ v, url }) {
|
|
|
12312
12528
|
header: "Brand",
|
|
12313
12529
|
cell: ({ row }) => {
|
|
12314
12530
|
const product = row.original;
|
|
12315
|
-
return /* @__PURE__ */ (0,
|
|
12531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: product?.brandData?.name || "N/A" });
|
|
12316
12532
|
}
|
|
12317
12533
|
},
|
|
12318
12534
|
{
|
|
@@ -12320,7 +12536,7 @@ function Products({ v, url }) {
|
|
|
12320
12536
|
header: "Cost",
|
|
12321
12537
|
cell: ({ row }) => {
|
|
12322
12538
|
const product = row.original;
|
|
12323
|
-
return /* @__PURE__ */ (0,
|
|
12539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { children: [
|
|
12324
12540
|
" ",
|
|
12325
12541
|
product?.cost?.toLocaleString()
|
|
12326
12542
|
] });
|
|
@@ -12331,13 +12547,13 @@ function Products({ v, url }) {
|
|
|
12331
12547
|
header: "Actions",
|
|
12332
12548
|
cell: ({ row }) => {
|
|
12333
12549
|
const data2 = row.original;
|
|
12334
|
-
return /* @__PURE__ */ (0,
|
|
12550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12335
12551
|
Dropdown,
|
|
12336
12552
|
{
|
|
12337
12553
|
className: "cursor-pointer w-[150px]",
|
|
12338
12554
|
items: items(data2),
|
|
12339
12555
|
triggerMode: "hover",
|
|
12340
|
-
children: /* @__PURE__ */ (0,
|
|
12556
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react35.EllipsisVertical, {})
|
|
12341
12557
|
}
|
|
12342
12558
|
);
|
|
12343
12559
|
}
|
|
@@ -12355,9 +12571,9 @@ function Products({ v, url }) {
|
|
|
12355
12571
|
return error;
|
|
12356
12572
|
}
|
|
12357
12573
|
};
|
|
12358
|
-
return /* @__PURE__ */ (0,
|
|
12359
|
-
/* @__PURE__ */ (0,
|
|
12360
|
-
/* @__PURE__ */ (0,
|
|
12574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
|
|
12575
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Modal2, {}),
|
|
12576
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12361
12577
|
ConfirmModal,
|
|
12362
12578
|
{
|
|
12363
12579
|
isOpen: !!deleteProduct,
|
|
@@ -12370,7 +12586,7 @@ function Products({ v, url }) {
|
|
|
12370
12586
|
children: null
|
|
12371
12587
|
}
|
|
12372
12588
|
),
|
|
12373
|
-
/* @__PURE__ */ (0,
|
|
12589
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
12374
12590
|
TransactionViewComponent,
|
|
12375
12591
|
{
|
|
12376
12592
|
columns,
|
|
@@ -12402,7 +12618,7 @@ var import_react_hook_form18 = require("react-hook-form");
|
|
|
12402
12618
|
var import_zod17 = require("@hookform/resolvers/zod");
|
|
12403
12619
|
var import_antd25 = require("antd");
|
|
12404
12620
|
var import_react51 = require("react");
|
|
12405
|
-
var
|
|
12621
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
12406
12622
|
function ProductForm() {
|
|
12407
12623
|
const { getQuery, navigate } = useApp_default();
|
|
12408
12624
|
const id = getQuery("id");
|
|
@@ -12455,24 +12671,24 @@ function ProductForm() {
|
|
|
12455
12671
|
fetches();
|
|
12456
12672
|
}
|
|
12457
12673
|
}, [id]);
|
|
12458
|
-
return /* @__PURE__ */ (0,
|
|
12674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
12459
12675
|
Card,
|
|
12460
12676
|
{
|
|
12461
12677
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
12462
12678
|
isLoading: isLoadingGet,
|
|
12463
12679
|
loadingText: "Processing...",
|
|
12464
12680
|
children: [
|
|
12465
|
-
/* @__PURE__ */ (0,
|
|
12466
|
-
/* @__PURE__ */ (0,
|
|
12467
|
-
/* @__PURE__ */ (0,
|
|
12681
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Card.Header, { children: [
|
|
12682
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Product` }),
|
|
12683
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card.Description, { children: isEdit ? `Update the details for this product` : `Create a new product and add it to your list` })
|
|
12468
12684
|
] }),
|
|
12469
|
-
/* @__PURE__ */ (0,
|
|
12685
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
12470
12686
|
"form",
|
|
12471
12687
|
{
|
|
12472
12688
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
12473
12689
|
children: [
|
|
12474
|
-
/* @__PURE__ */ (0,
|
|
12475
|
-
/* @__PURE__ */ (0,
|
|
12690
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
12691
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12476
12692
|
Fields_default.Input,
|
|
12477
12693
|
{
|
|
12478
12694
|
label: "Name",
|
|
@@ -12483,7 +12699,7 @@ function ProductForm() {
|
|
|
12483
12699
|
required: true
|
|
12484
12700
|
}
|
|
12485
12701
|
),
|
|
12486
|
-
/* @__PURE__ */ (0,
|
|
12702
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12487
12703
|
Fields_default.Input,
|
|
12488
12704
|
{
|
|
12489
12705
|
label: "Cost",
|
|
@@ -12494,7 +12710,7 @@ function ProductForm() {
|
|
|
12494
12710
|
required: true
|
|
12495
12711
|
}
|
|
12496
12712
|
),
|
|
12497
|
-
/* @__PURE__ */ (0,
|
|
12713
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12498
12714
|
Feilds_default4.Category,
|
|
12499
12715
|
{
|
|
12500
12716
|
label: "Category",
|
|
@@ -12503,7 +12719,7 @@ function ProductForm() {
|
|
|
12503
12719
|
api: "/categories/get"
|
|
12504
12720
|
}
|
|
12505
12721
|
),
|
|
12506
|
-
/* @__PURE__ */ (0,
|
|
12722
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12507
12723
|
Feilds_default3.Brand,
|
|
12508
12724
|
{
|
|
12509
12725
|
label: "Brand",
|
|
@@ -12513,7 +12729,7 @@ function ProductForm() {
|
|
|
12513
12729
|
}
|
|
12514
12730
|
)
|
|
12515
12731
|
] }),
|
|
12516
|
-
/* @__PURE__ */ (0,
|
|
12732
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
12517
12733
|
Button,
|
|
12518
12734
|
{
|
|
12519
12735
|
isLoading,
|
|
@@ -12535,7 +12751,7 @@ var ProductForm_default = ProductForm;
|
|
|
12535
12751
|
|
|
12536
12752
|
// src/components/products/Feilds/Product.tsx
|
|
12537
12753
|
var import_react_router_dom22 = require("react-router-dom");
|
|
12538
|
-
var
|
|
12754
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
12539
12755
|
function Product({
|
|
12540
12756
|
name,
|
|
12541
12757
|
label,
|
|
@@ -12550,7 +12766,7 @@ function Product({
|
|
|
12550
12766
|
obj
|
|
12551
12767
|
}) {
|
|
12552
12768
|
const { branchId } = (0, import_react_router_dom22.useParams)();
|
|
12553
|
-
return /* @__PURE__ */ (0,
|
|
12769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
12554
12770
|
Fields_default.SearchApi,
|
|
12555
12771
|
{
|
|
12556
12772
|
name,
|
|
@@ -12580,10 +12796,10 @@ var Feilds_default5 = ProductField;
|
|
|
12580
12796
|
|
|
12581
12797
|
// src/components/packs/Packs.tsx
|
|
12582
12798
|
var import_react_router_dom23 = require("react-router-dom");
|
|
12583
|
-
var
|
|
12799
|
+
var import_lucide_react36 = require("lucide-react");
|
|
12584
12800
|
var import_react52 = require("react");
|
|
12585
12801
|
var import_antd26 = require("antd");
|
|
12586
|
-
var
|
|
12802
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
12587
12803
|
function Packs({ v, url }) {
|
|
12588
12804
|
const [deletePack, setDeletePack] = (0, import_react52.useState)(null);
|
|
12589
12805
|
const { isLoading, remove } = useApis_default();
|
|
@@ -12597,12 +12813,12 @@ function Packs({ v, url }) {
|
|
|
12597
12813
|
const items = (data2) => [
|
|
12598
12814
|
{
|
|
12599
12815
|
label: `Edit Pack`,
|
|
12600
|
-
icon: /* @__PURE__ */ (0,
|
|
12816
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_lucide_react36.FilePenLine, { size: 16 }),
|
|
12601
12817
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
12602
12818
|
},
|
|
12603
12819
|
{
|
|
12604
12820
|
label: `Delete Pack`,
|
|
12605
|
-
icon: /* @__PURE__ */ (0,
|
|
12821
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_lucide_react36.Trash2, { className: "text-red-500", size: 16 }),
|
|
12606
12822
|
onClick: () => setDeletePack(data2)
|
|
12607
12823
|
}
|
|
12608
12824
|
].filter(Boolean);
|
|
@@ -12612,7 +12828,7 @@ function Packs({ v, url }) {
|
|
|
12612
12828
|
header: "Name",
|
|
12613
12829
|
cell: ({ row }) => {
|
|
12614
12830
|
const pack = row.original;
|
|
12615
|
-
return /* @__PURE__ */ (0,
|
|
12831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { children: pack?.name });
|
|
12616
12832
|
}
|
|
12617
12833
|
},
|
|
12618
12834
|
{
|
|
@@ -12620,7 +12836,7 @@ function Packs({ v, url }) {
|
|
|
12620
12836
|
header: "Type",
|
|
12621
12837
|
cell: ({ row }) => {
|
|
12622
12838
|
const pack = row.original;
|
|
12623
|
-
return /* @__PURE__ */ (0,
|
|
12839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "capitalize", children: pack?.type });
|
|
12624
12840
|
}
|
|
12625
12841
|
},
|
|
12626
12842
|
{
|
|
@@ -12628,7 +12844,7 @@ function Packs({ v, url }) {
|
|
|
12628
12844
|
header: "Products Count",
|
|
12629
12845
|
cell: ({ row }) => {
|
|
12630
12846
|
const pack = row.original;
|
|
12631
|
-
return /* @__PURE__ */ (0,
|
|
12847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { children: [
|
|
12632
12848
|
pack?.products?.length || 0,
|
|
12633
12849
|
" Products"
|
|
12634
12850
|
] });
|
|
@@ -12639,13 +12855,13 @@ function Packs({ v, url }) {
|
|
|
12639
12855
|
header: "Actions",
|
|
12640
12856
|
cell: ({ row }) => {
|
|
12641
12857
|
const data2 = row.original;
|
|
12642
|
-
return /* @__PURE__ */ (0,
|
|
12858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12643
12859
|
Dropdown,
|
|
12644
12860
|
{
|
|
12645
12861
|
className: "cursor-pointer w-[150px]",
|
|
12646
12862
|
items: items(data2),
|
|
12647
12863
|
triggerMode: "hover",
|
|
12648
|
-
children: /* @__PURE__ */ (0,
|
|
12864
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_lucide_react36.EllipsisVertical, {})
|
|
12649
12865
|
}
|
|
12650
12866
|
);
|
|
12651
12867
|
}
|
|
@@ -12663,9 +12879,9 @@ function Packs({ v, url }) {
|
|
|
12663
12879
|
return error;
|
|
12664
12880
|
}
|
|
12665
12881
|
};
|
|
12666
|
-
return /* @__PURE__ */ (0,
|
|
12667
|
-
/* @__PURE__ */ (0,
|
|
12668
|
-
/* @__PURE__ */ (0,
|
|
12882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
12883
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Modal2, {}),
|
|
12884
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12669
12885
|
ConfirmModal,
|
|
12670
12886
|
{
|
|
12671
12887
|
isOpen: !!deletePack,
|
|
@@ -12678,7 +12894,7 @@ function Packs({ v, url }) {
|
|
|
12678
12894
|
children: null
|
|
12679
12895
|
}
|
|
12680
12896
|
),
|
|
12681
|
-
/* @__PURE__ */ (0,
|
|
12897
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
12682
12898
|
TransactionViewComponent,
|
|
12683
12899
|
{
|
|
12684
12900
|
columns,
|
|
@@ -12721,9 +12937,9 @@ var import_react_hook_form19 = require("react-hook-form");
|
|
|
12721
12937
|
var import_zod19 = require("@hookform/resolvers/zod");
|
|
12722
12938
|
var import_antd27 = require("antd");
|
|
12723
12939
|
var import_react53 = require("react");
|
|
12724
|
-
var
|
|
12725
|
-
var
|
|
12726
|
-
function PackForm() {
|
|
12940
|
+
var import_lucide_react37 = require("lucide-react");
|
|
12941
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12942
|
+
function PackForm() {
|
|
12727
12943
|
const { getQuery, navigate } = useApp_default();
|
|
12728
12944
|
const id = getQuery("id");
|
|
12729
12945
|
const isEdit = !!id;
|
|
@@ -12814,24 +13030,24 @@ function PackForm() {
|
|
|
12814
13030
|
setValue("tempCost", currentProduct.cost || 0);
|
|
12815
13031
|
}
|
|
12816
13032
|
}, [currentProduct]);
|
|
12817
|
-
return /* @__PURE__ */ (0,
|
|
13033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
12818
13034
|
Card,
|
|
12819
13035
|
{
|
|
12820
13036
|
className: "max-w-5xl mx-auto mt-10 relative",
|
|
12821
13037
|
isLoading: isLoadingGet,
|
|
12822
13038
|
loadingText: "Processing...",
|
|
12823
13039
|
children: [
|
|
12824
|
-
/* @__PURE__ */ (0,
|
|
12825
|
-
/* @__PURE__ */ (0,
|
|
12826
|
-
/* @__PURE__ */ (0,
|
|
13040
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(Card.Header, { children: [
|
|
13041
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Pack` }),
|
|
13042
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card.Description, { children: isEdit ? `Update the details for this product pack` : `Create a new product pack and define its components` })
|
|
12827
13043
|
] }),
|
|
12828
|
-
/* @__PURE__ */ (0,
|
|
13044
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
12829
13045
|
"form",
|
|
12830
13046
|
{
|
|
12831
13047
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
12832
13048
|
children: [
|
|
12833
|
-
/* @__PURE__ */ (0,
|
|
12834
|
-
/* @__PURE__ */ (0,
|
|
13049
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 mb-8", children: [
|
|
13050
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12835
13051
|
Fields_default.Input,
|
|
12836
13052
|
{
|
|
12837
13053
|
label: "Pack Name",
|
|
@@ -12842,7 +13058,7 @@ function PackForm() {
|
|
|
12842
13058
|
required: true
|
|
12843
13059
|
}
|
|
12844
13060
|
),
|
|
12845
|
-
/* @__PURE__ */ (0,
|
|
13061
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12846
13062
|
Fields_default.Select,
|
|
12847
13063
|
{
|
|
12848
13064
|
label: "Pack Type",
|
|
@@ -12853,10 +13069,10 @@ function PackForm() {
|
|
|
12853
13069
|
}
|
|
12854
13070
|
)
|
|
12855
13071
|
] }),
|
|
12856
|
-
/* @__PURE__ */ (0,
|
|
12857
|
-
/* @__PURE__ */ (0,
|
|
12858
|
-
/* @__PURE__ */ (0,
|
|
12859
|
-
/* @__PURE__ */ (0,
|
|
13072
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "border rounded-lg p-4 bg-gray-50/50 dark:bg-gray-800/20", children: [
|
|
13073
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("h3", { className: "text-lg font-semibold mb-4", children: "Products in Pack" }),
|
|
13074
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "mb-6 bg-white dark:bg-gray-900 p-4 rounded-lg border shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "grid grid-cols-12 gap-3 items-end", children: [
|
|
13075
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "col-span-12 sm:col-span-5", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12860
13076
|
Feilds_default5.Product,
|
|
12861
13077
|
{
|
|
12862
13078
|
label: "Find Product",
|
|
@@ -12866,7 +13082,7 @@ function PackForm() {
|
|
|
12866
13082
|
obj: "tempData"
|
|
12867
13083
|
}
|
|
12868
13084
|
) }),
|
|
12869
|
-
/* @__PURE__ */ (0,
|
|
13085
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "col-span-4 sm:col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12870
13086
|
Fields_default.Input,
|
|
12871
13087
|
{
|
|
12872
13088
|
label: "Qty",
|
|
@@ -12876,7 +13092,7 @@ function PackForm() {
|
|
|
12876
13092
|
placeholder: "1"
|
|
12877
13093
|
}
|
|
12878
13094
|
) }),
|
|
12879
|
-
/* @__PURE__ */ (0,
|
|
13095
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "col-span-5 sm:col-span-3", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12880
13096
|
Fields_default.Input,
|
|
12881
13097
|
{
|
|
12882
13098
|
label: "Cost",
|
|
@@ -12886,39 +13102,39 @@ function PackForm() {
|
|
|
12886
13102
|
placeholder: "0.00"
|
|
12887
13103
|
}
|
|
12888
13104
|
) }),
|
|
12889
|
-
/* @__PURE__ */ (0,
|
|
13105
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "col-span-3 sm:col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12890
13106
|
Button,
|
|
12891
13107
|
{
|
|
12892
13108
|
type: "button",
|
|
12893
13109
|
onClick: onAddProduct,
|
|
12894
13110
|
className: "w-full h-[40px]",
|
|
12895
|
-
icon: /* @__PURE__ */ (0,
|
|
13111
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_lucide_react37.Plus, { size: 16 }),
|
|
12896
13112
|
children: "Add"
|
|
12897
13113
|
}
|
|
12898
13114
|
) })
|
|
12899
13115
|
] }) }),
|
|
12900
|
-
/* @__PURE__ */ (0,
|
|
12901
|
-
/* @__PURE__ */ (0,
|
|
12902
|
-
/* @__PURE__ */ (0,
|
|
12903
|
-
/* @__PURE__ */ (0,
|
|
12904
|
-
/* @__PURE__ */ (0,
|
|
12905
|
-
/* @__PURE__ */ (0,
|
|
12906
|
-
/* @__PURE__ */ (0,
|
|
13116
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("table", { className: "w-full text-left border-collapse", children: [
|
|
13117
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("thead", { className: "bg-gray-100 dark:bg-gray-800/50", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("tr", { children: [
|
|
13118
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500", children: "Product" }),
|
|
13119
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-24", children: "Qty" }),
|
|
13120
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-32", children: "Cost" }),
|
|
13121
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-32", children: "Line Total" }),
|
|
13122
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-16 text-center", children: "Action" })
|
|
12907
13123
|
] }) }),
|
|
12908
|
-
/* @__PURE__ */ (0,
|
|
12909
|
-
fields.map((field, index) => /* @__PURE__ */ (0,
|
|
13124
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("tbody", { className: "divide-y divide-gray-100 dark:divide-gray-800 bg-white dark:bg-gray-900", children: [
|
|
13125
|
+
fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
12910
13126
|
"tr",
|
|
12911
13127
|
{
|
|
12912
13128
|
className: "hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors",
|
|
12913
13129
|
children: [
|
|
12914
|
-
/* @__PURE__ */ (0,
|
|
12915
|
-
/* @__PURE__ */ (0,
|
|
12916
|
-
field.productData?.sku && /* @__PURE__ */ (0,
|
|
13130
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("td", { className: "px-3 py-2", children: [
|
|
13131
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
|
|
13132
|
+
field.productData?.sku && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("p", { className: "text-[10px] text-gray-500", children: [
|
|
12917
13133
|
"SKU: ",
|
|
12918
13134
|
field.productData?.sku
|
|
12919
13135
|
] })
|
|
12920
13136
|
] }),
|
|
12921
|
-
/* @__PURE__ */ (0,
|
|
13137
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12922
13138
|
Fields_default.Input,
|
|
12923
13139
|
{
|
|
12924
13140
|
form: methods,
|
|
@@ -12929,7 +13145,7 @@ function PackForm() {
|
|
|
12929
13145
|
className: "h-8 py-1!"
|
|
12930
13146
|
}
|
|
12931
13147
|
) }),
|
|
12932
|
-
/* @__PURE__ */ (0,
|
|
13148
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12933
13149
|
Fields_default.Input,
|
|
12934
13150
|
{
|
|
12935
13151
|
form: methods,
|
|
@@ -12940,8 +13156,8 @@ function PackForm() {
|
|
|
12940
13156
|
className: "h-8 py-1!"
|
|
12941
13157
|
}
|
|
12942
13158
|
) }),
|
|
12943
|
-
/* @__PURE__ */ (0,
|
|
12944
|
-
/* @__PURE__ */ (0,
|
|
13159
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "px-3 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "text-sm font-semibold", children: ((Number(watch(`products.${index}.quantity`)) || 0) * (Number(watch(`products.${index}.cost`)) || 0)).toLocaleString() }) }),
|
|
13160
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "px-3 py-2 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12945
13161
|
Button,
|
|
12946
13162
|
{
|
|
12947
13163
|
type: "button",
|
|
@@ -12949,42 +13165,42 @@ function PackForm() {
|
|
|
12949
13165
|
size: "sm",
|
|
12950
13166
|
className: "text-red-500 hover:text-red-700 hover:bg-red-50 p-1 h-8 w-8",
|
|
12951
13167
|
onClick: () => remove(index),
|
|
12952
|
-
children: /* @__PURE__ */ (0,
|
|
13168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_lucide_react37.Trash2, { size: 16 })
|
|
12953
13169
|
}
|
|
12954
13170
|
) })
|
|
12955
13171
|
]
|
|
12956
13172
|
},
|
|
12957
13173
|
field.id
|
|
12958
13174
|
)),
|
|
12959
|
-
fields.length === 0 && /* @__PURE__ */ (0,
|
|
13175
|
+
fields.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { colSpan: 5, className: "text-center py-10", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-sm text-gray-500", children: "No products added yet. Use the search above to add products." }) }) })
|
|
12960
13176
|
] })
|
|
12961
13177
|
] }) }),
|
|
12962
|
-
/* @__PURE__ */ (0,
|
|
12963
|
-
/* @__PURE__ */ (0,
|
|
12964
|
-
/* @__PURE__ */ (0,
|
|
12965
|
-
/* @__PURE__ */ (0,
|
|
13178
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "mt-6 pt-6 border-t grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
|
|
13179
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
|
|
13180
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Lines" }),
|
|
13181
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-lg font-bold text-blue-600", children: watch("products")?.length || 0 })
|
|
12966
13182
|
] }),
|
|
12967
|
-
/* @__PURE__ */ (0,
|
|
12968
|
-
/* @__PURE__ */ (0,
|
|
12969
|
-
/* @__PURE__ */ (0,
|
|
13183
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
|
|
13184
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Quantity" }),
|
|
13185
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-lg font-bold text-indigo-600", children: watch("products")?.reduce(
|
|
12970
13186
|
(acc, curr) => acc + (Number(curr.quantity) || 0),
|
|
12971
13187
|
0
|
|
12972
13188
|
) })
|
|
12973
13189
|
] }),
|
|
12974
|
-
/* @__PURE__ */ (0,
|
|
12975
|
-
/* @__PURE__ */ (0,
|
|
12976
|
-
/* @__PURE__ */ (0,
|
|
13190
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
|
|
13191
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
|
|
13192
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("p", { className: "text-lg font-bold text-emerald-600", children: [
|
|
12977
13193
|
watch("products")?.reduce(
|
|
12978
13194
|
(acc, curr) => acc + (Number(curr.quantity) || 0) * (Number(curr.cost) || 0),
|
|
12979
13195
|
0
|
|
12980
13196
|
).toLocaleString(),
|
|
12981
13197
|
" ",
|
|
12982
|
-
/* @__PURE__ */ (0,
|
|
13198
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
|
|
12983
13199
|
] })
|
|
12984
13200
|
] })
|
|
12985
13201
|
] })
|
|
12986
13202
|
] }),
|
|
12987
|
-
/* @__PURE__ */ (0,
|
|
13203
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("footer", { className: "flex justify-end mt-8", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
12988
13204
|
Button,
|
|
12989
13205
|
{
|
|
12990
13206
|
isLoading,
|
|
@@ -13005,7 +13221,7 @@ function PackForm() {
|
|
|
13005
13221
|
var PackForm_default = PackForm;
|
|
13006
13222
|
|
|
13007
13223
|
// src/components/packs/Feilds/Pack.tsx
|
|
13008
|
-
var
|
|
13224
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
13009
13225
|
function Pack({
|
|
13010
13226
|
name,
|
|
13011
13227
|
label,
|
|
@@ -13017,7 +13233,7 @@ function Pack({
|
|
|
13017
13233
|
required,
|
|
13018
13234
|
disabled
|
|
13019
13235
|
}) {
|
|
13020
|
-
return /* @__PURE__ */ (0,
|
|
13236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
13021
13237
|
Fields_default.SearchApi,
|
|
13022
13238
|
{
|
|
13023
13239
|
label,
|
|
@@ -13039,11 +13255,11 @@ var Pack_default = { Pack };
|
|
|
13039
13255
|
|
|
13040
13256
|
// src/components/journals/Journals.tsx
|
|
13041
13257
|
var import_react_router_dom24 = require("react-router-dom");
|
|
13042
|
-
var
|
|
13258
|
+
var import_lucide_react38 = require("lucide-react");
|
|
13043
13259
|
|
|
13044
13260
|
// src/hooks/useTransactionView.tsx
|
|
13045
13261
|
var import_react54 = require("react");
|
|
13046
|
-
var
|
|
13262
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
13047
13263
|
var useTransactionView = () => {
|
|
13048
13264
|
const [open, setOpen] = (0, import_react54.useState)(false);
|
|
13049
13265
|
const [id, setId] = (0, import_react54.useState)("");
|
|
@@ -13069,7 +13285,7 @@ var useTransactionView = () => {
|
|
|
13069
13285
|
};
|
|
13070
13286
|
const TransactionView = () => {
|
|
13071
13287
|
if (!open) return null;
|
|
13072
|
-
return /* @__PURE__ */ (0,
|
|
13288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
13073
13289
|
Views_default.Transaction,
|
|
13074
13290
|
{
|
|
13075
13291
|
close: closeTransaction,
|
|
@@ -13092,7 +13308,7 @@ var useTransactionView = () => {
|
|
|
13092
13308
|
var useTransactionView_default = useTransactionView;
|
|
13093
13309
|
|
|
13094
13310
|
// src/components/journals/Journals.tsx
|
|
13095
|
-
var
|
|
13311
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
13096
13312
|
function Journals({
|
|
13097
13313
|
url,
|
|
13098
13314
|
journalType
|
|
@@ -13108,7 +13324,7 @@ function Journals({
|
|
|
13108
13324
|
const items = (data2) => [
|
|
13109
13325
|
{
|
|
13110
13326
|
label: `View Journal`,
|
|
13111
|
-
icon: /* @__PURE__ */ (0,
|
|
13327
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react38.Eye, { size: 16 }),
|
|
13112
13328
|
className: "min-w-[200px]",
|
|
13113
13329
|
onClick: () => openTransaction({
|
|
13114
13330
|
id: data2?._id,
|
|
@@ -13117,12 +13333,12 @@ function Journals({
|
|
|
13117
13333
|
},
|
|
13118
13334
|
{
|
|
13119
13335
|
label: `Edit Journal`,
|
|
13120
|
-
icon: /* @__PURE__ */ (0,
|
|
13336
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react38.FilePenLine, { size: 16 }),
|
|
13121
13337
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
13122
13338
|
},
|
|
13123
13339
|
{
|
|
13124
13340
|
label: `Delete Journal`,
|
|
13125
|
-
icon: /* @__PURE__ */ (0,
|
|
13341
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react38.Trash2, { className: "text-red-500", size: 16 }),
|
|
13126
13342
|
onClick: () => {
|
|
13127
13343
|
openTransaction({
|
|
13128
13344
|
id: data2?._id,
|
|
@@ -13138,9 +13354,9 @@ function Journals({
|
|
|
13138
13354
|
header: "Date",
|
|
13139
13355
|
cell: ({ row }) => {
|
|
13140
13356
|
const journal = row.original;
|
|
13141
|
-
return /* @__PURE__ */ (0,
|
|
13142
|
-
/* @__PURE__ */ (0,
|
|
13143
|
-
/* @__PURE__ */ (0,
|
|
13357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col", children: [
|
|
13358
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: journal?.date }),
|
|
13359
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13144
13360
|
"span",
|
|
13145
13361
|
{
|
|
13146
13362
|
onClick: () => openTransaction({
|
|
@@ -13159,7 +13375,7 @@ function Journals({
|
|
|
13159
13375
|
header: "Account",
|
|
13160
13376
|
cell: ({ row }) => {
|
|
13161
13377
|
const journal = row.original;
|
|
13162
|
-
return /* @__PURE__ */ (0,
|
|
13378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: journal?.accountData?.name || "N/A" });
|
|
13163
13379
|
}
|
|
13164
13380
|
},
|
|
13165
13381
|
{
|
|
@@ -13167,9 +13383,9 @@ function Journals({
|
|
|
13167
13383
|
header: "Description",
|
|
13168
13384
|
cell: ({ row }) => {
|
|
13169
13385
|
const journal = row.original;
|
|
13170
|
-
return /* @__PURE__ */ (0,
|
|
13171
|
-
/* @__PURE__ */ (0,
|
|
13172
|
-
journal?.note && /* @__PURE__ */ (0,
|
|
13386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col", children: [
|
|
13387
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "capitalize", children: journal?.description }),
|
|
13388
|
+
journal?.note && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "text-xs text-gray-400 italic", children: [
|
|
13173
13389
|
"Note: ",
|
|
13174
13390
|
journal?.note
|
|
13175
13391
|
] })
|
|
@@ -13181,13 +13397,13 @@ function Journals({
|
|
|
13181
13397
|
header: "Amount",
|
|
13182
13398
|
cell: ({ row }) => {
|
|
13183
13399
|
const journal = row.original;
|
|
13184
|
-
return /* @__PURE__ */ (0,
|
|
13185
|
-
/* @__PURE__ */ (0,
|
|
13186
|
-
journal?.feeAmount > 0 && /* @__PURE__ */ (0,
|
|
13400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col", children: [
|
|
13401
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: Formats_default.Price(journal?.amount, journal?.currency) }),
|
|
13402
|
+
journal?.feeAmount > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "text-xs text-green-600", children: [
|
|
13187
13403
|
"with fee: ",
|
|
13188
13404
|
Formats_default.Price(journal?.feeAmount, journal?.currency)
|
|
13189
13405
|
] }),
|
|
13190
|
-
journal?.exchange?.rate && /* @__PURE__ */ (0,
|
|
13406
|
+
journal?.exchange?.rate && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "text-xs text-green-600", children: [
|
|
13191
13407
|
"Exchanged:",
|
|
13192
13408
|
" ",
|
|
13193
13409
|
Formats_default.Price(
|
|
@@ -13203,7 +13419,7 @@ function Journals({
|
|
|
13203
13419
|
header: "Type",
|
|
13204
13420
|
cell: ({ row }) => {
|
|
13205
13421
|
const journal = row.original;
|
|
13206
|
-
return /* @__PURE__ */ (0,
|
|
13422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "capitalize", children: journal?.journal });
|
|
13207
13423
|
}
|
|
13208
13424
|
},
|
|
13209
13425
|
{
|
|
@@ -13211,9 +13427,9 @@ function Journals({
|
|
|
13211
13427
|
header: "Via",
|
|
13212
13428
|
cell: ({ row }) => {
|
|
13213
13429
|
const journal = row.original;
|
|
13214
|
-
return /* @__PURE__ */ (0,
|
|
13215
|
-
/* @__PURE__ */ (0,
|
|
13216
|
-
journal?.journalVia === "via account" && /* @__PURE__ */ (0,
|
|
13430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "", children: [
|
|
13431
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "capitalize", children: journal?.journalVia }),
|
|
13432
|
+
journal?.journalVia === "via account" && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "capitalize text-xs text-gray-600", children: journal?.viaAccountData?.name })
|
|
13217
13433
|
] });
|
|
13218
13434
|
}
|
|
13219
13435
|
},
|
|
@@ -13222,7 +13438,7 @@ function Journals({
|
|
|
13222
13438
|
header: "Action",
|
|
13223
13439
|
cell: ({ row }) => {
|
|
13224
13440
|
const journal = row.original;
|
|
13225
|
-
return /* @__PURE__ */ (0,
|
|
13441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "capitalize", children: journal?.action });
|
|
13226
13442
|
}
|
|
13227
13443
|
},
|
|
13228
13444
|
{
|
|
@@ -13230,23 +13446,23 @@ function Journals({
|
|
|
13230
13446
|
header: "Actions",
|
|
13231
13447
|
cell: ({ row }) => {
|
|
13232
13448
|
const data2 = row.original;
|
|
13233
|
-
return /* @__PURE__ */ (0,
|
|
13449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13234
13450
|
Dropdown,
|
|
13235
13451
|
{
|
|
13236
13452
|
className: "cursor-pointer ",
|
|
13237
13453
|
items: items(data2),
|
|
13238
13454
|
triggerMode: "hover",
|
|
13239
|
-
children: /* @__PURE__ */ (0,
|
|
13455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react38.EllipsisVertical, {})
|
|
13240
13456
|
}
|
|
13241
13457
|
);
|
|
13242
13458
|
}
|
|
13243
13459
|
}
|
|
13244
13460
|
];
|
|
13245
13461
|
const journals = data?.data || [];
|
|
13246
|
-
return /* @__PURE__ */ (0,
|
|
13247
|
-
/* @__PURE__ */ (0,
|
|
13248
|
-
/* @__PURE__ */ (0,
|
|
13249
|
-
/* @__PURE__ */ (0,
|
|
13462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
|
|
13463
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Modal2, {}),
|
|
13464
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TransactionView, {}),
|
|
13465
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13250
13466
|
TransactionViewComponent,
|
|
13251
13467
|
{
|
|
13252
13468
|
columns,
|
|
@@ -13321,7 +13537,7 @@ function exchangedAmount({
|
|
|
13321
13537
|
result = amount;
|
|
13322
13538
|
} else if (accountCurrency === "USD") {
|
|
13323
13539
|
result = amount / exchangeRate;
|
|
13324
|
-
} else if (accountCurrency === "
|
|
13540
|
+
} else if (accountCurrency === "RMB") {
|
|
13325
13541
|
result = transactionCurrency === "USD" ? amount * exchangeRate : amount / exchangeRate;
|
|
13326
13542
|
} else if (accountCurrency === "KES") {
|
|
13327
13543
|
result = transactionCurrency === "TZS" ? amount / exchangeRate : amount * exchangeRate;
|
|
@@ -13338,7 +13554,7 @@ var Forex = {
|
|
|
13338
13554
|
var forex_default = Forex;
|
|
13339
13555
|
|
|
13340
13556
|
// src/components/journals/JournalForm.tsx
|
|
13341
|
-
var
|
|
13557
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
13342
13558
|
function JournalForm({
|
|
13343
13559
|
isFee = true,
|
|
13344
13560
|
accountType = "all"
|
|
@@ -13442,25 +13658,25 @@ function JournalForm({
|
|
|
13442
13658
|
fetches();
|
|
13443
13659
|
}
|
|
13444
13660
|
}, [id]);
|
|
13445
|
-
return /* @__PURE__ */ (0,
|
|
13661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13446
13662
|
Card,
|
|
13447
13663
|
{
|
|
13448
13664
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
13449
13665
|
isLoading: isLoadingGet,
|
|
13450
13666
|
loadingText: "Processing...",
|
|
13451
13667
|
children: [
|
|
13452
|
-
/* @__PURE__ */ (0,
|
|
13453
|
-
/* @__PURE__ */ (0,
|
|
13454
|
-
/* @__PURE__ */ (0,
|
|
13668
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(Card.Header, { children: [
|
|
13669
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Journal` }),
|
|
13670
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Card.Description, { children: isEdit ? `Update the details for this journal entry` : `Create a new journal entry` })
|
|
13455
13671
|
] }),
|
|
13456
|
-
/* @__PURE__ */ (0,
|
|
13672
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13457
13673
|
"form",
|
|
13458
13674
|
{
|
|
13459
13675
|
className: "space-y-4",
|
|
13460
13676
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
13461
13677
|
children: [
|
|
13462
|
-
/* @__PURE__ */ (0,
|
|
13463
|
-
/* @__PURE__ */ (0,
|
|
13678
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
13679
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13464
13680
|
Fields_default.Input,
|
|
13465
13681
|
{
|
|
13466
13682
|
label: "Description",
|
|
@@ -13470,7 +13686,7 @@ function JournalForm({
|
|
|
13470
13686
|
required: true
|
|
13471
13687
|
}
|
|
13472
13688
|
),
|
|
13473
|
-
/* @__PURE__ */ (0,
|
|
13689
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13474
13690
|
Fields_default.Select,
|
|
13475
13691
|
{
|
|
13476
13692
|
label: "Journal Via",
|
|
@@ -13481,8 +13697,8 @@ function JournalForm({
|
|
|
13481
13697
|
}
|
|
13482
13698
|
)
|
|
13483
13699
|
] }),
|
|
13484
|
-
/* @__PURE__ */ (0,
|
|
13485
|
-
/* @__PURE__ */ (0,
|
|
13700
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
13701
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13486
13702
|
Fields_default.DateInput,
|
|
13487
13703
|
{
|
|
13488
13704
|
label: "Date",
|
|
@@ -13491,7 +13707,7 @@ function JournalForm({
|
|
|
13491
13707
|
required: true
|
|
13492
13708
|
}
|
|
13493
13709
|
),
|
|
13494
|
-
journalVia === "via account" && /* @__PURE__ */ (0,
|
|
13710
|
+
journalVia === "via account" && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13495
13711
|
Feilds_default.Account,
|
|
13496
13712
|
{
|
|
13497
13713
|
label: "Via Account",
|
|
@@ -13505,7 +13721,7 @@ function JournalForm({
|
|
|
13505
13721
|
showBalance: true
|
|
13506
13722
|
}
|
|
13507
13723
|
),
|
|
13508
|
-
/* @__PURE__ */ (0,
|
|
13724
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13509
13725
|
Fields_default.Input,
|
|
13510
13726
|
{
|
|
13511
13727
|
label: "Amount",
|
|
@@ -13516,7 +13732,7 @@ function JournalForm({
|
|
|
13516
13732
|
required: true
|
|
13517
13733
|
}
|
|
13518
13734
|
),
|
|
13519
|
-
/* @__PURE__ */ (0,
|
|
13735
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13520
13736
|
Feilds_default.Account,
|
|
13521
13737
|
{
|
|
13522
13738
|
label: accountType === "all" ? "Account" : accountType,
|
|
@@ -13530,7 +13746,7 @@ function JournalForm({
|
|
|
13530
13746
|
obj: "accountObject"
|
|
13531
13747
|
}
|
|
13532
13748
|
),
|
|
13533
|
-
journalVia !== "via account" && /* @__PURE__ */ (0,
|
|
13749
|
+
journalVia !== "via account" && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13534
13750
|
Fields_default.Select,
|
|
13535
13751
|
{
|
|
13536
13752
|
label: "Action",
|
|
@@ -13540,8 +13756,8 @@ function JournalForm({
|
|
|
13540
13756
|
required: true
|
|
13541
13757
|
}
|
|
13542
13758
|
),
|
|
13543
|
-
isRate && /* @__PURE__ */ (0,
|
|
13544
|
-
/* @__PURE__ */ (0,
|
|
13759
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
|
|
13760
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13545
13761
|
Fields_default.Input,
|
|
13546
13762
|
{
|
|
13547
13763
|
label: "Rate",
|
|
@@ -13551,7 +13767,7 @@ function JournalForm({
|
|
|
13551
13767
|
required: true
|
|
13552
13768
|
}
|
|
13553
13769
|
),
|
|
13554
|
-
/* @__PURE__ */ (0,
|
|
13770
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13555
13771
|
Fields_default.Input,
|
|
13556
13772
|
{
|
|
13557
13773
|
label: "Exchanged Amount",
|
|
@@ -13563,8 +13779,8 @@ function JournalForm({
|
|
|
13563
13779
|
),
|
|
13564
13780
|
" "
|
|
13565
13781
|
] }),
|
|
13566
|
-
isFee && /* @__PURE__ */ (0,
|
|
13567
|
-
/* @__PURE__ */ (0,
|
|
13782
|
+
isFee && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
|
|
13783
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13568
13784
|
Fields_default.Input,
|
|
13569
13785
|
{
|
|
13570
13786
|
label: "Fee",
|
|
@@ -13574,7 +13790,7 @@ function JournalForm({
|
|
|
13574
13790
|
required: true
|
|
13575
13791
|
}
|
|
13576
13792
|
),
|
|
13577
|
-
/* @__PURE__ */ (0,
|
|
13793
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13578
13794
|
Fields_default.Input,
|
|
13579
13795
|
{
|
|
13580
13796
|
label: "Amount After Fee",
|
|
@@ -13586,7 +13802,7 @@ function JournalForm({
|
|
|
13586
13802
|
)
|
|
13587
13803
|
] })
|
|
13588
13804
|
] }),
|
|
13589
|
-
/* @__PURE__ */ (0,
|
|
13805
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13590
13806
|
Fields_default.Textarea,
|
|
13591
13807
|
{
|
|
13592
13808
|
label: "Note",
|
|
@@ -13595,7 +13811,7 @@ function JournalForm({
|
|
|
13595
13811
|
placeholder: "Add any additional notes here..."
|
|
13596
13812
|
}
|
|
13597
13813
|
),
|
|
13598
|
-
/* @__PURE__ */ (0,
|
|
13814
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13599
13815
|
Button,
|
|
13600
13816
|
{
|
|
13601
13817
|
isLoading,
|
|
@@ -13617,8 +13833,8 @@ var JournalForm_default = JournalForm;
|
|
|
13617
13833
|
|
|
13618
13834
|
// src/components/payment/Payments.tsx
|
|
13619
13835
|
var import_react_router_dom26 = require("react-router-dom");
|
|
13620
|
-
var
|
|
13621
|
-
var
|
|
13836
|
+
var import_lucide_react39 = require("lucide-react");
|
|
13837
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13622
13838
|
function Payments({
|
|
13623
13839
|
url,
|
|
13624
13840
|
paymentType
|
|
@@ -13634,17 +13850,17 @@ function Payments({
|
|
|
13634
13850
|
const items = (data2) => [
|
|
13635
13851
|
{
|
|
13636
13852
|
label: `View Payment`,
|
|
13637
|
-
icon: /* @__PURE__ */ (0,
|
|
13853
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react39.Eye, { size: 16 }),
|
|
13638
13854
|
onClick: () => openTransaction({ id: data2?._id, type: "payment" })
|
|
13639
13855
|
},
|
|
13640
13856
|
{
|
|
13641
13857
|
label: `Edit Payment`,
|
|
13642
|
-
icon: /* @__PURE__ */ (0,
|
|
13858
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react39.FilePenLine, { size: 16 }),
|
|
13643
13859
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
13644
13860
|
},
|
|
13645
13861
|
{
|
|
13646
13862
|
label: `Delete Payment`,
|
|
13647
|
-
icon: /* @__PURE__ */ (0,
|
|
13863
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react39.Trash2, { className: "text-red-500", size: 16 }),
|
|
13648
13864
|
onClick: () => {
|
|
13649
13865
|
openTransaction({
|
|
13650
13866
|
id: data2?._id,
|
|
@@ -13660,9 +13876,9 @@ function Payments({
|
|
|
13660
13876
|
header: "Date",
|
|
13661
13877
|
cell: ({ row }) => {
|
|
13662
13878
|
const payment = row.original;
|
|
13663
|
-
return /* @__PURE__ */ (0,
|
|
13664
|
-
/* @__PURE__ */ (0,
|
|
13665
|
-
/* @__PURE__ */ (0,
|
|
13879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex flex-col", children: [
|
|
13880
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: payment?.date }),
|
|
13881
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13666
13882
|
"span",
|
|
13667
13883
|
{
|
|
13668
13884
|
onClick: () => openTransaction({ id: payment?._id, type: "payment" }),
|
|
@@ -13678,7 +13894,7 @@ function Payments({
|
|
|
13678
13894
|
header: "Account",
|
|
13679
13895
|
cell: ({ row }) => {
|
|
13680
13896
|
const payment = row.original;
|
|
13681
|
-
return /* @__PURE__ */ (0,
|
|
13897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: payment?.accountData?.name || "N/A" });
|
|
13682
13898
|
}
|
|
13683
13899
|
},
|
|
13684
13900
|
{
|
|
@@ -13687,7 +13903,7 @@ function Payments({
|
|
|
13687
13903
|
cell: ({ row }) => {
|
|
13688
13904
|
const payment = row.original;
|
|
13689
13905
|
const walletData = payment?.fromWalletData || payment?.toWalletData;
|
|
13690
|
-
return /* @__PURE__ */ (0,
|
|
13906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: walletData?.name || "N/A" });
|
|
13691
13907
|
}
|
|
13692
13908
|
},
|
|
13693
13909
|
{
|
|
@@ -13695,13 +13911,13 @@ function Payments({
|
|
|
13695
13911
|
header: "Amount",
|
|
13696
13912
|
cell: ({ row }) => {
|
|
13697
13913
|
const payment = row.original;
|
|
13698
|
-
return /* @__PURE__ */ (0,
|
|
13699
|
-
/* @__PURE__ */ (0,
|
|
13700
|
-
payment?.feeAmount > 0 && /* @__PURE__ */ (0,
|
|
13914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex flex-col", children: [
|
|
13915
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: Formats_default.Price(payment?.amount, payment?.currency) }),
|
|
13916
|
+
payment?.feeAmount > 0 && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "text-xs text-green-600", children: [
|
|
13701
13917
|
"fee: ",
|
|
13702
13918
|
Formats_default.Price(payment?.feeAmount, payment?.currency)
|
|
13703
13919
|
] }),
|
|
13704
|
-
payment?.exchange?.rate && /* @__PURE__ */ (0,
|
|
13920
|
+
payment?.exchange?.rate && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "text-xs text-green-600", children: [
|
|
13705
13921
|
"Rate: ",
|
|
13706
13922
|
payment?.exchange?.rate,
|
|
13707
13923
|
" (",
|
|
@@ -13719,7 +13935,7 @@ function Payments({
|
|
|
13719
13935
|
header: "Action",
|
|
13720
13936
|
cell: ({ row }) => {
|
|
13721
13937
|
const payment = row.original;
|
|
13722
|
-
return /* @__PURE__ */ (0,
|
|
13938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13723
13939
|
"span",
|
|
13724
13940
|
{
|
|
13725
13941
|
className: `capitalize ${payment?.action === "debit" ? "text-red-600" : "text-green-600"}`,
|
|
@@ -13733,23 +13949,23 @@ function Payments({
|
|
|
13733
13949
|
header: "Actions",
|
|
13734
13950
|
cell: ({ row }) => {
|
|
13735
13951
|
const data2 = row.original;
|
|
13736
|
-
return /* @__PURE__ */ (0,
|
|
13952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13737
13953
|
Dropdown,
|
|
13738
13954
|
{
|
|
13739
13955
|
className: "cursor-pointer w-[150px]",
|
|
13740
13956
|
items: items(data2),
|
|
13741
13957
|
triggerMode: "hover",
|
|
13742
|
-
children: /* @__PURE__ */ (0,
|
|
13958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_lucide_react39.EllipsisVertical, {})
|
|
13743
13959
|
}
|
|
13744
13960
|
);
|
|
13745
13961
|
}
|
|
13746
13962
|
}
|
|
13747
13963
|
];
|
|
13748
13964
|
const payments = data?.data || [];
|
|
13749
|
-
return /* @__PURE__ */ (0,
|
|
13750
|
-
/* @__PURE__ */ (0,
|
|
13751
|
-
/* @__PURE__ */ (0,
|
|
13752
|
-
/* @__PURE__ */ (0,
|
|
13965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
13966
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TransactionView, {}),
|
|
13967
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Modal2, {}),
|
|
13968
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13753
13969
|
TransactionViewComponent,
|
|
13754
13970
|
{
|
|
13755
13971
|
columns,
|
|
@@ -13794,7 +14010,7 @@ var paymentSchema = import_zod25.z.object({
|
|
|
13794
14010
|
});
|
|
13795
14011
|
|
|
13796
14012
|
// src/components/payment/PaymentForm.tsx
|
|
13797
|
-
var
|
|
14013
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
13798
14014
|
function PaymentForm({
|
|
13799
14015
|
accountType = "all"
|
|
13800
14016
|
}) {
|
|
@@ -13883,24 +14099,24 @@ function PaymentForm({
|
|
|
13883
14099
|
fetches();
|
|
13884
14100
|
}
|
|
13885
14101
|
}, [id]);
|
|
13886
|
-
return /* @__PURE__ */ (0,
|
|
14102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
13887
14103
|
Card,
|
|
13888
14104
|
{
|
|
13889
14105
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
13890
14106
|
isLoading: isLoadingGet,
|
|
13891
14107
|
loadingText: "Processing...",
|
|
13892
14108
|
children: [
|
|
13893
|
-
/* @__PURE__ */ (0,
|
|
13894
|
-
/* @__PURE__ */ (0,
|
|
13895
|
-
/* @__PURE__ */ (0,
|
|
14109
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Card.Header, { children: [
|
|
14110
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Payment` }),
|
|
14111
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Card.Description, { children: isEdit ? `Update the details for this payment entry` : `Create a new payment and link it to an account and wallet` })
|
|
13896
14112
|
] }),
|
|
13897
|
-
/* @__PURE__ */ (0,
|
|
14113
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
13898
14114
|
"form",
|
|
13899
14115
|
{
|
|
13900
14116
|
className: "space-y-4",
|
|
13901
14117
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
13902
14118
|
children: [
|
|
13903
|
-
/* @__PURE__ */ (0,
|
|
14119
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13904
14120
|
Fields_default.Input,
|
|
13905
14121
|
{
|
|
13906
14122
|
label: "Description",
|
|
@@ -13911,8 +14127,8 @@ function PaymentForm({
|
|
|
13911
14127
|
required: true
|
|
13912
14128
|
}
|
|
13913
14129
|
),
|
|
13914
|
-
/* @__PURE__ */ (0,
|
|
13915
|
-
/* @__PURE__ */ (0,
|
|
14130
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
14131
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13916
14132
|
Fields_default.DateInput,
|
|
13917
14133
|
{
|
|
13918
14134
|
label: "Date",
|
|
@@ -13921,7 +14137,7 @@ function PaymentForm({
|
|
|
13921
14137
|
required: true
|
|
13922
14138
|
}
|
|
13923
14139
|
),
|
|
13924
|
-
/* @__PURE__ */ (0,
|
|
14140
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13925
14141
|
Feilds_default.Account,
|
|
13926
14142
|
{
|
|
13927
14143
|
label: accountType === "all" ? "Account" : accountType,
|
|
@@ -13935,8 +14151,8 @@ function PaymentForm({
|
|
|
13935
14151
|
}
|
|
13936
14152
|
)
|
|
13937
14153
|
] }),
|
|
13938
|
-
/* @__PURE__ */ (0,
|
|
13939
|
-
/* @__PURE__ */ (0,
|
|
14154
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
14155
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13940
14156
|
Feilds_default2.Wallet,
|
|
13941
14157
|
{
|
|
13942
14158
|
label: "Wallet",
|
|
@@ -13948,7 +14164,7 @@ function PaymentForm({
|
|
|
13948
14164
|
obj: "walletObject"
|
|
13949
14165
|
}
|
|
13950
14166
|
),
|
|
13951
|
-
/* @__PURE__ */ (0,
|
|
14167
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13952
14168
|
Fields_default.Input,
|
|
13953
14169
|
{
|
|
13954
14170
|
label: "Amount",
|
|
@@ -13960,8 +14176,8 @@ function PaymentForm({
|
|
|
13960
14176
|
}
|
|
13961
14177
|
),
|
|
13962
14178
|
" ",
|
|
13963
|
-
isRate && /* @__PURE__ */ (0,
|
|
13964
|
-
/* @__PURE__ */ (0,
|
|
14179
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
14180
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13965
14181
|
Fields_default.Input,
|
|
13966
14182
|
{
|
|
13967
14183
|
label: `Rate (1 ${walletObj?.currency} = ? ${accountObj?.currency})`,
|
|
@@ -13971,7 +14187,7 @@ function PaymentForm({
|
|
|
13971
14187
|
required: true
|
|
13972
14188
|
}
|
|
13973
14189
|
),
|
|
13974
|
-
/* @__PURE__ */ (0,
|
|
14190
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13975
14191
|
Fields_default.Input,
|
|
13976
14192
|
{
|
|
13977
14193
|
label: "Exchanged Amount",
|
|
@@ -13982,7 +14198,7 @@ function PaymentForm({
|
|
|
13982
14198
|
}
|
|
13983
14199
|
)
|
|
13984
14200
|
] }),
|
|
13985
|
-
/* @__PURE__ */ (0,
|
|
14201
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13986
14202
|
Fields_default.Select,
|
|
13987
14203
|
{
|
|
13988
14204
|
label: "Action",
|
|
@@ -13992,9 +14208,9 @@ function PaymentForm({
|
|
|
13992
14208
|
required: true
|
|
13993
14209
|
}
|
|
13994
14210
|
),
|
|
13995
|
-
/* @__PURE__ */ (0,
|
|
14211
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Fields_default.Input, { label: "Fee", type: "number", name: "fee", form: methods })
|
|
13996
14212
|
] }),
|
|
13997
|
-
/* @__PURE__ */ (0,
|
|
14213
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13998
14214
|
Fields_default.Textarea,
|
|
13999
14215
|
{
|
|
14000
14216
|
label: "Note",
|
|
@@ -14003,7 +14219,7 @@ function PaymentForm({
|
|
|
14003
14219
|
placeholder: "Add any additional notes here..."
|
|
14004
14220
|
}
|
|
14005
14221
|
),
|
|
14006
|
-
/* @__PURE__ */ (0,
|
|
14222
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14007
14223
|
Button,
|
|
14008
14224
|
{
|
|
14009
14225
|
isLoading,
|
|
@@ -14025,8 +14241,8 @@ var PaymentForm_default = PaymentForm;
|
|
|
14025
14241
|
|
|
14026
14242
|
// src/components/moneyTransfer/MoneyTransfers.tsx
|
|
14027
14243
|
var import_react_router_dom28 = require("react-router-dom");
|
|
14028
|
-
var
|
|
14029
|
-
var
|
|
14244
|
+
var import_lucide_react40 = require("lucide-react");
|
|
14245
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
14030
14246
|
function MoneyTransfers({ url }) {
|
|
14031
14247
|
const { branchId } = (0, import_react_router_dom28.useParams)();
|
|
14032
14248
|
const navigate = (0, import_react_router_dom28.useNavigate)();
|
|
@@ -14039,17 +14255,17 @@ function MoneyTransfers({ url }) {
|
|
|
14039
14255
|
const items = (data2) => [
|
|
14040
14256
|
{
|
|
14041
14257
|
label: `View Transfer`,
|
|
14042
|
-
icon: /* @__PURE__ */ (0,
|
|
14258
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react40.FilePenLine, { size: 16 }),
|
|
14043
14259
|
onClick: () => openTransaction({ id: data2?._id, type: "money transfer" })
|
|
14044
14260
|
},
|
|
14045
14261
|
{
|
|
14046
14262
|
label: `Edit Transfer`,
|
|
14047
|
-
icon: /* @__PURE__ */ (0,
|
|
14263
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react40.FilePenLine, { size: 16 }),
|
|
14048
14264
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
14049
14265
|
},
|
|
14050
14266
|
{
|
|
14051
14267
|
label: `Reverse Transfer`,
|
|
14052
|
-
icon: /* @__PURE__ */ (0,
|
|
14268
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react40.Trash2, { className: "text-red-500", size: 16 }),
|
|
14053
14269
|
onClick: () => {
|
|
14054
14270
|
openTransaction({
|
|
14055
14271
|
id: data2?._id,
|
|
@@ -14065,9 +14281,9 @@ function MoneyTransfers({ url }) {
|
|
|
14065
14281
|
header: "Date",
|
|
14066
14282
|
cell: ({ row }) => {
|
|
14067
14283
|
const transfer = row.original;
|
|
14068
|
-
return /* @__PURE__ */ (0,
|
|
14069
|
-
/* @__PURE__ */ (0,
|
|
14070
|
-
/* @__PURE__ */ (0,
|
|
14284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex flex-col", children: [
|
|
14285
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: transfer?.date }),
|
|
14286
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14071
14287
|
"span",
|
|
14072
14288
|
{
|
|
14073
14289
|
onClick: () => openTransaction({ id: transfer?._id, type: "money transfer" }),
|
|
@@ -14083,7 +14299,7 @@ function MoneyTransfers({ url }) {
|
|
|
14083
14299
|
header: "From Wallet",
|
|
14084
14300
|
cell: ({ row }) => {
|
|
14085
14301
|
const transfer = row.original;
|
|
14086
|
-
return /* @__PURE__ */ (0,
|
|
14302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: transfer?.fromWalletData?.name || "N/A" });
|
|
14087
14303
|
}
|
|
14088
14304
|
},
|
|
14089
14305
|
{
|
|
@@ -14091,7 +14307,7 @@ function MoneyTransfers({ url }) {
|
|
|
14091
14307
|
header: "To Wallet",
|
|
14092
14308
|
cell: ({ row }) => {
|
|
14093
14309
|
const transfer = row.original;
|
|
14094
|
-
return /* @__PURE__ */ (0,
|
|
14310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: transfer?.toWalletData?.name || "N/A" });
|
|
14095
14311
|
}
|
|
14096
14312
|
},
|
|
14097
14313
|
{
|
|
@@ -14099,13 +14315,13 @@ function MoneyTransfers({ url }) {
|
|
|
14099
14315
|
header: "Amount",
|
|
14100
14316
|
cell: ({ row }) => {
|
|
14101
14317
|
const transfer = row.original;
|
|
14102
|
-
return /* @__PURE__ */ (0,
|
|
14103
|
-
/* @__PURE__ */ (0,
|
|
14104
|
-
transfer?.fee > 0 && /* @__PURE__ */ (0,
|
|
14318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex flex-col", children: [
|
|
14319
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: Formats_default.Price(transfer?.amount, transfer?.currency) }),
|
|
14320
|
+
transfer?.fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "text-xs text-orange-600", children: [
|
|
14105
14321
|
"Fee: ",
|
|
14106
14322
|
Formats_default.Price(transfer?.fee, transfer?.currency)
|
|
14107
14323
|
] }),
|
|
14108
|
-
transfer?.exchange?.rate && /* @__PURE__ */ (0,
|
|
14324
|
+
transfer?.exchange?.rate && /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "text-xs text-green-600", children: [
|
|
14109
14325
|
"Rate: ",
|
|
14110
14326
|
transfer?.exchange?.rate,
|
|
14111
14327
|
" (",
|
|
@@ -14123,23 +14339,23 @@ function MoneyTransfers({ url }) {
|
|
|
14123
14339
|
header: "Actions",
|
|
14124
14340
|
cell: ({ row }) => {
|
|
14125
14341
|
const data2 = row.original;
|
|
14126
|
-
return /* @__PURE__ */ (0,
|
|
14342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14127
14343
|
Dropdown,
|
|
14128
14344
|
{
|
|
14129
14345
|
className: "cursor-pointer w-[150px]",
|
|
14130
14346
|
items: items(data2),
|
|
14131
14347
|
triggerMode: "hover",
|
|
14132
|
-
children: /* @__PURE__ */ (0,
|
|
14348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_lucide_react40.EllipsisVertical, {})
|
|
14133
14349
|
}
|
|
14134
14350
|
);
|
|
14135
14351
|
}
|
|
14136
14352
|
}
|
|
14137
14353
|
];
|
|
14138
14354
|
const transfers = data?.data || [];
|
|
14139
|
-
return /* @__PURE__ */ (0,
|
|
14140
|
-
/* @__PURE__ */ (0,
|
|
14141
|
-
/* @__PURE__ */ (0,
|
|
14142
|
-
/* @__PURE__ */ (0,
|
|
14355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
14356
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Modal2, {}),
|
|
14357
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TransactionView, {}),
|
|
14358
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
14143
14359
|
TransactionViewComponent,
|
|
14144
14360
|
{
|
|
14145
14361
|
columns,
|
|
@@ -14182,7 +14398,7 @@ var moneyTransferSchema = import_zod28.z.object({
|
|
|
14182
14398
|
});
|
|
14183
14399
|
|
|
14184
14400
|
// src/components/moneyTransfer/MoneyTransferForm.tsx
|
|
14185
|
-
var
|
|
14401
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
14186
14402
|
function MoneyTransferForm() {
|
|
14187
14403
|
const { branchId } = (0, import_react_router_dom29.useParams)();
|
|
14188
14404
|
const { getQuery, navigate } = useApp_default();
|
|
@@ -14262,26 +14478,26 @@ function MoneyTransferForm() {
|
|
|
14262
14478
|
fetches();
|
|
14263
14479
|
}
|
|
14264
14480
|
}, [id]);
|
|
14265
|
-
return /* @__PURE__ */ (0,
|
|
14481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
14266
14482
|
Card,
|
|
14267
14483
|
{
|
|
14268
14484
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
14269
14485
|
isLoading: isLoadingGet,
|
|
14270
14486
|
loadingText: "Processing...",
|
|
14271
14487
|
children: [
|
|
14272
|
-
/* @__PURE__ */ (0,
|
|
14273
|
-
/* @__PURE__ */ (0,
|
|
14274
|
-
/* @__PURE__ */ (0,
|
|
14488
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Card.Header, { children: [
|
|
14489
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Money Transfer` }),
|
|
14490
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Card.Description, { children: isEdit ? `Update the details for this money transfer` : `Move funds between two wallets` })
|
|
14275
14491
|
] }),
|
|
14276
|
-
/* @__PURE__ */ (0,
|
|
14492
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
14277
14493
|
"form",
|
|
14278
14494
|
{
|
|
14279
14495
|
className: "space-y-4",
|
|
14280
14496
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
14281
14497
|
children: [
|
|
14282
14498
|
" ",
|
|
14283
|
-
/* @__PURE__ */ (0,
|
|
14284
|
-
/* @__PURE__ */ (0,
|
|
14499
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
14500
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14285
14501
|
Feilds_default2.Wallet,
|
|
14286
14502
|
{
|
|
14287
14503
|
label: "Source Wallet (From)",
|
|
@@ -14294,7 +14510,7 @@ function MoneyTransferForm() {
|
|
|
14294
14510
|
filter: [toWallet]
|
|
14295
14511
|
}
|
|
14296
14512
|
),
|
|
14297
|
-
/* @__PURE__ */ (0,
|
|
14513
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14298
14514
|
Feilds_default2.Wallet,
|
|
14299
14515
|
{
|
|
14300
14516
|
label: "Destination Wallet (To)",
|
|
@@ -14308,8 +14524,8 @@ function MoneyTransferForm() {
|
|
|
14308
14524
|
}
|
|
14309
14525
|
)
|
|
14310
14526
|
] }),
|
|
14311
|
-
/* @__PURE__ */ (0,
|
|
14312
|
-
/* @__PURE__ */ (0,
|
|
14527
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-4", children: [
|
|
14528
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14313
14529
|
Fields_default.DateInput,
|
|
14314
14530
|
{
|
|
14315
14531
|
label: "Date",
|
|
@@ -14318,7 +14534,7 @@ function MoneyTransferForm() {
|
|
|
14318
14534
|
required: true
|
|
14319
14535
|
}
|
|
14320
14536
|
),
|
|
14321
|
-
/* @__PURE__ */ (0,
|
|
14537
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14322
14538
|
Fields_default.Input,
|
|
14323
14539
|
{
|
|
14324
14540
|
label: "Amount",
|
|
@@ -14329,7 +14545,7 @@ function MoneyTransferForm() {
|
|
|
14329
14545
|
required: true
|
|
14330
14546
|
}
|
|
14331
14547
|
),
|
|
14332
|
-
/* @__PURE__ */ (0,
|
|
14548
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14333
14549
|
Fields_default.Input,
|
|
14334
14550
|
{
|
|
14335
14551
|
label: "Fee (Optional)",
|
|
@@ -14340,8 +14556,8 @@ function MoneyTransferForm() {
|
|
|
14340
14556
|
}
|
|
14341
14557
|
)
|
|
14342
14558
|
] }),
|
|
14343
|
-
isRate && /* @__PURE__ */ (0,
|
|
14344
|
-
/* @__PURE__ */ (0,
|
|
14559
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
14560
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14345
14561
|
Fields_default.Input,
|
|
14346
14562
|
{
|
|
14347
14563
|
label: `Rate (1 ${fromWalletObj?.currency} = ? ${toWalletObj?.currency})`,
|
|
@@ -14351,7 +14567,7 @@ function MoneyTransferForm() {
|
|
|
14351
14567
|
required: true
|
|
14352
14568
|
}
|
|
14353
14569
|
),
|
|
14354
|
-
/* @__PURE__ */ (0,
|
|
14570
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14355
14571
|
Fields_default.Input,
|
|
14356
14572
|
{
|
|
14357
14573
|
label: "Exchanged Amount",
|
|
@@ -14362,7 +14578,7 @@ function MoneyTransferForm() {
|
|
|
14362
14578
|
}
|
|
14363
14579
|
)
|
|
14364
14580
|
] }),
|
|
14365
|
-
/* @__PURE__ */ (0,
|
|
14581
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14366
14582
|
Fields_default.Textarea,
|
|
14367
14583
|
{
|
|
14368
14584
|
label: "Note",
|
|
@@ -14371,7 +14587,7 @@ function MoneyTransferForm() {
|
|
|
14371
14587
|
placeholder: "Add any additional notes here..."
|
|
14372
14588
|
}
|
|
14373
14589
|
),
|
|
14374
|
-
/* @__PURE__ */ (0,
|
|
14590
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
14375
14591
|
Button,
|
|
14376
14592
|
{
|
|
14377
14593
|
isLoading,
|
|
@@ -14393,8 +14609,8 @@ var MoneyTransferForm_default = MoneyTransferForm;
|
|
|
14393
14609
|
|
|
14394
14610
|
// src/components/expense/Expenses.tsx
|
|
14395
14611
|
var import_react_router_dom30 = require("react-router-dom");
|
|
14396
|
-
var
|
|
14397
|
-
var
|
|
14612
|
+
var import_lucide_react41 = require("lucide-react");
|
|
14613
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
14398
14614
|
function Expenses({ url }) {
|
|
14399
14615
|
const { branchId } = (0, import_react_router_dom30.useParams)();
|
|
14400
14616
|
const navigate = (0, import_react_router_dom30.useNavigate)();
|
|
@@ -14407,17 +14623,17 @@ function Expenses({ url }) {
|
|
|
14407
14623
|
const items = (data2) => [
|
|
14408
14624
|
{
|
|
14409
14625
|
label: `View Expense`,
|
|
14410
|
-
icon: /* @__PURE__ */ (0,
|
|
14626
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react41.FilePenLine, { size: 16 }),
|
|
14411
14627
|
onClick: () => openTransaction({ id: data2?._id, type: "expense" })
|
|
14412
14628
|
},
|
|
14413
14629
|
{
|
|
14414
14630
|
label: `Edit Expense`,
|
|
14415
|
-
icon: /* @__PURE__ */ (0,
|
|
14631
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react41.FilePenLine, { size: 16 }),
|
|
14416
14632
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
14417
14633
|
},
|
|
14418
14634
|
{
|
|
14419
14635
|
label: `Delete Expense`,
|
|
14420
|
-
icon: /* @__PURE__ */ (0,
|
|
14636
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react41.Trash2, { className: "text-red-500", size: 16 }),
|
|
14421
14637
|
onClick: () => {
|
|
14422
14638
|
openTransaction({
|
|
14423
14639
|
id: data2?._id,
|
|
@@ -14433,9 +14649,9 @@ function Expenses({ url }) {
|
|
|
14433
14649
|
header: "Date",
|
|
14434
14650
|
cell: ({ row }) => {
|
|
14435
14651
|
const expense = row.original;
|
|
14436
|
-
return /* @__PURE__ */ (0,
|
|
14437
|
-
/* @__PURE__ */ (0,
|
|
14438
|
-
/* @__PURE__ */ (0,
|
|
14652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col", children: [
|
|
14653
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { children: expense?.date }),
|
|
14654
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
14439
14655
|
"span",
|
|
14440
14656
|
{
|
|
14441
14657
|
onClick: () => openTransaction({ id: expense?._id, type: "expense" }),
|
|
@@ -14451,9 +14667,9 @@ function Expenses({ url }) {
|
|
|
14451
14667
|
header: "Description",
|
|
14452
14668
|
cell: ({ row }) => {
|
|
14453
14669
|
const expense = row.original;
|
|
14454
|
-
return /* @__PURE__ */ (0,
|
|
14455
|
-
/* @__PURE__ */ (0,
|
|
14456
|
-
expense?.note && /* @__PURE__ */ (0,
|
|
14670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col", children: [
|
|
14671
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "capitalize", children: expense?.description }),
|
|
14672
|
+
expense?.note && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
14457
14673
|
] });
|
|
14458
14674
|
}
|
|
14459
14675
|
},
|
|
@@ -14463,7 +14679,7 @@ function Expenses({ url }) {
|
|
|
14463
14679
|
cell: ({ row }) => {
|
|
14464
14680
|
const expense = row.original;
|
|
14465
14681
|
const walletData = expense?.fromWalletData || expense?.toWalletData;
|
|
14466
|
-
return /* @__PURE__ */ (0,
|
|
14682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { children: walletData?.name || "N/A" });
|
|
14467
14683
|
}
|
|
14468
14684
|
},
|
|
14469
14685
|
{
|
|
@@ -14471,7 +14687,7 @@ function Expenses({ url }) {
|
|
|
14471
14687
|
header: "Amount",
|
|
14472
14688
|
cell: ({ row }) => {
|
|
14473
14689
|
const expense = row.original;
|
|
14474
|
-
return /* @__PURE__ */ (0,
|
|
14690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) });
|
|
14475
14691
|
}
|
|
14476
14692
|
},
|
|
14477
14693
|
{
|
|
@@ -14479,23 +14695,23 @@ function Expenses({ url }) {
|
|
|
14479
14695
|
header: "Actions",
|
|
14480
14696
|
cell: ({ row }) => {
|
|
14481
14697
|
const data2 = row.original;
|
|
14482
|
-
return /* @__PURE__ */ (0,
|
|
14698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
14483
14699
|
Dropdown,
|
|
14484
14700
|
{
|
|
14485
14701
|
className: "cursor-pointer w-[150px]",
|
|
14486
14702
|
items: items(data2),
|
|
14487
14703
|
triggerMode: "hover",
|
|
14488
|
-
children: /* @__PURE__ */ (0,
|
|
14704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_lucide_react41.EllipsisVertical, {})
|
|
14489
14705
|
}
|
|
14490
14706
|
);
|
|
14491
14707
|
}
|
|
14492
14708
|
}
|
|
14493
14709
|
];
|
|
14494
14710
|
const expenses = data?.data || [];
|
|
14495
|
-
return /* @__PURE__ */ (0,
|
|
14496
|
-
/* @__PURE__ */ (0,
|
|
14497
|
-
/* @__PURE__ */ (0,
|
|
14498
|
-
/* @__PURE__ */ (0,
|
|
14711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
14712
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TransactionView, {}),
|
|
14713
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Modal2, {}),
|
|
14714
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
14499
14715
|
TransactionViewComponent,
|
|
14500
14716
|
{
|
|
14501
14717
|
columns,
|
|
@@ -14534,7 +14750,7 @@ var expenseSchema = import_zod31.z.object({
|
|
|
14534
14750
|
});
|
|
14535
14751
|
|
|
14536
14752
|
// src/components/expense/ExpenseForm.tsx
|
|
14537
|
-
var
|
|
14753
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
14538
14754
|
function ExpenseForm() {
|
|
14539
14755
|
const { branchId } = (0, import_react_router_dom31.useParams)();
|
|
14540
14756
|
const { getQuery, navigate } = useApp_default();
|
|
@@ -14592,25 +14808,25 @@ function ExpenseForm() {
|
|
|
14592
14808
|
fetches();
|
|
14593
14809
|
}
|
|
14594
14810
|
}, [id]);
|
|
14595
|
-
return /* @__PURE__ */ (0,
|
|
14811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
14596
14812
|
Card,
|
|
14597
14813
|
{
|
|
14598
14814
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
14599
14815
|
isLoading: isLoadingGet,
|
|
14600
14816
|
loadingText: "Processing...",
|
|
14601
14817
|
children: [
|
|
14602
|
-
/* @__PURE__ */ (0,
|
|
14603
|
-
/* @__PURE__ */ (0,
|
|
14604
|
-
/* @__PURE__ */ (0,
|
|
14818
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Card.Header, { children: [
|
|
14819
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
14820
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
14605
14821
|
] }),
|
|
14606
|
-
/* @__PURE__ */ (0,
|
|
14822
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
14607
14823
|
"form",
|
|
14608
14824
|
{
|
|
14609
14825
|
className: "space-y-4",
|
|
14610
14826
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
14611
14827
|
children: [
|
|
14612
|
-
/* @__PURE__ */ (0,
|
|
14613
|
-
/* @__PURE__ */ (0,
|
|
14828
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
14829
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14614
14830
|
Fields_default.Input,
|
|
14615
14831
|
{
|
|
14616
14832
|
label: "Description",
|
|
@@ -14620,7 +14836,7 @@ function ExpenseForm() {
|
|
|
14620
14836
|
required: true
|
|
14621
14837
|
}
|
|
14622
14838
|
),
|
|
14623
|
-
/* @__PURE__ */ (0,
|
|
14839
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14624
14840
|
Feilds_default2.Wallet,
|
|
14625
14841
|
{
|
|
14626
14842
|
label: "Wallet",
|
|
@@ -14633,8 +14849,8 @@ function ExpenseForm() {
|
|
|
14633
14849
|
}
|
|
14634
14850
|
)
|
|
14635
14851
|
] }),
|
|
14636
|
-
/* @__PURE__ */ (0,
|
|
14637
|
-
/* @__PURE__ */ (0,
|
|
14852
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
14853
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14638
14854
|
Fields_default.DateInput,
|
|
14639
14855
|
{
|
|
14640
14856
|
label: "Date",
|
|
@@ -14643,7 +14859,7 @@ function ExpenseForm() {
|
|
|
14643
14859
|
required: true
|
|
14644
14860
|
}
|
|
14645
14861
|
),
|
|
14646
|
-
/* @__PURE__ */ (0,
|
|
14862
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14647
14863
|
Fields_default.Input,
|
|
14648
14864
|
{
|
|
14649
14865
|
label: "Amount",
|
|
@@ -14655,7 +14871,7 @@ function ExpenseForm() {
|
|
|
14655
14871
|
}
|
|
14656
14872
|
)
|
|
14657
14873
|
] }),
|
|
14658
|
-
/* @__PURE__ */ (0,
|
|
14874
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14659
14875
|
Fields_default.Textarea,
|
|
14660
14876
|
{
|
|
14661
14877
|
label: "Note",
|
|
@@ -14664,7 +14880,7 @@ function ExpenseForm() {
|
|
|
14664
14880
|
placeholder: "Add any additional details..."
|
|
14665
14881
|
}
|
|
14666
14882
|
),
|
|
14667
|
-
/* @__PURE__ */ (0,
|
|
14883
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
14668
14884
|
Button,
|
|
14669
14885
|
{
|
|
14670
14886
|
isLoading,
|
|
@@ -14685,28 +14901,28 @@ function ExpenseForm() {
|
|
|
14685
14901
|
var ExpenseForm_default = ExpenseForm;
|
|
14686
14902
|
|
|
14687
14903
|
// src/components/ErrorPage/ErrorPage.tsx
|
|
14688
|
-
var
|
|
14904
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
14689
14905
|
var ErrorPageBase = ({
|
|
14690
14906
|
title,
|
|
14691
|
-
message:
|
|
14907
|
+
message: message31,
|
|
14692
14908
|
statusCode,
|
|
14693
14909
|
action,
|
|
14694
14910
|
className = ""
|
|
14695
14911
|
}) => {
|
|
14696
|
-
return /* @__PURE__ */ (0,
|
|
14912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14697
14913
|
"div",
|
|
14698
14914
|
{
|
|
14699
14915
|
className: `flex-1 m-auto h-full w-full min-h-[50vh] flex flex-col items-center justify-center p-6 text-zinc-900 dark:text-zinc-100 ${className}`,
|
|
14700
|
-
children: /* @__PURE__ */ (0,
|
|
14701
|
-
statusCode && /* @__PURE__ */ (0,
|
|
14702
|
-
/* @__PURE__ */ (0,
|
|
14703
|
-
statusCode && /* @__PURE__ */ (0,
|
|
14916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
|
|
14917
|
+
statusCode && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "absolute inset-0 flex items-center justify-center z-0 select-none pointer-events-none opacity-[0.03] dark:opacity-5", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
|
|
14918
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "relative z-10 space-y-6", children: [
|
|
14919
|
+
statusCode && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
|
|
14704
14920
|
"Error ",
|
|
14705
14921
|
statusCode
|
|
14706
14922
|
] }),
|
|
14707
|
-
title && /* @__PURE__ */ (0,
|
|
14708
|
-
|
|
14709
|
-
action && /* @__PURE__ */ (0,
|
|
14923
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
|
|
14924
|
+
message31 && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message31 }),
|
|
14925
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "pt-8", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14710
14926
|
"button",
|
|
14711
14927
|
{
|
|
14712
14928
|
onClick: action.onClick,
|
|
@@ -14722,9 +14938,9 @@ var ErrorPageBase = ({
|
|
|
14722
14938
|
};
|
|
14723
14939
|
|
|
14724
14940
|
// src/components/ErrorPage/ErrorPage.500.tsx
|
|
14725
|
-
var
|
|
14941
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
14726
14942
|
var ErrorPage500 = (props) => {
|
|
14727
|
-
return /* @__PURE__ */ (0,
|
|
14943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14728
14944
|
ErrorPageBase,
|
|
14729
14945
|
{
|
|
14730
14946
|
statusCode: 500,
|
|
@@ -14737,9 +14953,9 @@ var ErrorPage500 = (props) => {
|
|
|
14737
14953
|
};
|
|
14738
14954
|
|
|
14739
14955
|
// src/components/ErrorPage/ErrorPage.404.tsx
|
|
14740
|
-
var
|
|
14956
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
14741
14957
|
var ErrorPage404 = (props) => {
|
|
14742
|
-
return /* @__PURE__ */ (0,
|
|
14958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
14743
14959
|
ErrorPageBase,
|
|
14744
14960
|
{
|
|
14745
14961
|
statusCode: 404,
|
|
@@ -14752,9 +14968,9 @@ var ErrorPage404 = (props) => {
|
|
|
14752
14968
|
};
|
|
14753
14969
|
|
|
14754
14970
|
// src/components/ErrorPage/ErrorPage.401.tsx
|
|
14755
|
-
var
|
|
14971
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
14756
14972
|
var ErrorPage401 = (props) => {
|
|
14757
|
-
return /* @__PURE__ */ (0,
|
|
14973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14758
14974
|
ErrorPageBase,
|
|
14759
14975
|
{
|
|
14760
14976
|
statusCode: 401,
|
|
@@ -14767,9 +14983,9 @@ var ErrorPage401 = (props) => {
|
|
|
14767
14983
|
};
|
|
14768
14984
|
|
|
14769
14985
|
// src/components/ErrorPage/ErrorPage.400.tsx
|
|
14770
|
-
var
|
|
14986
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
14771
14987
|
var ErrorPage400 = (props) => {
|
|
14772
|
-
return /* @__PURE__ */ (0,
|
|
14988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14773
14989
|
ErrorPageBase,
|
|
14774
14990
|
{
|
|
14775
14991
|
statusCode: 400,
|
|
@@ -14790,7 +15006,7 @@ var ErrorPage = Object.assign(ErrorPageBase, {
|
|
|
14790
15006
|
});
|
|
14791
15007
|
|
|
14792
15008
|
// src/components/accounts/Report.tsx
|
|
14793
|
-
var
|
|
15009
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
14794
15010
|
var AccountReport = () => {
|
|
14795
15011
|
const { apiConfig } = useWarqadConfig();
|
|
14796
15012
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -14809,9 +15025,9 @@ var AccountReport = () => {
|
|
|
14809
15025
|
header: "Date",
|
|
14810
15026
|
key: "date",
|
|
14811
15027
|
className: "text-xs whitespace-nowrap",
|
|
14812
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
14813
|
-
/* @__PURE__ */ (0,
|
|
14814
|
-
/* @__PURE__ */ (0,
|
|
15028
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "", children: [
|
|
15029
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
15030
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
14815
15031
|
"span",
|
|
14816
15032
|
{
|
|
14817
15033
|
onClick: () => {
|
|
@@ -14830,7 +15046,7 @@ var AccountReport = () => {
|
|
|
14830
15046
|
header: "Description",
|
|
14831
15047
|
key: "description",
|
|
14832
15048
|
className: "text-xs w-full break-words",
|
|
14833
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15049
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.description })
|
|
14834
15050
|
},
|
|
14835
15051
|
{
|
|
14836
15052
|
header: "Credit",
|
|
@@ -14839,16 +15055,16 @@ var AccountReport = () => {
|
|
|
14839
15055
|
render: (row) => {
|
|
14840
15056
|
const Amount = row.calculatedAmount;
|
|
14841
15057
|
const fee = 0;
|
|
14842
|
-
return /* @__PURE__ */ (0,
|
|
14843
|
-
/* @__PURE__ */ (0,
|
|
14844
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "", children: Amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
15059
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "font-bold text-green-500 dark:text-green-500 print:text-green-500", children: Formats_default.Amount(Amount) }),
|
|
15060
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "text-[8px]", children: [
|
|
14845
15061
|
"fee:(",
|
|
14846
15062
|
fee,
|
|
14847
15063
|
")"
|
|
14848
15064
|
] })
|
|
14849
15065
|
] }) : "" });
|
|
14850
15066
|
},
|
|
14851
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15067
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
14852
15068
|
data2.reduce(
|
|
14853
15069
|
(acc, row) => acc + (row.calculatedAmount > 0 ? row.calculatedAmount : 0),
|
|
14854
15070
|
0
|
|
@@ -14862,16 +15078,16 @@ var AccountReport = () => {
|
|
|
14862
15078
|
render: (row) => {
|
|
14863
15079
|
const Amount = row.calculatedAmount;
|
|
14864
15080
|
const fee = 0;
|
|
14865
|
-
return /* @__PURE__ */ (0,
|
|
14866
|
-
/* @__PURE__ */ (0,
|
|
14867
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "", children: Amount < 0 ? /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
15082
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "font-bold text-red-500 dark:text-red-500 print:text-red-500", children: Formats_default.Amount(Amount) }),
|
|
15083
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "text-[8px]", children: [
|
|
14868
15084
|
"Fee:(",
|
|
14869
15085
|
fee,
|
|
14870
15086
|
")"
|
|
14871
15087
|
] })
|
|
14872
15088
|
] }) : "" });
|
|
14873
15089
|
},
|
|
14874
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15090
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
14875
15091
|
data2.reduce(
|
|
14876
15092
|
(acc, row) => acc + (row.calculatedAmount < 0 ? row.calculatedAmount : 0),
|
|
14877
15093
|
0
|
|
@@ -14882,8 +15098,8 @@ var AccountReport = () => {
|
|
|
14882
15098
|
header: "Balance",
|
|
14883
15099
|
key: "runningBalance",
|
|
14884
15100
|
className: "text-xs whitespace-nowrap text-right",
|
|
14885
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
14886
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15101
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
15102
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
14887
15103
|
data2.reduce((acc, row) => acc + row.calculatedAmount, 0),
|
|
14888
15104
|
currency
|
|
14889
15105
|
) })
|
|
@@ -14902,9 +15118,9 @@ var AccountReport = () => {
|
|
|
14902
15118
|
{ label: "Account Type", value: data?.data?.type },
|
|
14903
15119
|
{ label: "Currency", value: data?.data?.currency }
|
|
14904
15120
|
];
|
|
14905
|
-
return /* @__PURE__ */ (0,
|
|
14906
|
-
/* @__PURE__ */ (0,
|
|
14907
|
-
/* @__PURE__ */ (0,
|
|
15121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
15122
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(TransactionView, {}),
|
|
15123
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
14908
15124
|
A4DataView,
|
|
14909
15125
|
{
|
|
14910
15126
|
columns,
|
|
@@ -14921,7 +15137,7 @@ var AccountReport = () => {
|
|
|
14921
15137
|
var Report_default = AccountReport;
|
|
14922
15138
|
|
|
14923
15139
|
// src/components/wallets/Report.tsx
|
|
14924
|
-
var
|
|
15140
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
14925
15141
|
var WalletReport = () => {
|
|
14926
15142
|
const { apiConfig } = useWarqadConfig();
|
|
14927
15143
|
const { getParams } = useApp_default();
|
|
@@ -14939,9 +15155,9 @@ var WalletReport = () => {
|
|
|
14939
15155
|
header: "Date",
|
|
14940
15156
|
key: "date",
|
|
14941
15157
|
className: "text-xs whitespace-nowrap",
|
|
14942
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
14943
|
-
/* @__PURE__ */ (0,
|
|
14944
|
-
/* @__PURE__ */ (0,
|
|
15158
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "", children: [
|
|
15159
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
15160
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
14945
15161
|
"span",
|
|
14946
15162
|
{
|
|
14947
15163
|
onClick: () => {
|
|
@@ -14960,7 +15176,7 @@ var WalletReport = () => {
|
|
|
14960
15176
|
header: "Description",
|
|
14961
15177
|
key: "description",
|
|
14962
15178
|
className: "text-xs w-full break-words",
|
|
14963
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15179
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: row.description })
|
|
14964
15180
|
},
|
|
14965
15181
|
{
|
|
14966
15182
|
header: "Credit",
|
|
@@ -14969,9 +15185,9 @@ var WalletReport = () => {
|
|
|
14969
15185
|
render: (row) => {
|
|
14970
15186
|
const Amount = row.calculatedAmount;
|
|
14971
15187
|
const fee = 0;
|
|
14972
|
-
return /* @__PURE__ */ (0,
|
|
14973
|
-
/* @__PURE__ */ (0,
|
|
14974
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "", children: Amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
15189
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "font-bold text-green-500 dark:text-green-500 print:text-green-500", children: Formats_default.Amount(Amount) }),
|
|
15190
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "text-[8px]", children: [
|
|
14975
15191
|
"fee:(",
|
|
14976
15192
|
fee,
|
|
14977
15193
|
")"
|
|
@@ -14979,7 +15195,7 @@ var WalletReport = () => {
|
|
|
14979
15195
|
] }) : "" });
|
|
14980
15196
|
},
|
|
14981
15197
|
renderFooter: (data2) => {
|
|
14982
|
-
return /* @__PURE__ */ (0,
|
|
15198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
14983
15199
|
data2.reduce(
|
|
14984
15200
|
(acc, row) => acc + (row.calculatedAmount > 0 ? row.calculatedAmount : 0),
|
|
14985
15201
|
0
|
|
@@ -14995,16 +15211,16 @@ var WalletReport = () => {
|
|
|
14995
15211
|
render: (row) => {
|
|
14996
15212
|
const Amount = row.calculatedAmount;
|
|
14997
15213
|
const fee = 0;
|
|
14998
|
-
return /* @__PURE__ */ (0,
|
|
14999
|
-
/* @__PURE__ */ (0,
|
|
15000
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "", children: Amount < 0 ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
15215
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "font-bold text-red-500 dark:text-red-500 print:text-red-500", children: Formats_default.Amount(Amount) }),
|
|
15216
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "text-[8px]", children: [
|
|
15001
15217
|
"Fee:(",
|
|
15002
15218
|
fee,
|
|
15003
15219
|
")"
|
|
15004
15220
|
] })
|
|
15005
15221
|
] }) : "" });
|
|
15006
15222
|
},
|
|
15007
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15223
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
15008
15224
|
data2.reduce(
|
|
15009
15225
|
(acc, row) => acc + (row.calculatedAmount < 0 ? row.calculatedAmount : 0),
|
|
15010
15226
|
0
|
|
@@ -15015,8 +15231,8 @@ var WalletReport = () => {
|
|
|
15015
15231
|
header: "Balance",
|
|
15016
15232
|
key: "runningBalance",
|
|
15017
15233
|
className: "text-xs whitespace-nowrap text-right",
|
|
15018
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15019
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15234
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
15235
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
15020
15236
|
data2.reduce((acc, row) => acc + row.calculatedAmount, 0),
|
|
15021
15237
|
currency
|
|
15022
15238
|
) })
|
|
@@ -15035,9 +15251,9 @@ var WalletReport = () => {
|
|
|
15035
15251
|
{ label: "Wallet Account No", value: data?.data?.accountNo || "N/A" },
|
|
15036
15252
|
{ label: "Currency", value: data?.data?.currency }
|
|
15037
15253
|
];
|
|
15038
|
-
return /* @__PURE__ */ (0,
|
|
15039
|
-
/* @__PURE__ */ (0,
|
|
15040
|
-
/* @__PURE__ */ (0,
|
|
15254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
15255
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(TransactionView, {}),
|
|
15256
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
15041
15257
|
A4DataView,
|
|
15042
15258
|
{
|
|
15043
15259
|
columns,
|
|
@@ -15056,7 +15272,7 @@ var Report_default2 = WalletReport;
|
|
|
15056
15272
|
// src/components/accounts/Statements.tsx
|
|
15057
15273
|
var import_react_router_dom32 = require("react-router-dom");
|
|
15058
15274
|
var import_react59 = require("react");
|
|
15059
|
-
var
|
|
15275
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
15060
15276
|
var options = [
|
|
15061
15277
|
{ label: "All", value: "all" },
|
|
15062
15278
|
{ label: "Debit", value: "debit" },
|
|
@@ -15121,7 +15337,7 @@ var AccountStatements = () => {
|
|
|
15121
15337
|
header: "Name",
|
|
15122
15338
|
key: "name",
|
|
15123
15339
|
className: "text-xs whitespace-nowrap ",
|
|
15124
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15340
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
15125
15341
|
"p",
|
|
15126
15342
|
{
|
|
15127
15343
|
onClick: () => navigate(`${row._id}`),
|
|
@@ -15137,9 +15353,9 @@ var AccountStatements = () => {
|
|
|
15137
15353
|
render: (row) => {
|
|
15138
15354
|
const Amount = row.balance;
|
|
15139
15355
|
const fee = 0;
|
|
15140
|
-
return /* @__PURE__ */ (0,
|
|
15141
|
-
/* @__PURE__ */ (0,
|
|
15142
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "", children: Amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
15357
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("p", { className: "font-bold text-green-500 dark:text-green-500 print:text-green-500", children: Formats_default.Amount(Amount) }),
|
|
15358
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "text-[8px]", children: [
|
|
15143
15359
|
"fee:(",
|
|
15144
15360
|
fee,
|
|
15145
15361
|
")"
|
|
@@ -15147,7 +15363,7 @@ var AccountStatements = () => {
|
|
|
15147
15363
|
] }) : "" });
|
|
15148
15364
|
},
|
|
15149
15365
|
renderFooter: (data2) => {
|
|
15150
|
-
return /* @__PURE__ */ (0,
|
|
15366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
15151
15367
|
data2.reduce(
|
|
15152
15368
|
(acc, row) => acc + (row.balance > 0 ? row.balance : 0),
|
|
15153
15369
|
0
|
|
@@ -15163,16 +15379,16 @@ var AccountStatements = () => {
|
|
|
15163
15379
|
render: (row) => {
|
|
15164
15380
|
const Amount = row.balance;
|
|
15165
15381
|
const fee = 0;
|
|
15166
|
-
return /* @__PURE__ */ (0,
|
|
15167
|
-
/* @__PURE__ */ (0,
|
|
15168
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "", children: Amount < 0 ? /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
15383
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("p", { className: "font-bold text-red-500 dark:text-red-500 print:text-red-500", children: Formats_default.Amount(Amount) }),
|
|
15384
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "text-[8px]", children: [
|
|
15169
15385
|
"Fee:(",
|
|
15170
15386
|
fee,
|
|
15171
15387
|
")"
|
|
15172
15388
|
] })
|
|
15173
15389
|
] }) : "" });
|
|
15174
15390
|
},
|
|
15175
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15391
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
15176
15392
|
data2.reduce(
|
|
15177
15393
|
(acc, row) => acc + (row.balance < 0 ? row.balance : 0),
|
|
15178
15394
|
0
|
|
@@ -15183,8 +15399,8 @@ var AccountStatements = () => {
|
|
|
15183
15399
|
header: "Balance",
|
|
15184
15400
|
key: "runningBalance",
|
|
15185
15401
|
className: "text-xs whitespace-nowrap text-right",
|
|
15186
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15187
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15402
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, row.currency || currency || (currencyFilter === "all" ? void 0 : currencyFilter)) }),
|
|
15403
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
15188
15404
|
data2.reduce((acc, row) => acc + row.balance, 0),
|
|
15189
15405
|
currency || (currencyFilter === "all" ? void 0 : currencyFilter)
|
|
15190
15406
|
) })
|
|
@@ -15209,9 +15425,9 @@ var AccountStatements = () => {
|
|
|
15209
15425
|
if (filter === "credit")
|
|
15210
15426
|
return result.filter((item) => item.runningBalance > 0);
|
|
15211
15427
|
}, [filter, currencyFilter, data]);
|
|
15212
|
-
return /* @__PURE__ */ (0,
|
|
15213
|
-
/* @__PURE__ */ (0,
|
|
15214
|
-
/* @__PURE__ */ (0,
|
|
15428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_jsx_runtime98.Fragment, { children: [
|
|
15429
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(TransactionView, {}),
|
|
15430
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
15215
15431
|
A4DataView,
|
|
15216
15432
|
{
|
|
15217
15433
|
columns,
|
|
@@ -15220,8 +15436,8 @@ var AccountStatements = () => {
|
|
|
15220
15436
|
title: `Account Statement`,
|
|
15221
15437
|
subtitle: `All Outstanding Balances`,
|
|
15222
15438
|
fixed: false,
|
|
15223
|
-
headers: /* @__PURE__ */ (0,
|
|
15224
|
-
/* @__PURE__ */ (0,
|
|
15439
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex gap-2", children: [
|
|
15440
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
15225
15441
|
Fields_default.Select,
|
|
15226
15442
|
{
|
|
15227
15443
|
options,
|
|
@@ -15230,7 +15446,7 @@ var AccountStatements = () => {
|
|
|
15230
15446
|
className: "min-w-[150px] print:hidden"
|
|
15231
15447
|
}
|
|
15232
15448
|
),
|
|
15233
|
-
/* @__PURE__ */ (0,
|
|
15449
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
15234
15450
|
Fields_default.Select,
|
|
15235
15451
|
{
|
|
15236
15452
|
options: [
|
|
@@ -15255,7 +15471,7 @@ var Statements_default = AccountStatements;
|
|
|
15255
15471
|
// src/components/wallets/Statements.tsx
|
|
15256
15472
|
var import_react_router_dom33 = require("react-router-dom");
|
|
15257
15473
|
var import_react60 = require("react");
|
|
15258
|
-
var
|
|
15474
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
15259
15475
|
var options2 = [
|
|
15260
15476
|
{ label: "All", value: "all" },
|
|
15261
15477
|
{ label: "Debit", value: "debit" },
|
|
@@ -15318,7 +15534,7 @@ var WalletStatements = () => {
|
|
|
15318
15534
|
header: "Name",
|
|
15319
15535
|
key: "name",
|
|
15320
15536
|
className: "text-xs whitespace-nowrap",
|
|
15321
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15537
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
15322
15538
|
"p",
|
|
15323
15539
|
{
|
|
15324
15540
|
onClick: () => navigate(`${row._id}`),
|
|
@@ -15334,9 +15550,9 @@ var WalletStatements = () => {
|
|
|
15334
15550
|
render: (row) => {
|
|
15335
15551
|
const Amount = row.balance;
|
|
15336
15552
|
const fee = 0;
|
|
15337
|
-
return /* @__PURE__ */ (0,
|
|
15338
|
-
/* @__PURE__ */ (0,
|
|
15339
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "", children: Amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
15554
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "font-bold text-green-500 dark:text-green-500 print:text-green-500", children: Formats_default.Amount(Amount) }),
|
|
15555
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("span", { className: "text-[8px]", children: [
|
|
15340
15556
|
"fee:(",
|
|
15341
15557
|
fee,
|
|
15342
15558
|
")"
|
|
@@ -15344,7 +15560,7 @@ var WalletStatements = () => {
|
|
|
15344
15560
|
] }) : "" });
|
|
15345
15561
|
},
|
|
15346
15562
|
renderFooter: (data2) => {
|
|
15347
|
-
return /* @__PURE__ */ (0,
|
|
15563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
15348
15564
|
data2.reduce(
|
|
15349
15565
|
(acc, row) => acc + (row.balance > 0 ? row.balance : 0),
|
|
15350
15566
|
0
|
|
@@ -15360,16 +15576,16 @@ var WalletStatements = () => {
|
|
|
15360
15576
|
render: (row) => {
|
|
15361
15577
|
const Amount = row.balance;
|
|
15362
15578
|
const fee = 0;
|
|
15363
|
-
return /* @__PURE__ */ (0,
|
|
15364
|
-
/* @__PURE__ */ (0,
|
|
15365
|
-
fee > 0 && /* @__PURE__ */ (0,
|
|
15579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "", children: Amount < 0 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
15580
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)("p", { className: "font-bold text-red-500 dark:text-red-500 print:text-red-500", children: Formats_default.Amount(Amount) }),
|
|
15581
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("span", { className: "text-[8px]", children: [
|
|
15366
15582
|
"Fee:(",
|
|
15367
15583
|
fee,
|
|
15368
15584
|
")"
|
|
15369
15585
|
] })
|
|
15370
15586
|
] }) : "" });
|
|
15371
15587
|
},
|
|
15372
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15588
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
15373
15589
|
data2.reduce(
|
|
15374
15590
|
(acc, row) => acc + (row.balance < 0 ? row.balance : 0),
|
|
15375
15591
|
0
|
|
@@ -15380,8 +15596,8 @@ var WalletStatements = () => {
|
|
|
15380
15596
|
header: "Balance",
|
|
15381
15597
|
key: "runningBalance",
|
|
15382
15598
|
className: "text-xs whitespace-nowrap text-right",
|
|
15383
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
15384
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
15599
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, row.currency || currency || (currencyFilter === "all" ? void 0 : currencyFilter)) }),
|
|
15600
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
15385
15601
|
data2.reduce((acc, row) => acc + row.balance, 0),
|
|
15386
15602
|
currency || (currencyFilter === "all" ? void 0 : currencyFilter)
|
|
15387
15603
|
) })
|
|
@@ -15407,9 +15623,9 @@ var WalletStatements = () => {
|
|
|
15407
15623
|
if (filter === "credit")
|
|
15408
15624
|
return result.filter((item) => item.runningBalance > 0);
|
|
15409
15625
|
}, [filter, currencyFilter, data]);
|
|
15410
|
-
return /* @__PURE__ */ (0,
|
|
15411
|
-
/* @__PURE__ */ (0,
|
|
15412
|
-
/* @__PURE__ */ (0,
|
|
15626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
15627
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(TransactionView, {}),
|
|
15628
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
15413
15629
|
A4DataView,
|
|
15414
15630
|
{
|
|
15415
15631
|
columns,
|
|
@@ -15418,8 +15634,8 @@ var WalletStatements = () => {
|
|
|
15418
15634
|
title: `Wallet Statement`,
|
|
15419
15635
|
subtitle: `All Outstanding Balances`,
|
|
15420
15636
|
fixed: false,
|
|
15421
|
-
headers: /* @__PURE__ */ (0,
|
|
15422
|
-
/* @__PURE__ */ (0,
|
|
15637
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex gap-2", children: [
|
|
15638
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
15423
15639
|
Fields_default.Select,
|
|
15424
15640
|
{
|
|
15425
15641
|
options: options2,
|
|
@@ -15428,7 +15644,7 @@ var WalletStatements = () => {
|
|
|
15428
15644
|
className: "min-w-[150px] print:hidden"
|
|
15429
15645
|
}
|
|
15430
15646
|
),
|
|
15431
|
-
/* @__PURE__ */ (0,
|
|
15647
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
15432
15648
|
Fields_default.Select,
|
|
15433
15649
|
{
|
|
15434
15650
|
options: [
|
|
@@ -15452,8 +15668,8 @@ var Statements_default2 = WalletStatements;
|
|
|
15452
15668
|
|
|
15453
15669
|
// src/components/walletAdjustment/WalletAdjustments.tsx
|
|
15454
15670
|
var import_react_router_dom34 = require("react-router-dom");
|
|
15455
|
-
var
|
|
15456
|
-
var
|
|
15671
|
+
var import_lucide_react42 = require("lucide-react");
|
|
15672
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
15457
15673
|
function WalletAdjustments({ url }) {
|
|
15458
15674
|
const { branchId } = (0, import_react_router_dom34.useParams)();
|
|
15459
15675
|
const navigate = (0, import_react_router_dom34.useNavigate)();
|
|
@@ -15466,17 +15682,17 @@ function WalletAdjustments({ url }) {
|
|
|
15466
15682
|
const items = (data2) => [
|
|
15467
15683
|
{
|
|
15468
15684
|
label: `View Adjustment`,
|
|
15469
|
-
icon: /* @__PURE__ */ (0,
|
|
15685
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react42.FilePenLine, { size: 16 }),
|
|
15470
15686
|
onClick: () => openTransaction({ id: data2?._id, type: "adjustment" })
|
|
15471
15687
|
},
|
|
15472
15688
|
{
|
|
15473
15689
|
label: `Edit Adjustment`,
|
|
15474
|
-
icon: /* @__PURE__ */ (0,
|
|
15690
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react42.FilePenLine, { size: 16 }),
|
|
15475
15691
|
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
15476
15692
|
},
|
|
15477
15693
|
{
|
|
15478
15694
|
label: `Reverse Adjustment`,
|
|
15479
|
-
icon: /* @__PURE__ */ (0,
|
|
15695
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react42.Trash2, { className: "text-red-500", size: 16 }),
|
|
15480
15696
|
onClick: () => {
|
|
15481
15697
|
openTransaction({
|
|
15482
15698
|
id: data2?._id,
|
|
@@ -15492,9 +15708,9 @@ function WalletAdjustments({ url }) {
|
|
|
15492
15708
|
header: "Date",
|
|
15493
15709
|
cell: ({ row }) => {
|
|
15494
15710
|
const adjustment = row.original;
|
|
15495
|
-
return /* @__PURE__ */ (0,
|
|
15496
|
-
/* @__PURE__ */ (0,
|
|
15497
|
-
/* @__PURE__ */ (0,
|
|
15711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex flex-col", children: [
|
|
15712
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: adjustment?.date }),
|
|
15713
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
15498
15714
|
"span",
|
|
15499
15715
|
{
|
|
15500
15716
|
onClick: () => openTransaction({
|
|
@@ -15514,7 +15730,7 @@ function WalletAdjustments({ url }) {
|
|
|
15514
15730
|
cell: ({ row }) => {
|
|
15515
15731
|
const adjustment = row.original;
|
|
15516
15732
|
const walletData = adjustment?.toWalletData || adjustment?.fromWalletData;
|
|
15517
|
-
return /* @__PURE__ */ (0,
|
|
15733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: walletData?.name || "N/A" });
|
|
15518
15734
|
}
|
|
15519
15735
|
},
|
|
15520
15736
|
{
|
|
@@ -15522,7 +15738,7 @@ function WalletAdjustments({ url }) {
|
|
|
15522
15738
|
header: "Action",
|
|
15523
15739
|
cell: ({ row }) => {
|
|
15524
15740
|
const action = row.original.action;
|
|
15525
|
-
return /* @__PURE__ */ (0,
|
|
15741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
15526
15742
|
"span",
|
|
15527
15743
|
{
|
|
15528
15744
|
className: action === "credit" ? "text-green-600 font-medium" : "text-red-600 font-medium",
|
|
@@ -15541,7 +15757,7 @@ function WalletAdjustments({ url }) {
|
|
|
15541
15757
|
header: "Amount",
|
|
15542
15758
|
cell: ({ row }) => {
|
|
15543
15759
|
const adjustment = row.original;
|
|
15544
|
-
return /* @__PURE__ */ (0,
|
|
15760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: Formats_default.Price(adjustment?.amount, adjustment?.currency) }) });
|
|
15545
15761
|
}
|
|
15546
15762
|
},
|
|
15547
15763
|
{
|
|
@@ -15549,23 +15765,23 @@ function WalletAdjustments({ url }) {
|
|
|
15549
15765
|
header: "Actions",
|
|
15550
15766
|
cell: ({ row }) => {
|
|
15551
15767
|
const data2 = row.original;
|
|
15552
|
-
return /* @__PURE__ */ (0,
|
|
15768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
15553
15769
|
Dropdown,
|
|
15554
15770
|
{
|
|
15555
15771
|
className: "cursor-pointer w-[150px]",
|
|
15556
15772
|
items: items(data2),
|
|
15557
15773
|
triggerMode: "hover",
|
|
15558
|
-
children: /* @__PURE__ */ (0,
|
|
15774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_lucide_react42.EllipsisVertical, {})
|
|
15559
15775
|
}
|
|
15560
15776
|
);
|
|
15561
15777
|
}
|
|
15562
15778
|
}
|
|
15563
15779
|
];
|
|
15564
15780
|
const adjustments = data?.data || [];
|
|
15565
|
-
return /* @__PURE__ */ (0,
|
|
15566
|
-
/* @__PURE__ */ (0,
|
|
15567
|
-
/* @__PURE__ */ (0,
|
|
15568
|
-
/* @__PURE__ */ (0,
|
|
15781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_jsx_runtime100.Fragment, { children: [
|
|
15782
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Modal2, {}),
|
|
15783
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(TransactionView, {}),
|
|
15784
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
15569
15785
|
TransactionViewComponent,
|
|
15570
15786
|
{
|
|
15571
15787
|
columns,
|
|
@@ -15605,7 +15821,7 @@ var walletAdjustmentSchema = import_zod34.z.object({
|
|
|
15605
15821
|
});
|
|
15606
15822
|
|
|
15607
15823
|
// src/components/walletAdjustment/WalletAdjustmentForm.tsx
|
|
15608
|
-
var
|
|
15824
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
15609
15825
|
function WalletAdjustmentForm() {
|
|
15610
15826
|
const { branchId } = (0, import_react_router_dom35.useParams)();
|
|
15611
15827
|
const { getQuery, navigate } = useApp_default();
|
|
@@ -15665,25 +15881,25 @@ function WalletAdjustmentForm() {
|
|
|
15665
15881
|
fetches();
|
|
15666
15882
|
}
|
|
15667
15883
|
}, [id]);
|
|
15668
|
-
return /* @__PURE__ */ (0,
|
|
15884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
15669
15885
|
Card,
|
|
15670
15886
|
{
|
|
15671
15887
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
15672
15888
|
isLoading: isLoadingGet,
|
|
15673
15889
|
loadingText: "Processing...",
|
|
15674
15890
|
children: [
|
|
15675
|
-
/* @__PURE__ */ (0,
|
|
15676
|
-
/* @__PURE__ */ (0,
|
|
15677
|
-
/* @__PURE__ */ (0,
|
|
15891
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Card.Header, { children: [
|
|
15892
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Wallet Adjustment` }),
|
|
15893
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Card.Description, { children: isEdit ? `Update the details for this wallet adjustment` : `Adjust the balance of a specific wallet` })
|
|
15678
15894
|
] }),
|
|
15679
|
-
/* @__PURE__ */ (0,
|
|
15895
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
15680
15896
|
"form",
|
|
15681
15897
|
{
|
|
15682
15898
|
className: "space-y-4",
|
|
15683
15899
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
15684
15900
|
children: [
|
|
15685
|
-
/* @__PURE__ */ (0,
|
|
15686
|
-
/* @__PURE__ */ (0,
|
|
15901
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
15902
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15687
15903
|
Feilds_default2.Wallet,
|
|
15688
15904
|
{
|
|
15689
15905
|
label: "Wallet",
|
|
@@ -15695,7 +15911,7 @@ function WalletAdjustmentForm() {
|
|
|
15695
15911
|
obj: "walletObject"
|
|
15696
15912
|
}
|
|
15697
15913
|
),
|
|
15698
|
-
/* @__PURE__ */ (0,
|
|
15914
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15699
15915
|
Fields_default.DateInput,
|
|
15700
15916
|
{
|
|
15701
15917
|
label: "Date",
|
|
@@ -15705,7 +15921,7 @@ function WalletAdjustmentForm() {
|
|
|
15705
15921
|
}
|
|
15706
15922
|
)
|
|
15707
15923
|
] }),
|
|
15708
|
-
/* @__PURE__ */ (0,
|
|
15924
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15709
15925
|
Fields_default.Input,
|
|
15710
15926
|
{
|
|
15711
15927
|
label: "Description",
|
|
@@ -15715,8 +15931,8 @@ function WalletAdjustmentForm() {
|
|
|
15715
15931
|
required: true
|
|
15716
15932
|
}
|
|
15717
15933
|
),
|
|
15718
|
-
/* @__PURE__ */ (0,
|
|
15719
|
-
/* @__PURE__ */ (0,
|
|
15934
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
15935
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15720
15936
|
Fields_default.Select,
|
|
15721
15937
|
{
|
|
15722
15938
|
label: "Action",
|
|
@@ -15729,7 +15945,7 @@ function WalletAdjustmentForm() {
|
|
|
15729
15945
|
]
|
|
15730
15946
|
}
|
|
15731
15947
|
),
|
|
15732
|
-
/* @__PURE__ */ (0,
|
|
15948
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15733
15949
|
Fields_default.Input,
|
|
15734
15950
|
{
|
|
15735
15951
|
label: "Amount",
|
|
@@ -15741,7 +15957,7 @@ function WalletAdjustmentForm() {
|
|
|
15741
15957
|
}
|
|
15742
15958
|
)
|
|
15743
15959
|
] }),
|
|
15744
|
-
/* @__PURE__ */ (0,
|
|
15960
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15745
15961
|
Fields_default.Textarea,
|
|
15746
15962
|
{
|
|
15747
15963
|
label: "Note",
|
|
@@ -15750,7 +15966,7 @@ function WalletAdjustmentForm() {
|
|
|
15750
15966
|
placeholder: "Add any additional notes here..."
|
|
15751
15967
|
}
|
|
15752
15968
|
),
|
|
15753
|
-
/* @__PURE__ */ (0,
|
|
15969
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
15754
15970
|
Button,
|
|
15755
15971
|
{
|
|
15756
15972
|
isLoading,
|
|
@@ -15769,6 +15985,420 @@ function WalletAdjustmentForm() {
|
|
|
15769
15985
|
);
|
|
15770
15986
|
}
|
|
15771
15987
|
var WalletAdjustmentForm_default = WalletAdjustmentForm;
|
|
15988
|
+
|
|
15989
|
+
// src/components/forexTransfer/ForexTransfers.tsx
|
|
15990
|
+
var import_react_router_dom36 = require("react-router-dom");
|
|
15991
|
+
var import_lucide_react43 = require("lucide-react");
|
|
15992
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
15993
|
+
function ForexTransfers({ url }) {
|
|
15994
|
+
const { branchId } = (0, import_react_router_dom36.useParams)();
|
|
15995
|
+
const navigate = (0, import_react_router_dom36.useNavigate)();
|
|
15996
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
15997
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
15998
|
+
url: url || `/transactions/get?type=forex transfer${branchId ? `&fromBranch=${branchId}` : ""}`,
|
|
15999
|
+
dateFilter: true
|
|
16000
|
+
});
|
|
16001
|
+
const { Modal: Modal2 } = useModal();
|
|
16002
|
+
const items = (data2) => [
|
|
16003
|
+
{
|
|
16004
|
+
label: `View Transfer`,
|
|
16005
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react43.FilePenLine, { size: 16 }),
|
|
16006
|
+
onClick: () => openTransaction({ id: data2?._id, type: "forex transfer" })
|
|
16007
|
+
},
|
|
16008
|
+
{
|
|
16009
|
+
label: `Edit Transfer`,
|
|
16010
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react43.FilePenLine, { size: 16 }),
|
|
16011
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
16012
|
+
},
|
|
16013
|
+
{
|
|
16014
|
+
label: `Reverse Transfer`,
|
|
16015
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react43.Trash2, { className: "text-red-500", size: 16 }),
|
|
16016
|
+
onClick: () => {
|
|
16017
|
+
openTransaction({
|
|
16018
|
+
id: data2?._id,
|
|
16019
|
+
type: "forex transfer",
|
|
16020
|
+
reverseable: { reload }
|
|
16021
|
+
});
|
|
16022
|
+
}
|
|
16023
|
+
}
|
|
16024
|
+
].filter(Boolean);
|
|
16025
|
+
const columns = [
|
|
16026
|
+
{
|
|
16027
|
+
accessorKey: "date",
|
|
16028
|
+
header: "Date",
|
|
16029
|
+
cell: ({ row }) => {
|
|
16030
|
+
const transfer = row.original;
|
|
16031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex flex-col", children: [
|
|
16032
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { children: transfer?.date }),
|
|
16033
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
16034
|
+
"span",
|
|
16035
|
+
{
|
|
16036
|
+
onClick: () => openTransaction({ id: transfer?._id, type: "forex transfer" }),
|
|
16037
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
16038
|
+
children: transfer.ref
|
|
16039
|
+
}
|
|
16040
|
+
)
|
|
16041
|
+
] });
|
|
16042
|
+
}
|
|
16043
|
+
},
|
|
16044
|
+
{
|
|
16045
|
+
accessorKey: "account",
|
|
16046
|
+
header: "Account",
|
|
16047
|
+
cell: ({ row }) => {
|
|
16048
|
+
const transfer = row.original;
|
|
16049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { children: transfer?.accountData?.name || "N/A" });
|
|
16050
|
+
}
|
|
16051
|
+
},
|
|
16052
|
+
{
|
|
16053
|
+
accessorKey: "wallet",
|
|
16054
|
+
header: "Wallet",
|
|
16055
|
+
cell: ({ row }) => {
|
|
16056
|
+
const transfer = row.original;
|
|
16057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { children: transfer?.walletData?.name || "N/A" });
|
|
16058
|
+
}
|
|
16059
|
+
},
|
|
16060
|
+
{
|
|
16061
|
+
accessorKey: "amount",
|
|
16062
|
+
header: "Amount",
|
|
16063
|
+
cell: ({ row }) => {
|
|
16064
|
+
const transfer = row.original;
|
|
16065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex flex-col", children: [
|
|
16066
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
16067
|
+
"span",
|
|
16068
|
+
{
|
|
16069
|
+
className: transfer?.action === "debit" ? "text-red-600" : "text-green-600",
|
|
16070
|
+
children: [
|
|
16071
|
+
transfer?.action === "debit" ? "-" : "+",
|
|
16072
|
+
" ",
|
|
16073
|
+
Formats_default.Price(transfer?.amount, transfer?.currency)
|
|
16074
|
+
]
|
|
16075
|
+
}
|
|
16076
|
+
),
|
|
16077
|
+
transfer?.exchange?.rate && /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "text-xs text-indigo-600", children: [
|
|
16078
|
+
"EX: ",
|
|
16079
|
+
transfer?.exchange?.rate,
|
|
16080
|
+
" (",
|
|
16081
|
+
Formats_default.Price(
|
|
16082
|
+
transfer?.exchange?.amount,
|
|
16083
|
+
transfer?.exchange?.currency
|
|
16084
|
+
),
|
|
16085
|
+
")"
|
|
16086
|
+
] }),
|
|
16087
|
+
transfer?.fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("span", { className: "text-xs text-orange-600", children: [
|
|
16088
|
+
"Fee:",
|
|
16089
|
+
" ",
|
|
16090
|
+
Formats_default.Price(
|
|
16091
|
+
transfer?.fee,
|
|
16092
|
+
transfer?.exchange?.currency || transfer?.currency
|
|
16093
|
+
)
|
|
16094
|
+
] })
|
|
16095
|
+
] });
|
|
16096
|
+
}
|
|
16097
|
+
},
|
|
16098
|
+
{
|
|
16099
|
+
accessorKey: "actions",
|
|
16100
|
+
header: "Actions",
|
|
16101
|
+
cell: ({ row }) => {
|
|
16102
|
+
const data2 = row.original;
|
|
16103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
16104
|
+
Dropdown,
|
|
16105
|
+
{
|
|
16106
|
+
className: "cursor-pointer w-[150px]",
|
|
16107
|
+
items: items(data2),
|
|
16108
|
+
triggerMode: "hover",
|
|
16109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_lucide_react43.EllipsisVertical, {})
|
|
16110
|
+
}
|
|
16111
|
+
);
|
|
16112
|
+
}
|
|
16113
|
+
}
|
|
16114
|
+
];
|
|
16115
|
+
const transfers = data?.data || [];
|
|
16116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
16117
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Modal2, {}),
|
|
16118
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(TransactionView, {}),
|
|
16119
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
16120
|
+
TransactionViewComponent,
|
|
16121
|
+
{
|
|
16122
|
+
columns,
|
|
16123
|
+
data: transfers,
|
|
16124
|
+
title: "Forex Transfers",
|
|
16125
|
+
description: "Manage transfers between accounts and wallets",
|
|
16126
|
+
index: true,
|
|
16127
|
+
createTitle: "Add Forex Transfer",
|
|
16128
|
+
onCreate: () => {
|
|
16129
|
+
navigate("create");
|
|
16130
|
+
}
|
|
16131
|
+
}
|
|
16132
|
+
)
|
|
16133
|
+
] });
|
|
16134
|
+
}
|
|
16135
|
+
var ForexTransfers_default = ForexTransfers;
|
|
16136
|
+
|
|
16137
|
+
// src/components/forexTransfer/ForexTransferForm.tsx
|
|
16138
|
+
var import_react62 = require("react");
|
|
16139
|
+
var import_react_router_dom37 = require("react-router-dom");
|
|
16140
|
+
var import_react_hook_form25 = require("react-hook-form");
|
|
16141
|
+
var import_zod38 = require("@hookform/resolvers/zod");
|
|
16142
|
+
var import_antd33 = require("antd");
|
|
16143
|
+
|
|
16144
|
+
// src/components/forexTransfer/schema.ts
|
|
16145
|
+
var import_zod37 = require("zod");
|
|
16146
|
+
var forexTransferSchema = import_zod37.z.object({
|
|
16147
|
+
account: import_zod37.z.string(),
|
|
16148
|
+
wallet: import_zod37.z.string(),
|
|
16149
|
+
amount: import_zod37.z.number().gt(0, "Amount must be greater than 0"),
|
|
16150
|
+
date: zodFields.date,
|
|
16151
|
+
description: import_zod37.z.string(),
|
|
16152
|
+
note: import_zod37.z.string().optional(),
|
|
16153
|
+
fee: import_zod37.z.coerce.number().optional(),
|
|
16154
|
+
branch: import_zod37.z.string().optional(),
|
|
16155
|
+
// Objects for frontend helpers
|
|
16156
|
+
accountObject: import_zod37.z.any().optional(),
|
|
16157
|
+
walletObject: import_zod37.z.any().optional(),
|
|
16158
|
+
// Exchange rate
|
|
16159
|
+
rate: import_zod37.z.coerce.number().gte(0).optional()
|
|
16160
|
+
});
|
|
16161
|
+
|
|
16162
|
+
// src/components/forexTransfer/ForexTransferForm.tsx
|
|
16163
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
16164
|
+
function ForexTransferForm() {
|
|
16165
|
+
const { branchId } = (0, import_react_router_dom37.useParams)();
|
|
16166
|
+
const { getQuery, navigate } = useApp_default();
|
|
16167
|
+
const id = getQuery("id");
|
|
16168
|
+
const isEdit = !!id;
|
|
16169
|
+
const [ref, setRef] = (0, import_react62.useState)("");
|
|
16170
|
+
const { post, isLoading } = useApis_default();
|
|
16171
|
+
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
16172
|
+
const methods = (0, import_react_hook_form25.useForm)({
|
|
16173
|
+
resolver: (0, import_zod38.zodResolver)(forexTransferSchema),
|
|
16174
|
+
defaultValues: {
|
|
16175
|
+
date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
|
|
16176
|
+
amount: 0,
|
|
16177
|
+
fee: 0,
|
|
16178
|
+
account: "",
|
|
16179
|
+
wallet: "",
|
|
16180
|
+
description: "Forex Transfer"
|
|
16181
|
+
}
|
|
16182
|
+
});
|
|
16183
|
+
const { handleSubmit, watch, reset } = methods;
|
|
16184
|
+
const accountObj = watch("accountObject");
|
|
16185
|
+
const walletObj = watch("walletObject");
|
|
16186
|
+
const amount = watch("amount") || 0;
|
|
16187
|
+
const fee = watch("fee") || 0;
|
|
16188
|
+
const rate = watch("rate");
|
|
16189
|
+
const isRate = accountObj?.currency && walletObj?.currency && accountObj?.currency !== walletObj?.currency;
|
|
16190
|
+
const isCurrencies = accountObj?.currency && walletObj?.currency;
|
|
16191
|
+
const onSubmit = async (data) => {
|
|
16192
|
+
try {
|
|
16193
|
+
const payload = {
|
|
16194
|
+
...data,
|
|
16195
|
+
type: "forex transfer",
|
|
16196
|
+
branch: branchId ?? void 0
|
|
16197
|
+
};
|
|
16198
|
+
await post({
|
|
16199
|
+
url: `/transactions/add${isEdit ? `?ref=${ref}` : ""}`,
|
|
16200
|
+
body: payload
|
|
16201
|
+
});
|
|
16202
|
+
import_antd33.message.success(`Forex transfer saved successfully`);
|
|
16203
|
+
navigate(-1);
|
|
16204
|
+
} catch (error) {
|
|
16205
|
+
import_antd33.message.error(error?.message || "Something went wrong");
|
|
16206
|
+
}
|
|
16207
|
+
};
|
|
16208
|
+
const fetches = async () => {
|
|
16209
|
+
try {
|
|
16210
|
+
const res = await get({
|
|
16211
|
+
url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
|
|
16212
|
+
});
|
|
16213
|
+
const data = res.data;
|
|
16214
|
+
reset({
|
|
16215
|
+
...data,
|
|
16216
|
+
rate: data?.exchange?.rate,
|
|
16217
|
+
wallet: data?.toWallet || data?.fromWallet
|
|
16218
|
+
});
|
|
16219
|
+
setRef(data?.ref);
|
|
16220
|
+
} catch (error) {
|
|
16221
|
+
import_antd33.message.error(error?.message || "Something went wrong");
|
|
16222
|
+
navigate(-1);
|
|
16223
|
+
}
|
|
16224
|
+
};
|
|
16225
|
+
const exchangedAmount2 = (0, import_react62.useMemo)(() => {
|
|
16226
|
+
if (isRate) {
|
|
16227
|
+
const am = forex_default.exchangedAmount({
|
|
16228
|
+
accountCurrency: accountObj?.currency,
|
|
16229
|
+
amount,
|
|
16230
|
+
exchangeRate: rate ?? 1,
|
|
16231
|
+
transactionCurrency: walletObj?.currency
|
|
16232
|
+
});
|
|
16233
|
+
return Formats_default.Price(am, accountObj?.currency ?? "N/A");
|
|
16234
|
+
}
|
|
16235
|
+
}, [amount, accountObj?.currency, walletObj?.currency, rate, isRate]);
|
|
16236
|
+
const totalAmount = (0, import_react62.useMemo)(() => {
|
|
16237
|
+
if (isCurrencies) {
|
|
16238
|
+
const am = forex_default.exchangedAmount({
|
|
16239
|
+
accountCurrency: accountObj?.currency,
|
|
16240
|
+
amount,
|
|
16241
|
+
exchangeRate: rate ?? 1,
|
|
16242
|
+
transactionCurrency: walletObj?.currency
|
|
16243
|
+
});
|
|
16244
|
+
return am + fee / 100 * am;
|
|
16245
|
+
} else {
|
|
16246
|
+
return 0;
|
|
16247
|
+
}
|
|
16248
|
+
}, [exchangedAmount2, fee]);
|
|
16249
|
+
(0, import_react62.useEffect)(() => {
|
|
16250
|
+
if (isEdit) {
|
|
16251
|
+
fetches();
|
|
16252
|
+
}
|
|
16253
|
+
}, [id]);
|
|
16254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
16255
|
+
Card,
|
|
16256
|
+
{
|
|
16257
|
+
className: "max-w-4xl mx-auto mt-10 relative",
|
|
16258
|
+
isLoading: isLoadingGet,
|
|
16259
|
+
loadingText: "Processing...",
|
|
16260
|
+
children: [
|
|
16261
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(Card.Header, { children: [
|
|
16262
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Forex Transfer` }),
|
|
16263
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Card.Description, { children: isEdit ? `Update the details for this forex transfer` : `Move funds between an account and a wallet` })
|
|
16264
|
+
] }),
|
|
16265
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
16266
|
+
"form",
|
|
16267
|
+
{
|
|
16268
|
+
className: "space-y-4",
|
|
16269
|
+
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
16270
|
+
children: [
|
|
16271
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
16272
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16273
|
+
Fields_default.Input,
|
|
16274
|
+
{
|
|
16275
|
+
label: "Description",
|
|
16276
|
+
form: methods,
|
|
16277
|
+
name: "description",
|
|
16278
|
+
placeholder: "Enter description...",
|
|
16279
|
+
required: true
|
|
16280
|
+
}
|
|
16281
|
+
),
|
|
16282
|
+
" ",
|
|
16283
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16284
|
+
Fields_default.DateInput,
|
|
16285
|
+
{
|
|
16286
|
+
label: "Date",
|
|
16287
|
+
form: methods,
|
|
16288
|
+
name: "date",
|
|
16289
|
+
required: true
|
|
16290
|
+
}
|
|
16291
|
+
),
|
|
16292
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16293
|
+
Feilds_default.Account,
|
|
16294
|
+
{
|
|
16295
|
+
label: "Account",
|
|
16296
|
+
form: methods,
|
|
16297
|
+
name: "account",
|
|
16298
|
+
api: "/accounts/get/all",
|
|
16299
|
+
placeholder: "Select account...",
|
|
16300
|
+
required: true,
|
|
16301
|
+
obj: "accountObject",
|
|
16302
|
+
showBalance: true
|
|
16303
|
+
}
|
|
16304
|
+
),
|
|
16305
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16306
|
+
Feilds_default2.Wallet,
|
|
16307
|
+
{
|
|
16308
|
+
label: "Wallet",
|
|
16309
|
+
form: methods,
|
|
16310
|
+
name: "wallet",
|
|
16311
|
+
placeholder: "Select wallet...",
|
|
16312
|
+
required: true,
|
|
16313
|
+
showBalance: true,
|
|
16314
|
+
obj: "walletObject"
|
|
16315
|
+
}
|
|
16316
|
+
),
|
|
16317
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16318
|
+
Fields_default.Input,
|
|
16319
|
+
{
|
|
16320
|
+
label: "Amount",
|
|
16321
|
+
form: methods,
|
|
16322
|
+
name: "amount",
|
|
16323
|
+
type: "number",
|
|
16324
|
+
placeholder: "0.00",
|
|
16325
|
+
required: true
|
|
16326
|
+
}
|
|
16327
|
+
),
|
|
16328
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(import_jsx_runtime103.Fragment, { children: [
|
|
16329
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16330
|
+
Fields_default.Input,
|
|
16331
|
+
{
|
|
16332
|
+
label: `Rate (1 ${walletObj?.currency} = ? ${accountObj?.currency})`,
|
|
16333
|
+
type: "number",
|
|
16334
|
+
name: "rate",
|
|
16335
|
+
form: methods,
|
|
16336
|
+
required: true
|
|
16337
|
+
}
|
|
16338
|
+
),
|
|
16339
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16340
|
+
Fields_default.Input,
|
|
16341
|
+
{
|
|
16342
|
+
label: "Exchanged Amount",
|
|
16343
|
+
type: "text",
|
|
16344
|
+
readOnly: true,
|
|
16345
|
+
disabled: true,
|
|
16346
|
+
value: exchangedAmount2
|
|
16347
|
+
}
|
|
16348
|
+
)
|
|
16349
|
+
] }),
|
|
16350
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16351
|
+
Fields_default.Input,
|
|
16352
|
+
{
|
|
16353
|
+
label: "Fee (Optional)",
|
|
16354
|
+
form: methods,
|
|
16355
|
+
name: "fee",
|
|
16356
|
+
type: "number",
|
|
16357
|
+
placeholder: "0.00"
|
|
16358
|
+
}
|
|
16359
|
+
),
|
|
16360
|
+
fee > 0 && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16361
|
+
Fields_default.Input,
|
|
16362
|
+
{
|
|
16363
|
+
label: "Amount After Fee",
|
|
16364
|
+
type: "text",
|
|
16365
|
+
readOnly: true,
|
|
16366
|
+
disabled: true,
|
|
16367
|
+
value: Formats_default.Price(
|
|
16368
|
+
totalAmount,
|
|
16369
|
+
accountObj?.currency || "N/A"
|
|
16370
|
+
)
|
|
16371
|
+
}
|
|
16372
|
+
)
|
|
16373
|
+
] }),
|
|
16374
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16375
|
+
Fields_default.Textarea,
|
|
16376
|
+
{
|
|
16377
|
+
label: "Note",
|
|
16378
|
+
form: methods,
|
|
16379
|
+
name: "note",
|
|
16380
|
+
placeholder: "Add any additional notes here..."
|
|
16381
|
+
}
|
|
16382
|
+
),
|
|
16383
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
16384
|
+
Button,
|
|
16385
|
+
{
|
|
16386
|
+
isLoading,
|
|
16387
|
+
disabled: isLoading,
|
|
16388
|
+
type: "submit",
|
|
16389
|
+
className: "min-w-[100px]",
|
|
16390
|
+
variant: !isEdit ? "primary" : "warning",
|
|
16391
|
+
children: isEdit ? "Update" : "Add"
|
|
16392
|
+
}
|
|
16393
|
+
) })
|
|
16394
|
+
]
|
|
16395
|
+
}
|
|
16396
|
+
) })
|
|
16397
|
+
]
|
|
16398
|
+
}
|
|
16399
|
+
);
|
|
16400
|
+
}
|
|
16401
|
+
var ForexTransferForm_default = ForexTransferForm;
|
|
15772
16402
|
// Annotate the CommonJS export names for ESM import in node:
|
|
15773
16403
|
0 && (module.exports = {
|
|
15774
16404
|
AccountFields,
|
|
@@ -15805,6 +16435,8 @@ var WalletAdjustmentForm_default = WalletAdjustmentForm;
|
|
|
15805
16435
|
ExpenseForm,
|
|
15806
16436
|
Expenses,
|
|
15807
16437
|
Fields,
|
|
16438
|
+
ForexTransferForm,
|
|
16439
|
+
ForexTransfers,
|
|
15808
16440
|
Guard,
|
|
15809
16441
|
InfoGrid,
|
|
15810
16442
|
Input,
|
|
@@ -15871,6 +16503,7 @@ var WalletAdjustmentForm_default = WalletAdjustmentForm;
|
|
|
15871
16503
|
createUserSchema,
|
|
15872
16504
|
createWalletSchema,
|
|
15873
16505
|
expenseSchema,
|
|
16506
|
+
forexTransferSchema,
|
|
15874
16507
|
generatePdf,
|
|
15875
16508
|
journalSchema,
|
|
15876
16509
|
linkUserSchema,
|