warqadui 0.0.279 → 0.0.281
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 +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +703 -367
- package/dist/index.mjs +701 -365
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -348,8 +348,8 @@ var InfoGrid = ({
|
|
|
348
348
|
/* @__PURE__ */ jsx4(
|
|
349
349
|
"span",
|
|
350
350
|
{
|
|
351
|
-
className: `text-sm font-medium text-gray-700 block text-left ${item.mono ? "font-mono" : ""}`,
|
|
352
|
-
children: isLoading ? /* @__PURE__ */ jsx4("div", { className: "h-4
|
|
351
|
+
className: `text-sm uppercase font-medium text-gray-700 block text-left ${item.mono ? "font-mono" : ""}`,
|
|
352
|
+
children: isLoading ? /* @__PURE__ */ jsx4("div", { className: "h-4 bg-gray-200 dark:bg-zinc-800 rounded-sm animate-pulse w-3/4 mt-1" }) : item.value
|
|
353
353
|
}
|
|
354
354
|
)
|
|
355
355
|
] }, `${item.label}-${index}`))
|
|
@@ -1598,13 +1598,13 @@ var Input = forwardRef(
|
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
1600
|
}, [props.value, name, form]);
|
|
1601
|
-
let
|
|
1601
|
+
let message92 = error;
|
|
1602
1602
|
if (form && name) {
|
|
1603
1603
|
const {
|
|
1604
1604
|
formState: { errors }
|
|
1605
1605
|
} = form;
|
|
1606
1606
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1607
|
-
|
|
1607
|
+
message92 = errorObj?.message;
|
|
1608
1608
|
}
|
|
1609
1609
|
const watchedValue = form?.watch(name);
|
|
1610
1610
|
useEffect8(() => {
|
|
@@ -1673,7 +1673,7 @@ var Input = forwardRef(
|
|
|
1673
1673
|
}
|
|
1674
1674
|
)
|
|
1675
1675
|
] }),
|
|
1676
|
-
|
|
1676
|
+
message92 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
1677
1677
|
]
|
|
1678
1678
|
}
|
|
1679
1679
|
);
|
|
@@ -2023,7 +2023,7 @@ var PhoneInput = forwardRef2(
|
|
|
2023
2023
|
const [isFocused, setIsFocused] = useState12(false);
|
|
2024
2024
|
const { theme } = useWarqadConfig();
|
|
2025
2025
|
const primaryColor = theme?.primaryColor;
|
|
2026
|
-
let
|
|
2026
|
+
let message92 = error;
|
|
2027
2027
|
if (form && name) {
|
|
2028
2028
|
const {
|
|
2029
2029
|
formState: { errors }
|
|
@@ -2033,7 +2033,7 @@ var PhoneInput = forwardRef2(
|
|
|
2033
2033
|
for (const part of nameParts) {
|
|
2034
2034
|
currentError = currentError?.[part];
|
|
2035
2035
|
}
|
|
2036
|
-
|
|
2036
|
+
message92 = currentError?.message || message92;
|
|
2037
2037
|
}
|
|
2038
2038
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs15("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
2039
2039
|
/* @__PURE__ */ jsxs15(
|
|
@@ -2084,7 +2084,7 @@ var PhoneInput = forwardRef2(
|
|
|
2084
2084
|
}
|
|
2085
2085
|
)
|
|
2086
2086
|
] }),
|
|
2087
|
-
|
|
2087
|
+
message92 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
2088
2088
|
] });
|
|
2089
2089
|
if (form && name) {
|
|
2090
2090
|
return /* @__PURE__ */ jsx20(
|
|
@@ -2273,7 +2273,7 @@ var SelectRoot = ({
|
|
|
2273
2273
|
setSearchQuery("");
|
|
2274
2274
|
}
|
|
2275
2275
|
}, [isOpen]);
|
|
2276
|
-
let
|
|
2276
|
+
let message92 = error;
|
|
2277
2277
|
if (form && name) {
|
|
2278
2278
|
const {
|
|
2279
2279
|
formState: { errors }
|
|
@@ -2283,7 +2283,7 @@ var SelectRoot = ({
|
|
|
2283
2283
|
for (const part of nameParts) {
|
|
2284
2284
|
currentError = currentError?.[part];
|
|
2285
2285
|
}
|
|
2286
|
-
|
|
2286
|
+
message92 = currentError?.message || message92;
|
|
2287
2287
|
}
|
|
2288
2288
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
2289
2289
|
const filteredOptions = useMemo4(() => {
|
|
@@ -2353,7 +2353,7 @@ var SelectRoot = ({
|
|
|
2353
2353
|
String(opt.value) || index
|
|
2354
2354
|
)) })
|
|
2355
2355
|
] }),
|
|
2356
|
-
|
|
2356
|
+
message92 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
2357
2357
|
]
|
|
2358
2358
|
}
|
|
2359
2359
|
) });
|
|
@@ -2620,13 +2620,13 @@ var Textarea = forwardRef4(
|
|
|
2620
2620
|
const [isFocused, setIsFocused] = useState14(false);
|
|
2621
2621
|
const { theme } = useWarqadConfig();
|
|
2622
2622
|
const primaryColor = theme?.primaryColor;
|
|
2623
|
-
let
|
|
2623
|
+
let message92 = error;
|
|
2624
2624
|
if (form && name) {
|
|
2625
2625
|
const {
|
|
2626
2626
|
formState: { errors }
|
|
2627
2627
|
} = form;
|
|
2628
2628
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2629
|
-
|
|
2629
|
+
message92 = errorObj?.message;
|
|
2630
2630
|
}
|
|
2631
2631
|
const renderInput = (inputProps, ref3) => /* @__PURE__ */ jsxs17("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
2632
2632
|
/* @__PURE__ */ jsxs17(
|
|
@@ -2664,7 +2664,7 @@ var Textarea = forwardRef4(
|
|
|
2664
2664
|
}
|
|
2665
2665
|
}
|
|
2666
2666
|
) }),
|
|
2667
|
-
|
|
2667
|
+
message92 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
2668
2668
|
] });
|
|
2669
2669
|
useEffect10(() => {
|
|
2670
2670
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -3014,7 +3014,7 @@ var SearchApiRoot = ({
|
|
|
3014
3014
|
const filteredOptions = options10.filter(
|
|
3015
3015
|
(option) => !filter.includes(getOptionValue(option))
|
|
3016
3016
|
);
|
|
3017
|
-
let
|
|
3017
|
+
let message92 = error || errorMessage;
|
|
3018
3018
|
if (form && name) {
|
|
3019
3019
|
const {
|
|
3020
3020
|
formState: { errors }
|
|
@@ -3024,7 +3024,7 @@ var SearchApiRoot = ({
|
|
|
3024
3024
|
for (const part of nameParts) {
|
|
3025
3025
|
currentError = currentError?.[part];
|
|
3026
3026
|
}
|
|
3027
|
-
|
|
3027
|
+
message92 = currentError?.message || message92;
|
|
3028
3028
|
}
|
|
3029
3029
|
const valueCtx = {
|
|
3030
3030
|
isOpen,
|
|
@@ -3058,7 +3058,7 @@ var SearchApiRoot = ({
|
|
|
3058
3058
|
form,
|
|
3059
3059
|
name,
|
|
3060
3060
|
obj,
|
|
3061
|
-
error:
|
|
3061
|
+
error: message92,
|
|
3062
3062
|
onSelect,
|
|
3063
3063
|
onClear
|
|
3064
3064
|
};
|
|
@@ -3423,7 +3423,7 @@ var DateInput = forwardRef6(
|
|
|
3423
3423
|
value,
|
|
3424
3424
|
...props
|
|
3425
3425
|
}, ref2) => {
|
|
3426
|
-
let
|
|
3426
|
+
let message92 = error;
|
|
3427
3427
|
const { theme } = useWarqadConfig();
|
|
3428
3428
|
const primaryColor = theme?.primaryColor;
|
|
3429
3429
|
const [isFocused, setIsFocused] = useState16(false);
|
|
@@ -3432,13 +3432,13 @@ var DateInput = forwardRef6(
|
|
|
3432
3432
|
formState: { errors }
|
|
3433
3433
|
} = form;
|
|
3434
3434
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
3435
|
-
|
|
3435
|
+
message92 = errorObj?.message;
|
|
3436
3436
|
}
|
|
3437
3437
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
3438
3438
|
bg-white! dark:bg-gray-900/80!
|
|
3439
3439
|
text-gray-900! dark:text-zinc-100!
|
|
3440
3440
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
3441
|
-
${
|
|
3441
|
+
${message92 ? "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"}
|
|
3442
3442
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
3443
3443
|
${className}`;
|
|
3444
3444
|
const renderDatePicker = (val, onChangeHandler, onBlur2, refProps) => {
|
|
@@ -3471,8 +3471,8 @@ var DateInput = forwardRef6(
|
|
|
3471
3471
|
needConfirm: false,
|
|
3472
3472
|
style: {
|
|
3473
3473
|
height: "var(--input-height, 40px)",
|
|
3474
|
-
borderColor: isFocused && !
|
|
3475
|
-
boxShadow: isFocused && !
|
|
3474
|
+
borderColor: isFocused && !message92 ? primaryColor : void 0,
|
|
3475
|
+
boxShadow: isFocused && !message92 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
3476
3476
|
},
|
|
3477
3477
|
classNames: { popup: { root: "z-50" } },
|
|
3478
3478
|
suffixIcon: /* @__PURE__ */ jsx24(Calendar, { className: "h-5 w-5 text-gray-400 group-focus-within:text-primary" }),
|
|
@@ -3487,7 +3487,7 @@ var DateInput = forwardRef6(
|
|
|
3487
3487
|
{
|
|
3488
3488
|
className: "block text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-200",
|
|
3489
3489
|
style: {
|
|
3490
|
-
color:
|
|
3490
|
+
color: message92 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3491
3491
|
},
|
|
3492
3492
|
children: [
|
|
3493
3493
|
label,
|
|
@@ -3505,7 +3505,7 @@ var DateInput = forwardRef6(
|
|
|
3505
3505
|
}) => renderDatePicker(value2, onC, onBlur2, fieldRef)
|
|
3506
3506
|
}
|
|
3507
3507
|
) : renderDatePicker(value, onChange, onBlur, ref2),
|
|
3508
|
-
|
|
3508
|
+
message92 && /* @__PURE__ */ jsx24("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
3509
3509
|
] });
|
|
3510
3510
|
}
|
|
3511
3511
|
);
|
|
@@ -3536,7 +3536,7 @@ var MonthInput = forwardRef7(
|
|
|
3536
3536
|
value,
|
|
3537
3537
|
...props
|
|
3538
3538
|
}, ref2) => {
|
|
3539
|
-
let
|
|
3539
|
+
let message92 = error;
|
|
3540
3540
|
const { theme } = useWarqadConfig();
|
|
3541
3541
|
const primaryColor = theme?.primaryColor;
|
|
3542
3542
|
const [isFocused, setIsFocused] = useState17(false);
|
|
@@ -3545,13 +3545,13 @@ var MonthInput = forwardRef7(
|
|
|
3545
3545
|
formState: { errors }
|
|
3546
3546
|
} = form;
|
|
3547
3547
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
3548
|
-
|
|
3548
|
+
message92 = errorObj?.message;
|
|
3549
3549
|
}
|
|
3550
3550
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
3551
3551
|
bg-white! dark:bg-gray-900/80!
|
|
3552
3552
|
text-gray-900! dark:text-zinc-100!
|
|
3553
3553
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
3554
|
-
${
|
|
3554
|
+
${message92 ? "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"}
|
|
3555
3555
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
3556
3556
|
${className}`;
|
|
3557
3557
|
const renderDatePicker = (val, onChangeHandler, onBlur2, refProps) => {
|
|
@@ -3585,8 +3585,8 @@ var MonthInput = forwardRef7(
|
|
|
3585
3585
|
needConfirm: false,
|
|
3586
3586
|
style: {
|
|
3587
3587
|
height: "var(--input-height, 40px)",
|
|
3588
|
-
borderColor: isFocused && !
|
|
3589
|
-
boxShadow: isFocused && !
|
|
3588
|
+
borderColor: isFocused && !message92 ? primaryColor : void 0,
|
|
3589
|
+
boxShadow: isFocused && !message92 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
3590
3590
|
},
|
|
3591
3591
|
classNames: { popup: { root: "z-50" } },
|
|
3592
3592
|
suffixIcon: /* @__PURE__ */ jsx25(Calendar2, { className: "h-5 w-5 text-gray-400 group-focus-within:text-primary" }),
|
|
@@ -3601,7 +3601,7 @@ var MonthInput = forwardRef7(
|
|
|
3601
3601
|
{
|
|
3602
3602
|
className: "block text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-200",
|
|
3603
3603
|
style: {
|
|
3604
|
-
color:
|
|
3604
|
+
color: message92 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3605
3605
|
},
|
|
3606
3606
|
children: [
|
|
3607
3607
|
label,
|
|
@@ -3619,7 +3619,7 @@ var MonthInput = forwardRef7(
|
|
|
3619
3619
|
}) => renderDatePicker(value2, onC, onBlur2, fieldRef)
|
|
3620
3620
|
}
|
|
3621
3621
|
) : renderDatePicker(value, onChange, onBlur, ref2),
|
|
3622
|
-
|
|
3622
|
+
message92 && /* @__PURE__ */ jsx25("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
3623
3623
|
] });
|
|
3624
3624
|
}
|
|
3625
3625
|
);
|
|
@@ -9143,17 +9143,17 @@ var preWarningFns = [];
|
|
|
9143
9143
|
var preMessage = (fn) => {
|
|
9144
9144
|
preWarningFns.push(fn);
|
|
9145
9145
|
};
|
|
9146
|
-
function warning(valid,
|
|
9146
|
+
function warning(valid, message92) {
|
|
9147
9147
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
9148
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
9148
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message92);
|
|
9149
9149
|
if (finalMessage) {
|
|
9150
9150
|
console.error(`Warning: ${finalMessage}`);
|
|
9151
9151
|
}
|
|
9152
9152
|
}
|
|
9153
9153
|
}
|
|
9154
|
-
function note(valid,
|
|
9154
|
+
function note(valid, message92) {
|
|
9155
9155
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
9156
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
9156
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message92);
|
|
9157
9157
|
if (finalMessage) {
|
|
9158
9158
|
console.warn(`Note: ${finalMessage}`);
|
|
9159
9159
|
}
|
|
@@ -9162,17 +9162,17 @@ function note(valid, message91) {
|
|
|
9162
9162
|
function resetWarned() {
|
|
9163
9163
|
warned = {};
|
|
9164
9164
|
}
|
|
9165
|
-
function call(method, valid,
|
|
9166
|
-
if (!valid && !warned[
|
|
9167
|
-
method(false,
|
|
9168
|
-
warned[
|
|
9165
|
+
function call(method, valid, message92) {
|
|
9166
|
+
if (!valid && !warned[message92]) {
|
|
9167
|
+
method(false, message92);
|
|
9168
|
+
warned[message92] = true;
|
|
9169
9169
|
}
|
|
9170
9170
|
}
|
|
9171
|
-
function warningOnce(valid,
|
|
9172
|
-
call(warning, valid,
|
|
9171
|
+
function warningOnce(valid, message92) {
|
|
9172
|
+
call(warning, valid, message92);
|
|
9173
9173
|
}
|
|
9174
|
-
function noteOnce(valid,
|
|
9175
|
-
call(note, valid,
|
|
9174
|
+
function noteOnce(valid, message92) {
|
|
9175
|
+
call(note, valid, message92);
|
|
9176
9176
|
}
|
|
9177
9177
|
warningOnce.preMessage = preMessage;
|
|
9178
9178
|
warningOnce.resetWarned = resetWarned;
|
|
@@ -9183,8 +9183,8 @@ import React20, { useContext as useContext5, useEffect as useEffect18 } from "re
|
|
|
9183
9183
|
function camelCase(input) {
|
|
9184
9184
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
9185
9185
|
}
|
|
9186
|
-
function warning2(valid,
|
|
9187
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
9186
|
+
function warning2(valid, message92) {
|
|
9187
|
+
warningOnce(valid, `[@ant-design/icons] ${message92}`);
|
|
9188
9188
|
}
|
|
9189
9189
|
function isIconDefinition(target) {
|
|
9190
9190
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -23069,7 +23069,7 @@ var ForexExpensesReport_default = ForexExpensesReport;
|
|
|
23069
23069
|
import { jsx as jsx131, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
23070
23070
|
var ErrorPageBase = ({
|
|
23071
23071
|
title,
|
|
23072
|
-
message:
|
|
23072
|
+
message: message92,
|
|
23073
23073
|
statusCode,
|
|
23074
23074
|
action,
|
|
23075
23075
|
className = ""
|
|
@@ -23086,7 +23086,7 @@ var ErrorPageBase = ({
|
|
|
23086
23086
|
statusCode
|
|
23087
23087
|
] }),
|
|
23088
23088
|
title && /* @__PURE__ */ jsx131("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
|
|
23089
|
-
|
|
23089
|
+
message92 && /* @__PURE__ */ jsx131("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message92 }),
|
|
23090
23090
|
action && /* @__PURE__ */ jsx131("div", { className: "pt-8", children: /* @__PURE__ */ jsx131(
|
|
23091
23091
|
"button",
|
|
23092
23092
|
{
|
|
@@ -45136,10 +45136,7 @@ function Payments3({ url }) {
|
|
|
45136
45136
|
{
|
|
45137
45137
|
accessorKey: "account",
|
|
45138
45138
|
header: "Account",
|
|
45139
|
-
|
|
45140
|
-
const payment = row.original;
|
|
45141
|
-
return /* @__PURE__ */ jsx249("span", { children: payment?.accountData?.name || "N/A" });
|
|
45142
|
-
}
|
|
45139
|
+
accessorFn: (data2) => data2?.accountData?.name || "N/A"
|
|
45143
45140
|
},
|
|
45144
45141
|
{
|
|
45145
45142
|
accessorKey: "wallet",
|
|
@@ -45579,10 +45576,7 @@ function Journals3({ url }) {
|
|
|
45579
45576
|
{
|
|
45580
45577
|
accessorKey: "account",
|
|
45581
45578
|
header: "Account",
|
|
45582
|
-
|
|
45583
|
-
const journal = row.original;
|
|
45584
|
-
return /* @__PURE__ */ jsx251("span", { children: journal?.accountData?.name || "N/A" });
|
|
45585
|
-
}
|
|
45579
|
+
accessorFn: (data2) => data2?.accountData?.name || "N/A"
|
|
45586
45580
|
},
|
|
45587
45581
|
{
|
|
45588
45582
|
accessorKey: "amount",
|
|
@@ -48658,7 +48652,7 @@ var Expenses3Reports = () => {
|
|
|
48658
48652
|
const [startDate, setStartDate] = useState113(null);
|
|
48659
48653
|
const [endDate, setEndDate] = useState113(null);
|
|
48660
48654
|
const { A4DataView, data } = useA4DataView_default({
|
|
48661
|
-
url: `/transactions/get?
|
|
48655
|
+
url: `/transactions/get?isExpenses3=true${branchId ? `&branch=${branchId}` : ""}`,
|
|
48662
48656
|
v: 1
|
|
48663
48657
|
// No prefix
|
|
48664
48658
|
});
|
|
@@ -48789,6 +48783,347 @@ var Reports3 = {
|
|
|
48789
48783
|
};
|
|
48790
48784
|
var reports_default = Reports3;
|
|
48791
48785
|
|
|
48786
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48787
|
+
import { useNavigate as useNavigate64, useParams as useParams107 } from "react-router-dom";
|
|
48788
|
+
import { EllipsisVertical as EllipsisVertical47, FilePenLine as FilePenLine43, Trash2 as Trash253 } from "lucide-react";
|
|
48789
|
+
import { Fragment as Fragment134, jsx as jsx266, jsxs as jsxs235 } from "react/jsx-runtime";
|
|
48790
|
+
function ExpensesJournal3({ url }) {
|
|
48791
|
+
const { branchId } = useParams107();
|
|
48792
|
+
const navigate = useNavigate64();
|
|
48793
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48794
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48795
|
+
url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48796
|
+
dateFilter: true
|
|
48797
|
+
});
|
|
48798
|
+
const { Modal: Modal2 } = useModal();
|
|
48799
|
+
const items = (data2) => [
|
|
48800
|
+
{
|
|
48801
|
+
label: `View Expense`,
|
|
48802
|
+
icon: /* @__PURE__ */ jsx266(FilePenLine43, { size: 16 }),
|
|
48803
|
+
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48804
|
+
},
|
|
48805
|
+
{
|
|
48806
|
+
label: `Edit Expense`,
|
|
48807
|
+
icon: /* @__PURE__ */ jsx266(FilePenLine43, { size: 16 }),
|
|
48808
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48809
|
+
},
|
|
48810
|
+
{
|
|
48811
|
+
label: `Delete Expense`,
|
|
48812
|
+
icon: /* @__PURE__ */ jsx266(Trash253, { className: "text-red-500", size: 16 }),
|
|
48813
|
+
onClick: () => {
|
|
48814
|
+
openTransaction({
|
|
48815
|
+
id: data2?._id,
|
|
48816
|
+
type: "expense",
|
|
48817
|
+
reverseable: { reload }
|
|
48818
|
+
});
|
|
48819
|
+
}
|
|
48820
|
+
}
|
|
48821
|
+
].filter(Boolean);
|
|
48822
|
+
const columns = [
|
|
48823
|
+
{
|
|
48824
|
+
accessorKey: "date",
|
|
48825
|
+
header: "Date",
|
|
48826
|
+
cell: ({ row }) => {
|
|
48827
|
+
const expense = row.original;
|
|
48828
|
+
return /* @__PURE__ */ jsxs235("div", { className: "flex flex-col", children: [
|
|
48829
|
+
/* @__PURE__ */ jsx266("span", { children: expense?.date }),
|
|
48830
|
+
/* @__PURE__ */ jsx266(
|
|
48831
|
+
"span",
|
|
48832
|
+
{
|
|
48833
|
+
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
48834
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
48835
|
+
children: expense.ref
|
|
48836
|
+
}
|
|
48837
|
+
)
|
|
48838
|
+
] });
|
|
48839
|
+
}
|
|
48840
|
+
},
|
|
48841
|
+
{
|
|
48842
|
+
accessorKey: "description",
|
|
48843
|
+
header: "Description",
|
|
48844
|
+
cell: ({ row }) => {
|
|
48845
|
+
const expense = row.original;
|
|
48846
|
+
return /* @__PURE__ */ jsxs235("div", { className: "flex flex-col", children: [
|
|
48847
|
+
/* @__PURE__ */ jsx266("span", { className: "capitalize", children: expense?.description }),
|
|
48848
|
+
expense?.note && /* @__PURE__ */ jsx266("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48849
|
+
] });
|
|
48850
|
+
}
|
|
48851
|
+
},
|
|
48852
|
+
{
|
|
48853
|
+
accessorKey: "amount",
|
|
48854
|
+
header: "Amount",
|
|
48855
|
+
cell: ({ row }) => {
|
|
48856
|
+
const expense = row.original;
|
|
48857
|
+
return /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48858
|
+
/* @__PURE__ */ jsx266("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
48859
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ jsxs235("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48860
|
+
"rate ",
|
|
48861
|
+
expense?.exchange?.rate,
|
|
48862
|
+
" ,",
|
|
48863
|
+
" ",
|
|
48864
|
+
Formats_default.Price(
|
|
48865
|
+
expense?.exchange?.amount || 0,
|
|
48866
|
+
expense?.exchange?.currency
|
|
48867
|
+
)
|
|
48868
|
+
] })
|
|
48869
|
+
] });
|
|
48870
|
+
}
|
|
48871
|
+
},
|
|
48872
|
+
{
|
|
48873
|
+
accessorKey: "actions",
|
|
48874
|
+
header: "Actions",
|
|
48875
|
+
cell: ({ row }) => {
|
|
48876
|
+
const data2 = row.original;
|
|
48877
|
+
return /* @__PURE__ */ jsx266(
|
|
48878
|
+
Dropdown,
|
|
48879
|
+
{
|
|
48880
|
+
className: "cursor-pointer w-[150px]",
|
|
48881
|
+
items: items(data2),
|
|
48882
|
+
triggerMode: "hover",
|
|
48883
|
+
children: /* @__PURE__ */ jsx266(EllipsisVertical47, {})
|
|
48884
|
+
}
|
|
48885
|
+
);
|
|
48886
|
+
}
|
|
48887
|
+
}
|
|
48888
|
+
];
|
|
48889
|
+
const expenses = data?.data || [];
|
|
48890
|
+
return /* @__PURE__ */ jsxs235(Fragment134, { children: [
|
|
48891
|
+
/* @__PURE__ */ jsx266(TransactionView, {}),
|
|
48892
|
+
/* @__PURE__ */ jsx266(Modal2, {}),
|
|
48893
|
+
/* @__PURE__ */ jsx266(
|
|
48894
|
+
TransactionViewComponent,
|
|
48895
|
+
{
|
|
48896
|
+
columns,
|
|
48897
|
+
data: expenses,
|
|
48898
|
+
title: "Expenses",
|
|
48899
|
+
description: "Track and manage business expenses",
|
|
48900
|
+
index: true,
|
|
48901
|
+
createTitle: "Add Expense",
|
|
48902
|
+
onCreate: () => {
|
|
48903
|
+
navigate("create");
|
|
48904
|
+
}
|
|
48905
|
+
}
|
|
48906
|
+
)
|
|
48907
|
+
] });
|
|
48908
|
+
}
|
|
48909
|
+
var ExpensesJournal_default = ExpensesJournal3;
|
|
48910
|
+
|
|
48911
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48912
|
+
import { useEffect as useEffect114, useMemo as useMemo53, useState as useState114 } from "react";
|
|
48913
|
+
import { useParams as useParams108 } from "react-router-dom";
|
|
48914
|
+
import { useForm as useForm58 } from "react-hook-form";
|
|
48915
|
+
import { zodResolver as zodResolver57 } from "@hookform/resolvers/zod";
|
|
48916
|
+
import { message as message85 } from "antd";
|
|
48917
|
+
|
|
48918
|
+
// src/components/Transactions/3/expenseJournal/schema.ts
|
|
48919
|
+
import { z as z49 } from "zod";
|
|
48920
|
+
var expenseSchema5 = z49.object({
|
|
48921
|
+
description: z49.string().min(1, "Description is required"),
|
|
48922
|
+
date: zodFields.date,
|
|
48923
|
+
amount: z49.number().gt(0, "Amount must be greater than 0"),
|
|
48924
|
+
branch: z49.string().optional(),
|
|
48925
|
+
note: z49.string().optional(),
|
|
48926
|
+
currency: z49.enum(Enums_default.currencies),
|
|
48927
|
+
rate: z49.number().optional()
|
|
48928
|
+
});
|
|
48929
|
+
|
|
48930
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48931
|
+
import { Fragment as Fragment135, jsx as jsx267, jsxs as jsxs236 } from "react/jsx-runtime";
|
|
48932
|
+
function ExpensesJournal3Form() {
|
|
48933
|
+
const { branchId } = useParams108();
|
|
48934
|
+
const { getQuery, navigate } = useApp_default();
|
|
48935
|
+
const id = getQuery("id");
|
|
48936
|
+
const isEdit = !!id;
|
|
48937
|
+
const [ref2, setRef] = useState114("");
|
|
48938
|
+
const { post, isLoading } = useApis_default();
|
|
48939
|
+
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48940
|
+
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
48941
|
+
const methods = useForm58({
|
|
48942
|
+
resolver: zodResolver57(expenseSchema5),
|
|
48943
|
+
defaultValues: {
|
|
48944
|
+
date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
|
|
48945
|
+
amount: 0,
|
|
48946
|
+
description: "",
|
|
48947
|
+
rate: void 0,
|
|
48948
|
+
branch: branchId || void 0
|
|
48949
|
+
}
|
|
48950
|
+
});
|
|
48951
|
+
const { handleSubmit, reset, watch } = methods;
|
|
48952
|
+
const currency = watch("currency");
|
|
48953
|
+
const isRate = currency && currency !== defaultCurrency;
|
|
48954
|
+
const amount = watch("amount");
|
|
48955
|
+
const rate = watch("rate");
|
|
48956
|
+
const exchangedAmount2 = useMemo53(() => {
|
|
48957
|
+
if (isRate) {
|
|
48958
|
+
const am = forex_default.exchangedAmount({
|
|
48959
|
+
accountCurrency: defaultCurrency,
|
|
48960
|
+
amount,
|
|
48961
|
+
exchangeRate: rate ?? 1,
|
|
48962
|
+
transactionCurrency: currency
|
|
48963
|
+
});
|
|
48964
|
+
return Formats_default.Price(am, defaultCurrency ?? "N/A", false);
|
|
48965
|
+
}
|
|
48966
|
+
}, [amount, currency, rate, isRate]);
|
|
48967
|
+
const onSubmit = async (data) => {
|
|
48968
|
+
try {
|
|
48969
|
+
const payload = {
|
|
48970
|
+
...data,
|
|
48971
|
+
type: "expense-journal-3",
|
|
48972
|
+
defaultCurrency,
|
|
48973
|
+
branch: branchId ?? void 0,
|
|
48974
|
+
rate: data?.rate ?? 1
|
|
48975
|
+
};
|
|
48976
|
+
await post({
|
|
48977
|
+
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
48978
|
+
body: payload
|
|
48979
|
+
});
|
|
48980
|
+
message85.success(`Expense saved successfully`);
|
|
48981
|
+
navigate(-1);
|
|
48982
|
+
} catch (error) {
|
|
48983
|
+
message85.error(error?.message || "Something went wrong");
|
|
48984
|
+
}
|
|
48985
|
+
};
|
|
48986
|
+
const fetches = async () => {
|
|
48987
|
+
try {
|
|
48988
|
+
const res = await get({
|
|
48989
|
+
url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
|
|
48990
|
+
});
|
|
48991
|
+
const data = res.data;
|
|
48992
|
+
reset({
|
|
48993
|
+
...data,
|
|
48994
|
+
rate: data?.exchange?.rate
|
|
48995
|
+
});
|
|
48996
|
+
setRef(data?.ref);
|
|
48997
|
+
} catch (error) {
|
|
48998
|
+
message85.error(error?.message || "Something went wrong");
|
|
48999
|
+
navigate(-1);
|
|
49000
|
+
}
|
|
49001
|
+
};
|
|
49002
|
+
useEffect114(() => {
|
|
49003
|
+
if (isEdit) {
|
|
49004
|
+
fetches();
|
|
49005
|
+
}
|
|
49006
|
+
}, [id]);
|
|
49007
|
+
return /* @__PURE__ */ jsxs236(
|
|
49008
|
+
Card,
|
|
49009
|
+
{
|
|
49010
|
+
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49011
|
+
isLoading: isLoadingGet,
|
|
49012
|
+
loadingText: "Processing...",
|
|
49013
|
+
children: [
|
|
49014
|
+
/* @__PURE__ */ jsxs236(Card.Header, { children: [
|
|
49015
|
+
/* @__PURE__ */ jsx267(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
49016
|
+
/* @__PURE__ */ jsx267(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
49017
|
+
] }),
|
|
49018
|
+
/* @__PURE__ */ jsx267(Card.Content, { children: /* @__PURE__ */ jsxs236(
|
|
49019
|
+
"form",
|
|
49020
|
+
{
|
|
49021
|
+
className: "space-y-4",
|
|
49022
|
+
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49023
|
+
children: [
|
|
49024
|
+
/* @__PURE__ */ jsxs236("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49025
|
+
/* @__PURE__ */ jsx267(
|
|
49026
|
+
Fields_default.Input,
|
|
49027
|
+
{
|
|
49028
|
+
label: "Description",
|
|
49029
|
+
form: methods,
|
|
49030
|
+
name: "description",
|
|
49031
|
+
placeholder: "What was this expense for?",
|
|
49032
|
+
required: true
|
|
49033
|
+
}
|
|
49034
|
+
),
|
|
49035
|
+
/* @__PURE__ */ jsx267(
|
|
49036
|
+
Fields_default.Select,
|
|
49037
|
+
{
|
|
49038
|
+
label: "Currency",
|
|
49039
|
+
form: methods,
|
|
49040
|
+
enumName: "currencies",
|
|
49041
|
+
name: "currency",
|
|
49042
|
+
required: true
|
|
49043
|
+
}
|
|
49044
|
+
)
|
|
49045
|
+
] }),
|
|
49046
|
+
/* @__PURE__ */ jsxs236("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49047
|
+
/* @__PURE__ */ jsx267(
|
|
49048
|
+
Fields_default.DateInput,
|
|
49049
|
+
{
|
|
49050
|
+
label: "Date",
|
|
49051
|
+
form: methods,
|
|
49052
|
+
name: "date",
|
|
49053
|
+
required: true
|
|
49054
|
+
}
|
|
49055
|
+
),
|
|
49056
|
+
/* @__PURE__ */ jsx267(
|
|
49057
|
+
Fields_default.Input,
|
|
49058
|
+
{
|
|
49059
|
+
label: "Amount",
|
|
49060
|
+
form: methods,
|
|
49061
|
+
name: "amount",
|
|
49062
|
+
type: "number",
|
|
49063
|
+
placeholder: "0.00",
|
|
49064
|
+
required: true
|
|
49065
|
+
}
|
|
49066
|
+
),
|
|
49067
|
+
isRate && /* @__PURE__ */ jsxs236(Fragment135, { children: [
|
|
49068
|
+
/* @__PURE__ */ jsx267(
|
|
49069
|
+
Fields_default.Input,
|
|
49070
|
+
{
|
|
49071
|
+
label: "Rate",
|
|
49072
|
+
form: methods,
|
|
49073
|
+
name: "rate",
|
|
49074
|
+
type: "number",
|
|
49075
|
+
placeholder: "Rate",
|
|
49076
|
+
required: true
|
|
49077
|
+
}
|
|
49078
|
+
),
|
|
49079
|
+
/* @__PURE__ */ jsx267(
|
|
49080
|
+
Fields_default.Input,
|
|
49081
|
+
{
|
|
49082
|
+
label: "Exchanged Amount",
|
|
49083
|
+
type: "text",
|
|
49084
|
+
readOnly: true,
|
|
49085
|
+
disabled: true,
|
|
49086
|
+
value: exchangedAmount2
|
|
49087
|
+
}
|
|
49088
|
+
)
|
|
49089
|
+
] })
|
|
49090
|
+
] }),
|
|
49091
|
+
/* @__PURE__ */ jsx267(
|
|
49092
|
+
Fields_default.Textarea,
|
|
49093
|
+
{
|
|
49094
|
+
label: "Note",
|
|
49095
|
+
form: methods,
|
|
49096
|
+
name: "note",
|
|
49097
|
+
placeholder: "Add any additional details..."
|
|
49098
|
+
}
|
|
49099
|
+
),
|
|
49100
|
+
/* @__PURE__ */ jsx267("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx267(
|
|
49101
|
+
Button,
|
|
49102
|
+
{
|
|
49103
|
+
isLoading,
|
|
49104
|
+
disabled: isLoading,
|
|
49105
|
+
type: "submit",
|
|
49106
|
+
className: "min-w-[100px]",
|
|
49107
|
+
variant: !isEdit ? "primary" : "warning",
|
|
49108
|
+
children: isEdit ? "Update" : "Add"
|
|
49109
|
+
}
|
|
49110
|
+
) })
|
|
49111
|
+
]
|
|
49112
|
+
}
|
|
49113
|
+
) })
|
|
49114
|
+
]
|
|
49115
|
+
}
|
|
49116
|
+
);
|
|
49117
|
+
}
|
|
49118
|
+
var ExpensesJournal3Form_default = ExpensesJournal3Form;
|
|
49119
|
+
|
|
49120
|
+
// src/components/Transactions/3/expenseJournal/index.tsx
|
|
49121
|
+
var ExpensesJournal32 = {
|
|
49122
|
+
List: ExpensesJournal_default,
|
|
49123
|
+
Form: ExpensesJournal3Form_default
|
|
49124
|
+
};
|
|
49125
|
+
var expenseJournal_default = ExpensesJournal32;
|
|
49126
|
+
|
|
48792
49127
|
// src/components/Transactions/3/index.ts
|
|
48793
49128
|
var Transaction3 = {
|
|
48794
49129
|
Payments: Payments_default3,
|
|
@@ -48801,26 +49136,27 @@ var Transaction3 = {
|
|
|
48801
49136
|
Purchase3Form: purchase3_default.Form,
|
|
48802
49137
|
Expenses: expense_default.List,
|
|
48803
49138
|
ExpenseForm: expense_default.Form,
|
|
48804
|
-
Reports: reports_default
|
|
49139
|
+
Reports: reports_default,
|
|
49140
|
+
ExpensesJournal3: expenseJournal_default
|
|
48805
49141
|
};
|
|
48806
49142
|
var __default = Transaction3;
|
|
48807
49143
|
|
|
48808
49144
|
// src/components/reports/ItemReport.tsx
|
|
48809
|
-
import { useParams as
|
|
48810
|
-
import { z as
|
|
48811
|
-
import { useForm as
|
|
48812
|
-
import { zodResolver as
|
|
48813
|
-
import { useState as
|
|
48814
|
-
import { message as
|
|
48815
|
-
import { Fragment as
|
|
49145
|
+
import { useParams as useParams109 } from "react-router-dom";
|
|
49146
|
+
import { z as z50 } from "zod";
|
|
49147
|
+
import { useForm as useForm59 } from "react-hook-form";
|
|
49148
|
+
import { zodResolver as zodResolver58 } from "@hookform/resolvers/zod";
|
|
49149
|
+
import { useState as useState115 } from "react";
|
|
49150
|
+
import { message as message86 } from "antd";
|
|
49151
|
+
import { Fragment as Fragment136, jsx as jsx268, jsxs as jsxs237 } from "react/jsx-runtime";
|
|
48816
49152
|
var ItemReport = ({
|
|
48817
49153
|
value = false,
|
|
48818
49154
|
type
|
|
48819
49155
|
}) => {
|
|
48820
49156
|
const { apiConfig } = useWarqadConfig();
|
|
48821
|
-
const { branchId } =
|
|
49157
|
+
const { branchId } = useParams109();
|
|
48822
49158
|
const { branches } = useAuth_default();
|
|
48823
|
-
const [params, setParams] =
|
|
49159
|
+
const [params, setParams] = useState115({
|
|
48824
49160
|
id: "",
|
|
48825
49161
|
branch: "all"
|
|
48826
49162
|
});
|
|
@@ -48845,9 +49181,9 @@ var ItemReport = ({
|
|
|
48845
49181
|
header: "Date",
|
|
48846
49182
|
key: "date",
|
|
48847
49183
|
className: "text-xs whitespace-nowrap",
|
|
48848
|
-
render: (row) => /* @__PURE__ */
|
|
48849
|
-
/* @__PURE__ */
|
|
48850
|
-
/* @__PURE__ */
|
|
49184
|
+
render: (row) => /* @__PURE__ */ jsxs237("div", { className: "", children: [
|
|
49185
|
+
/* @__PURE__ */ jsx268("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49186
|
+
/* @__PURE__ */ jsx268(
|
|
48851
49187
|
"span",
|
|
48852
49188
|
{
|
|
48853
49189
|
onClick: () => {
|
|
@@ -48866,7 +49202,7 @@ var ItemReport = ({
|
|
|
48866
49202
|
header: "Description",
|
|
48867
49203
|
key: "description",
|
|
48868
49204
|
className: "text-xs whitespace-nowrap",
|
|
48869
|
-
render: (row) => /* @__PURE__ */
|
|
49205
|
+
render: (row) => /* @__PURE__ */ jsx268("div", { className: "", children: /* @__PURE__ */ jsx268("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
48870
49206
|
},
|
|
48871
49207
|
{
|
|
48872
49208
|
header: "Quantity",
|
|
@@ -48874,7 +49210,7 @@ var ItemReport = ({
|
|
|
48874
49210
|
className: "text-xs whitespace-nowrap",
|
|
48875
49211
|
render: (row) => {
|
|
48876
49212
|
const Qty = row.quantity;
|
|
48877
|
-
return /* @__PURE__ */
|
|
49213
|
+
return /* @__PURE__ */ jsxs237(
|
|
48878
49214
|
"div",
|
|
48879
49215
|
{
|
|
48880
49216
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -48891,7 +49227,7 @@ var ItemReport = ({
|
|
|
48891
49227
|
header: "Balance",
|
|
48892
49228
|
key: "runningBalance",
|
|
48893
49229
|
className: "text-xs whitespace-nowrap",
|
|
48894
|
-
render: (row) => /* @__PURE__ */
|
|
49230
|
+
render: (row) => /* @__PURE__ */ jsx268("div", { className: "", children: /* @__PURE__ */ jsx268("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
48895
49231
|
}
|
|
48896
49232
|
];
|
|
48897
49233
|
let runningBalance = 0;
|
|
@@ -48903,10 +49239,10 @@ var ItemReport = ({
|
|
|
48903
49239
|
};
|
|
48904
49240
|
});
|
|
48905
49241
|
const itemName = datas[0]?.name;
|
|
48906
|
-
return /* @__PURE__ */
|
|
48907
|
-
/* @__PURE__ */
|
|
48908
|
-
/* @__PURE__ */
|
|
48909
|
-
/* @__PURE__ */
|
|
49242
|
+
return /* @__PURE__ */ jsxs237(Fragment136, { children: [
|
|
49243
|
+
/* @__PURE__ */ jsx268(Modal2, {}),
|
|
49244
|
+
/* @__PURE__ */ jsx268(TransactionView, {}),
|
|
49245
|
+
/* @__PURE__ */ jsx268(
|
|
48910
49246
|
A4DataView,
|
|
48911
49247
|
{
|
|
48912
49248
|
columns,
|
|
@@ -48917,14 +49253,14 @@ var ItemReport = ({
|
|
|
48917
49253
|
tableTitle: `${type} Movement Report`,
|
|
48918
49254
|
fixed: false,
|
|
48919
49255
|
error: !id ? "Please select an item" : void 0,
|
|
48920
|
-
headers: /* @__PURE__ */
|
|
49256
|
+
headers: /* @__PURE__ */ jsx268(
|
|
48921
49257
|
Button,
|
|
48922
49258
|
{
|
|
48923
49259
|
type: "button",
|
|
48924
49260
|
size: "sm",
|
|
48925
49261
|
onClick: () => openState({
|
|
48926
49262
|
title: "Item Transactions",
|
|
48927
|
-
content: /* @__PURE__ */
|
|
49263
|
+
content: /* @__PURE__ */ jsx268(
|
|
48928
49264
|
ItemReportHeader2,
|
|
48929
49265
|
{
|
|
48930
49266
|
type,
|
|
@@ -48942,18 +49278,18 @@ var ItemReport = ({
|
|
|
48942
49278
|
)
|
|
48943
49279
|
] });
|
|
48944
49280
|
};
|
|
48945
|
-
var schema3 =
|
|
48946
|
-
pack:
|
|
48947
|
-
product:
|
|
48948
|
-
branch:
|
|
49281
|
+
var schema3 = z50.object({
|
|
49282
|
+
pack: z50.string().optional(),
|
|
49283
|
+
product: z50.string().optional(),
|
|
49284
|
+
branch: z50.string()
|
|
48949
49285
|
});
|
|
48950
49286
|
function ItemReportHeader2({
|
|
48951
49287
|
type,
|
|
48952
49288
|
close,
|
|
48953
49289
|
addToParams
|
|
48954
49290
|
}) {
|
|
48955
|
-
const methods =
|
|
48956
|
-
resolver:
|
|
49291
|
+
const methods = useForm59({
|
|
49292
|
+
resolver: zodResolver58(schema3),
|
|
48957
49293
|
defaultValues: {
|
|
48958
49294
|
pack: "",
|
|
48959
49295
|
product: "",
|
|
@@ -48967,14 +49303,14 @@ function ItemReportHeader2({
|
|
|
48967
49303
|
label: b.name,
|
|
48968
49304
|
value: b._id
|
|
48969
49305
|
}));
|
|
48970
|
-
return /* @__PURE__ */
|
|
49306
|
+
return /* @__PURE__ */ jsxs237(
|
|
48971
49307
|
"form",
|
|
48972
49308
|
{
|
|
48973
49309
|
className: "space-y-3",
|
|
48974
49310
|
onSubmit: handleSubmit((data) => {
|
|
48975
49311
|
const id = type === "pack" ? data.pack : data.product;
|
|
48976
49312
|
if (!id) {
|
|
48977
|
-
|
|
49313
|
+
message86.error("Please select an item");
|
|
48978
49314
|
methods.setFocus(type);
|
|
48979
49315
|
return;
|
|
48980
49316
|
}
|
|
@@ -48985,8 +49321,8 @@ function ItemReportHeader2({
|
|
|
48985
49321
|
close();
|
|
48986
49322
|
}),
|
|
48987
49323
|
children: [
|
|
48988
|
-
/* @__PURE__ */
|
|
48989
|
-
/* @__PURE__ */
|
|
49324
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49325
|
+
/* @__PURE__ */ jsx268(
|
|
48990
49326
|
Select,
|
|
48991
49327
|
{
|
|
48992
49328
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -48994,7 +49330,7 @@ function ItemReportHeader2({
|
|
|
48994
49330
|
name: "branch"
|
|
48995
49331
|
}
|
|
48996
49332
|
),
|
|
48997
|
-
type === "pack" ? /* @__PURE__ */
|
|
49333
|
+
type === "pack" ? /* @__PURE__ */ jsx268(
|
|
48998
49334
|
Pack_default.Pack,
|
|
48999
49335
|
{
|
|
49000
49336
|
api: "/packs/get",
|
|
@@ -49002,7 +49338,7 @@ function ItemReportHeader2({
|
|
|
49002
49338
|
form: methods,
|
|
49003
49339
|
name: "pack"
|
|
49004
49340
|
}
|
|
49005
|
-
) : /* @__PURE__ */
|
|
49341
|
+
) : /* @__PURE__ */ jsx268(
|
|
49006
49342
|
Feilds_default5.Product,
|
|
49007
49343
|
{
|
|
49008
49344
|
label: "",
|
|
@@ -49013,7 +49349,7 @@ function ItemReportHeader2({
|
|
|
49013
49349
|
}
|
|
49014
49350
|
)
|
|
49015
49351
|
] }),
|
|
49016
|
-
/* @__PURE__ */
|
|
49352
|
+
/* @__PURE__ */ jsx268("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ jsx268(Button, { type: "submit", children: "Filter" }) })
|
|
49017
49353
|
]
|
|
49018
49354
|
}
|
|
49019
49355
|
);
|
|
@@ -49021,19 +49357,19 @@ function ItemReportHeader2({
|
|
|
49021
49357
|
var ItemReport_default = ItemReport;
|
|
49022
49358
|
|
|
49023
49359
|
// src/components/accounts/LeaseCollection.tsx
|
|
49024
|
-
import { useNavigate as
|
|
49025
|
-
import { useMemo as
|
|
49026
|
-
import { Fragment as
|
|
49360
|
+
import { useNavigate as useNavigate65, useParams as useParams110, useSearchParams as useSearchParams19 } from "react-router-dom";
|
|
49361
|
+
import { useMemo as useMemo54, useState as useState116, useEffect as useEffect115 } from "react";
|
|
49362
|
+
import { Fragment as Fragment137, jsx as jsx269, jsxs as jsxs238 } from "react/jsx-runtime";
|
|
49027
49363
|
var LeaseCollection = ({
|
|
49028
49364
|
leaseType,
|
|
49029
49365
|
defaultCurrency = "KES"
|
|
49030
49366
|
}) => {
|
|
49031
|
-
const navigate =
|
|
49367
|
+
const navigate = useNavigate65();
|
|
49032
49368
|
const [searchParams] = useSearchParams19();
|
|
49033
49369
|
const { apiConfig } = useWarqadConfig();
|
|
49034
|
-
const { branchId } =
|
|
49370
|
+
const { branchId } = useParams110();
|
|
49035
49371
|
const { branches } = useAuth_default();
|
|
49036
|
-
const currentBranch =
|
|
49372
|
+
const currentBranch = useMemo54(
|
|
49037
49373
|
() => branches?.find((b) => b?._id === branchId),
|
|
49038
49374
|
[branches, branchId]
|
|
49039
49375
|
);
|
|
@@ -49041,16 +49377,16 @@ var LeaseCollection = ({
|
|
|
49041
49377
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
49042
49378
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49043
49379
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
49044
|
-
const [filter, setFilter] =
|
|
49380
|
+
const [filter, setFilter] = useState116(
|
|
49045
49381
|
initialFilter
|
|
49046
49382
|
);
|
|
49047
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
49048
|
-
|
|
49383
|
+
const [currencyFilter, setCurrencyFilter] = useState116(initialCurrency);
|
|
49384
|
+
useEffect115(() => {
|
|
49049
49385
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
49050
49386
|
setFilter(urlFilter);
|
|
49051
49387
|
}
|
|
49052
49388
|
}, [urlFilter]);
|
|
49053
|
-
|
|
49389
|
+
useEffect115(() => {
|
|
49054
49390
|
if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
|
|
49055
49391
|
setCurrencyFilter(urlCurrency);
|
|
49056
49392
|
} else {
|
|
@@ -49069,9 +49405,9 @@ var LeaseCollection = ({
|
|
|
49069
49405
|
key: "name",
|
|
49070
49406
|
className: "text-xs whitespace-nowrap ",
|
|
49071
49407
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
49072
|
-
render: (row) => /* @__PURE__ */
|
|
49073
|
-
/* @__PURE__ */
|
|
49074
|
-
row.unitNames && /* @__PURE__ */
|
|
49408
|
+
render: (row) => /* @__PURE__ */ jsxs238("div", { className: "space-y-1", children: [
|
|
49409
|
+
/* @__PURE__ */ jsx269("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49410
|
+
row.unitNames && /* @__PURE__ */ jsxs238("p", { className: "text-[9px]! capitalize", children: [
|
|
49075
49411
|
"(",
|
|
49076
49412
|
row.unitNames,
|
|
49077
49413
|
")"
|
|
@@ -49083,7 +49419,7 @@ var LeaseCollection = ({
|
|
|
49083
49419
|
key: "phoneNumber",
|
|
49084
49420
|
maxWidth: 70,
|
|
49085
49421
|
render: (row) => {
|
|
49086
|
-
return /* @__PURE__ */
|
|
49422
|
+
return /* @__PURE__ */ jsx269("p", { children: row?.phoneNumber || "N/A" });
|
|
49087
49423
|
}
|
|
49088
49424
|
},
|
|
49089
49425
|
// </span>
|
|
@@ -49093,11 +49429,11 @@ var LeaseCollection = ({
|
|
|
49093
49429
|
className: "text-xs whitespace-nowrap text-right",
|
|
49094
49430
|
render: (row) => {
|
|
49095
49431
|
const Amount = row.totalCollectionString;
|
|
49096
|
-
return /* @__PURE__ */
|
|
49432
|
+
return /* @__PURE__ */ jsx269("div", { className: "", children: /* @__PURE__ */ jsx269("p", { className: "font-bold ", children: Amount }) });
|
|
49097
49433
|
},
|
|
49098
49434
|
renderFooter: (data2) => {
|
|
49099
49435
|
if (currencyFilter === "all") return;
|
|
49100
|
-
return /* @__PURE__ */
|
|
49436
|
+
return /* @__PURE__ */ jsx269("span", { className: " font-bold", children: Formats_default.Price(
|
|
49101
49437
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
49102
49438
|
defaultCurrency,
|
|
49103
49439
|
false
|
|
@@ -49105,7 +49441,7 @@ var LeaseCollection = ({
|
|
|
49105
49441
|
}
|
|
49106
49442
|
}
|
|
49107
49443
|
];
|
|
49108
|
-
const datas =
|
|
49444
|
+
const datas = useMemo54(() => {
|
|
49109
49445
|
let runningBalance = 0;
|
|
49110
49446
|
let filteredData = data?.data || [];
|
|
49111
49447
|
const result = filteredData.map((item) => {
|
|
@@ -49118,9 +49454,9 @@ var LeaseCollection = ({
|
|
|
49118
49454
|
});
|
|
49119
49455
|
return result;
|
|
49120
49456
|
}, [filter, currencyFilter, data]);
|
|
49121
|
-
return /* @__PURE__ */
|
|
49122
|
-
/* @__PURE__ */
|
|
49123
|
-
/* @__PURE__ */
|
|
49457
|
+
return /* @__PURE__ */ jsxs238(Fragment137, { children: [
|
|
49458
|
+
/* @__PURE__ */ jsx269(TransactionView, {}),
|
|
49459
|
+
/* @__PURE__ */ jsx269(
|
|
49124
49460
|
A4DataView,
|
|
49125
49461
|
{
|
|
49126
49462
|
columns,
|
|
@@ -49130,7 +49466,7 @@ var LeaseCollection = ({
|
|
|
49130
49466
|
subtitle: `All Collections`,
|
|
49131
49467
|
fixed: false,
|
|
49132
49468
|
startPage: 1e9,
|
|
49133
|
-
headers: /* @__PURE__ */
|
|
49469
|
+
headers: /* @__PURE__ */ jsx269("div", { className: "flex gap-2" })
|
|
49134
49470
|
}
|
|
49135
49471
|
)
|
|
49136
49472
|
] });
|
|
@@ -49138,61 +49474,61 @@ var LeaseCollection = ({
|
|
|
49138
49474
|
var LeaseCollection_default = LeaseCollection;
|
|
49139
49475
|
|
|
49140
49476
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49141
|
-
import { useNavigate as
|
|
49142
|
-
import { EllipsisVertical as
|
|
49143
|
-
import { useState as
|
|
49144
|
-
import { message as
|
|
49477
|
+
import { useNavigate as useNavigate66, useParams as useParams114 } from "react-router-dom";
|
|
49478
|
+
import { EllipsisVertical as EllipsisVertical48, FilePenLine as FilePenLine44, Trash2 as Trash255 } from "lucide-react";
|
|
49479
|
+
import { useState as useState118 } from "react";
|
|
49480
|
+
import { message as message90 } from "antd";
|
|
49145
49481
|
|
|
49146
49482
|
// src/components/Transactions/cargoIM/schema.ts
|
|
49147
|
-
import { z as
|
|
49148
|
-
var InvoiceSchema2 =
|
|
49149
|
-
name:
|
|
49150
|
-
quantity:
|
|
49151
|
-
amount:
|
|
49483
|
+
import { z as z51 } from "zod";
|
|
49484
|
+
var InvoiceSchema2 = z51.object({
|
|
49485
|
+
name: z51.string().min(1, { message: "Item name is required" }),
|
|
49486
|
+
quantity: z51.number().gt(0, { message: "Quantity must be greater than 0" }),
|
|
49487
|
+
amount: z51.number().gt(0, { message: "Price must be greater than 0" })
|
|
49152
49488
|
});
|
|
49153
|
-
var createInvoiceManagerValidation2 =
|
|
49154
|
-
invoices:
|
|
49155
|
-
date:
|
|
49156
|
-
currency:
|
|
49157
|
-
branch:
|
|
49489
|
+
var createInvoiceManagerValidation2 = z51.object({
|
|
49490
|
+
invoices: z51.array(InvoiceSchema2),
|
|
49491
|
+
date: z51.string(),
|
|
49492
|
+
currency: z51.string(),
|
|
49493
|
+
branch: z51.string().optional()
|
|
49158
49494
|
});
|
|
49159
|
-
var createAccountSchema3 =
|
|
49160
|
-
name:
|
|
49161
|
-
phoneNumber:
|
|
49162
|
-
branch:
|
|
49163
|
-
currency:
|
|
49495
|
+
var createAccountSchema3 = z51.object({
|
|
49496
|
+
name: z51.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
49497
|
+
phoneNumber: z51.string().optional(),
|
|
49498
|
+
branch: z51.string().optional(),
|
|
49499
|
+
currency: z51.string().optional()
|
|
49164
49500
|
});
|
|
49165
|
-
var journalSchema5 =
|
|
49501
|
+
var journalSchema5 = z51.object({
|
|
49166
49502
|
date: zodFields.date,
|
|
49167
|
-
amount:
|
|
49168
|
-
currency:
|
|
49169
|
-
description:
|
|
49170
|
-
branch:
|
|
49171
|
-
action:
|
|
49172
|
-
note:
|
|
49503
|
+
amount: z51.number().gt(0, "Amount must be greater than 0"),
|
|
49504
|
+
currency: z51.string(),
|
|
49505
|
+
description: z51.string(),
|
|
49506
|
+
branch: z51.string().optional(),
|
|
49507
|
+
action: z51.enum(Enums_default.actionTypes).optional(),
|
|
49508
|
+
note: z51.string().optional()
|
|
49173
49509
|
});
|
|
49174
49510
|
|
|
49175
49511
|
// src/components/Transactions/cargoIM/AccountForm.tsx
|
|
49176
|
-
import { useForm as
|
|
49177
|
-
import { zodResolver as
|
|
49178
|
-
import { message as
|
|
49179
|
-
import { useEffect as
|
|
49180
|
-
import { useParams as
|
|
49181
|
-
import { jsx as
|
|
49512
|
+
import { useForm as useForm60 } from "react-hook-form";
|
|
49513
|
+
import { zodResolver as zodResolver59 } from "@hookform/resolvers/zod";
|
|
49514
|
+
import { message as message87 } from "antd";
|
|
49515
|
+
import { useEffect as useEffect116 } from "react";
|
|
49516
|
+
import { useParams as useParams111 } from "react-router-dom";
|
|
49517
|
+
import { jsx as jsx270, jsxs as jsxs239 } from "react/jsx-runtime";
|
|
49182
49518
|
function AccountForm3({
|
|
49183
49519
|
onReload,
|
|
49184
49520
|
close,
|
|
49185
49521
|
id
|
|
49186
49522
|
}) {
|
|
49187
|
-
const { branchId } =
|
|
49523
|
+
const { branchId } = useParams111();
|
|
49188
49524
|
const { currencies } = useWarqadConfig();
|
|
49189
49525
|
const { stock } = currencies;
|
|
49190
49526
|
const isEdit = !!id;
|
|
49191
49527
|
const type = "supplier";
|
|
49192
49528
|
const { post, put, isLoading } = useApis_default();
|
|
49193
49529
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
49194
|
-
const methods =
|
|
49195
|
-
resolver:
|
|
49530
|
+
const methods = useForm60({
|
|
49531
|
+
resolver: zodResolver59(createAccountSchema3),
|
|
49196
49532
|
defaultValues: {
|
|
49197
49533
|
name: "",
|
|
49198
49534
|
phoneNumber: "",
|
|
@@ -49222,7 +49558,7 @@ function AccountForm3({
|
|
|
49222
49558
|
body: payload
|
|
49223
49559
|
});
|
|
49224
49560
|
}
|
|
49225
|
-
|
|
49561
|
+
message87.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
|
|
49226
49562
|
if (onReload) {
|
|
49227
49563
|
onReload();
|
|
49228
49564
|
}
|
|
@@ -49230,7 +49566,7 @@ function AccountForm3({
|
|
|
49230
49566
|
close();
|
|
49231
49567
|
}
|
|
49232
49568
|
} catch (error) {
|
|
49233
|
-
|
|
49569
|
+
message87.error(error?.message || "Something went wrong");
|
|
49234
49570
|
}
|
|
49235
49571
|
};
|
|
49236
49572
|
const fetches = async () => {
|
|
@@ -49241,33 +49577,33 @@ function AccountForm3({
|
|
|
49241
49577
|
const data = res.data;
|
|
49242
49578
|
methods.reset(data);
|
|
49243
49579
|
} catch (error) {
|
|
49244
|
-
|
|
49580
|
+
message87.error(error?.message || "Something went wrong");
|
|
49245
49581
|
close?.();
|
|
49246
49582
|
}
|
|
49247
49583
|
};
|
|
49248
|
-
|
|
49584
|
+
useEffect116(() => {
|
|
49249
49585
|
if (isEdit) {
|
|
49250
49586
|
fetches();
|
|
49251
49587
|
}
|
|
49252
49588
|
}, [id]);
|
|
49253
|
-
return /* @__PURE__ */
|
|
49589
|
+
return /* @__PURE__ */ jsxs239(
|
|
49254
49590
|
Card,
|
|
49255
49591
|
{
|
|
49256
49592
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49257
49593
|
isLoading: isLoadingGet,
|
|
49258
49594
|
loadingText: "Processing...",
|
|
49259
49595
|
children: [
|
|
49260
|
-
/* @__PURE__ */
|
|
49261
|
-
/* @__PURE__ */
|
|
49262
|
-
/* @__PURE__ */
|
|
49596
|
+
/* @__PURE__ */ jsxs239(Card.Header, { children: [
|
|
49597
|
+
/* @__PURE__ */ jsx270(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49598
|
+
/* @__PURE__ */ jsx270(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49263
49599
|
] }),
|
|
49264
|
-
/* @__PURE__ */
|
|
49600
|
+
/* @__PURE__ */ jsx270(Card.Content, { children: /* @__PURE__ */ jsxs239(
|
|
49265
49601
|
"form",
|
|
49266
49602
|
{
|
|
49267
49603
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49268
49604
|
children: [
|
|
49269
|
-
/* @__PURE__ */
|
|
49270
|
-
/* @__PURE__ */
|
|
49605
|
+
/* @__PURE__ */ jsxs239("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49606
|
+
/* @__PURE__ */ jsx270(
|
|
49271
49607
|
Fields_default.Input,
|
|
49272
49608
|
{
|
|
49273
49609
|
label: "Name",
|
|
@@ -49278,7 +49614,7 @@ function AccountForm3({
|
|
|
49278
49614
|
required: true
|
|
49279
49615
|
}
|
|
49280
49616
|
),
|
|
49281
|
-
/* @__PURE__ */
|
|
49617
|
+
/* @__PURE__ */ jsx270(
|
|
49282
49618
|
Fields_default.PhoneInput,
|
|
49283
49619
|
{
|
|
49284
49620
|
label: "Phone Number",
|
|
@@ -49287,7 +49623,7 @@ function AccountForm3({
|
|
|
49287
49623
|
placeholder: "Enter phone number"
|
|
49288
49624
|
}
|
|
49289
49625
|
),
|
|
49290
|
-
/* @__PURE__ */
|
|
49626
|
+
/* @__PURE__ */ jsx270(
|
|
49291
49627
|
Fields_default.Select,
|
|
49292
49628
|
{
|
|
49293
49629
|
label: "Currency",
|
|
@@ -49298,7 +49634,7 @@ function AccountForm3({
|
|
|
49298
49634
|
}
|
|
49299
49635
|
)
|
|
49300
49636
|
] }),
|
|
49301
|
-
/* @__PURE__ */
|
|
49637
|
+
/* @__PURE__ */ jsx270("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx270(
|
|
49302
49638
|
Button,
|
|
49303
49639
|
{
|
|
49304
49640
|
isLoading,
|
|
@@ -49319,33 +49655,33 @@ function AccountForm3({
|
|
|
49319
49655
|
var AccountForm_default3 = AccountForm3;
|
|
49320
49656
|
|
|
49321
49657
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49322
|
-
import { useEffect as
|
|
49323
|
-
import { useForm as
|
|
49324
|
-
import { zodResolver as
|
|
49325
|
-
import { useParams as
|
|
49326
|
-
import { message as
|
|
49327
|
-
import { Trash2 as
|
|
49658
|
+
import { useEffect as useEffect117, useState as useState117 } from "react";
|
|
49659
|
+
import { useForm as useForm61, useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
49660
|
+
import { zodResolver as zodResolver60 } from "@hookform/resolvers/zod";
|
|
49661
|
+
import { useParams as useParams112 } from "react-router-dom";
|
|
49662
|
+
import { message as message88 } from "antd";
|
|
49663
|
+
import { Trash2 as Trash254, Plus as Plus6 } from "lucide-react";
|
|
49328
49664
|
import dayjs12 from "dayjs";
|
|
49329
|
-
import { jsx as
|
|
49665
|
+
import { jsx as jsx271, jsxs as jsxs240 } from "react/jsx-runtime";
|
|
49330
49666
|
function InvoiceForm2({
|
|
49331
49667
|
onReload,
|
|
49332
49668
|
close,
|
|
49333
49669
|
accountData,
|
|
49334
49670
|
id
|
|
49335
49671
|
}) {
|
|
49336
|
-
const { branchId } =
|
|
49337
|
-
const [ref2, setRef] =
|
|
49672
|
+
const { branchId } = useParams112();
|
|
49673
|
+
const [ref2, setRef] = useState117(void 0);
|
|
49338
49674
|
const { post, isLoading } = useApis_default();
|
|
49339
49675
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49340
49676
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49341
49677
|
const isEdit = !!id;
|
|
49342
49678
|
const { currencies } = useWarqadConfig();
|
|
49343
49679
|
const { stock: defaultCurrency } = currencies;
|
|
49344
|
-
const [itemName, setItemName] =
|
|
49345
|
-
const [itemQuantity, setItemQuantity] =
|
|
49346
|
-
const [itemPrice, setItemPrice] =
|
|
49347
|
-
const methods =
|
|
49348
|
-
resolver:
|
|
49680
|
+
const [itemName, setItemName] = useState117("");
|
|
49681
|
+
const [itemQuantity, setItemQuantity] = useState117("");
|
|
49682
|
+
const [itemPrice, setItemPrice] = useState117("");
|
|
49683
|
+
const methods = useForm61({
|
|
49684
|
+
resolver: zodResolver60(createInvoiceManagerValidation2),
|
|
49349
49685
|
defaultValues: {
|
|
49350
49686
|
invoices: [],
|
|
49351
49687
|
date: dayjs12().format("DD/MM/YYYY"),
|
|
@@ -49369,27 +49705,27 @@ function InvoiceForm2({
|
|
|
49369
49705
|
});
|
|
49370
49706
|
setRef(data?.ref);
|
|
49371
49707
|
} catch (error) {
|
|
49372
|
-
|
|
49708
|
+
message88.error(error?.message || "Something went wrong");
|
|
49373
49709
|
}
|
|
49374
49710
|
};
|
|
49375
|
-
|
|
49711
|
+
useEffect117(() => {
|
|
49376
49712
|
if (isEdit) {
|
|
49377
49713
|
fetches();
|
|
49378
49714
|
}
|
|
49379
49715
|
}, [isEdit]);
|
|
49380
49716
|
const handleAddItem = () => {
|
|
49381
49717
|
if (!itemName.trim()) {
|
|
49382
|
-
|
|
49718
|
+
message88.error("Item name is required");
|
|
49383
49719
|
return;
|
|
49384
49720
|
}
|
|
49385
49721
|
const qty = Number(itemQuantity);
|
|
49386
49722
|
const price = Number(itemPrice);
|
|
49387
49723
|
if (isNaN(qty) || qty <= 0) {
|
|
49388
|
-
|
|
49724
|
+
message88.error("Quantity must be greater than 0");
|
|
49389
49725
|
return;
|
|
49390
49726
|
}
|
|
49391
49727
|
if (isNaN(price) || price <= 0) {
|
|
49392
|
-
|
|
49728
|
+
message88.error("Price must be greater than 0");
|
|
49393
49729
|
return;
|
|
49394
49730
|
}
|
|
49395
49731
|
append({
|
|
@@ -49403,7 +49739,7 @@ function InvoiceForm2({
|
|
|
49403
49739
|
};
|
|
49404
49740
|
const onSubmit = async (data) => {
|
|
49405
49741
|
if (data.invoices.length === 0) {
|
|
49406
|
-
|
|
49742
|
+
message88.error("Please add at least one item to the invoice");
|
|
49407
49743
|
return;
|
|
49408
49744
|
}
|
|
49409
49745
|
try {
|
|
@@ -49416,13 +49752,13 @@ function InvoiceForm2({
|
|
|
49416
49752
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49417
49753
|
body: payload
|
|
49418
49754
|
});
|
|
49419
|
-
|
|
49755
|
+
message88.success(
|
|
49420
49756
|
isEdit ? "Invoice updated successfully" : "Invoice created successfully"
|
|
49421
49757
|
);
|
|
49422
49758
|
if (onReload) onReload();
|
|
49423
49759
|
if (close) close();
|
|
49424
49760
|
} catch (error) {
|
|
49425
|
-
|
|
49761
|
+
message88.error(error?.message || "Something went wrong");
|
|
49426
49762
|
}
|
|
49427
49763
|
};
|
|
49428
49764
|
const onReverse = async () => {
|
|
@@ -49431,11 +49767,11 @@ function InvoiceForm2({
|
|
|
49431
49767
|
await put({
|
|
49432
49768
|
url: `/transactions/reverse/${id}`
|
|
49433
49769
|
});
|
|
49434
|
-
|
|
49770
|
+
message88.success("Transaction reversed successfully");
|
|
49435
49771
|
if (onReload) onReload();
|
|
49436
49772
|
if (close) close();
|
|
49437
49773
|
} catch (error) {
|
|
49438
|
-
|
|
49774
|
+
message88.error(error?.message || "Something went wrong");
|
|
49439
49775
|
}
|
|
49440
49776
|
};
|
|
49441
49777
|
const handleKeyDown = (e) => {
|
|
@@ -49447,25 +49783,25 @@ function InvoiceForm2({
|
|
|
49447
49783
|
e.preventDefault();
|
|
49448
49784
|
}
|
|
49449
49785
|
};
|
|
49450
|
-
return /* @__PURE__ */
|
|
49786
|
+
return /* @__PURE__ */ jsx271(
|
|
49451
49787
|
Card,
|
|
49452
49788
|
{
|
|
49453
49789
|
isLoading: getLoading,
|
|
49454
49790
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49455
|
-
children: /* @__PURE__ */
|
|
49456
|
-
/* @__PURE__ */
|
|
49457
|
-
/* @__PURE__ */
|
|
49791
|
+
children: /* @__PURE__ */ jsxs240(Card.Content, { children: [
|
|
49792
|
+
/* @__PURE__ */ jsx271("input", { type: "hidden", ...register("currency") }),
|
|
49793
|
+
/* @__PURE__ */ jsxs240(
|
|
49458
49794
|
"form",
|
|
49459
49795
|
{
|
|
49460
49796
|
onSubmit: handleSubmit(onSubmit),
|
|
49461
49797
|
onKeyDown: handleKeyDown,
|
|
49462
49798
|
className: "space-y-6",
|
|
49463
49799
|
children: [
|
|
49464
|
-
/* @__PURE__ */
|
|
49465
|
-
/* @__PURE__ */
|
|
49466
|
-
/* @__PURE__ */
|
|
49467
|
-
/* @__PURE__ */
|
|
49468
|
-
/* @__PURE__ */
|
|
49800
|
+
/* @__PURE__ */ jsxs240("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
49801
|
+
/* @__PURE__ */ jsx271("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49802
|
+
/* @__PURE__ */ jsxs240("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49803
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49804
|
+
/* @__PURE__ */ jsx271(
|
|
49469
49805
|
Fields_default.Input,
|
|
49470
49806
|
{
|
|
49471
49807
|
label: "Container No",
|
|
@@ -49474,7 +49810,7 @@ function InvoiceForm2({
|
|
|
49474
49810
|
onChange: (val) => setItemName(val)
|
|
49475
49811
|
}
|
|
49476
49812
|
),
|
|
49477
|
-
/* @__PURE__ */
|
|
49813
|
+
/* @__PURE__ */ jsx271(
|
|
49478
49814
|
Fields_default.Input,
|
|
49479
49815
|
{
|
|
49480
49816
|
label: "Cbm",
|
|
@@ -49484,7 +49820,7 @@ function InvoiceForm2({
|
|
|
49484
49820
|
onChange: (val) => setItemQuantity(val)
|
|
49485
49821
|
}
|
|
49486
49822
|
),
|
|
49487
|
-
/* @__PURE__ */
|
|
49823
|
+
/* @__PURE__ */ jsx271(
|
|
49488
49824
|
Fields_default.Input,
|
|
49489
49825
|
{
|
|
49490
49826
|
label: "Price (KES)",
|
|
@@ -49495,7 +49831,7 @@ function InvoiceForm2({
|
|
|
49495
49831
|
}
|
|
49496
49832
|
)
|
|
49497
49833
|
] }),
|
|
49498
|
-
/* @__PURE__ */
|
|
49834
|
+
/* @__PURE__ */ jsxs240(
|
|
49499
49835
|
Button,
|
|
49500
49836
|
{
|
|
49501
49837
|
type: "button",
|
|
@@ -49503,23 +49839,23 @@ function InvoiceForm2({
|
|
|
49503
49839
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49504
49840
|
variant: "outline",
|
|
49505
49841
|
children: [
|
|
49506
|
-
/* @__PURE__ */
|
|
49842
|
+
/* @__PURE__ */ jsx271(Plus6, { size: 16 }),
|
|
49507
49843
|
" Add Item"
|
|
49508
49844
|
]
|
|
49509
49845
|
}
|
|
49510
49846
|
)
|
|
49511
49847
|
] })
|
|
49512
49848
|
] }),
|
|
49513
|
-
/* @__PURE__ */
|
|
49514
|
-
/* @__PURE__ */
|
|
49515
|
-
/* @__PURE__ */
|
|
49516
|
-
/* @__PURE__ */
|
|
49517
|
-
/* @__PURE__ */
|
|
49518
|
-
/* @__PURE__ */
|
|
49519
|
-
/* @__PURE__ */
|
|
49520
|
-
/* @__PURE__ */
|
|
49849
|
+
/* @__PURE__ */ jsxs240("div", { children: [
|
|
49850
|
+
/* @__PURE__ */ jsx271("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49851
|
+
/* @__PURE__ */ jsx271("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ jsx271("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs240("table", { className: "w-full text-left border-collapse", children: [
|
|
49852
|
+
/* @__PURE__ */ jsx271("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs240("tr", { children: [
|
|
49853
|
+
/* @__PURE__ */ jsx271("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
|
|
49854
|
+
/* @__PURE__ */ jsx271("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
|
|
49855
|
+
/* @__PURE__ */ jsx271("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
|
|
49856
|
+
/* @__PURE__ */ jsx271("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
|
|
49521
49857
|
] }) }),
|
|
49522
|
-
/* @__PURE__ */
|
|
49858
|
+
/* @__PURE__ */ jsx271("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ jsx271("tr", { children: /* @__PURE__ */ jsx271(
|
|
49523
49859
|
"td",
|
|
49524
49860
|
{
|
|
49525
49861
|
colSpan: 4,
|
|
@@ -49528,30 +49864,30 @@ function InvoiceForm2({
|
|
|
49528
49864
|
}
|
|
49529
49865
|
) }) : fields.map((item, index) => {
|
|
49530
49866
|
const total = item.quantity * item.amount;
|
|
49531
|
-
return /* @__PURE__ */
|
|
49867
|
+
return /* @__PURE__ */ jsxs240(
|
|
49532
49868
|
"tr",
|
|
49533
49869
|
{
|
|
49534
49870
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49535
49871
|
children: [
|
|
49536
|
-
/* @__PURE__ */
|
|
49537
|
-
/* @__PURE__ */
|
|
49538
|
-
/* @__PURE__ */
|
|
49539
|
-
/* @__PURE__ */
|
|
49872
|
+
/* @__PURE__ */ jsx271("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
|
|
49873
|
+
/* @__PURE__ */ jsxs240("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
49874
|
+
/* @__PURE__ */ jsx271("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
49875
|
+
/* @__PURE__ */ jsxs240("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49540
49876
|
item.quantity,
|
|
49541
49877
|
" Cbm @",
|
|
49542
49878
|
" ",
|
|
49543
49879
|
Formats_default.Price(item.amount, "KES")
|
|
49544
49880
|
] })
|
|
49545
49881
|
] }),
|
|
49546
|
-
/* @__PURE__ */
|
|
49547
|
-
/* @__PURE__ */
|
|
49882
|
+
/* @__PURE__ */ jsx271("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
|
|
49883
|
+
/* @__PURE__ */ jsx271("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ jsx271(
|
|
49548
49884
|
"button",
|
|
49549
49885
|
{
|
|
49550
49886
|
type: "button",
|
|
49551
49887
|
onClick: () => remove(index),
|
|
49552
49888
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49553
|
-
children: /* @__PURE__ */
|
|
49554
|
-
|
|
49889
|
+
children: /* @__PURE__ */ jsx271(
|
|
49890
|
+
Trash254,
|
|
49555
49891
|
{
|
|
49556
49892
|
size: 13,
|
|
49557
49893
|
className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
|
|
@@ -49564,8 +49900,8 @@ function InvoiceForm2({
|
|
|
49564
49900
|
item.id
|
|
49565
49901
|
);
|
|
49566
49902
|
}) }),
|
|
49567
|
-
fields.length > 0 && /* @__PURE__ */
|
|
49568
|
-
/* @__PURE__ */
|
|
49903
|
+
fields.length > 0 && /* @__PURE__ */ jsx271("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ jsxs240("tr", { children: [
|
|
49904
|
+
/* @__PURE__ */ jsx271(
|
|
49569
49905
|
"td",
|
|
49570
49906
|
{
|
|
49571
49907
|
colSpan: 2,
|
|
@@ -49573,20 +49909,20 @@ function InvoiceForm2({
|
|
|
49573
49909
|
children: "Total"
|
|
49574
49910
|
}
|
|
49575
49911
|
),
|
|
49576
|
-
/* @__PURE__ */
|
|
49912
|
+
/* @__PURE__ */ jsx271("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
|
|
49577
49913
|
fields.reduce(
|
|
49578
49914
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49579
49915
|
0
|
|
49580
49916
|
),
|
|
49581
49917
|
"KES"
|
|
49582
49918
|
) }),
|
|
49583
|
-
/* @__PURE__ */
|
|
49919
|
+
/* @__PURE__ */ jsx271("td", {})
|
|
49584
49920
|
] }) })
|
|
49585
49921
|
] }) }) })
|
|
49586
49922
|
] }),
|
|
49587
|
-
/* @__PURE__ */
|
|
49588
|
-
/* @__PURE__ */
|
|
49589
|
-
/* @__PURE__ */
|
|
49923
|
+
/* @__PURE__ */ jsxs240("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
49924
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49925
|
+
/* @__PURE__ */ jsx271(
|
|
49590
49926
|
Fields_default.DateInput,
|
|
49591
49927
|
{
|
|
49592
49928
|
label: "Date",
|
|
@@ -49595,20 +49931,20 @@ function InvoiceForm2({
|
|
|
49595
49931
|
required: true
|
|
49596
49932
|
}
|
|
49597
49933
|
),
|
|
49598
|
-
/* @__PURE__ */
|
|
49934
|
+
/* @__PURE__ */ jsx271(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49599
49935
|
] }),
|
|
49600
|
-
/* @__PURE__ */
|
|
49601
|
-
/* @__PURE__ */
|
|
49936
|
+
/* @__PURE__ */ jsxs240("div", { className: "flex justify-between items-center mt-6", children: [
|
|
49937
|
+
/* @__PURE__ */ jsx271("div", { children: isEdit && /* @__PURE__ */ jsx271(
|
|
49602
49938
|
ConfirmModal,
|
|
49603
49939
|
{
|
|
49604
49940
|
title: "Reverse Transaction",
|
|
49605
|
-
description: /* @__PURE__ */
|
|
49606
|
-
/* @__PURE__ */
|
|
49607
|
-
/* @__PURE__ */
|
|
49941
|
+
description: /* @__PURE__ */ jsxs240("div", { className: "space-y-3 text-left", children: [
|
|
49942
|
+
/* @__PURE__ */ jsx271("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49943
|
+
/* @__PURE__ */ jsx271("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
49608
49944
|
] }),
|
|
49609
49945
|
confirmationWord: "delete",
|
|
49610
49946
|
onSubmit: onReverse,
|
|
49611
|
-
children: /* @__PURE__ */
|
|
49947
|
+
children: /* @__PURE__ */ jsx271(
|
|
49612
49948
|
Button,
|
|
49613
49949
|
{
|
|
49614
49950
|
type: "button",
|
|
@@ -49621,8 +49957,8 @@ function InvoiceForm2({
|
|
|
49621
49957
|
)
|
|
49622
49958
|
}
|
|
49623
49959
|
) }),
|
|
49624
|
-
/* @__PURE__ */
|
|
49625
|
-
close && /* @__PURE__ */
|
|
49960
|
+
/* @__PURE__ */ jsxs240("div", { className: "flex justify-end gap-3", children: [
|
|
49961
|
+
close && /* @__PURE__ */ jsx271(
|
|
49626
49962
|
Button,
|
|
49627
49963
|
{
|
|
49628
49964
|
type: "button",
|
|
@@ -49632,7 +49968,7 @@ function InvoiceForm2({
|
|
|
49632
49968
|
children: "Cancel"
|
|
49633
49969
|
}
|
|
49634
49970
|
),
|
|
49635
|
-
/* @__PURE__ */
|
|
49971
|
+
/* @__PURE__ */ jsx271(
|
|
49636
49972
|
Button,
|
|
49637
49973
|
{
|
|
49638
49974
|
isLoading,
|
|
@@ -49656,13 +49992,13 @@ function InvoiceForm2({
|
|
|
49656
49992
|
var InvoiceForm_default2 = InvoiceForm2;
|
|
49657
49993
|
|
|
49658
49994
|
// src/components/Transactions/cargoIM/journalForm.tsx
|
|
49659
|
-
import
|
|
49660
|
-
import { useForm as
|
|
49661
|
-
import { zodResolver as
|
|
49662
|
-
import { useParams as
|
|
49663
|
-
import { message as
|
|
49995
|
+
import React47 from "react";
|
|
49996
|
+
import { useForm as useForm62 } from "react-hook-form";
|
|
49997
|
+
import { zodResolver as zodResolver61 } from "@hookform/resolvers/zod";
|
|
49998
|
+
import { useParams as useParams113 } from "react-router-dom";
|
|
49999
|
+
import { message as message89 } from "antd";
|
|
49664
50000
|
import dayjs13 from "dayjs";
|
|
49665
|
-
import { jsx as
|
|
50001
|
+
import { jsx as jsx272, jsxs as jsxs241 } from "react/jsx-runtime";
|
|
49666
50002
|
function JournalForm5({
|
|
49667
50003
|
onReload,
|
|
49668
50004
|
close,
|
|
@@ -49670,16 +50006,16 @@ function JournalForm5({
|
|
|
49670
50006
|
action = "debit",
|
|
49671
50007
|
id
|
|
49672
50008
|
}) {
|
|
49673
|
-
const { branchId } =
|
|
50009
|
+
const { branchId } = useParams113();
|
|
49674
50010
|
const { currencies } = useWarqadConfig();
|
|
49675
50011
|
const { stock: defaultCurrency } = currencies;
|
|
49676
|
-
const [ref2, setRef] =
|
|
50012
|
+
const [ref2, setRef] = React47.useState(void 0);
|
|
49677
50013
|
const { post, isLoading } = useApis_default();
|
|
49678
50014
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49679
50015
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49680
50016
|
const isEdit = !!id;
|
|
49681
|
-
const methods =
|
|
49682
|
-
resolver:
|
|
50017
|
+
const methods = useForm62({
|
|
50018
|
+
resolver: zodResolver61(journalSchema5),
|
|
49683
50019
|
defaultValues: {
|
|
49684
50020
|
date: dayjs13().format("DD/MM/YYYY"),
|
|
49685
50021
|
currency: defaultCurrency,
|
|
@@ -49701,10 +50037,10 @@ function JournalForm5({
|
|
|
49701
50037
|
});
|
|
49702
50038
|
setRef(data?.ref);
|
|
49703
50039
|
} catch (error) {
|
|
49704
|
-
|
|
50040
|
+
message89.error(error?.message || "Something went wrong");
|
|
49705
50041
|
}
|
|
49706
50042
|
};
|
|
49707
|
-
|
|
50043
|
+
React47.useEffect(() => {
|
|
49708
50044
|
if (isEdit) {
|
|
49709
50045
|
fetches();
|
|
49710
50046
|
}
|
|
@@ -49722,13 +50058,13 @@ function JournalForm5({
|
|
|
49722
50058
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49723
50059
|
body: payload
|
|
49724
50060
|
});
|
|
49725
|
-
|
|
50061
|
+
message89.success(
|
|
49726
50062
|
isEdit ? "Journal updated successfully" : "Journal saved successfully"
|
|
49727
50063
|
);
|
|
49728
50064
|
if (onReload) onReload();
|
|
49729
50065
|
if (close) close();
|
|
49730
50066
|
} catch (error) {
|
|
49731
|
-
|
|
50067
|
+
message89.error(error?.message || "Something went wrong");
|
|
49732
50068
|
}
|
|
49733
50069
|
};
|
|
49734
50070
|
const onReverse = async () => {
|
|
@@ -49737,11 +50073,11 @@ function JournalForm5({
|
|
|
49737
50073
|
await put({
|
|
49738
50074
|
url: `/transactions/reverse/${id}`
|
|
49739
50075
|
});
|
|
49740
|
-
|
|
50076
|
+
message89.success("Transaction reversed successfully");
|
|
49741
50077
|
if (onReload) onReload();
|
|
49742
50078
|
if (close) close();
|
|
49743
50079
|
} catch (error) {
|
|
49744
|
-
|
|
50080
|
+
message89.error(error?.message || "Something went wrong");
|
|
49745
50081
|
}
|
|
49746
50082
|
};
|
|
49747
50083
|
const handleKeyDown = (e) => {
|
|
@@ -49753,19 +50089,19 @@ function JournalForm5({
|
|
|
49753
50089
|
e.preventDefault();
|
|
49754
50090
|
}
|
|
49755
50091
|
};
|
|
49756
|
-
return /* @__PURE__ */
|
|
50092
|
+
return /* @__PURE__ */ jsx272(
|
|
49757
50093
|
Card,
|
|
49758
50094
|
{
|
|
49759
50095
|
isLoading: getLoading,
|
|
49760
50096
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49761
|
-
children: /* @__PURE__ */
|
|
50097
|
+
children: /* @__PURE__ */ jsx272(Card.Content, { children: /* @__PURE__ */ jsxs241(
|
|
49762
50098
|
"form",
|
|
49763
50099
|
{
|
|
49764
50100
|
onSubmit: handleSubmit(onSubmit),
|
|
49765
50101
|
onKeyDown: handleKeyDown,
|
|
49766
50102
|
className: "space-y-4",
|
|
49767
50103
|
children: [
|
|
49768
|
-
/* @__PURE__ */
|
|
50104
|
+
/* @__PURE__ */ jsx272(
|
|
49769
50105
|
Fields_default.Input,
|
|
49770
50106
|
{
|
|
49771
50107
|
label: "Description",
|
|
@@ -49776,8 +50112,8 @@ function JournalForm5({
|
|
|
49776
50112
|
placeholder: "Enter description"
|
|
49777
50113
|
}
|
|
49778
50114
|
),
|
|
49779
|
-
/* @__PURE__ */
|
|
49780
|
-
/* @__PURE__ */
|
|
50115
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50116
|
+
/* @__PURE__ */ jsx272(
|
|
49781
50117
|
Fields_default.DateInput,
|
|
49782
50118
|
{
|
|
49783
50119
|
label: "Date",
|
|
@@ -49786,7 +50122,7 @@ function JournalForm5({
|
|
|
49786
50122
|
required: true
|
|
49787
50123
|
}
|
|
49788
50124
|
),
|
|
49789
|
-
/* @__PURE__ */
|
|
50125
|
+
/* @__PURE__ */ jsx272(
|
|
49790
50126
|
Fields_default.Input,
|
|
49791
50127
|
{
|
|
49792
50128
|
label: "Currency",
|
|
@@ -49796,8 +50132,8 @@ function JournalForm5({
|
|
|
49796
50132
|
}
|
|
49797
50133
|
)
|
|
49798
50134
|
] }),
|
|
49799
|
-
/* @__PURE__ */
|
|
49800
|
-
/* @__PURE__ */
|
|
50135
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50136
|
+
/* @__PURE__ */ jsx272(
|
|
49801
50137
|
Fields_default.Input,
|
|
49802
50138
|
{
|
|
49803
50139
|
label: "Amount",
|
|
@@ -49808,7 +50144,7 @@ function JournalForm5({
|
|
|
49808
50144
|
placeholder: "0.00"
|
|
49809
50145
|
}
|
|
49810
50146
|
),
|
|
49811
|
-
/* @__PURE__ */
|
|
50147
|
+
/* @__PURE__ */ jsx272(
|
|
49812
50148
|
Fields_default.Select,
|
|
49813
50149
|
{
|
|
49814
50150
|
label: "Action",
|
|
@@ -49822,7 +50158,7 @@ function JournalForm5({
|
|
|
49822
50158
|
}
|
|
49823
50159
|
)
|
|
49824
50160
|
] }),
|
|
49825
|
-
/* @__PURE__ */
|
|
50161
|
+
/* @__PURE__ */ jsx272(
|
|
49826
50162
|
Fields_default.Textarea,
|
|
49827
50163
|
{
|
|
49828
50164
|
label: "Note",
|
|
@@ -49832,18 +50168,18 @@ function JournalForm5({
|
|
|
49832
50168
|
rows: 3
|
|
49833
50169
|
}
|
|
49834
50170
|
),
|
|
49835
|
-
/* @__PURE__ */
|
|
49836
|
-
/* @__PURE__ */
|
|
50171
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
50172
|
+
/* @__PURE__ */ jsx272("div", { children: isEdit && /* @__PURE__ */ jsx272(
|
|
49837
50173
|
ConfirmModal,
|
|
49838
50174
|
{
|
|
49839
50175
|
title: "Reverse Transaction",
|
|
49840
|
-
description: /* @__PURE__ */
|
|
49841
|
-
/* @__PURE__ */
|
|
49842
|
-
/* @__PURE__ */
|
|
50176
|
+
description: /* @__PURE__ */ jsxs241("div", { className: "space-y-3 text-left", children: [
|
|
50177
|
+
/* @__PURE__ */ jsx272("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50178
|
+
/* @__PURE__ */ jsx272("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
49843
50179
|
] }),
|
|
49844
50180
|
confirmationWord: "delete",
|
|
49845
50181
|
onSubmit: onReverse,
|
|
49846
|
-
children: /* @__PURE__ */
|
|
50182
|
+
children: /* @__PURE__ */ jsx272(
|
|
49847
50183
|
Button,
|
|
49848
50184
|
{
|
|
49849
50185
|
type: "button",
|
|
@@ -49856,8 +50192,8 @@ function JournalForm5({
|
|
|
49856
50192
|
)
|
|
49857
50193
|
}
|
|
49858
50194
|
) }),
|
|
49859
|
-
/* @__PURE__ */
|
|
49860
|
-
close && /* @__PURE__ */
|
|
50195
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-end gap-3", children: [
|
|
50196
|
+
close && /* @__PURE__ */ jsx272(
|
|
49861
50197
|
Button,
|
|
49862
50198
|
{
|
|
49863
50199
|
type: "button",
|
|
@@ -49867,7 +50203,7 @@ function JournalForm5({
|
|
|
49867
50203
|
children: "Cancel"
|
|
49868
50204
|
}
|
|
49869
50205
|
),
|
|
49870
|
-
/* @__PURE__ */
|
|
50206
|
+
/* @__PURE__ */ jsx272(
|
|
49871
50207
|
Button,
|
|
49872
50208
|
{
|
|
49873
50209
|
isLoading,
|
|
@@ -49889,15 +50225,15 @@ function JournalForm5({
|
|
|
49889
50225
|
var journalForm_default2 = JournalForm5;
|
|
49890
50226
|
|
|
49891
50227
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49892
|
-
import { Fragment as
|
|
50228
|
+
import { Fragment as Fragment138, jsx as jsx273, jsxs as jsxs242 } from "react/jsx-runtime";
|
|
49893
50229
|
function CargoIM({ v, url }) {
|
|
49894
|
-
const { branchId } =
|
|
50230
|
+
const { branchId } = useParams114();
|
|
49895
50231
|
const { apiConfig } = useWarqadConfig();
|
|
49896
50232
|
const { width } = useMediaSize();
|
|
49897
50233
|
const isLargeScreen = width > 768;
|
|
49898
|
-
const navigate =
|
|
50234
|
+
const navigate = useNavigate66();
|
|
49899
50235
|
const type = "supplier";
|
|
49900
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50236
|
+
const [deleteAccount, setDeleteAccount] = useState118(null);
|
|
49901
50237
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
49902
50238
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
49903
50239
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -49908,17 +50244,17 @@ function CargoIM({ v, url }) {
|
|
|
49908
50244
|
const items = (data2) => [
|
|
49909
50245
|
{
|
|
49910
50246
|
label: `Edit ${type}`,
|
|
49911
|
-
icon: /* @__PURE__ */
|
|
50247
|
+
icon: /* @__PURE__ */ jsx273(FilePenLine44, { size: 16 }),
|
|
49912
50248
|
onClick: () => openState({
|
|
49913
50249
|
type: "Account",
|
|
49914
|
-
content: /* @__PURE__ */
|
|
50250
|
+
content: /* @__PURE__ */ jsx273(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
49915
50251
|
title: "Account Form",
|
|
49916
50252
|
width: 800
|
|
49917
50253
|
})
|
|
49918
50254
|
},
|
|
49919
50255
|
{
|
|
49920
50256
|
label: `Delete ${type}`,
|
|
49921
|
-
icon: /* @__PURE__ */
|
|
50257
|
+
icon: /* @__PURE__ */ jsx273(Trash255, { className: "text-red-500", size: 16 }),
|
|
49922
50258
|
onClick: () => setDeleteAccount(data2)
|
|
49923
50259
|
}
|
|
49924
50260
|
].filter(Boolean);
|
|
@@ -49929,7 +50265,7 @@ function CargoIM({ v, url }) {
|
|
|
49929
50265
|
className: "w-full",
|
|
49930
50266
|
cell: ({ row }) => {
|
|
49931
50267
|
const account = row.original;
|
|
49932
|
-
return /* @__PURE__ */
|
|
50268
|
+
return /* @__PURE__ */ jsx273(
|
|
49933
50269
|
"span",
|
|
49934
50270
|
{
|
|
49935
50271
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -49958,8 +50294,8 @@ function CargoIM({ v, url }) {
|
|
|
49958
50294
|
className: "w-px whitespace-nowrap",
|
|
49959
50295
|
cell: ({ row }) => {
|
|
49960
50296
|
const data2 = row.original;
|
|
49961
|
-
return /* @__PURE__ */
|
|
49962
|
-
/* @__PURE__ */
|
|
50297
|
+
return /* @__PURE__ */ jsxs242("div", { className: "flex gap-4 items-center", children: [
|
|
50298
|
+
/* @__PURE__ */ jsx273(
|
|
49963
50299
|
"button",
|
|
49964
50300
|
{
|
|
49965
50301
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -49967,7 +50303,7 @@ function CargoIM({ v, url }) {
|
|
|
49967
50303
|
openState({
|
|
49968
50304
|
type: "credit",
|
|
49969
50305
|
closeOnOverlayClick: false,
|
|
49970
|
-
content: /* @__PURE__ */
|
|
50306
|
+
content: /* @__PURE__ */ jsx273(
|
|
49971
50307
|
InvoiceForm_default2,
|
|
49972
50308
|
{
|
|
49973
50309
|
onReload: reload,
|
|
@@ -49982,7 +50318,7 @@ function CargoIM({ v, url }) {
|
|
|
49982
50318
|
children: "Inv"
|
|
49983
50319
|
}
|
|
49984
50320
|
),
|
|
49985
|
-
/* @__PURE__ */
|
|
50321
|
+
/* @__PURE__ */ jsx273(
|
|
49986
50322
|
"button",
|
|
49987
50323
|
{
|
|
49988
50324
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -49990,7 +50326,7 @@ function CargoIM({ v, url }) {
|
|
|
49990
50326
|
openState({
|
|
49991
50327
|
type: "debit",
|
|
49992
50328
|
closeOnOverlayClick: false,
|
|
49993
|
-
content: /* @__PURE__ */
|
|
50329
|
+
content: /* @__PURE__ */ jsx273(
|
|
49994
50330
|
journalForm_default2,
|
|
49995
50331
|
{
|
|
49996
50332
|
onReload: reload,
|
|
@@ -50006,14 +50342,14 @@ function CargoIM({ v, url }) {
|
|
|
50006
50342
|
children: "Pay"
|
|
50007
50343
|
}
|
|
50008
50344
|
),
|
|
50009
|
-
/* @__PURE__ */
|
|
50345
|
+
/* @__PURE__ */ jsx273(
|
|
50010
50346
|
Dropdown,
|
|
50011
50347
|
{
|
|
50012
50348
|
className: "cursor-pointer",
|
|
50013
50349
|
width: "w-[150px]",
|
|
50014
50350
|
items: items(data2),
|
|
50015
50351
|
triggerMode: "hover",
|
|
50016
|
-
children: /* @__PURE__ */
|
|
50352
|
+
children: /* @__PURE__ */ jsx273(EllipsisVertical48, {})
|
|
50017
50353
|
}
|
|
50018
50354
|
)
|
|
50019
50355
|
] });
|
|
@@ -50029,17 +50365,17 @@ function CargoIM({ v, url }) {
|
|
|
50029
50365
|
const onDelete = async (id) => {
|
|
50030
50366
|
try {
|
|
50031
50367
|
await remove({ url: `/accounts/delete/${id}` });
|
|
50032
|
-
|
|
50368
|
+
message90.success("Account deleted successfully");
|
|
50033
50369
|
reload();
|
|
50034
50370
|
setDeleteAccount(null);
|
|
50035
50371
|
} catch (error) {
|
|
50036
|
-
|
|
50372
|
+
message90.error(error.message || "Something went wrong");
|
|
50037
50373
|
return error;
|
|
50038
50374
|
}
|
|
50039
50375
|
};
|
|
50040
|
-
return /* @__PURE__ */
|
|
50041
|
-
/* @__PURE__ */
|
|
50042
|
-
/* @__PURE__ */
|
|
50376
|
+
return /* @__PURE__ */ jsxs242(Fragment138, { children: [
|
|
50377
|
+
/* @__PURE__ */ jsx273(Modal2, {}),
|
|
50378
|
+
/* @__PURE__ */ jsx273(
|
|
50043
50379
|
ConfirmModal,
|
|
50044
50380
|
{
|
|
50045
50381
|
isOpen: !!deleteAccount,
|
|
@@ -50052,7 +50388,7 @@ function CargoIM({ v, url }) {
|
|
|
50052
50388
|
children: null
|
|
50053
50389
|
}
|
|
50054
50390
|
),
|
|
50055
|
-
/* @__PURE__ */
|
|
50391
|
+
/* @__PURE__ */ jsx273("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ jsx273(
|
|
50056
50392
|
TransactionViewComponent,
|
|
50057
50393
|
{
|
|
50058
50394
|
columns,
|
|
@@ -50063,7 +50399,7 @@ function CargoIM({ v, url }) {
|
|
|
50063
50399
|
onCreate: () => {
|
|
50064
50400
|
openState({
|
|
50065
50401
|
type: "account",
|
|
50066
|
-
content: /* @__PURE__ */
|
|
50402
|
+
content: /* @__PURE__ */ jsx273(AccountForm_default3, { onReload: reload, close }),
|
|
50067
50403
|
title: "Account Form",
|
|
50068
50404
|
width: 800
|
|
50069
50405
|
});
|
|
@@ -50076,8 +50412,8 @@ var CargoIM_default = CargoIM;
|
|
|
50076
50412
|
|
|
50077
50413
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
50078
50414
|
import { useSearchParams as useSearchParams20 } from "react-router-dom";
|
|
50079
|
-
import { useMemo as
|
|
50080
|
-
import { Fragment as
|
|
50415
|
+
import { useMemo as useMemo55, useState as useState119, useEffect as useEffect118 } from "react";
|
|
50416
|
+
import { Fragment as Fragment139, jsx as jsx274, jsxs as jsxs243 } from "react/jsx-runtime";
|
|
50081
50417
|
var CargoIMReport = () => {
|
|
50082
50418
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
50083
50419
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -50093,7 +50429,7 @@ var CargoIMReport = () => {
|
|
|
50093
50429
|
const [searchParams, setSearchParams] = useSearchParams20();
|
|
50094
50430
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
50095
50431
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
50096
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
50432
|
+
const [currencyFilter, setCurrencyFilter] = useState119(initialCurrency);
|
|
50097
50433
|
const handleCurrencyChange = (value) => {
|
|
50098
50434
|
setCurrencyFilter(value);
|
|
50099
50435
|
setSearchParams((prev) => {
|
|
@@ -50101,7 +50437,7 @@ var CargoIMReport = () => {
|
|
|
50101
50437
|
return prev;
|
|
50102
50438
|
});
|
|
50103
50439
|
};
|
|
50104
|
-
|
|
50440
|
+
useEffect118(() => {
|
|
50105
50441
|
if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
|
|
50106
50442
|
setCurrencyFilter(urlCurrency);
|
|
50107
50443
|
}
|
|
@@ -50121,9 +50457,9 @@ var CargoIMReport = () => {
|
|
|
50121
50457
|
header: "Date",
|
|
50122
50458
|
key: "date",
|
|
50123
50459
|
className: "text-xs whitespace-nowrap",
|
|
50124
|
-
render: (row) => /* @__PURE__ */
|
|
50125
|
-
/* @__PURE__ */
|
|
50126
|
-
/* @__PURE__ */
|
|
50460
|
+
render: (row) => /* @__PURE__ */ jsxs243("div", { className: "", children: [
|
|
50461
|
+
/* @__PURE__ */ jsx274("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50462
|
+
/* @__PURE__ */ jsx274(
|
|
50127
50463
|
"span",
|
|
50128
50464
|
{
|
|
50129
50465
|
onClick: () => {
|
|
@@ -50142,13 +50478,13 @@ var CargoIMReport = () => {
|
|
|
50142
50478
|
header: "Container No",
|
|
50143
50479
|
key: "description",
|
|
50144
50480
|
className: "text-xs w-full break-words",
|
|
50145
|
-
render: (row) => /* @__PURE__ */
|
|
50481
|
+
render: (row) => /* @__PURE__ */ jsx274("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50146
50482
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50147
50483
|
/[^a-zA-Z0-9]/g,
|
|
50148
50484
|
""
|
|
50149
50485
|
);
|
|
50150
50486
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50151
|
-
return /* @__PURE__ */
|
|
50487
|
+
return /* @__PURE__ */ jsx274(
|
|
50152
50488
|
"div",
|
|
50153
50489
|
{
|
|
50154
50490
|
className: `${lineClass} min-h-[24px] py-1 flex items-center font-bold capitalize text-black dark:text-white print:text-black whitespace-normal break-words`,
|
|
@@ -50162,13 +50498,13 @@ var CargoIMReport = () => {
|
|
|
50162
50498
|
header: "Cbm",
|
|
50163
50499
|
key: "cbm",
|
|
50164
50500
|
className: "text-xs whitespace-nowrap text-right",
|
|
50165
|
-
render: (row) => /* @__PURE__ */
|
|
50501
|
+
render: (row) => /* @__PURE__ */ jsx274("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50166
50502
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50167
50503
|
/[^a-zA-Z0-9]/g,
|
|
50168
50504
|
""
|
|
50169
50505
|
);
|
|
50170
50506
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50171
|
-
return /* @__PURE__ */
|
|
50507
|
+
return /* @__PURE__ */ jsx274(
|
|
50172
50508
|
"div",
|
|
50173
50509
|
{
|
|
50174
50510
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50185,20 +50521,20 @@ var CargoIMReport = () => {
|
|
|
50185
50521
|
),
|
|
50186
50522
|
0
|
|
50187
50523
|
);
|
|
50188
|
-
return totalCbm > 0 ? /* @__PURE__ */
|
|
50524
|
+
return totalCbm > 0 ? /* @__PURE__ */ jsx274("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50189
50525
|
}
|
|
50190
50526
|
},
|
|
50191
50527
|
{
|
|
50192
50528
|
header: "Price",
|
|
50193
50529
|
key: "price",
|
|
50194
50530
|
className: "text-xs whitespace-nowrap text-right",
|
|
50195
|
-
render: (row) => /* @__PURE__ */
|
|
50531
|
+
render: (row) => /* @__PURE__ */ jsx274("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50196
50532
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50197
50533
|
/[^a-zA-Z0-9]/g,
|
|
50198
50534
|
""
|
|
50199
50535
|
);
|
|
50200
50536
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50201
|
-
return /* @__PURE__ */
|
|
50537
|
+
return /* @__PURE__ */ jsx274(
|
|
50202
50538
|
"div",
|
|
50203
50539
|
{
|
|
50204
50540
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50212,13 +50548,13 @@ var CargoIMReport = () => {
|
|
|
50212
50548
|
header: "Credit",
|
|
50213
50549
|
key: "credit",
|
|
50214
50550
|
className: "text-xs whitespace-nowrap text-right",
|
|
50215
|
-
render: (row) => /* @__PURE__ */
|
|
50551
|
+
render: (row) => /* @__PURE__ */ jsx274("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50216
50552
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50217
50553
|
/[^a-zA-Z0-9]/g,
|
|
50218
50554
|
""
|
|
50219
50555
|
);
|
|
50220
50556
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50221
|
-
return /* @__PURE__ */
|
|
50557
|
+
return /* @__PURE__ */ jsx274(
|
|
50222
50558
|
"div",
|
|
50223
50559
|
{
|
|
50224
50560
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-green-500 dark:text-green-500 print:text-green-500 whitespace-nowrap`,
|
|
@@ -50227,7 +50563,7 @@ var CargoIMReport = () => {
|
|
|
50227
50563
|
idx
|
|
50228
50564
|
);
|
|
50229
50565
|
}) }),
|
|
50230
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50566
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx274("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50231
50567
|
data2.reduce(
|
|
50232
50568
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50233
50569
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50241,13 +50577,13 @@ var CargoIMReport = () => {
|
|
|
50241
50577
|
header: "Debit",
|
|
50242
50578
|
key: "debit",
|
|
50243
50579
|
className: "text-xs whitespace-nowrap text-right",
|
|
50244
|
-
render: (row) => /* @__PURE__ */
|
|
50580
|
+
render: (row) => /* @__PURE__ */ jsx274("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50245
50581
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50246
50582
|
/[^a-zA-Z0-9]/g,
|
|
50247
50583
|
""
|
|
50248
50584
|
);
|
|
50249
50585
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50250
|
-
return /* @__PURE__ */
|
|
50586
|
+
return /* @__PURE__ */ jsx274(
|
|
50251
50587
|
"div",
|
|
50252
50588
|
{
|
|
50253
50589
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-red-500 dark:text-red-500 print:text-red-500 whitespace-nowrap`,
|
|
@@ -50256,7 +50592,7 @@ var CargoIMReport = () => {
|
|
|
50256
50592
|
idx
|
|
50257
50593
|
);
|
|
50258
50594
|
}) }),
|
|
50259
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50595
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx274("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50260
50596
|
data2.reduce(
|
|
50261
50597
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50262
50598
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50270,14 +50606,14 @@ var CargoIMReport = () => {
|
|
|
50270
50606
|
header: "Balance",
|
|
50271
50607
|
key: "runningBalance",
|
|
50272
50608
|
className: "text-xs whitespace-nowrap text-right",
|
|
50273
|
-
render: (row) => /* @__PURE__ */
|
|
50274
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50609
|
+
render: (row) => /* @__PURE__ */ jsx274("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50610
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx274("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50275
50611
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50276
50612
|
currency
|
|
50277
50613
|
) })
|
|
50278
50614
|
}
|
|
50279
50615
|
];
|
|
50280
|
-
const datas =
|
|
50616
|
+
const datas = useMemo55(() => {
|
|
50281
50617
|
let runningBalance = 0;
|
|
50282
50618
|
const transactions = data?.data?.transactions;
|
|
50283
50619
|
const res = (transactions || []).map((item) => {
|
|
@@ -50314,10 +50650,10 @@ var CargoIMReport = () => {
|
|
|
50314
50650
|
{ label: "Account Type", value: data?.data?.type },
|
|
50315
50651
|
{ label: "Currency", value: currencyFilter }
|
|
50316
50652
|
];
|
|
50317
|
-
return /* @__PURE__ */
|
|
50318
|
-
/* @__PURE__ */
|
|
50319
|
-
/* @__PURE__ */
|
|
50320
|
-
/* @__PURE__ */
|
|
50653
|
+
return /* @__PURE__ */ jsxs243(Fragment139, { children: [
|
|
50654
|
+
/* @__PURE__ */ jsx274(Modal2, {}),
|
|
50655
|
+
/* @__PURE__ */ jsx274(TransactionView, {}),
|
|
50656
|
+
/* @__PURE__ */ jsx274(
|
|
50321
50657
|
A4DataView,
|
|
50322
50658
|
{
|
|
50323
50659
|
columns,
|
|
@@ -50332,7 +50668,7 @@ var CargoIMReport = () => {
|
|
|
50332
50668
|
openState({
|
|
50333
50669
|
type: "debit",
|
|
50334
50670
|
closeOnOverlayClick: false,
|
|
50335
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */
|
|
50671
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ jsx274(
|
|
50336
50672
|
InvoiceForm_default2,
|
|
50337
50673
|
{
|
|
50338
50674
|
close: closeTransaction,
|
|
@@ -50340,7 +50676,7 @@ var CargoIMReport = () => {
|
|
|
50340
50676
|
onReload: reload,
|
|
50341
50677
|
id: row._id
|
|
50342
50678
|
}
|
|
50343
|
-
) : /* @__PURE__ */
|
|
50679
|
+
) : /* @__PURE__ */ jsx274(
|
|
50344
50680
|
journalForm_default2,
|
|
50345
50681
|
{
|
|
50346
50682
|
close: closeTransaction,
|
|
@@ -50353,7 +50689,7 @@ var CargoIMReport = () => {
|
|
|
50353
50689
|
width: 800
|
|
50354
50690
|
});
|
|
50355
50691
|
},
|
|
50356
|
-
headers: /* @__PURE__ */
|
|
50692
|
+
headers: /* @__PURE__ */ jsx274("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx274(
|
|
50357
50693
|
Fields_default.Select,
|
|
50358
50694
|
{
|
|
50359
50695
|
options: currencies,
|
|
@@ -50369,21 +50705,21 @@ var CargoIMReport = () => {
|
|
|
50369
50705
|
var cargoIMReport_default = CargoIMReport;
|
|
50370
50706
|
|
|
50371
50707
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50372
|
-
import { useNavigate as
|
|
50708
|
+
import { useNavigate as useNavigate67, useParams as useParams115 } from "react-router-dom";
|
|
50373
50709
|
import {
|
|
50374
|
-
EllipsisVertical as
|
|
50710
|
+
EllipsisVertical as EllipsisVertical49,
|
|
50375
50711
|
FileChartLine as FileChartLine2,
|
|
50376
|
-
FilePenLine as
|
|
50377
|
-
Trash2 as
|
|
50712
|
+
FilePenLine as FilePenLine45,
|
|
50713
|
+
Trash2 as Trash256
|
|
50378
50714
|
} from "lucide-react";
|
|
50379
|
-
import { useState as
|
|
50380
|
-
import { message as
|
|
50381
|
-
import { Fragment as
|
|
50715
|
+
import { useState as useState120 } from "react";
|
|
50716
|
+
import { message as message91 } from "antd";
|
|
50717
|
+
import { Fragment as Fragment140, jsx as jsx275, jsxs as jsxs244 } from "react/jsx-runtime";
|
|
50382
50718
|
function Forex2Accounts({ v, url }) {
|
|
50383
|
-
const { branchId } =
|
|
50384
|
-
const navigate =
|
|
50719
|
+
const { branchId } = useParams115();
|
|
50720
|
+
const navigate = useNavigate67();
|
|
50385
50721
|
const type = "account";
|
|
50386
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50722
|
+
const [deleteAccount, setDeleteAccount] = useState120(null);
|
|
50387
50723
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50388
50724
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50389
50725
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50394,22 +50730,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50394
50730
|
const items = (data2) => [
|
|
50395
50731
|
{
|
|
50396
50732
|
label: `Currency Report`,
|
|
50397
|
-
icon: /* @__PURE__ */
|
|
50733
|
+
icon: /* @__PURE__ */ jsx275(FileChartLine2, { size: 16 }),
|
|
50398
50734
|
onClick: () => navigate(data2?._id)
|
|
50399
50735
|
},
|
|
50400
50736
|
{
|
|
50401
50737
|
label: `Edit ${type}`,
|
|
50402
|
-
icon: /* @__PURE__ */
|
|
50738
|
+
icon: /* @__PURE__ */ jsx275(FilePenLine45, { size: 16 }),
|
|
50403
50739
|
onClick: () => openState({
|
|
50404
50740
|
type: "forex account",
|
|
50405
|
-
content: /* @__PURE__ */
|
|
50741
|
+
content: /* @__PURE__ */ jsx275(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50406
50742
|
title: "Forex Account Form",
|
|
50407
50743
|
width: 800
|
|
50408
50744
|
})
|
|
50409
50745
|
},
|
|
50410
50746
|
{
|
|
50411
50747
|
label: `Delete ${type}`,
|
|
50412
|
-
icon: /* @__PURE__ */
|
|
50748
|
+
icon: /* @__PURE__ */ jsx275(Trash256, { className: "text-red-500", size: 16 }),
|
|
50413
50749
|
onClick: () => setDeleteAccount(data2)
|
|
50414
50750
|
}
|
|
50415
50751
|
].filter(Boolean);
|
|
@@ -50419,7 +50755,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50419
50755
|
header: "Name",
|
|
50420
50756
|
cell: ({ row }) => {
|
|
50421
50757
|
const account = row.original;
|
|
50422
|
-
return /* @__PURE__ */
|
|
50758
|
+
return /* @__PURE__ */ jsx275(
|
|
50423
50759
|
"span",
|
|
50424
50760
|
{
|
|
50425
50761
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50434,7 +50770,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50434
50770
|
header: "Phone",
|
|
50435
50771
|
cell: ({ row }) => {
|
|
50436
50772
|
const account = row.original;
|
|
50437
|
-
return /* @__PURE__ */
|
|
50773
|
+
return /* @__PURE__ */ jsx275("span", { children: account?.phoneNumber || "N/A" });
|
|
50438
50774
|
}
|
|
50439
50775
|
},
|
|
50440
50776
|
{
|
|
@@ -50442,14 +50778,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50442
50778
|
header: "Balances",
|
|
50443
50779
|
cell: ({ row }) => {
|
|
50444
50780
|
const account = row.original;
|
|
50445
|
-
return /* @__PURE__ */
|
|
50446
|
-
([currency, data2]) => /* @__PURE__ */
|
|
50781
|
+
return /* @__PURE__ */ jsx275("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50782
|
+
([currency, data2]) => /* @__PURE__ */ jsxs244(
|
|
50447
50783
|
"div",
|
|
50448
50784
|
{
|
|
50449
50785
|
className: "flex items-center gap-1.5 px-2 py-0.5 rounded-lg bg-gray-50 dark:bg-gray-800/50 border border-gray-100 dark:border-gray-700",
|
|
50450
50786
|
children: [
|
|
50451
|
-
/* @__PURE__ */
|
|
50452
|
-
/* @__PURE__ */
|
|
50787
|
+
/* @__PURE__ */ jsx275("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50788
|
+
/* @__PURE__ */ jsx275(
|
|
50453
50789
|
"span",
|
|
50454
50790
|
{
|
|
50455
50791
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50468,8 +50804,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50468
50804
|
header: "Actions",
|
|
50469
50805
|
cell: ({ row }) => {
|
|
50470
50806
|
const data2 = row.original;
|
|
50471
|
-
return /* @__PURE__ */
|
|
50472
|
-
/* @__PURE__ */
|
|
50807
|
+
return /* @__PURE__ */ jsxs244("div", { className: "flex gap-4 items-center", children: [
|
|
50808
|
+
/* @__PURE__ */ jsx275(
|
|
50473
50809
|
"button",
|
|
50474
50810
|
{
|
|
50475
50811
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50477,7 +50813,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50477
50813
|
openState({
|
|
50478
50814
|
type: "credit",
|
|
50479
50815
|
closeOnOverlayClick: false,
|
|
50480
|
-
content: /* @__PURE__ */
|
|
50816
|
+
content: /* @__PURE__ */ jsx275(
|
|
50481
50817
|
Forex2FormTransaction_default,
|
|
50482
50818
|
{
|
|
50483
50819
|
close,
|
|
@@ -50493,7 +50829,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50493
50829
|
children: "Out"
|
|
50494
50830
|
}
|
|
50495
50831
|
),
|
|
50496
|
-
/* @__PURE__ */
|
|
50832
|
+
/* @__PURE__ */ jsx275(
|
|
50497
50833
|
"button",
|
|
50498
50834
|
{
|
|
50499
50835
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50501,7 +50837,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50501
50837
|
openState({
|
|
50502
50838
|
type: "debit",
|
|
50503
50839
|
closeOnOverlayClick: false,
|
|
50504
|
-
content: /* @__PURE__ */
|
|
50840
|
+
content: /* @__PURE__ */ jsx275(
|
|
50505
50841
|
Forex2FormTransaction_default,
|
|
50506
50842
|
{
|
|
50507
50843
|
close,
|
|
@@ -50517,13 +50853,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50517
50853
|
children: "In"
|
|
50518
50854
|
}
|
|
50519
50855
|
),
|
|
50520
|
-
/* @__PURE__ */
|
|
50856
|
+
/* @__PURE__ */ jsx275(
|
|
50521
50857
|
Dropdown,
|
|
50522
50858
|
{
|
|
50523
50859
|
className: "cursor-pointer w-[150px]",
|
|
50524
50860
|
items: items(data2),
|
|
50525
50861
|
triggerMode: "hover",
|
|
50526
|
-
children: /* @__PURE__ */
|
|
50862
|
+
children: /* @__PURE__ */ jsx275(EllipsisVertical49, {})
|
|
50527
50863
|
}
|
|
50528
50864
|
)
|
|
50529
50865
|
] });
|
|
@@ -50534,11 +50870,11 @@ function Forex2Accounts({ v, url }) {
|
|
|
50534
50870
|
const onDelete = async (id) => {
|
|
50535
50871
|
try {
|
|
50536
50872
|
await remove({ url: `/accounts/delete/${id}` });
|
|
50537
|
-
|
|
50873
|
+
message91.success("Account deleted successfully");
|
|
50538
50874
|
reload();
|
|
50539
50875
|
setDeleteAccount(null);
|
|
50540
50876
|
} catch (error) {
|
|
50541
|
-
|
|
50877
|
+
message91.error(error.message || "Something went wrong");
|
|
50542
50878
|
return error;
|
|
50543
50879
|
}
|
|
50544
50880
|
};
|
|
@@ -50562,9 +50898,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50562
50898
|
};
|
|
50563
50899
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50564
50900
|
console.log(currencies);
|
|
50565
|
-
return /* @__PURE__ */
|
|
50566
|
-
/* @__PURE__ */
|
|
50567
|
-
/* @__PURE__ */
|
|
50901
|
+
return /* @__PURE__ */ jsxs244(Fragment140, { children: [
|
|
50902
|
+
/* @__PURE__ */ jsx275(Modal2, {}),
|
|
50903
|
+
/* @__PURE__ */ jsx275(
|
|
50568
50904
|
ConfirmModal,
|
|
50569
50905
|
{
|
|
50570
50906
|
isOpen: !!deleteAccount,
|
|
@@ -50577,9 +50913,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50577
50913
|
children: null
|
|
50578
50914
|
}
|
|
50579
50915
|
),
|
|
50580
|
-
/* @__PURE__ */
|
|
50581
|
-
/* @__PURE__ */
|
|
50582
|
-
/* @__PURE__ */
|
|
50916
|
+
/* @__PURE__ */ jsxs244("div", { children: [
|
|
50917
|
+
/* @__PURE__ */ jsx275(ForexAccountSummary_default, { currencies, isLoading }),
|
|
50918
|
+
/* @__PURE__ */ jsx275(
|
|
50583
50919
|
TransactionViewComponent,
|
|
50584
50920
|
{
|
|
50585
50921
|
columns,
|
|
@@ -50591,7 +50927,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50591
50927
|
onCreate: () => {
|
|
50592
50928
|
openState({
|
|
50593
50929
|
type: "forex account",
|
|
50594
|
-
content: /* @__PURE__ */
|
|
50930
|
+
content: /* @__PURE__ */ jsx275(ForexAccountForm_default, { close, reloads: reload }),
|
|
50595
50931
|
title: "Forex Account Form",
|
|
50596
50932
|
width: 800
|
|
50597
50933
|
});
|
|
@@ -50604,14 +50940,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50604
50940
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50605
50941
|
|
|
50606
50942
|
// src/components/reports/ProductList.tsx
|
|
50607
|
-
import { useParams as
|
|
50608
|
-
import { Fragment as
|
|
50943
|
+
import { useParams as useParams116 } from "react-router-dom";
|
|
50944
|
+
import { Fragment as Fragment141, jsx as jsx276, jsxs as jsxs245 } from "react/jsx-runtime";
|
|
50609
50945
|
var options9 = [
|
|
50610
50946
|
{ label: "Product", value: "product" },
|
|
50611
50947
|
{ label: "Pack", value: "pack" }
|
|
50612
50948
|
];
|
|
50613
50949
|
var ProductList2 = ({ value = false }) => {
|
|
50614
|
-
const { branchId } =
|
|
50950
|
+
const { branchId } = useParams116();
|
|
50615
50951
|
const { branches } = useAuth_default();
|
|
50616
50952
|
const { TransactionView } = useTransactionView_default();
|
|
50617
50953
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50633,7 +50969,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50633
50969
|
key: "name",
|
|
50634
50970
|
className: "text-xs whitespace-nowrap",
|
|
50635
50971
|
render: (row) => {
|
|
50636
|
-
return /* @__PURE__ */
|
|
50972
|
+
return /* @__PURE__ */ jsx276("div", { className: "", children: /* @__PURE__ */ jsx276("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
50637
50973
|
}
|
|
50638
50974
|
},
|
|
50639
50975
|
...value ? [
|
|
@@ -50641,14 +50977,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50641
50977
|
header: "Cost",
|
|
50642
50978
|
key: "cost",
|
|
50643
50979
|
className: "text-xs whitespace-nowrap text-right",
|
|
50644
|
-
render: (row) => /* @__PURE__ */
|
|
50980
|
+
render: (row) => /* @__PURE__ */ jsx276("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50645
50981
|
}
|
|
50646
50982
|
] : []
|
|
50647
50983
|
];
|
|
50648
50984
|
const datas = data?.data || [];
|
|
50649
|
-
return /* @__PURE__ */
|
|
50650
|
-
/* @__PURE__ */
|
|
50651
|
-
/* @__PURE__ */
|
|
50985
|
+
return /* @__PURE__ */ jsxs245(Fragment141, { children: [
|
|
50986
|
+
/* @__PURE__ */ jsx276(TransactionView, {}),
|
|
50987
|
+
/* @__PURE__ */ jsx276(
|
|
50652
50988
|
A4DataView,
|
|
50653
50989
|
{
|
|
50654
50990
|
columns,
|
|
@@ -50659,7 +50995,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50659
50995
|
tableTitle: "Stock List",
|
|
50660
50996
|
fixed: false,
|
|
50661
50997
|
startPage: 1e10,
|
|
50662
|
-
headers: /* @__PURE__ */
|
|
50998
|
+
headers: /* @__PURE__ */ jsx276(
|
|
50663
50999
|
Select,
|
|
50664
51000
|
{
|
|
50665
51001
|
options: options9,
|