warqadui 0.0.279 → 0.0.280
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 +701 -359
- package/dist/index.mjs +699 -357
- 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
|
{
|
|
@@ -48658,7 +48658,7 @@ var Expenses3Reports = () => {
|
|
|
48658
48658
|
const [startDate, setStartDate] = useState113(null);
|
|
48659
48659
|
const [endDate, setEndDate] = useState113(null);
|
|
48660
48660
|
const { A4DataView, data } = useA4DataView_default({
|
|
48661
|
-
url: `/transactions/get?
|
|
48661
|
+
url: `/transactions/get?isExpenses3=true${branchId ? `&branch=${branchId}` : ""}`,
|
|
48662
48662
|
v: 1
|
|
48663
48663
|
// No prefix
|
|
48664
48664
|
});
|
|
@@ -48789,6 +48789,347 @@ var Reports3 = {
|
|
|
48789
48789
|
};
|
|
48790
48790
|
var reports_default = Reports3;
|
|
48791
48791
|
|
|
48792
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48793
|
+
import { useNavigate as useNavigate64, useParams as useParams107 } from "react-router-dom";
|
|
48794
|
+
import { EllipsisVertical as EllipsisVertical47, FilePenLine as FilePenLine43, Trash2 as Trash253 } from "lucide-react";
|
|
48795
|
+
import { Fragment as Fragment134, jsx as jsx266, jsxs as jsxs235 } from "react/jsx-runtime";
|
|
48796
|
+
function ExpensesJournal3({ url }) {
|
|
48797
|
+
const { branchId } = useParams107();
|
|
48798
|
+
const navigate = useNavigate64();
|
|
48799
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48800
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48801
|
+
url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48802
|
+
dateFilter: true
|
|
48803
|
+
});
|
|
48804
|
+
const { Modal: Modal2 } = useModal();
|
|
48805
|
+
const items = (data2) => [
|
|
48806
|
+
{
|
|
48807
|
+
label: `View Expense`,
|
|
48808
|
+
icon: /* @__PURE__ */ jsx266(FilePenLine43, { size: 16 }),
|
|
48809
|
+
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48810
|
+
},
|
|
48811
|
+
{
|
|
48812
|
+
label: `Edit Expense`,
|
|
48813
|
+
icon: /* @__PURE__ */ jsx266(FilePenLine43, { size: 16 }),
|
|
48814
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48815
|
+
},
|
|
48816
|
+
{
|
|
48817
|
+
label: `Delete Expense`,
|
|
48818
|
+
icon: /* @__PURE__ */ jsx266(Trash253, { className: "text-red-500", size: 16 }),
|
|
48819
|
+
onClick: () => {
|
|
48820
|
+
openTransaction({
|
|
48821
|
+
id: data2?._id,
|
|
48822
|
+
type: "expense",
|
|
48823
|
+
reverseable: { reload }
|
|
48824
|
+
});
|
|
48825
|
+
}
|
|
48826
|
+
}
|
|
48827
|
+
].filter(Boolean);
|
|
48828
|
+
const columns = [
|
|
48829
|
+
{
|
|
48830
|
+
accessorKey: "date",
|
|
48831
|
+
header: "Date",
|
|
48832
|
+
cell: ({ row }) => {
|
|
48833
|
+
const expense = row.original;
|
|
48834
|
+
return /* @__PURE__ */ jsxs235("div", { className: "flex flex-col", children: [
|
|
48835
|
+
/* @__PURE__ */ jsx266("span", { children: expense?.date }),
|
|
48836
|
+
/* @__PURE__ */ jsx266(
|
|
48837
|
+
"span",
|
|
48838
|
+
{
|
|
48839
|
+
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
48840
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
48841
|
+
children: expense.ref
|
|
48842
|
+
}
|
|
48843
|
+
)
|
|
48844
|
+
] });
|
|
48845
|
+
}
|
|
48846
|
+
},
|
|
48847
|
+
{
|
|
48848
|
+
accessorKey: "description",
|
|
48849
|
+
header: "Description",
|
|
48850
|
+
cell: ({ row }) => {
|
|
48851
|
+
const expense = row.original;
|
|
48852
|
+
return /* @__PURE__ */ jsxs235("div", { className: "flex flex-col", children: [
|
|
48853
|
+
/* @__PURE__ */ jsx266("span", { className: "capitalize", children: expense?.description }),
|
|
48854
|
+
expense?.note && /* @__PURE__ */ jsx266("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48855
|
+
] });
|
|
48856
|
+
}
|
|
48857
|
+
},
|
|
48858
|
+
{
|
|
48859
|
+
accessorKey: "amount",
|
|
48860
|
+
header: "Amount",
|
|
48861
|
+
cell: ({ row }) => {
|
|
48862
|
+
const expense = row.original;
|
|
48863
|
+
return /* @__PURE__ */ jsxs235("div", { className: "", children: [
|
|
48864
|
+
/* @__PURE__ */ jsx266("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
48865
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ jsxs235("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48866
|
+
"rate ",
|
|
48867
|
+
expense?.exchange?.rate,
|
|
48868
|
+
" ,",
|
|
48869
|
+
" ",
|
|
48870
|
+
Formats_default.Price(
|
|
48871
|
+
expense?.exchange?.amount || 0,
|
|
48872
|
+
expense?.exchange?.currency
|
|
48873
|
+
)
|
|
48874
|
+
] })
|
|
48875
|
+
] });
|
|
48876
|
+
}
|
|
48877
|
+
},
|
|
48878
|
+
{
|
|
48879
|
+
accessorKey: "actions",
|
|
48880
|
+
header: "Actions",
|
|
48881
|
+
cell: ({ row }) => {
|
|
48882
|
+
const data2 = row.original;
|
|
48883
|
+
return /* @__PURE__ */ jsx266(
|
|
48884
|
+
Dropdown,
|
|
48885
|
+
{
|
|
48886
|
+
className: "cursor-pointer w-[150px]",
|
|
48887
|
+
items: items(data2),
|
|
48888
|
+
triggerMode: "hover",
|
|
48889
|
+
children: /* @__PURE__ */ jsx266(EllipsisVertical47, {})
|
|
48890
|
+
}
|
|
48891
|
+
);
|
|
48892
|
+
}
|
|
48893
|
+
}
|
|
48894
|
+
];
|
|
48895
|
+
const expenses = data?.data || [];
|
|
48896
|
+
return /* @__PURE__ */ jsxs235(Fragment134, { children: [
|
|
48897
|
+
/* @__PURE__ */ jsx266(TransactionView, {}),
|
|
48898
|
+
/* @__PURE__ */ jsx266(Modal2, {}),
|
|
48899
|
+
/* @__PURE__ */ jsx266(
|
|
48900
|
+
TransactionViewComponent,
|
|
48901
|
+
{
|
|
48902
|
+
columns,
|
|
48903
|
+
data: expenses,
|
|
48904
|
+
title: "Expenses",
|
|
48905
|
+
description: "Track and manage business expenses",
|
|
48906
|
+
index: true,
|
|
48907
|
+
createTitle: "Add Expense",
|
|
48908
|
+
onCreate: () => {
|
|
48909
|
+
navigate("create");
|
|
48910
|
+
}
|
|
48911
|
+
}
|
|
48912
|
+
)
|
|
48913
|
+
] });
|
|
48914
|
+
}
|
|
48915
|
+
var ExpensesJournal_default = ExpensesJournal3;
|
|
48916
|
+
|
|
48917
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48918
|
+
import { useEffect as useEffect114, useMemo as useMemo53, useState as useState114 } from "react";
|
|
48919
|
+
import { useParams as useParams108 } from "react-router-dom";
|
|
48920
|
+
import { useForm as useForm58 } from "react-hook-form";
|
|
48921
|
+
import { zodResolver as zodResolver57 } from "@hookform/resolvers/zod";
|
|
48922
|
+
import { message as message85 } from "antd";
|
|
48923
|
+
|
|
48924
|
+
// src/components/Transactions/3/expenseJournal/schema.ts
|
|
48925
|
+
import { z as z49 } from "zod";
|
|
48926
|
+
var expenseSchema5 = z49.object({
|
|
48927
|
+
description: z49.string().min(1, "Description is required"),
|
|
48928
|
+
date: zodFields.date,
|
|
48929
|
+
amount: z49.number().gt(0, "Amount must be greater than 0"),
|
|
48930
|
+
branch: z49.string().optional(),
|
|
48931
|
+
note: z49.string().optional(),
|
|
48932
|
+
currency: z49.enum(Enums_default.currencies),
|
|
48933
|
+
rate: z49.number().optional()
|
|
48934
|
+
});
|
|
48935
|
+
|
|
48936
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48937
|
+
import { Fragment as Fragment135, jsx as jsx267, jsxs as jsxs236 } from "react/jsx-runtime";
|
|
48938
|
+
function ExpensesJournal3Form() {
|
|
48939
|
+
const { branchId } = useParams108();
|
|
48940
|
+
const { getQuery, navigate } = useApp_default();
|
|
48941
|
+
const id = getQuery("id");
|
|
48942
|
+
const isEdit = !!id;
|
|
48943
|
+
const [ref2, setRef] = useState114("");
|
|
48944
|
+
const { post, isLoading } = useApis_default();
|
|
48945
|
+
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48946
|
+
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
48947
|
+
const methods = useForm58({
|
|
48948
|
+
resolver: zodResolver57(expenseSchema5),
|
|
48949
|
+
defaultValues: {
|
|
48950
|
+
date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
|
|
48951
|
+
amount: 0,
|
|
48952
|
+
description: "",
|
|
48953
|
+
rate: void 0,
|
|
48954
|
+
branch: branchId || void 0
|
|
48955
|
+
}
|
|
48956
|
+
});
|
|
48957
|
+
const { handleSubmit, reset, watch } = methods;
|
|
48958
|
+
const currency = watch("currency");
|
|
48959
|
+
const isRate = currency && currency !== defaultCurrency;
|
|
48960
|
+
const amount = watch("amount");
|
|
48961
|
+
const rate = watch("rate");
|
|
48962
|
+
const exchangedAmount2 = useMemo53(() => {
|
|
48963
|
+
if (isRate) {
|
|
48964
|
+
const am = forex_default.exchangedAmount({
|
|
48965
|
+
accountCurrency: defaultCurrency,
|
|
48966
|
+
amount,
|
|
48967
|
+
exchangeRate: rate ?? 1,
|
|
48968
|
+
transactionCurrency: currency
|
|
48969
|
+
});
|
|
48970
|
+
return Formats_default.Price(am, defaultCurrency ?? "N/A", false);
|
|
48971
|
+
}
|
|
48972
|
+
}, [amount, currency, rate, isRate]);
|
|
48973
|
+
const onSubmit = async (data) => {
|
|
48974
|
+
try {
|
|
48975
|
+
const payload = {
|
|
48976
|
+
...data,
|
|
48977
|
+
type: "expense-journal-3",
|
|
48978
|
+
defaultCurrency,
|
|
48979
|
+
branch: branchId ?? void 0,
|
|
48980
|
+
rate: data?.rate ?? 1
|
|
48981
|
+
};
|
|
48982
|
+
await post({
|
|
48983
|
+
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
48984
|
+
body: payload
|
|
48985
|
+
});
|
|
48986
|
+
message85.success(`Expense saved successfully`);
|
|
48987
|
+
navigate(-1);
|
|
48988
|
+
} catch (error) {
|
|
48989
|
+
message85.error(error?.message || "Something went wrong");
|
|
48990
|
+
}
|
|
48991
|
+
};
|
|
48992
|
+
const fetches = async () => {
|
|
48993
|
+
try {
|
|
48994
|
+
const res = await get({
|
|
48995
|
+
url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
|
|
48996
|
+
});
|
|
48997
|
+
const data = res.data;
|
|
48998
|
+
reset({
|
|
48999
|
+
...data,
|
|
49000
|
+
rate: data?.exchange?.rate
|
|
49001
|
+
});
|
|
49002
|
+
setRef(data?.ref);
|
|
49003
|
+
} catch (error) {
|
|
49004
|
+
message85.error(error?.message || "Something went wrong");
|
|
49005
|
+
navigate(-1);
|
|
49006
|
+
}
|
|
49007
|
+
};
|
|
49008
|
+
useEffect114(() => {
|
|
49009
|
+
if (isEdit) {
|
|
49010
|
+
fetches();
|
|
49011
|
+
}
|
|
49012
|
+
}, [id]);
|
|
49013
|
+
return /* @__PURE__ */ jsxs236(
|
|
49014
|
+
Card,
|
|
49015
|
+
{
|
|
49016
|
+
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49017
|
+
isLoading: isLoadingGet,
|
|
49018
|
+
loadingText: "Processing...",
|
|
49019
|
+
children: [
|
|
49020
|
+
/* @__PURE__ */ jsxs236(Card.Header, { children: [
|
|
49021
|
+
/* @__PURE__ */ jsx267(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
49022
|
+
/* @__PURE__ */ jsx267(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
49023
|
+
] }),
|
|
49024
|
+
/* @__PURE__ */ jsx267(Card.Content, { children: /* @__PURE__ */ jsxs236(
|
|
49025
|
+
"form",
|
|
49026
|
+
{
|
|
49027
|
+
className: "space-y-4",
|
|
49028
|
+
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49029
|
+
children: [
|
|
49030
|
+
/* @__PURE__ */ jsxs236("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49031
|
+
/* @__PURE__ */ jsx267(
|
|
49032
|
+
Fields_default.Input,
|
|
49033
|
+
{
|
|
49034
|
+
label: "Description",
|
|
49035
|
+
form: methods,
|
|
49036
|
+
name: "description",
|
|
49037
|
+
placeholder: "What was this expense for?",
|
|
49038
|
+
required: true
|
|
49039
|
+
}
|
|
49040
|
+
),
|
|
49041
|
+
/* @__PURE__ */ jsx267(
|
|
49042
|
+
Fields_default.Select,
|
|
49043
|
+
{
|
|
49044
|
+
label: "Currency",
|
|
49045
|
+
form: methods,
|
|
49046
|
+
enumName: "currencies",
|
|
49047
|
+
name: "currency",
|
|
49048
|
+
required: true
|
|
49049
|
+
}
|
|
49050
|
+
)
|
|
49051
|
+
] }),
|
|
49052
|
+
/* @__PURE__ */ jsxs236("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49053
|
+
/* @__PURE__ */ jsx267(
|
|
49054
|
+
Fields_default.DateInput,
|
|
49055
|
+
{
|
|
49056
|
+
label: "Date",
|
|
49057
|
+
form: methods,
|
|
49058
|
+
name: "date",
|
|
49059
|
+
required: true
|
|
49060
|
+
}
|
|
49061
|
+
),
|
|
49062
|
+
/* @__PURE__ */ jsx267(
|
|
49063
|
+
Fields_default.Input,
|
|
49064
|
+
{
|
|
49065
|
+
label: "Amount",
|
|
49066
|
+
form: methods,
|
|
49067
|
+
name: "amount",
|
|
49068
|
+
type: "number",
|
|
49069
|
+
placeholder: "0.00",
|
|
49070
|
+
required: true
|
|
49071
|
+
}
|
|
49072
|
+
),
|
|
49073
|
+
isRate && /* @__PURE__ */ jsxs236(Fragment135, { children: [
|
|
49074
|
+
/* @__PURE__ */ jsx267(
|
|
49075
|
+
Fields_default.Input,
|
|
49076
|
+
{
|
|
49077
|
+
label: "Rate",
|
|
49078
|
+
form: methods,
|
|
49079
|
+
name: "rate",
|
|
49080
|
+
type: "number",
|
|
49081
|
+
placeholder: "Rate",
|
|
49082
|
+
required: true
|
|
49083
|
+
}
|
|
49084
|
+
),
|
|
49085
|
+
/* @__PURE__ */ jsx267(
|
|
49086
|
+
Fields_default.Input,
|
|
49087
|
+
{
|
|
49088
|
+
label: "Exchanged Amount",
|
|
49089
|
+
type: "text",
|
|
49090
|
+
readOnly: true,
|
|
49091
|
+
disabled: true,
|
|
49092
|
+
value: exchangedAmount2
|
|
49093
|
+
}
|
|
49094
|
+
)
|
|
49095
|
+
] })
|
|
49096
|
+
] }),
|
|
49097
|
+
/* @__PURE__ */ jsx267(
|
|
49098
|
+
Fields_default.Textarea,
|
|
49099
|
+
{
|
|
49100
|
+
label: "Note",
|
|
49101
|
+
form: methods,
|
|
49102
|
+
name: "note",
|
|
49103
|
+
placeholder: "Add any additional details..."
|
|
49104
|
+
}
|
|
49105
|
+
),
|
|
49106
|
+
/* @__PURE__ */ jsx267("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx267(
|
|
49107
|
+
Button,
|
|
49108
|
+
{
|
|
49109
|
+
isLoading,
|
|
49110
|
+
disabled: isLoading,
|
|
49111
|
+
type: "submit",
|
|
49112
|
+
className: "min-w-[100px]",
|
|
49113
|
+
variant: !isEdit ? "primary" : "warning",
|
|
49114
|
+
children: isEdit ? "Update" : "Add"
|
|
49115
|
+
}
|
|
49116
|
+
) })
|
|
49117
|
+
]
|
|
49118
|
+
}
|
|
49119
|
+
) })
|
|
49120
|
+
]
|
|
49121
|
+
}
|
|
49122
|
+
);
|
|
49123
|
+
}
|
|
49124
|
+
var ExpensesJournal3Form_default = ExpensesJournal3Form;
|
|
49125
|
+
|
|
49126
|
+
// src/components/Transactions/3/expenseJournal/index.tsx
|
|
49127
|
+
var ExpensesJournal32 = {
|
|
49128
|
+
List: ExpensesJournal_default,
|
|
49129
|
+
Form: ExpensesJournal3Form_default
|
|
49130
|
+
};
|
|
49131
|
+
var expenseJournal_default = ExpensesJournal32;
|
|
49132
|
+
|
|
48792
49133
|
// src/components/Transactions/3/index.ts
|
|
48793
49134
|
var Transaction3 = {
|
|
48794
49135
|
Payments: Payments_default3,
|
|
@@ -48801,26 +49142,27 @@ var Transaction3 = {
|
|
|
48801
49142
|
Purchase3Form: purchase3_default.Form,
|
|
48802
49143
|
Expenses: expense_default.List,
|
|
48803
49144
|
ExpenseForm: expense_default.Form,
|
|
48804
|
-
Reports: reports_default
|
|
49145
|
+
Reports: reports_default,
|
|
49146
|
+
ExpensesJournal3: expenseJournal_default
|
|
48805
49147
|
};
|
|
48806
49148
|
var __default = Transaction3;
|
|
48807
49149
|
|
|
48808
49150
|
// 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
|
|
49151
|
+
import { useParams as useParams109 } from "react-router-dom";
|
|
49152
|
+
import { z as z50 } from "zod";
|
|
49153
|
+
import { useForm as useForm59 } from "react-hook-form";
|
|
49154
|
+
import { zodResolver as zodResolver58 } from "@hookform/resolvers/zod";
|
|
49155
|
+
import { useState as useState115 } from "react";
|
|
49156
|
+
import { message as message86 } from "antd";
|
|
49157
|
+
import { Fragment as Fragment136, jsx as jsx268, jsxs as jsxs237 } from "react/jsx-runtime";
|
|
48816
49158
|
var ItemReport = ({
|
|
48817
49159
|
value = false,
|
|
48818
49160
|
type
|
|
48819
49161
|
}) => {
|
|
48820
49162
|
const { apiConfig } = useWarqadConfig();
|
|
48821
|
-
const { branchId } =
|
|
49163
|
+
const { branchId } = useParams109();
|
|
48822
49164
|
const { branches } = useAuth_default();
|
|
48823
|
-
const [params, setParams] =
|
|
49165
|
+
const [params, setParams] = useState115({
|
|
48824
49166
|
id: "",
|
|
48825
49167
|
branch: "all"
|
|
48826
49168
|
});
|
|
@@ -48845,9 +49187,9 @@ var ItemReport = ({
|
|
|
48845
49187
|
header: "Date",
|
|
48846
49188
|
key: "date",
|
|
48847
49189
|
className: "text-xs whitespace-nowrap",
|
|
48848
|
-
render: (row) => /* @__PURE__ */
|
|
48849
|
-
/* @__PURE__ */
|
|
48850
|
-
/* @__PURE__ */
|
|
49190
|
+
render: (row) => /* @__PURE__ */ jsxs237("div", { className: "", children: [
|
|
49191
|
+
/* @__PURE__ */ jsx268("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
49192
|
+
/* @__PURE__ */ jsx268(
|
|
48851
49193
|
"span",
|
|
48852
49194
|
{
|
|
48853
49195
|
onClick: () => {
|
|
@@ -48866,7 +49208,7 @@ var ItemReport = ({
|
|
|
48866
49208
|
header: "Description",
|
|
48867
49209
|
key: "description",
|
|
48868
49210
|
className: "text-xs whitespace-nowrap",
|
|
48869
|
-
render: (row) => /* @__PURE__ */
|
|
49211
|
+
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
49212
|
},
|
|
48871
49213
|
{
|
|
48872
49214
|
header: "Quantity",
|
|
@@ -48874,7 +49216,7 @@ var ItemReport = ({
|
|
|
48874
49216
|
className: "text-xs whitespace-nowrap",
|
|
48875
49217
|
render: (row) => {
|
|
48876
49218
|
const Qty = row.quantity;
|
|
48877
|
-
return /* @__PURE__ */
|
|
49219
|
+
return /* @__PURE__ */ jsxs237(
|
|
48878
49220
|
"div",
|
|
48879
49221
|
{
|
|
48880
49222
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -48891,7 +49233,7 @@ var ItemReport = ({
|
|
|
48891
49233
|
header: "Balance",
|
|
48892
49234
|
key: "runningBalance",
|
|
48893
49235
|
className: "text-xs whitespace-nowrap",
|
|
48894
|
-
render: (row) => /* @__PURE__ */
|
|
49236
|
+
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
49237
|
}
|
|
48896
49238
|
];
|
|
48897
49239
|
let runningBalance = 0;
|
|
@@ -48903,10 +49245,10 @@ var ItemReport = ({
|
|
|
48903
49245
|
};
|
|
48904
49246
|
});
|
|
48905
49247
|
const itemName = datas[0]?.name;
|
|
48906
|
-
return /* @__PURE__ */
|
|
48907
|
-
/* @__PURE__ */
|
|
48908
|
-
/* @__PURE__ */
|
|
48909
|
-
/* @__PURE__ */
|
|
49248
|
+
return /* @__PURE__ */ jsxs237(Fragment136, { children: [
|
|
49249
|
+
/* @__PURE__ */ jsx268(Modal2, {}),
|
|
49250
|
+
/* @__PURE__ */ jsx268(TransactionView, {}),
|
|
49251
|
+
/* @__PURE__ */ jsx268(
|
|
48910
49252
|
A4DataView,
|
|
48911
49253
|
{
|
|
48912
49254
|
columns,
|
|
@@ -48917,14 +49259,14 @@ var ItemReport = ({
|
|
|
48917
49259
|
tableTitle: `${type} Movement Report`,
|
|
48918
49260
|
fixed: false,
|
|
48919
49261
|
error: !id ? "Please select an item" : void 0,
|
|
48920
|
-
headers: /* @__PURE__ */
|
|
49262
|
+
headers: /* @__PURE__ */ jsx268(
|
|
48921
49263
|
Button,
|
|
48922
49264
|
{
|
|
48923
49265
|
type: "button",
|
|
48924
49266
|
size: "sm",
|
|
48925
49267
|
onClick: () => openState({
|
|
48926
49268
|
title: "Item Transactions",
|
|
48927
|
-
content: /* @__PURE__ */
|
|
49269
|
+
content: /* @__PURE__ */ jsx268(
|
|
48928
49270
|
ItemReportHeader2,
|
|
48929
49271
|
{
|
|
48930
49272
|
type,
|
|
@@ -48942,18 +49284,18 @@ var ItemReport = ({
|
|
|
48942
49284
|
)
|
|
48943
49285
|
] });
|
|
48944
49286
|
};
|
|
48945
|
-
var schema3 =
|
|
48946
|
-
pack:
|
|
48947
|
-
product:
|
|
48948
|
-
branch:
|
|
49287
|
+
var schema3 = z50.object({
|
|
49288
|
+
pack: z50.string().optional(),
|
|
49289
|
+
product: z50.string().optional(),
|
|
49290
|
+
branch: z50.string()
|
|
48949
49291
|
});
|
|
48950
49292
|
function ItemReportHeader2({
|
|
48951
49293
|
type,
|
|
48952
49294
|
close,
|
|
48953
49295
|
addToParams
|
|
48954
49296
|
}) {
|
|
48955
|
-
const methods =
|
|
48956
|
-
resolver:
|
|
49297
|
+
const methods = useForm59({
|
|
49298
|
+
resolver: zodResolver58(schema3),
|
|
48957
49299
|
defaultValues: {
|
|
48958
49300
|
pack: "",
|
|
48959
49301
|
product: "",
|
|
@@ -48967,14 +49309,14 @@ function ItemReportHeader2({
|
|
|
48967
49309
|
label: b.name,
|
|
48968
49310
|
value: b._id
|
|
48969
49311
|
}));
|
|
48970
|
-
return /* @__PURE__ */
|
|
49312
|
+
return /* @__PURE__ */ jsxs237(
|
|
48971
49313
|
"form",
|
|
48972
49314
|
{
|
|
48973
49315
|
className: "space-y-3",
|
|
48974
49316
|
onSubmit: handleSubmit((data) => {
|
|
48975
49317
|
const id = type === "pack" ? data.pack : data.product;
|
|
48976
49318
|
if (!id) {
|
|
48977
|
-
|
|
49319
|
+
message86.error("Please select an item");
|
|
48978
49320
|
methods.setFocus(type);
|
|
48979
49321
|
return;
|
|
48980
49322
|
}
|
|
@@ -48985,8 +49327,8 @@ function ItemReportHeader2({
|
|
|
48985
49327
|
close();
|
|
48986
49328
|
}),
|
|
48987
49329
|
children: [
|
|
48988
|
-
/* @__PURE__ */
|
|
48989
|
-
/* @__PURE__ */
|
|
49330
|
+
/* @__PURE__ */ jsxs237("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49331
|
+
/* @__PURE__ */ jsx268(
|
|
48990
49332
|
Select,
|
|
48991
49333
|
{
|
|
48992
49334
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -48994,7 +49336,7 @@ function ItemReportHeader2({
|
|
|
48994
49336
|
name: "branch"
|
|
48995
49337
|
}
|
|
48996
49338
|
),
|
|
48997
|
-
type === "pack" ? /* @__PURE__ */
|
|
49339
|
+
type === "pack" ? /* @__PURE__ */ jsx268(
|
|
48998
49340
|
Pack_default.Pack,
|
|
48999
49341
|
{
|
|
49000
49342
|
api: "/packs/get",
|
|
@@ -49002,7 +49344,7 @@ function ItemReportHeader2({
|
|
|
49002
49344
|
form: methods,
|
|
49003
49345
|
name: "pack"
|
|
49004
49346
|
}
|
|
49005
|
-
) : /* @__PURE__ */
|
|
49347
|
+
) : /* @__PURE__ */ jsx268(
|
|
49006
49348
|
Feilds_default5.Product,
|
|
49007
49349
|
{
|
|
49008
49350
|
label: "",
|
|
@@ -49013,7 +49355,7 @@ function ItemReportHeader2({
|
|
|
49013
49355
|
}
|
|
49014
49356
|
)
|
|
49015
49357
|
] }),
|
|
49016
|
-
/* @__PURE__ */
|
|
49358
|
+
/* @__PURE__ */ jsx268("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ jsx268(Button, { type: "submit", children: "Filter" }) })
|
|
49017
49359
|
]
|
|
49018
49360
|
}
|
|
49019
49361
|
);
|
|
@@ -49021,19 +49363,19 @@ function ItemReportHeader2({
|
|
|
49021
49363
|
var ItemReport_default = ItemReport;
|
|
49022
49364
|
|
|
49023
49365
|
// src/components/accounts/LeaseCollection.tsx
|
|
49024
|
-
import { useNavigate as
|
|
49025
|
-
import { useMemo as
|
|
49026
|
-
import { Fragment as
|
|
49366
|
+
import { useNavigate as useNavigate65, useParams as useParams110, useSearchParams as useSearchParams19 } from "react-router-dom";
|
|
49367
|
+
import { useMemo as useMemo54, useState as useState116, useEffect as useEffect115 } from "react";
|
|
49368
|
+
import { Fragment as Fragment137, jsx as jsx269, jsxs as jsxs238 } from "react/jsx-runtime";
|
|
49027
49369
|
var LeaseCollection = ({
|
|
49028
49370
|
leaseType,
|
|
49029
49371
|
defaultCurrency = "KES"
|
|
49030
49372
|
}) => {
|
|
49031
|
-
const navigate =
|
|
49373
|
+
const navigate = useNavigate65();
|
|
49032
49374
|
const [searchParams] = useSearchParams19();
|
|
49033
49375
|
const { apiConfig } = useWarqadConfig();
|
|
49034
|
-
const { branchId } =
|
|
49376
|
+
const { branchId } = useParams110();
|
|
49035
49377
|
const { branches } = useAuth_default();
|
|
49036
|
-
const currentBranch =
|
|
49378
|
+
const currentBranch = useMemo54(
|
|
49037
49379
|
() => branches?.find((b) => b?._id === branchId),
|
|
49038
49380
|
[branches, branchId]
|
|
49039
49381
|
);
|
|
@@ -49041,16 +49383,16 @@ var LeaseCollection = ({
|
|
|
49041
49383
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
49042
49384
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49043
49385
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
49044
|
-
const [filter, setFilter] =
|
|
49386
|
+
const [filter, setFilter] = useState116(
|
|
49045
49387
|
initialFilter
|
|
49046
49388
|
);
|
|
49047
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
49048
|
-
|
|
49389
|
+
const [currencyFilter, setCurrencyFilter] = useState116(initialCurrency);
|
|
49390
|
+
useEffect115(() => {
|
|
49049
49391
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
49050
49392
|
setFilter(urlFilter);
|
|
49051
49393
|
}
|
|
49052
49394
|
}, [urlFilter]);
|
|
49053
|
-
|
|
49395
|
+
useEffect115(() => {
|
|
49054
49396
|
if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
|
|
49055
49397
|
setCurrencyFilter(urlCurrency);
|
|
49056
49398
|
} else {
|
|
@@ -49069,9 +49411,9 @@ var LeaseCollection = ({
|
|
|
49069
49411
|
key: "name",
|
|
49070
49412
|
className: "text-xs whitespace-nowrap ",
|
|
49071
49413
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
49072
|
-
render: (row) => /* @__PURE__ */
|
|
49073
|
-
/* @__PURE__ */
|
|
49074
|
-
row.unitNames && /* @__PURE__ */
|
|
49414
|
+
render: (row) => /* @__PURE__ */ jsxs238("div", { className: "space-y-1", children: [
|
|
49415
|
+
/* @__PURE__ */ jsx269("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49416
|
+
row.unitNames && /* @__PURE__ */ jsxs238("p", { className: "text-[9px]! capitalize", children: [
|
|
49075
49417
|
"(",
|
|
49076
49418
|
row.unitNames,
|
|
49077
49419
|
")"
|
|
@@ -49083,7 +49425,7 @@ var LeaseCollection = ({
|
|
|
49083
49425
|
key: "phoneNumber",
|
|
49084
49426
|
maxWidth: 70,
|
|
49085
49427
|
render: (row) => {
|
|
49086
|
-
return /* @__PURE__ */
|
|
49428
|
+
return /* @__PURE__ */ jsx269("p", { children: row?.phoneNumber || "N/A" });
|
|
49087
49429
|
}
|
|
49088
49430
|
},
|
|
49089
49431
|
// </span>
|
|
@@ -49093,11 +49435,11 @@ var LeaseCollection = ({
|
|
|
49093
49435
|
className: "text-xs whitespace-nowrap text-right",
|
|
49094
49436
|
render: (row) => {
|
|
49095
49437
|
const Amount = row.totalCollectionString;
|
|
49096
|
-
return /* @__PURE__ */
|
|
49438
|
+
return /* @__PURE__ */ jsx269("div", { className: "", children: /* @__PURE__ */ jsx269("p", { className: "font-bold ", children: Amount }) });
|
|
49097
49439
|
},
|
|
49098
49440
|
renderFooter: (data2) => {
|
|
49099
49441
|
if (currencyFilter === "all") return;
|
|
49100
|
-
return /* @__PURE__ */
|
|
49442
|
+
return /* @__PURE__ */ jsx269("span", { className: " font-bold", children: Formats_default.Price(
|
|
49101
49443
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
49102
49444
|
defaultCurrency,
|
|
49103
49445
|
false
|
|
@@ -49105,7 +49447,7 @@ var LeaseCollection = ({
|
|
|
49105
49447
|
}
|
|
49106
49448
|
}
|
|
49107
49449
|
];
|
|
49108
|
-
const datas =
|
|
49450
|
+
const datas = useMemo54(() => {
|
|
49109
49451
|
let runningBalance = 0;
|
|
49110
49452
|
let filteredData = data?.data || [];
|
|
49111
49453
|
const result = filteredData.map((item) => {
|
|
@@ -49118,9 +49460,9 @@ var LeaseCollection = ({
|
|
|
49118
49460
|
});
|
|
49119
49461
|
return result;
|
|
49120
49462
|
}, [filter, currencyFilter, data]);
|
|
49121
|
-
return /* @__PURE__ */
|
|
49122
|
-
/* @__PURE__ */
|
|
49123
|
-
/* @__PURE__ */
|
|
49463
|
+
return /* @__PURE__ */ jsxs238(Fragment137, { children: [
|
|
49464
|
+
/* @__PURE__ */ jsx269(TransactionView, {}),
|
|
49465
|
+
/* @__PURE__ */ jsx269(
|
|
49124
49466
|
A4DataView,
|
|
49125
49467
|
{
|
|
49126
49468
|
columns,
|
|
@@ -49130,7 +49472,7 @@ var LeaseCollection = ({
|
|
|
49130
49472
|
subtitle: `All Collections`,
|
|
49131
49473
|
fixed: false,
|
|
49132
49474
|
startPage: 1e9,
|
|
49133
|
-
headers: /* @__PURE__ */
|
|
49475
|
+
headers: /* @__PURE__ */ jsx269("div", { className: "flex gap-2" })
|
|
49134
49476
|
}
|
|
49135
49477
|
)
|
|
49136
49478
|
] });
|
|
@@ -49138,61 +49480,61 @@ var LeaseCollection = ({
|
|
|
49138
49480
|
var LeaseCollection_default = LeaseCollection;
|
|
49139
49481
|
|
|
49140
49482
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49141
|
-
import { useNavigate as
|
|
49142
|
-
import { EllipsisVertical as
|
|
49143
|
-
import { useState as
|
|
49144
|
-
import { message as
|
|
49483
|
+
import { useNavigate as useNavigate66, useParams as useParams114 } from "react-router-dom";
|
|
49484
|
+
import { EllipsisVertical as EllipsisVertical48, FilePenLine as FilePenLine44, Trash2 as Trash255 } from "lucide-react";
|
|
49485
|
+
import { useState as useState118 } from "react";
|
|
49486
|
+
import { message as message90 } from "antd";
|
|
49145
49487
|
|
|
49146
49488
|
// src/components/Transactions/cargoIM/schema.ts
|
|
49147
|
-
import { z as
|
|
49148
|
-
var InvoiceSchema2 =
|
|
49149
|
-
name:
|
|
49150
|
-
quantity:
|
|
49151
|
-
amount:
|
|
49489
|
+
import { z as z51 } from "zod";
|
|
49490
|
+
var InvoiceSchema2 = z51.object({
|
|
49491
|
+
name: z51.string().min(1, { message: "Item name is required" }),
|
|
49492
|
+
quantity: z51.number().gt(0, { message: "Quantity must be greater than 0" }),
|
|
49493
|
+
amount: z51.number().gt(0, { message: "Price must be greater than 0" })
|
|
49152
49494
|
});
|
|
49153
|
-
var createInvoiceManagerValidation2 =
|
|
49154
|
-
invoices:
|
|
49155
|
-
date:
|
|
49156
|
-
currency:
|
|
49157
|
-
branch:
|
|
49495
|
+
var createInvoiceManagerValidation2 = z51.object({
|
|
49496
|
+
invoices: z51.array(InvoiceSchema2),
|
|
49497
|
+
date: z51.string(),
|
|
49498
|
+
currency: z51.string(),
|
|
49499
|
+
branch: z51.string().optional()
|
|
49158
49500
|
});
|
|
49159
|
-
var createAccountSchema3 =
|
|
49160
|
-
name:
|
|
49161
|
-
phoneNumber:
|
|
49162
|
-
branch:
|
|
49163
|
-
currency:
|
|
49501
|
+
var createAccountSchema3 = z51.object({
|
|
49502
|
+
name: z51.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
49503
|
+
phoneNumber: z51.string().optional(),
|
|
49504
|
+
branch: z51.string().optional(),
|
|
49505
|
+
currency: z51.string().optional()
|
|
49164
49506
|
});
|
|
49165
|
-
var journalSchema5 =
|
|
49507
|
+
var journalSchema5 = z51.object({
|
|
49166
49508
|
date: zodFields.date,
|
|
49167
|
-
amount:
|
|
49168
|
-
currency:
|
|
49169
|
-
description:
|
|
49170
|
-
branch:
|
|
49171
|
-
action:
|
|
49172
|
-
note:
|
|
49509
|
+
amount: z51.number().gt(0, "Amount must be greater than 0"),
|
|
49510
|
+
currency: z51.string(),
|
|
49511
|
+
description: z51.string(),
|
|
49512
|
+
branch: z51.string().optional(),
|
|
49513
|
+
action: z51.enum(Enums_default.actionTypes).optional(),
|
|
49514
|
+
note: z51.string().optional()
|
|
49173
49515
|
});
|
|
49174
49516
|
|
|
49175
49517
|
// 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
|
|
49518
|
+
import { useForm as useForm60 } from "react-hook-form";
|
|
49519
|
+
import { zodResolver as zodResolver59 } from "@hookform/resolvers/zod";
|
|
49520
|
+
import { message as message87 } from "antd";
|
|
49521
|
+
import { useEffect as useEffect116 } from "react";
|
|
49522
|
+
import { useParams as useParams111 } from "react-router-dom";
|
|
49523
|
+
import { jsx as jsx270, jsxs as jsxs239 } from "react/jsx-runtime";
|
|
49182
49524
|
function AccountForm3({
|
|
49183
49525
|
onReload,
|
|
49184
49526
|
close,
|
|
49185
49527
|
id
|
|
49186
49528
|
}) {
|
|
49187
|
-
const { branchId } =
|
|
49529
|
+
const { branchId } = useParams111();
|
|
49188
49530
|
const { currencies } = useWarqadConfig();
|
|
49189
49531
|
const { stock } = currencies;
|
|
49190
49532
|
const isEdit = !!id;
|
|
49191
49533
|
const type = "supplier";
|
|
49192
49534
|
const { post, put, isLoading } = useApis_default();
|
|
49193
49535
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
49194
|
-
const methods =
|
|
49195
|
-
resolver:
|
|
49536
|
+
const methods = useForm60({
|
|
49537
|
+
resolver: zodResolver59(createAccountSchema3),
|
|
49196
49538
|
defaultValues: {
|
|
49197
49539
|
name: "",
|
|
49198
49540
|
phoneNumber: "",
|
|
@@ -49222,7 +49564,7 @@ function AccountForm3({
|
|
|
49222
49564
|
body: payload
|
|
49223
49565
|
});
|
|
49224
49566
|
}
|
|
49225
|
-
|
|
49567
|
+
message87.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
|
|
49226
49568
|
if (onReload) {
|
|
49227
49569
|
onReload();
|
|
49228
49570
|
}
|
|
@@ -49230,7 +49572,7 @@ function AccountForm3({
|
|
|
49230
49572
|
close();
|
|
49231
49573
|
}
|
|
49232
49574
|
} catch (error) {
|
|
49233
|
-
|
|
49575
|
+
message87.error(error?.message || "Something went wrong");
|
|
49234
49576
|
}
|
|
49235
49577
|
};
|
|
49236
49578
|
const fetches = async () => {
|
|
@@ -49241,33 +49583,33 @@ function AccountForm3({
|
|
|
49241
49583
|
const data = res.data;
|
|
49242
49584
|
methods.reset(data);
|
|
49243
49585
|
} catch (error) {
|
|
49244
|
-
|
|
49586
|
+
message87.error(error?.message || "Something went wrong");
|
|
49245
49587
|
close?.();
|
|
49246
49588
|
}
|
|
49247
49589
|
};
|
|
49248
|
-
|
|
49590
|
+
useEffect116(() => {
|
|
49249
49591
|
if (isEdit) {
|
|
49250
49592
|
fetches();
|
|
49251
49593
|
}
|
|
49252
49594
|
}, [id]);
|
|
49253
|
-
return /* @__PURE__ */
|
|
49595
|
+
return /* @__PURE__ */ jsxs239(
|
|
49254
49596
|
Card,
|
|
49255
49597
|
{
|
|
49256
49598
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49257
49599
|
isLoading: isLoadingGet,
|
|
49258
49600
|
loadingText: "Processing...",
|
|
49259
49601
|
children: [
|
|
49260
|
-
/* @__PURE__ */
|
|
49261
|
-
/* @__PURE__ */
|
|
49262
|
-
/* @__PURE__ */
|
|
49602
|
+
/* @__PURE__ */ jsxs239(Card.Header, { children: [
|
|
49603
|
+
/* @__PURE__ */ jsx270(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49604
|
+
/* @__PURE__ */ jsx270(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49263
49605
|
] }),
|
|
49264
|
-
/* @__PURE__ */
|
|
49606
|
+
/* @__PURE__ */ jsx270(Card.Content, { children: /* @__PURE__ */ jsxs239(
|
|
49265
49607
|
"form",
|
|
49266
49608
|
{
|
|
49267
49609
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49268
49610
|
children: [
|
|
49269
|
-
/* @__PURE__ */
|
|
49270
|
-
/* @__PURE__ */
|
|
49611
|
+
/* @__PURE__ */ jsxs239("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49612
|
+
/* @__PURE__ */ jsx270(
|
|
49271
49613
|
Fields_default.Input,
|
|
49272
49614
|
{
|
|
49273
49615
|
label: "Name",
|
|
@@ -49278,7 +49620,7 @@ function AccountForm3({
|
|
|
49278
49620
|
required: true
|
|
49279
49621
|
}
|
|
49280
49622
|
),
|
|
49281
|
-
/* @__PURE__ */
|
|
49623
|
+
/* @__PURE__ */ jsx270(
|
|
49282
49624
|
Fields_default.PhoneInput,
|
|
49283
49625
|
{
|
|
49284
49626
|
label: "Phone Number",
|
|
@@ -49287,7 +49629,7 @@ function AccountForm3({
|
|
|
49287
49629
|
placeholder: "Enter phone number"
|
|
49288
49630
|
}
|
|
49289
49631
|
),
|
|
49290
|
-
/* @__PURE__ */
|
|
49632
|
+
/* @__PURE__ */ jsx270(
|
|
49291
49633
|
Fields_default.Select,
|
|
49292
49634
|
{
|
|
49293
49635
|
label: "Currency",
|
|
@@ -49298,7 +49640,7 @@ function AccountForm3({
|
|
|
49298
49640
|
}
|
|
49299
49641
|
)
|
|
49300
49642
|
] }),
|
|
49301
|
-
/* @__PURE__ */
|
|
49643
|
+
/* @__PURE__ */ jsx270("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx270(
|
|
49302
49644
|
Button,
|
|
49303
49645
|
{
|
|
49304
49646
|
isLoading,
|
|
@@ -49319,33 +49661,33 @@ function AccountForm3({
|
|
|
49319
49661
|
var AccountForm_default3 = AccountForm3;
|
|
49320
49662
|
|
|
49321
49663
|
// 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
|
|
49664
|
+
import { useEffect as useEffect117, useState as useState117 } from "react";
|
|
49665
|
+
import { useForm as useForm61, useFieldArray as useFieldArray4 } from "react-hook-form";
|
|
49666
|
+
import { zodResolver as zodResolver60 } from "@hookform/resolvers/zod";
|
|
49667
|
+
import { useParams as useParams112 } from "react-router-dom";
|
|
49668
|
+
import { message as message88 } from "antd";
|
|
49669
|
+
import { Trash2 as Trash254, Plus as Plus6 } from "lucide-react";
|
|
49328
49670
|
import dayjs12 from "dayjs";
|
|
49329
|
-
import { jsx as
|
|
49671
|
+
import { jsx as jsx271, jsxs as jsxs240 } from "react/jsx-runtime";
|
|
49330
49672
|
function InvoiceForm2({
|
|
49331
49673
|
onReload,
|
|
49332
49674
|
close,
|
|
49333
49675
|
accountData,
|
|
49334
49676
|
id
|
|
49335
49677
|
}) {
|
|
49336
|
-
const { branchId } =
|
|
49337
|
-
const [ref2, setRef] =
|
|
49678
|
+
const { branchId } = useParams112();
|
|
49679
|
+
const [ref2, setRef] = useState117(void 0);
|
|
49338
49680
|
const { post, isLoading } = useApis_default();
|
|
49339
49681
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49340
49682
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49341
49683
|
const isEdit = !!id;
|
|
49342
49684
|
const { currencies } = useWarqadConfig();
|
|
49343
49685
|
const { stock: defaultCurrency } = currencies;
|
|
49344
|
-
const [itemName, setItemName] =
|
|
49345
|
-
const [itemQuantity, setItemQuantity] =
|
|
49346
|
-
const [itemPrice, setItemPrice] =
|
|
49347
|
-
const methods =
|
|
49348
|
-
resolver:
|
|
49686
|
+
const [itemName, setItemName] = useState117("");
|
|
49687
|
+
const [itemQuantity, setItemQuantity] = useState117("");
|
|
49688
|
+
const [itemPrice, setItemPrice] = useState117("");
|
|
49689
|
+
const methods = useForm61({
|
|
49690
|
+
resolver: zodResolver60(createInvoiceManagerValidation2),
|
|
49349
49691
|
defaultValues: {
|
|
49350
49692
|
invoices: [],
|
|
49351
49693
|
date: dayjs12().format("DD/MM/YYYY"),
|
|
@@ -49369,27 +49711,27 @@ function InvoiceForm2({
|
|
|
49369
49711
|
});
|
|
49370
49712
|
setRef(data?.ref);
|
|
49371
49713
|
} catch (error) {
|
|
49372
|
-
|
|
49714
|
+
message88.error(error?.message || "Something went wrong");
|
|
49373
49715
|
}
|
|
49374
49716
|
};
|
|
49375
|
-
|
|
49717
|
+
useEffect117(() => {
|
|
49376
49718
|
if (isEdit) {
|
|
49377
49719
|
fetches();
|
|
49378
49720
|
}
|
|
49379
49721
|
}, [isEdit]);
|
|
49380
49722
|
const handleAddItem = () => {
|
|
49381
49723
|
if (!itemName.trim()) {
|
|
49382
|
-
|
|
49724
|
+
message88.error("Item name is required");
|
|
49383
49725
|
return;
|
|
49384
49726
|
}
|
|
49385
49727
|
const qty = Number(itemQuantity);
|
|
49386
49728
|
const price = Number(itemPrice);
|
|
49387
49729
|
if (isNaN(qty) || qty <= 0) {
|
|
49388
|
-
|
|
49730
|
+
message88.error("Quantity must be greater than 0");
|
|
49389
49731
|
return;
|
|
49390
49732
|
}
|
|
49391
49733
|
if (isNaN(price) || price <= 0) {
|
|
49392
|
-
|
|
49734
|
+
message88.error("Price must be greater than 0");
|
|
49393
49735
|
return;
|
|
49394
49736
|
}
|
|
49395
49737
|
append({
|
|
@@ -49403,7 +49745,7 @@ function InvoiceForm2({
|
|
|
49403
49745
|
};
|
|
49404
49746
|
const onSubmit = async (data) => {
|
|
49405
49747
|
if (data.invoices.length === 0) {
|
|
49406
|
-
|
|
49748
|
+
message88.error("Please add at least one item to the invoice");
|
|
49407
49749
|
return;
|
|
49408
49750
|
}
|
|
49409
49751
|
try {
|
|
@@ -49416,13 +49758,13 @@ function InvoiceForm2({
|
|
|
49416
49758
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49417
49759
|
body: payload
|
|
49418
49760
|
});
|
|
49419
|
-
|
|
49761
|
+
message88.success(
|
|
49420
49762
|
isEdit ? "Invoice updated successfully" : "Invoice created successfully"
|
|
49421
49763
|
);
|
|
49422
49764
|
if (onReload) onReload();
|
|
49423
49765
|
if (close) close();
|
|
49424
49766
|
} catch (error) {
|
|
49425
|
-
|
|
49767
|
+
message88.error(error?.message || "Something went wrong");
|
|
49426
49768
|
}
|
|
49427
49769
|
};
|
|
49428
49770
|
const onReverse = async () => {
|
|
@@ -49431,11 +49773,11 @@ function InvoiceForm2({
|
|
|
49431
49773
|
await put({
|
|
49432
49774
|
url: `/transactions/reverse/${id}`
|
|
49433
49775
|
});
|
|
49434
|
-
|
|
49776
|
+
message88.success("Transaction reversed successfully");
|
|
49435
49777
|
if (onReload) onReload();
|
|
49436
49778
|
if (close) close();
|
|
49437
49779
|
} catch (error) {
|
|
49438
|
-
|
|
49780
|
+
message88.error(error?.message || "Something went wrong");
|
|
49439
49781
|
}
|
|
49440
49782
|
};
|
|
49441
49783
|
const handleKeyDown = (e) => {
|
|
@@ -49447,25 +49789,25 @@ function InvoiceForm2({
|
|
|
49447
49789
|
e.preventDefault();
|
|
49448
49790
|
}
|
|
49449
49791
|
};
|
|
49450
|
-
return /* @__PURE__ */
|
|
49792
|
+
return /* @__PURE__ */ jsx271(
|
|
49451
49793
|
Card,
|
|
49452
49794
|
{
|
|
49453
49795
|
isLoading: getLoading,
|
|
49454
49796
|
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__ */
|
|
49797
|
+
children: /* @__PURE__ */ jsxs240(Card.Content, { children: [
|
|
49798
|
+
/* @__PURE__ */ jsx271("input", { type: "hidden", ...register("currency") }),
|
|
49799
|
+
/* @__PURE__ */ jsxs240(
|
|
49458
49800
|
"form",
|
|
49459
49801
|
{
|
|
49460
49802
|
onSubmit: handleSubmit(onSubmit),
|
|
49461
49803
|
onKeyDown: handleKeyDown,
|
|
49462
49804
|
className: "space-y-6",
|
|
49463
49805
|
children: [
|
|
49464
|
-
/* @__PURE__ */
|
|
49465
|
-
/* @__PURE__ */
|
|
49466
|
-
/* @__PURE__ */
|
|
49467
|
-
/* @__PURE__ */
|
|
49468
|
-
/* @__PURE__ */
|
|
49806
|
+
/* @__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: [
|
|
49807
|
+
/* @__PURE__ */ jsx271("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49808
|
+
/* @__PURE__ */ jsxs240("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49809
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49810
|
+
/* @__PURE__ */ jsx271(
|
|
49469
49811
|
Fields_default.Input,
|
|
49470
49812
|
{
|
|
49471
49813
|
label: "Container No",
|
|
@@ -49474,7 +49816,7 @@ function InvoiceForm2({
|
|
|
49474
49816
|
onChange: (val) => setItemName(val)
|
|
49475
49817
|
}
|
|
49476
49818
|
),
|
|
49477
|
-
/* @__PURE__ */
|
|
49819
|
+
/* @__PURE__ */ jsx271(
|
|
49478
49820
|
Fields_default.Input,
|
|
49479
49821
|
{
|
|
49480
49822
|
label: "Cbm",
|
|
@@ -49484,7 +49826,7 @@ function InvoiceForm2({
|
|
|
49484
49826
|
onChange: (val) => setItemQuantity(val)
|
|
49485
49827
|
}
|
|
49486
49828
|
),
|
|
49487
|
-
/* @__PURE__ */
|
|
49829
|
+
/* @__PURE__ */ jsx271(
|
|
49488
49830
|
Fields_default.Input,
|
|
49489
49831
|
{
|
|
49490
49832
|
label: "Price (KES)",
|
|
@@ -49495,7 +49837,7 @@ function InvoiceForm2({
|
|
|
49495
49837
|
}
|
|
49496
49838
|
)
|
|
49497
49839
|
] }),
|
|
49498
|
-
/* @__PURE__ */
|
|
49840
|
+
/* @__PURE__ */ jsxs240(
|
|
49499
49841
|
Button,
|
|
49500
49842
|
{
|
|
49501
49843
|
type: "button",
|
|
@@ -49503,23 +49845,23 @@ function InvoiceForm2({
|
|
|
49503
49845
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49504
49846
|
variant: "outline",
|
|
49505
49847
|
children: [
|
|
49506
|
-
/* @__PURE__ */
|
|
49848
|
+
/* @__PURE__ */ jsx271(Plus6, { size: 16 }),
|
|
49507
49849
|
" Add Item"
|
|
49508
49850
|
]
|
|
49509
49851
|
}
|
|
49510
49852
|
)
|
|
49511
49853
|
] })
|
|
49512
49854
|
] }),
|
|
49513
|
-
/* @__PURE__ */
|
|
49514
|
-
/* @__PURE__ */
|
|
49515
|
-
/* @__PURE__ */
|
|
49516
|
-
/* @__PURE__ */
|
|
49517
|
-
/* @__PURE__ */
|
|
49518
|
-
/* @__PURE__ */
|
|
49519
|
-
/* @__PURE__ */
|
|
49520
|
-
/* @__PURE__ */
|
|
49855
|
+
/* @__PURE__ */ jsxs240("div", { children: [
|
|
49856
|
+
/* @__PURE__ */ jsx271("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49857
|
+
/* @__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: [
|
|
49858
|
+
/* @__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: [
|
|
49859
|
+
/* @__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: "#" }),
|
|
49860
|
+
/* @__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" }),
|
|
49861
|
+
/* @__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" }),
|
|
49862
|
+
/* @__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
49863
|
] }) }),
|
|
49522
|
-
/* @__PURE__ */
|
|
49864
|
+
/* @__PURE__ */ jsx271("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ jsx271("tr", { children: /* @__PURE__ */ jsx271(
|
|
49523
49865
|
"td",
|
|
49524
49866
|
{
|
|
49525
49867
|
colSpan: 4,
|
|
@@ -49528,30 +49870,30 @@ function InvoiceForm2({
|
|
|
49528
49870
|
}
|
|
49529
49871
|
) }) : fields.map((item, index) => {
|
|
49530
49872
|
const total = item.quantity * item.amount;
|
|
49531
|
-
return /* @__PURE__ */
|
|
49873
|
+
return /* @__PURE__ */ jsxs240(
|
|
49532
49874
|
"tr",
|
|
49533
49875
|
{
|
|
49534
49876
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49535
49877
|
children: [
|
|
49536
|
-
/* @__PURE__ */
|
|
49537
|
-
/* @__PURE__ */
|
|
49538
|
-
/* @__PURE__ */
|
|
49539
|
-
/* @__PURE__ */
|
|
49878
|
+
/* @__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 }),
|
|
49879
|
+
/* @__PURE__ */ jsxs240("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
49880
|
+
/* @__PURE__ */ jsx271("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
49881
|
+
/* @__PURE__ */ jsxs240("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49540
49882
|
item.quantity,
|
|
49541
49883
|
" Cbm @",
|
|
49542
49884
|
" ",
|
|
49543
49885
|
Formats_default.Price(item.amount, "KES")
|
|
49544
49886
|
] })
|
|
49545
49887
|
] }),
|
|
49546
|
-
/* @__PURE__ */
|
|
49547
|
-
/* @__PURE__ */
|
|
49888
|
+
/* @__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") }),
|
|
49889
|
+
/* @__PURE__ */ jsx271("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ jsx271(
|
|
49548
49890
|
"button",
|
|
49549
49891
|
{
|
|
49550
49892
|
type: "button",
|
|
49551
49893
|
onClick: () => remove(index),
|
|
49552
49894
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49553
|
-
children: /* @__PURE__ */
|
|
49554
|
-
|
|
49895
|
+
children: /* @__PURE__ */ jsx271(
|
|
49896
|
+
Trash254,
|
|
49555
49897
|
{
|
|
49556
49898
|
size: 13,
|
|
49557
49899
|
className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
|
|
@@ -49564,8 +49906,8 @@ function InvoiceForm2({
|
|
|
49564
49906
|
item.id
|
|
49565
49907
|
);
|
|
49566
49908
|
}) }),
|
|
49567
|
-
fields.length > 0 && /* @__PURE__ */
|
|
49568
|
-
/* @__PURE__ */
|
|
49909
|
+
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: [
|
|
49910
|
+
/* @__PURE__ */ jsx271(
|
|
49569
49911
|
"td",
|
|
49570
49912
|
{
|
|
49571
49913
|
colSpan: 2,
|
|
@@ -49573,20 +49915,20 @@ function InvoiceForm2({
|
|
|
49573
49915
|
children: "Total"
|
|
49574
49916
|
}
|
|
49575
49917
|
),
|
|
49576
|
-
/* @__PURE__ */
|
|
49918
|
+
/* @__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
49919
|
fields.reduce(
|
|
49578
49920
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49579
49921
|
0
|
|
49580
49922
|
),
|
|
49581
49923
|
"KES"
|
|
49582
49924
|
) }),
|
|
49583
|
-
/* @__PURE__ */
|
|
49925
|
+
/* @__PURE__ */ jsx271("td", {})
|
|
49584
49926
|
] }) })
|
|
49585
49927
|
] }) }) })
|
|
49586
49928
|
] }),
|
|
49587
|
-
/* @__PURE__ */
|
|
49588
|
-
/* @__PURE__ */
|
|
49589
|
-
/* @__PURE__ */
|
|
49929
|
+
/* @__PURE__ */ jsxs240("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
49930
|
+
/* @__PURE__ */ jsxs240("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49931
|
+
/* @__PURE__ */ jsx271(
|
|
49590
49932
|
Fields_default.DateInput,
|
|
49591
49933
|
{
|
|
49592
49934
|
label: "Date",
|
|
@@ -49595,20 +49937,20 @@ function InvoiceForm2({
|
|
|
49595
49937
|
required: true
|
|
49596
49938
|
}
|
|
49597
49939
|
),
|
|
49598
|
-
/* @__PURE__ */
|
|
49940
|
+
/* @__PURE__ */ jsx271(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49599
49941
|
] }),
|
|
49600
|
-
/* @__PURE__ */
|
|
49601
|
-
/* @__PURE__ */
|
|
49942
|
+
/* @__PURE__ */ jsxs240("div", { className: "flex justify-between items-center mt-6", children: [
|
|
49943
|
+
/* @__PURE__ */ jsx271("div", { children: isEdit && /* @__PURE__ */ jsx271(
|
|
49602
49944
|
ConfirmModal,
|
|
49603
49945
|
{
|
|
49604
49946
|
title: "Reverse Transaction",
|
|
49605
|
-
description: /* @__PURE__ */
|
|
49606
|
-
/* @__PURE__ */
|
|
49607
|
-
/* @__PURE__ */
|
|
49947
|
+
description: /* @__PURE__ */ jsxs240("div", { className: "space-y-3 text-left", children: [
|
|
49948
|
+
/* @__PURE__ */ jsx271("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49949
|
+
/* @__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
49950
|
] }),
|
|
49609
49951
|
confirmationWord: "delete",
|
|
49610
49952
|
onSubmit: onReverse,
|
|
49611
|
-
children: /* @__PURE__ */
|
|
49953
|
+
children: /* @__PURE__ */ jsx271(
|
|
49612
49954
|
Button,
|
|
49613
49955
|
{
|
|
49614
49956
|
type: "button",
|
|
@@ -49621,8 +49963,8 @@ function InvoiceForm2({
|
|
|
49621
49963
|
)
|
|
49622
49964
|
}
|
|
49623
49965
|
) }),
|
|
49624
|
-
/* @__PURE__ */
|
|
49625
|
-
close && /* @__PURE__ */
|
|
49966
|
+
/* @__PURE__ */ jsxs240("div", { className: "flex justify-end gap-3", children: [
|
|
49967
|
+
close && /* @__PURE__ */ jsx271(
|
|
49626
49968
|
Button,
|
|
49627
49969
|
{
|
|
49628
49970
|
type: "button",
|
|
@@ -49632,7 +49974,7 @@ function InvoiceForm2({
|
|
|
49632
49974
|
children: "Cancel"
|
|
49633
49975
|
}
|
|
49634
49976
|
),
|
|
49635
|
-
/* @__PURE__ */
|
|
49977
|
+
/* @__PURE__ */ jsx271(
|
|
49636
49978
|
Button,
|
|
49637
49979
|
{
|
|
49638
49980
|
isLoading,
|
|
@@ -49656,13 +49998,13 @@ function InvoiceForm2({
|
|
|
49656
49998
|
var InvoiceForm_default2 = InvoiceForm2;
|
|
49657
49999
|
|
|
49658
50000
|
// src/components/Transactions/cargoIM/journalForm.tsx
|
|
49659
|
-
import
|
|
49660
|
-
import { useForm as
|
|
49661
|
-
import { zodResolver as
|
|
49662
|
-
import { useParams as
|
|
49663
|
-
import { message as
|
|
50001
|
+
import React47 from "react";
|
|
50002
|
+
import { useForm as useForm62 } from "react-hook-form";
|
|
50003
|
+
import { zodResolver as zodResolver61 } from "@hookform/resolvers/zod";
|
|
50004
|
+
import { useParams as useParams113 } from "react-router-dom";
|
|
50005
|
+
import { message as message89 } from "antd";
|
|
49664
50006
|
import dayjs13 from "dayjs";
|
|
49665
|
-
import { jsx as
|
|
50007
|
+
import { jsx as jsx272, jsxs as jsxs241 } from "react/jsx-runtime";
|
|
49666
50008
|
function JournalForm5({
|
|
49667
50009
|
onReload,
|
|
49668
50010
|
close,
|
|
@@ -49670,16 +50012,16 @@ function JournalForm5({
|
|
|
49670
50012
|
action = "debit",
|
|
49671
50013
|
id
|
|
49672
50014
|
}) {
|
|
49673
|
-
const { branchId } =
|
|
50015
|
+
const { branchId } = useParams113();
|
|
49674
50016
|
const { currencies } = useWarqadConfig();
|
|
49675
50017
|
const { stock: defaultCurrency } = currencies;
|
|
49676
|
-
const [ref2, setRef] =
|
|
50018
|
+
const [ref2, setRef] = React47.useState(void 0);
|
|
49677
50019
|
const { post, isLoading } = useApis_default();
|
|
49678
50020
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49679
50021
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49680
50022
|
const isEdit = !!id;
|
|
49681
|
-
const methods =
|
|
49682
|
-
resolver:
|
|
50023
|
+
const methods = useForm62({
|
|
50024
|
+
resolver: zodResolver61(journalSchema5),
|
|
49683
50025
|
defaultValues: {
|
|
49684
50026
|
date: dayjs13().format("DD/MM/YYYY"),
|
|
49685
50027
|
currency: defaultCurrency,
|
|
@@ -49701,10 +50043,10 @@ function JournalForm5({
|
|
|
49701
50043
|
});
|
|
49702
50044
|
setRef(data?.ref);
|
|
49703
50045
|
} catch (error) {
|
|
49704
|
-
|
|
50046
|
+
message89.error(error?.message || "Something went wrong");
|
|
49705
50047
|
}
|
|
49706
50048
|
};
|
|
49707
|
-
|
|
50049
|
+
React47.useEffect(() => {
|
|
49708
50050
|
if (isEdit) {
|
|
49709
50051
|
fetches();
|
|
49710
50052
|
}
|
|
@@ -49722,13 +50064,13 @@ function JournalForm5({
|
|
|
49722
50064
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49723
50065
|
body: payload
|
|
49724
50066
|
});
|
|
49725
|
-
|
|
50067
|
+
message89.success(
|
|
49726
50068
|
isEdit ? "Journal updated successfully" : "Journal saved successfully"
|
|
49727
50069
|
);
|
|
49728
50070
|
if (onReload) onReload();
|
|
49729
50071
|
if (close) close();
|
|
49730
50072
|
} catch (error) {
|
|
49731
|
-
|
|
50073
|
+
message89.error(error?.message || "Something went wrong");
|
|
49732
50074
|
}
|
|
49733
50075
|
};
|
|
49734
50076
|
const onReverse = async () => {
|
|
@@ -49737,11 +50079,11 @@ function JournalForm5({
|
|
|
49737
50079
|
await put({
|
|
49738
50080
|
url: `/transactions/reverse/${id}`
|
|
49739
50081
|
});
|
|
49740
|
-
|
|
50082
|
+
message89.success("Transaction reversed successfully");
|
|
49741
50083
|
if (onReload) onReload();
|
|
49742
50084
|
if (close) close();
|
|
49743
50085
|
} catch (error) {
|
|
49744
|
-
|
|
50086
|
+
message89.error(error?.message || "Something went wrong");
|
|
49745
50087
|
}
|
|
49746
50088
|
};
|
|
49747
50089
|
const handleKeyDown = (e) => {
|
|
@@ -49753,19 +50095,19 @@ function JournalForm5({
|
|
|
49753
50095
|
e.preventDefault();
|
|
49754
50096
|
}
|
|
49755
50097
|
};
|
|
49756
|
-
return /* @__PURE__ */
|
|
50098
|
+
return /* @__PURE__ */ jsx272(
|
|
49757
50099
|
Card,
|
|
49758
50100
|
{
|
|
49759
50101
|
isLoading: getLoading,
|
|
49760
50102
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49761
|
-
children: /* @__PURE__ */
|
|
50103
|
+
children: /* @__PURE__ */ jsx272(Card.Content, { children: /* @__PURE__ */ jsxs241(
|
|
49762
50104
|
"form",
|
|
49763
50105
|
{
|
|
49764
50106
|
onSubmit: handleSubmit(onSubmit),
|
|
49765
50107
|
onKeyDown: handleKeyDown,
|
|
49766
50108
|
className: "space-y-4",
|
|
49767
50109
|
children: [
|
|
49768
|
-
/* @__PURE__ */
|
|
50110
|
+
/* @__PURE__ */ jsx272(
|
|
49769
50111
|
Fields_default.Input,
|
|
49770
50112
|
{
|
|
49771
50113
|
label: "Description",
|
|
@@ -49776,8 +50118,8 @@ function JournalForm5({
|
|
|
49776
50118
|
placeholder: "Enter description"
|
|
49777
50119
|
}
|
|
49778
50120
|
),
|
|
49779
|
-
/* @__PURE__ */
|
|
49780
|
-
/* @__PURE__ */
|
|
50121
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50122
|
+
/* @__PURE__ */ jsx272(
|
|
49781
50123
|
Fields_default.DateInput,
|
|
49782
50124
|
{
|
|
49783
50125
|
label: "Date",
|
|
@@ -49786,7 +50128,7 @@ function JournalForm5({
|
|
|
49786
50128
|
required: true
|
|
49787
50129
|
}
|
|
49788
50130
|
),
|
|
49789
|
-
/* @__PURE__ */
|
|
50131
|
+
/* @__PURE__ */ jsx272(
|
|
49790
50132
|
Fields_default.Input,
|
|
49791
50133
|
{
|
|
49792
50134
|
label: "Currency",
|
|
@@ -49796,8 +50138,8 @@ function JournalForm5({
|
|
|
49796
50138
|
}
|
|
49797
50139
|
)
|
|
49798
50140
|
] }),
|
|
49799
|
-
/* @__PURE__ */
|
|
49800
|
-
/* @__PURE__ */
|
|
50141
|
+
/* @__PURE__ */ jsxs241("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
50142
|
+
/* @__PURE__ */ jsx272(
|
|
49801
50143
|
Fields_default.Input,
|
|
49802
50144
|
{
|
|
49803
50145
|
label: "Amount",
|
|
@@ -49808,7 +50150,7 @@ function JournalForm5({
|
|
|
49808
50150
|
placeholder: "0.00"
|
|
49809
50151
|
}
|
|
49810
50152
|
),
|
|
49811
|
-
/* @__PURE__ */
|
|
50153
|
+
/* @__PURE__ */ jsx272(
|
|
49812
50154
|
Fields_default.Select,
|
|
49813
50155
|
{
|
|
49814
50156
|
label: "Action",
|
|
@@ -49822,7 +50164,7 @@ function JournalForm5({
|
|
|
49822
50164
|
}
|
|
49823
50165
|
)
|
|
49824
50166
|
] }),
|
|
49825
|
-
/* @__PURE__ */
|
|
50167
|
+
/* @__PURE__ */ jsx272(
|
|
49826
50168
|
Fields_default.Textarea,
|
|
49827
50169
|
{
|
|
49828
50170
|
label: "Note",
|
|
@@ -49832,18 +50174,18 @@ function JournalForm5({
|
|
|
49832
50174
|
rows: 3
|
|
49833
50175
|
}
|
|
49834
50176
|
),
|
|
49835
|
-
/* @__PURE__ */
|
|
49836
|
-
/* @__PURE__ */
|
|
50177
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
50178
|
+
/* @__PURE__ */ jsx272("div", { children: isEdit && /* @__PURE__ */ jsx272(
|
|
49837
50179
|
ConfirmModal,
|
|
49838
50180
|
{
|
|
49839
50181
|
title: "Reverse Transaction",
|
|
49840
|
-
description: /* @__PURE__ */
|
|
49841
|
-
/* @__PURE__ */
|
|
49842
|
-
/* @__PURE__ */
|
|
50182
|
+
description: /* @__PURE__ */ jsxs241("div", { className: "space-y-3 text-left", children: [
|
|
50183
|
+
/* @__PURE__ */ jsx272("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
50184
|
+
/* @__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
50185
|
] }),
|
|
49844
50186
|
confirmationWord: "delete",
|
|
49845
50187
|
onSubmit: onReverse,
|
|
49846
|
-
children: /* @__PURE__ */
|
|
50188
|
+
children: /* @__PURE__ */ jsx272(
|
|
49847
50189
|
Button,
|
|
49848
50190
|
{
|
|
49849
50191
|
type: "button",
|
|
@@ -49856,8 +50198,8 @@ function JournalForm5({
|
|
|
49856
50198
|
)
|
|
49857
50199
|
}
|
|
49858
50200
|
) }),
|
|
49859
|
-
/* @__PURE__ */
|
|
49860
|
-
close && /* @__PURE__ */
|
|
50201
|
+
/* @__PURE__ */ jsxs241("div", { className: "flex justify-end gap-3", children: [
|
|
50202
|
+
close && /* @__PURE__ */ jsx272(
|
|
49861
50203
|
Button,
|
|
49862
50204
|
{
|
|
49863
50205
|
type: "button",
|
|
@@ -49867,7 +50209,7 @@ function JournalForm5({
|
|
|
49867
50209
|
children: "Cancel"
|
|
49868
50210
|
}
|
|
49869
50211
|
),
|
|
49870
|
-
/* @__PURE__ */
|
|
50212
|
+
/* @__PURE__ */ jsx272(
|
|
49871
50213
|
Button,
|
|
49872
50214
|
{
|
|
49873
50215
|
isLoading,
|
|
@@ -49889,15 +50231,15 @@ function JournalForm5({
|
|
|
49889
50231
|
var journalForm_default2 = JournalForm5;
|
|
49890
50232
|
|
|
49891
50233
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49892
|
-
import { Fragment as
|
|
50234
|
+
import { Fragment as Fragment138, jsx as jsx273, jsxs as jsxs242 } from "react/jsx-runtime";
|
|
49893
50235
|
function CargoIM({ v, url }) {
|
|
49894
|
-
const { branchId } =
|
|
50236
|
+
const { branchId } = useParams114();
|
|
49895
50237
|
const { apiConfig } = useWarqadConfig();
|
|
49896
50238
|
const { width } = useMediaSize();
|
|
49897
50239
|
const isLargeScreen = width > 768;
|
|
49898
|
-
const navigate =
|
|
50240
|
+
const navigate = useNavigate66();
|
|
49899
50241
|
const type = "supplier";
|
|
49900
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50242
|
+
const [deleteAccount, setDeleteAccount] = useState118(null);
|
|
49901
50243
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
49902
50244
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
49903
50245
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -49908,17 +50250,17 @@ function CargoIM({ v, url }) {
|
|
|
49908
50250
|
const items = (data2) => [
|
|
49909
50251
|
{
|
|
49910
50252
|
label: `Edit ${type}`,
|
|
49911
|
-
icon: /* @__PURE__ */
|
|
50253
|
+
icon: /* @__PURE__ */ jsx273(FilePenLine44, { size: 16 }),
|
|
49912
50254
|
onClick: () => openState({
|
|
49913
50255
|
type: "Account",
|
|
49914
|
-
content: /* @__PURE__ */
|
|
50256
|
+
content: /* @__PURE__ */ jsx273(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
49915
50257
|
title: "Account Form",
|
|
49916
50258
|
width: 800
|
|
49917
50259
|
})
|
|
49918
50260
|
},
|
|
49919
50261
|
{
|
|
49920
50262
|
label: `Delete ${type}`,
|
|
49921
|
-
icon: /* @__PURE__ */
|
|
50263
|
+
icon: /* @__PURE__ */ jsx273(Trash255, { className: "text-red-500", size: 16 }),
|
|
49922
50264
|
onClick: () => setDeleteAccount(data2)
|
|
49923
50265
|
}
|
|
49924
50266
|
].filter(Boolean);
|
|
@@ -49929,7 +50271,7 @@ function CargoIM({ v, url }) {
|
|
|
49929
50271
|
className: "w-full",
|
|
49930
50272
|
cell: ({ row }) => {
|
|
49931
50273
|
const account = row.original;
|
|
49932
|
-
return /* @__PURE__ */
|
|
50274
|
+
return /* @__PURE__ */ jsx273(
|
|
49933
50275
|
"span",
|
|
49934
50276
|
{
|
|
49935
50277
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -49958,8 +50300,8 @@ function CargoIM({ v, url }) {
|
|
|
49958
50300
|
className: "w-px whitespace-nowrap",
|
|
49959
50301
|
cell: ({ row }) => {
|
|
49960
50302
|
const data2 = row.original;
|
|
49961
|
-
return /* @__PURE__ */
|
|
49962
|
-
/* @__PURE__ */
|
|
50303
|
+
return /* @__PURE__ */ jsxs242("div", { className: "flex gap-4 items-center", children: [
|
|
50304
|
+
/* @__PURE__ */ jsx273(
|
|
49963
50305
|
"button",
|
|
49964
50306
|
{
|
|
49965
50307
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -49967,7 +50309,7 @@ function CargoIM({ v, url }) {
|
|
|
49967
50309
|
openState({
|
|
49968
50310
|
type: "credit",
|
|
49969
50311
|
closeOnOverlayClick: false,
|
|
49970
|
-
content: /* @__PURE__ */
|
|
50312
|
+
content: /* @__PURE__ */ jsx273(
|
|
49971
50313
|
InvoiceForm_default2,
|
|
49972
50314
|
{
|
|
49973
50315
|
onReload: reload,
|
|
@@ -49982,7 +50324,7 @@ function CargoIM({ v, url }) {
|
|
|
49982
50324
|
children: "Inv"
|
|
49983
50325
|
}
|
|
49984
50326
|
),
|
|
49985
|
-
/* @__PURE__ */
|
|
50327
|
+
/* @__PURE__ */ jsx273(
|
|
49986
50328
|
"button",
|
|
49987
50329
|
{
|
|
49988
50330
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -49990,7 +50332,7 @@ function CargoIM({ v, url }) {
|
|
|
49990
50332
|
openState({
|
|
49991
50333
|
type: "debit",
|
|
49992
50334
|
closeOnOverlayClick: false,
|
|
49993
|
-
content: /* @__PURE__ */
|
|
50335
|
+
content: /* @__PURE__ */ jsx273(
|
|
49994
50336
|
journalForm_default2,
|
|
49995
50337
|
{
|
|
49996
50338
|
onReload: reload,
|
|
@@ -50006,14 +50348,14 @@ function CargoIM({ v, url }) {
|
|
|
50006
50348
|
children: "Pay"
|
|
50007
50349
|
}
|
|
50008
50350
|
),
|
|
50009
|
-
/* @__PURE__ */
|
|
50351
|
+
/* @__PURE__ */ jsx273(
|
|
50010
50352
|
Dropdown,
|
|
50011
50353
|
{
|
|
50012
50354
|
className: "cursor-pointer",
|
|
50013
50355
|
width: "w-[150px]",
|
|
50014
50356
|
items: items(data2),
|
|
50015
50357
|
triggerMode: "hover",
|
|
50016
|
-
children: /* @__PURE__ */
|
|
50358
|
+
children: /* @__PURE__ */ jsx273(EllipsisVertical48, {})
|
|
50017
50359
|
}
|
|
50018
50360
|
)
|
|
50019
50361
|
] });
|
|
@@ -50029,17 +50371,17 @@ function CargoIM({ v, url }) {
|
|
|
50029
50371
|
const onDelete = async (id) => {
|
|
50030
50372
|
try {
|
|
50031
50373
|
await remove({ url: `/accounts/delete/${id}` });
|
|
50032
|
-
|
|
50374
|
+
message90.success("Account deleted successfully");
|
|
50033
50375
|
reload();
|
|
50034
50376
|
setDeleteAccount(null);
|
|
50035
50377
|
} catch (error) {
|
|
50036
|
-
|
|
50378
|
+
message90.error(error.message || "Something went wrong");
|
|
50037
50379
|
return error;
|
|
50038
50380
|
}
|
|
50039
50381
|
};
|
|
50040
|
-
return /* @__PURE__ */
|
|
50041
|
-
/* @__PURE__ */
|
|
50042
|
-
/* @__PURE__ */
|
|
50382
|
+
return /* @__PURE__ */ jsxs242(Fragment138, { children: [
|
|
50383
|
+
/* @__PURE__ */ jsx273(Modal2, {}),
|
|
50384
|
+
/* @__PURE__ */ jsx273(
|
|
50043
50385
|
ConfirmModal,
|
|
50044
50386
|
{
|
|
50045
50387
|
isOpen: !!deleteAccount,
|
|
@@ -50052,7 +50394,7 @@ function CargoIM({ v, url }) {
|
|
|
50052
50394
|
children: null
|
|
50053
50395
|
}
|
|
50054
50396
|
),
|
|
50055
|
-
/* @__PURE__ */
|
|
50397
|
+
/* @__PURE__ */ jsx273("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ jsx273(
|
|
50056
50398
|
TransactionViewComponent,
|
|
50057
50399
|
{
|
|
50058
50400
|
columns,
|
|
@@ -50063,7 +50405,7 @@ function CargoIM({ v, url }) {
|
|
|
50063
50405
|
onCreate: () => {
|
|
50064
50406
|
openState({
|
|
50065
50407
|
type: "account",
|
|
50066
|
-
content: /* @__PURE__ */
|
|
50408
|
+
content: /* @__PURE__ */ jsx273(AccountForm_default3, { onReload: reload, close }),
|
|
50067
50409
|
title: "Account Form",
|
|
50068
50410
|
width: 800
|
|
50069
50411
|
});
|
|
@@ -50076,8 +50418,8 @@ var CargoIM_default = CargoIM;
|
|
|
50076
50418
|
|
|
50077
50419
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
50078
50420
|
import { useSearchParams as useSearchParams20 } from "react-router-dom";
|
|
50079
|
-
import { useMemo as
|
|
50080
|
-
import { Fragment as
|
|
50421
|
+
import { useMemo as useMemo55, useState as useState119, useEffect as useEffect118 } from "react";
|
|
50422
|
+
import { Fragment as Fragment139, jsx as jsx274, jsxs as jsxs243 } from "react/jsx-runtime";
|
|
50081
50423
|
var CargoIMReport = () => {
|
|
50082
50424
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
50083
50425
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -50093,7 +50435,7 @@ var CargoIMReport = () => {
|
|
|
50093
50435
|
const [searchParams, setSearchParams] = useSearchParams20();
|
|
50094
50436
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
50095
50437
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
50096
|
-
const [currencyFilter, setCurrencyFilter] =
|
|
50438
|
+
const [currencyFilter, setCurrencyFilter] = useState119(initialCurrency);
|
|
50097
50439
|
const handleCurrencyChange = (value) => {
|
|
50098
50440
|
setCurrencyFilter(value);
|
|
50099
50441
|
setSearchParams((prev) => {
|
|
@@ -50101,7 +50443,7 @@ var CargoIMReport = () => {
|
|
|
50101
50443
|
return prev;
|
|
50102
50444
|
});
|
|
50103
50445
|
};
|
|
50104
|
-
|
|
50446
|
+
useEffect118(() => {
|
|
50105
50447
|
if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
|
|
50106
50448
|
setCurrencyFilter(urlCurrency);
|
|
50107
50449
|
}
|
|
@@ -50121,9 +50463,9 @@ var CargoIMReport = () => {
|
|
|
50121
50463
|
header: "Date",
|
|
50122
50464
|
key: "date",
|
|
50123
50465
|
className: "text-xs whitespace-nowrap",
|
|
50124
|
-
render: (row) => /* @__PURE__ */
|
|
50125
|
-
/* @__PURE__ */
|
|
50126
|
-
/* @__PURE__ */
|
|
50466
|
+
render: (row) => /* @__PURE__ */ jsxs243("div", { className: "", children: [
|
|
50467
|
+
/* @__PURE__ */ jsx274("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50468
|
+
/* @__PURE__ */ jsx274(
|
|
50127
50469
|
"span",
|
|
50128
50470
|
{
|
|
50129
50471
|
onClick: () => {
|
|
@@ -50142,13 +50484,13 @@ var CargoIMReport = () => {
|
|
|
50142
50484
|
header: "Container No",
|
|
50143
50485
|
key: "description",
|
|
50144
50486
|
className: "text-xs w-full break-words",
|
|
50145
|
-
render: (row) => /* @__PURE__ */
|
|
50487
|
+
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
50488
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50147
50489
|
/[^a-zA-Z0-9]/g,
|
|
50148
50490
|
""
|
|
50149
50491
|
);
|
|
50150
50492
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50151
|
-
return /* @__PURE__ */
|
|
50493
|
+
return /* @__PURE__ */ jsx274(
|
|
50152
50494
|
"div",
|
|
50153
50495
|
{
|
|
50154
50496
|
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 +50504,13 @@ var CargoIMReport = () => {
|
|
|
50162
50504
|
header: "Cbm",
|
|
50163
50505
|
key: "cbm",
|
|
50164
50506
|
className: "text-xs whitespace-nowrap text-right",
|
|
50165
|
-
render: (row) => /* @__PURE__ */
|
|
50507
|
+
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
50508
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50167
50509
|
/[^a-zA-Z0-9]/g,
|
|
50168
50510
|
""
|
|
50169
50511
|
);
|
|
50170
50512
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50171
|
-
return /* @__PURE__ */
|
|
50513
|
+
return /* @__PURE__ */ jsx274(
|
|
50172
50514
|
"div",
|
|
50173
50515
|
{
|
|
50174
50516
|
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 +50527,20 @@ var CargoIMReport = () => {
|
|
|
50185
50527
|
),
|
|
50186
50528
|
0
|
|
50187
50529
|
);
|
|
50188
|
-
return totalCbm > 0 ? /* @__PURE__ */
|
|
50530
|
+
return totalCbm > 0 ? /* @__PURE__ */ jsx274("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
50189
50531
|
}
|
|
50190
50532
|
},
|
|
50191
50533
|
{
|
|
50192
50534
|
header: "Price",
|
|
50193
50535
|
key: "price",
|
|
50194
50536
|
className: "text-xs whitespace-nowrap text-right",
|
|
50195
|
-
render: (row) => /* @__PURE__ */
|
|
50537
|
+
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
50538
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50197
50539
|
/[^a-zA-Z0-9]/g,
|
|
50198
50540
|
""
|
|
50199
50541
|
);
|
|
50200
50542
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50201
|
-
return /* @__PURE__ */
|
|
50543
|
+
return /* @__PURE__ */ jsx274(
|
|
50202
50544
|
"div",
|
|
50203
50545
|
{
|
|
50204
50546
|
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 +50554,13 @@ var CargoIMReport = () => {
|
|
|
50212
50554
|
header: "Credit",
|
|
50213
50555
|
key: "credit",
|
|
50214
50556
|
className: "text-xs whitespace-nowrap text-right",
|
|
50215
|
-
render: (row) => /* @__PURE__ */
|
|
50557
|
+
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
50558
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50217
50559
|
/[^a-zA-Z0-9]/g,
|
|
50218
50560
|
""
|
|
50219
50561
|
);
|
|
50220
50562
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50221
|
-
return /* @__PURE__ */
|
|
50563
|
+
return /* @__PURE__ */ jsx274(
|
|
50222
50564
|
"div",
|
|
50223
50565
|
{
|
|
50224
50566
|
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 +50569,7 @@ var CargoIMReport = () => {
|
|
|
50227
50569
|
idx
|
|
50228
50570
|
);
|
|
50229
50571
|
}) }),
|
|
50230
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50572
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx274("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50231
50573
|
data2.reduce(
|
|
50232
50574
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50233
50575
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50241,13 +50583,13 @@ var CargoIMReport = () => {
|
|
|
50241
50583
|
header: "Debit",
|
|
50242
50584
|
key: "debit",
|
|
50243
50585
|
className: "text-xs whitespace-nowrap text-right",
|
|
50244
|
-
render: (row) => /* @__PURE__ */
|
|
50586
|
+
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
50587
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50246
50588
|
/[^a-zA-Z0-9]/g,
|
|
50247
50589
|
""
|
|
50248
50590
|
);
|
|
50249
50591
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50250
|
-
return /* @__PURE__ */
|
|
50592
|
+
return /* @__PURE__ */ jsx274(
|
|
50251
50593
|
"div",
|
|
50252
50594
|
{
|
|
50253
50595
|
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 +50598,7 @@ var CargoIMReport = () => {
|
|
|
50256
50598
|
idx
|
|
50257
50599
|
);
|
|
50258
50600
|
}) }),
|
|
50259
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50601
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx274("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50260
50602
|
data2.reduce(
|
|
50261
50603
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50262
50604
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50270,14 +50612,14 @@ var CargoIMReport = () => {
|
|
|
50270
50612
|
header: "Balance",
|
|
50271
50613
|
key: "runningBalance",
|
|
50272
50614
|
className: "text-xs whitespace-nowrap text-right",
|
|
50273
|
-
render: (row) => /* @__PURE__ */
|
|
50274
|
-
renderFooter: (data2) => /* @__PURE__ */
|
|
50615
|
+
render: (row) => /* @__PURE__ */ jsx274("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50616
|
+
renderFooter: (data2) => /* @__PURE__ */ jsx274("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50275
50617
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50276
50618
|
currency
|
|
50277
50619
|
) })
|
|
50278
50620
|
}
|
|
50279
50621
|
];
|
|
50280
|
-
const datas =
|
|
50622
|
+
const datas = useMemo55(() => {
|
|
50281
50623
|
let runningBalance = 0;
|
|
50282
50624
|
const transactions = data?.data?.transactions;
|
|
50283
50625
|
const res = (transactions || []).map((item) => {
|
|
@@ -50314,10 +50656,10 @@ var CargoIMReport = () => {
|
|
|
50314
50656
|
{ label: "Account Type", value: data?.data?.type },
|
|
50315
50657
|
{ label: "Currency", value: currencyFilter }
|
|
50316
50658
|
];
|
|
50317
|
-
return /* @__PURE__ */
|
|
50318
|
-
/* @__PURE__ */
|
|
50319
|
-
/* @__PURE__ */
|
|
50320
|
-
/* @__PURE__ */
|
|
50659
|
+
return /* @__PURE__ */ jsxs243(Fragment139, { children: [
|
|
50660
|
+
/* @__PURE__ */ jsx274(Modal2, {}),
|
|
50661
|
+
/* @__PURE__ */ jsx274(TransactionView, {}),
|
|
50662
|
+
/* @__PURE__ */ jsx274(
|
|
50321
50663
|
A4DataView,
|
|
50322
50664
|
{
|
|
50323
50665
|
columns,
|
|
@@ -50332,7 +50674,7 @@ var CargoIMReport = () => {
|
|
|
50332
50674
|
openState({
|
|
50333
50675
|
type: "debit",
|
|
50334
50676
|
closeOnOverlayClick: false,
|
|
50335
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */
|
|
50677
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ jsx274(
|
|
50336
50678
|
InvoiceForm_default2,
|
|
50337
50679
|
{
|
|
50338
50680
|
close: closeTransaction,
|
|
@@ -50340,7 +50682,7 @@ var CargoIMReport = () => {
|
|
|
50340
50682
|
onReload: reload,
|
|
50341
50683
|
id: row._id
|
|
50342
50684
|
}
|
|
50343
|
-
) : /* @__PURE__ */
|
|
50685
|
+
) : /* @__PURE__ */ jsx274(
|
|
50344
50686
|
journalForm_default2,
|
|
50345
50687
|
{
|
|
50346
50688
|
close: closeTransaction,
|
|
@@ -50353,7 +50695,7 @@ var CargoIMReport = () => {
|
|
|
50353
50695
|
width: 800
|
|
50354
50696
|
});
|
|
50355
50697
|
},
|
|
50356
|
-
headers: /* @__PURE__ */
|
|
50698
|
+
headers: /* @__PURE__ */ jsx274("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsx274(
|
|
50357
50699
|
Fields_default.Select,
|
|
50358
50700
|
{
|
|
50359
50701
|
options: currencies,
|
|
@@ -50369,21 +50711,21 @@ var CargoIMReport = () => {
|
|
|
50369
50711
|
var cargoIMReport_default = CargoIMReport;
|
|
50370
50712
|
|
|
50371
50713
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50372
|
-
import { useNavigate as
|
|
50714
|
+
import { useNavigate as useNavigate67, useParams as useParams115 } from "react-router-dom";
|
|
50373
50715
|
import {
|
|
50374
|
-
EllipsisVertical as
|
|
50716
|
+
EllipsisVertical as EllipsisVertical49,
|
|
50375
50717
|
FileChartLine as FileChartLine2,
|
|
50376
|
-
FilePenLine as
|
|
50377
|
-
Trash2 as
|
|
50718
|
+
FilePenLine as FilePenLine45,
|
|
50719
|
+
Trash2 as Trash256
|
|
50378
50720
|
} from "lucide-react";
|
|
50379
|
-
import { useState as
|
|
50380
|
-
import { message as
|
|
50381
|
-
import { Fragment as
|
|
50721
|
+
import { useState as useState120 } from "react";
|
|
50722
|
+
import { message as message91 } from "antd";
|
|
50723
|
+
import { Fragment as Fragment140, jsx as jsx275, jsxs as jsxs244 } from "react/jsx-runtime";
|
|
50382
50724
|
function Forex2Accounts({ v, url }) {
|
|
50383
|
-
const { branchId } =
|
|
50384
|
-
const navigate =
|
|
50725
|
+
const { branchId } = useParams115();
|
|
50726
|
+
const navigate = useNavigate67();
|
|
50385
50727
|
const type = "account";
|
|
50386
|
-
const [deleteAccount, setDeleteAccount] =
|
|
50728
|
+
const [deleteAccount, setDeleteAccount] = useState120(null);
|
|
50387
50729
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50388
50730
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50389
50731
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50394,22 +50736,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50394
50736
|
const items = (data2) => [
|
|
50395
50737
|
{
|
|
50396
50738
|
label: `Currency Report`,
|
|
50397
|
-
icon: /* @__PURE__ */
|
|
50739
|
+
icon: /* @__PURE__ */ jsx275(FileChartLine2, { size: 16 }),
|
|
50398
50740
|
onClick: () => navigate(data2?._id)
|
|
50399
50741
|
},
|
|
50400
50742
|
{
|
|
50401
50743
|
label: `Edit ${type}`,
|
|
50402
|
-
icon: /* @__PURE__ */
|
|
50744
|
+
icon: /* @__PURE__ */ jsx275(FilePenLine45, { size: 16 }),
|
|
50403
50745
|
onClick: () => openState({
|
|
50404
50746
|
type: "forex account",
|
|
50405
|
-
content: /* @__PURE__ */
|
|
50747
|
+
content: /* @__PURE__ */ jsx275(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50406
50748
|
title: "Forex Account Form",
|
|
50407
50749
|
width: 800
|
|
50408
50750
|
})
|
|
50409
50751
|
},
|
|
50410
50752
|
{
|
|
50411
50753
|
label: `Delete ${type}`,
|
|
50412
|
-
icon: /* @__PURE__ */
|
|
50754
|
+
icon: /* @__PURE__ */ jsx275(Trash256, { className: "text-red-500", size: 16 }),
|
|
50413
50755
|
onClick: () => setDeleteAccount(data2)
|
|
50414
50756
|
}
|
|
50415
50757
|
].filter(Boolean);
|
|
@@ -50419,7 +50761,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50419
50761
|
header: "Name",
|
|
50420
50762
|
cell: ({ row }) => {
|
|
50421
50763
|
const account = row.original;
|
|
50422
|
-
return /* @__PURE__ */
|
|
50764
|
+
return /* @__PURE__ */ jsx275(
|
|
50423
50765
|
"span",
|
|
50424
50766
|
{
|
|
50425
50767
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50434,7 +50776,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50434
50776
|
header: "Phone",
|
|
50435
50777
|
cell: ({ row }) => {
|
|
50436
50778
|
const account = row.original;
|
|
50437
|
-
return /* @__PURE__ */
|
|
50779
|
+
return /* @__PURE__ */ jsx275("span", { children: account?.phoneNumber || "N/A" });
|
|
50438
50780
|
}
|
|
50439
50781
|
},
|
|
50440
50782
|
{
|
|
@@ -50442,14 +50784,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50442
50784
|
header: "Balances",
|
|
50443
50785
|
cell: ({ row }) => {
|
|
50444
50786
|
const account = row.original;
|
|
50445
|
-
return /* @__PURE__ */
|
|
50446
|
-
([currency, data2]) => /* @__PURE__ */
|
|
50787
|
+
return /* @__PURE__ */ jsx275("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50788
|
+
([currency, data2]) => /* @__PURE__ */ jsxs244(
|
|
50447
50789
|
"div",
|
|
50448
50790
|
{
|
|
50449
50791
|
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
50792
|
children: [
|
|
50451
|
-
/* @__PURE__ */
|
|
50452
|
-
/* @__PURE__ */
|
|
50793
|
+
/* @__PURE__ */ jsx275("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50794
|
+
/* @__PURE__ */ jsx275(
|
|
50453
50795
|
"span",
|
|
50454
50796
|
{
|
|
50455
50797
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50468,8 +50810,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50468
50810
|
header: "Actions",
|
|
50469
50811
|
cell: ({ row }) => {
|
|
50470
50812
|
const data2 = row.original;
|
|
50471
|
-
return /* @__PURE__ */
|
|
50472
|
-
/* @__PURE__ */
|
|
50813
|
+
return /* @__PURE__ */ jsxs244("div", { className: "flex gap-4 items-center", children: [
|
|
50814
|
+
/* @__PURE__ */ jsx275(
|
|
50473
50815
|
"button",
|
|
50474
50816
|
{
|
|
50475
50817
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50477,7 +50819,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50477
50819
|
openState({
|
|
50478
50820
|
type: "credit",
|
|
50479
50821
|
closeOnOverlayClick: false,
|
|
50480
|
-
content: /* @__PURE__ */
|
|
50822
|
+
content: /* @__PURE__ */ jsx275(
|
|
50481
50823
|
Forex2FormTransaction_default,
|
|
50482
50824
|
{
|
|
50483
50825
|
close,
|
|
@@ -50493,7 +50835,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50493
50835
|
children: "Out"
|
|
50494
50836
|
}
|
|
50495
50837
|
),
|
|
50496
|
-
/* @__PURE__ */
|
|
50838
|
+
/* @__PURE__ */ jsx275(
|
|
50497
50839
|
"button",
|
|
50498
50840
|
{
|
|
50499
50841
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50501,7 +50843,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50501
50843
|
openState({
|
|
50502
50844
|
type: "debit",
|
|
50503
50845
|
closeOnOverlayClick: false,
|
|
50504
|
-
content: /* @__PURE__ */
|
|
50846
|
+
content: /* @__PURE__ */ jsx275(
|
|
50505
50847
|
Forex2FormTransaction_default,
|
|
50506
50848
|
{
|
|
50507
50849
|
close,
|
|
@@ -50517,13 +50859,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50517
50859
|
children: "In"
|
|
50518
50860
|
}
|
|
50519
50861
|
),
|
|
50520
|
-
/* @__PURE__ */
|
|
50862
|
+
/* @__PURE__ */ jsx275(
|
|
50521
50863
|
Dropdown,
|
|
50522
50864
|
{
|
|
50523
50865
|
className: "cursor-pointer w-[150px]",
|
|
50524
50866
|
items: items(data2),
|
|
50525
50867
|
triggerMode: "hover",
|
|
50526
|
-
children: /* @__PURE__ */
|
|
50868
|
+
children: /* @__PURE__ */ jsx275(EllipsisVertical49, {})
|
|
50527
50869
|
}
|
|
50528
50870
|
)
|
|
50529
50871
|
] });
|
|
@@ -50534,11 +50876,11 @@ function Forex2Accounts({ v, url }) {
|
|
|
50534
50876
|
const onDelete = async (id) => {
|
|
50535
50877
|
try {
|
|
50536
50878
|
await remove({ url: `/accounts/delete/${id}` });
|
|
50537
|
-
|
|
50879
|
+
message91.success("Account deleted successfully");
|
|
50538
50880
|
reload();
|
|
50539
50881
|
setDeleteAccount(null);
|
|
50540
50882
|
} catch (error) {
|
|
50541
|
-
|
|
50883
|
+
message91.error(error.message || "Something went wrong");
|
|
50542
50884
|
return error;
|
|
50543
50885
|
}
|
|
50544
50886
|
};
|
|
@@ -50562,9 +50904,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50562
50904
|
};
|
|
50563
50905
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50564
50906
|
console.log(currencies);
|
|
50565
|
-
return /* @__PURE__ */
|
|
50566
|
-
/* @__PURE__ */
|
|
50567
|
-
/* @__PURE__ */
|
|
50907
|
+
return /* @__PURE__ */ jsxs244(Fragment140, { children: [
|
|
50908
|
+
/* @__PURE__ */ jsx275(Modal2, {}),
|
|
50909
|
+
/* @__PURE__ */ jsx275(
|
|
50568
50910
|
ConfirmModal,
|
|
50569
50911
|
{
|
|
50570
50912
|
isOpen: !!deleteAccount,
|
|
@@ -50577,9 +50919,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50577
50919
|
children: null
|
|
50578
50920
|
}
|
|
50579
50921
|
),
|
|
50580
|
-
/* @__PURE__ */
|
|
50581
|
-
/* @__PURE__ */
|
|
50582
|
-
/* @__PURE__ */
|
|
50922
|
+
/* @__PURE__ */ jsxs244("div", { children: [
|
|
50923
|
+
/* @__PURE__ */ jsx275(ForexAccountSummary_default, { currencies, isLoading }),
|
|
50924
|
+
/* @__PURE__ */ jsx275(
|
|
50583
50925
|
TransactionViewComponent,
|
|
50584
50926
|
{
|
|
50585
50927
|
columns,
|
|
@@ -50591,7 +50933,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50591
50933
|
onCreate: () => {
|
|
50592
50934
|
openState({
|
|
50593
50935
|
type: "forex account",
|
|
50594
|
-
content: /* @__PURE__ */
|
|
50936
|
+
content: /* @__PURE__ */ jsx275(ForexAccountForm_default, { close, reloads: reload }),
|
|
50595
50937
|
title: "Forex Account Form",
|
|
50596
50938
|
width: 800
|
|
50597
50939
|
});
|
|
@@ -50604,14 +50946,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50604
50946
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50605
50947
|
|
|
50606
50948
|
// src/components/reports/ProductList.tsx
|
|
50607
|
-
import { useParams as
|
|
50608
|
-
import { Fragment as
|
|
50949
|
+
import { useParams as useParams116 } from "react-router-dom";
|
|
50950
|
+
import { Fragment as Fragment141, jsx as jsx276, jsxs as jsxs245 } from "react/jsx-runtime";
|
|
50609
50951
|
var options9 = [
|
|
50610
50952
|
{ label: "Product", value: "product" },
|
|
50611
50953
|
{ label: "Pack", value: "pack" }
|
|
50612
50954
|
];
|
|
50613
50955
|
var ProductList2 = ({ value = false }) => {
|
|
50614
|
-
const { branchId } =
|
|
50956
|
+
const { branchId } = useParams116();
|
|
50615
50957
|
const { branches } = useAuth_default();
|
|
50616
50958
|
const { TransactionView } = useTransactionView_default();
|
|
50617
50959
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50633,7 +50975,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50633
50975
|
key: "name",
|
|
50634
50976
|
className: "text-xs whitespace-nowrap",
|
|
50635
50977
|
render: (row) => {
|
|
50636
|
-
return /* @__PURE__ */
|
|
50978
|
+
return /* @__PURE__ */ jsx276("div", { className: "", children: /* @__PURE__ */ jsx276("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
50637
50979
|
}
|
|
50638
50980
|
},
|
|
50639
50981
|
...value ? [
|
|
@@ -50641,14 +50983,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50641
50983
|
header: "Cost",
|
|
50642
50984
|
key: "cost",
|
|
50643
50985
|
className: "text-xs whitespace-nowrap text-right",
|
|
50644
|
-
render: (row) => /* @__PURE__ */
|
|
50986
|
+
render: (row) => /* @__PURE__ */ jsx276("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50645
50987
|
}
|
|
50646
50988
|
] : []
|
|
50647
50989
|
];
|
|
50648
50990
|
const datas = data?.data || [];
|
|
50649
|
-
return /* @__PURE__ */
|
|
50650
|
-
/* @__PURE__ */
|
|
50651
|
-
/* @__PURE__ */
|
|
50991
|
+
return /* @__PURE__ */ jsxs245(Fragment141, { children: [
|
|
50992
|
+
/* @__PURE__ */ jsx276(TransactionView, {}),
|
|
50993
|
+
/* @__PURE__ */ jsx276(
|
|
50652
50994
|
A4DataView,
|
|
50653
50995
|
{
|
|
50654
50996
|
columns,
|
|
@@ -50659,7 +51001,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50659
51001
|
tableTitle: "Stock List",
|
|
50660
51002
|
fixed: false,
|
|
50661
51003
|
startPage: 1e10,
|
|
50662
|
-
headers: /* @__PURE__ */
|
|
51004
|
+
headers: /* @__PURE__ */ jsx276(
|
|
50663
51005
|
Select,
|
|
50664
51006
|
{
|
|
50665
51007
|
options: options9,
|