warqadui 0.0.279 → 0.0.281
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +703 -367
- package/dist/index.mjs +701 -365
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -566,8 +566,8 @@ var InfoGrid = ({
|
|
|
566
566
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
567
567
|
"span",
|
|
568
568
|
{
|
|
569
|
-
className: `text-sm font-medium text-gray-700 block text-left ${item.mono ? "font-mono" : ""}`,
|
|
570
|
-
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-4
|
|
569
|
+
className: `text-sm uppercase font-medium text-gray-700 block text-left ${item.mono ? "font-mono" : ""}`,
|
|
570
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-4 bg-gray-200 dark:bg-zinc-800 rounded-sm animate-pulse w-3/4 mt-1" }) : item.value
|
|
571
571
|
}
|
|
572
572
|
)
|
|
573
573
|
] }, `${item.label}-${index}`))
|
|
@@ -1809,13 +1809,13 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
1811
|
}, [props.value, name, form]);
|
|
1812
|
-
let
|
|
1812
|
+
let message92 = error;
|
|
1813
1813
|
if (form && name) {
|
|
1814
1814
|
const {
|
|
1815
1815
|
formState: { errors }
|
|
1816
1816
|
} = form;
|
|
1817
1817
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1818
|
-
|
|
1818
|
+
message92 = errorObj?.message;
|
|
1819
1819
|
}
|
|
1820
1820
|
const watchedValue = form?.watch(name);
|
|
1821
1821
|
(0, import_react11.useEffect)(() => {
|
|
@@ -1884,7 +1884,7 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1884
1884
|
}
|
|
1885
1885
|
)
|
|
1886
1886
|
] }),
|
|
1887
|
-
|
|
1887
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
1888
1888
|
]
|
|
1889
1889
|
}
|
|
1890
1890
|
);
|
|
@@ -2232,7 +2232,7 @@ var PhoneInput = (0, import_react14.forwardRef)(
|
|
|
2232
2232
|
const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
|
|
2233
2233
|
const { theme } = useWarqadConfig();
|
|
2234
2234
|
const primaryColor = theme?.primaryColor;
|
|
2235
|
-
let
|
|
2235
|
+
let message92 = error;
|
|
2236
2236
|
if (form && name) {
|
|
2237
2237
|
const {
|
|
2238
2238
|
formState: { errors }
|
|
@@ -2242,7 +2242,7 @@ var PhoneInput = (0, import_react14.forwardRef)(
|
|
|
2242
2242
|
for (const part of nameParts) {
|
|
2243
2243
|
currentError = currentError?.[part];
|
|
2244
2244
|
}
|
|
2245
|
-
|
|
2245
|
+
message92 = currentError?.message || message92;
|
|
2246
2246
|
}
|
|
2247
2247
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
2248
2248
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
@@ -2293,7 +2293,7 @@ var PhoneInput = (0, import_react14.forwardRef)(
|
|
|
2293
2293
|
}
|
|
2294
2294
|
)
|
|
2295
2295
|
] }),
|
|
2296
|
-
|
|
2296
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
2297
2297
|
] });
|
|
2298
2298
|
if (form && name) {
|
|
2299
2299
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -2474,7 +2474,7 @@ var SelectRoot = ({
|
|
|
2474
2474
|
setSearchQuery("");
|
|
2475
2475
|
}
|
|
2476
2476
|
}, [isOpen]);
|
|
2477
|
-
let
|
|
2477
|
+
let message92 = error;
|
|
2478
2478
|
if (form && name) {
|
|
2479
2479
|
const {
|
|
2480
2480
|
formState: { errors }
|
|
@@ -2484,7 +2484,7 @@ var SelectRoot = ({
|
|
|
2484
2484
|
for (const part of nameParts) {
|
|
2485
2485
|
currentError = currentError?.[part];
|
|
2486
2486
|
}
|
|
2487
|
-
|
|
2487
|
+
message92 = currentError?.message || message92;
|
|
2488
2488
|
}
|
|
2489
2489
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
2490
2490
|
const filteredOptions = (0, import_react15.useMemo)(() => {
|
|
@@ -2554,7 +2554,7 @@ var SelectRoot = ({
|
|
|
2554
2554
|
String(opt.value) || index
|
|
2555
2555
|
)) })
|
|
2556
2556
|
] }),
|
|
2557
|
-
|
|
2557
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
2558
2558
|
]
|
|
2559
2559
|
}
|
|
2560
2560
|
) });
|
|
@@ -2819,13 +2819,13 @@ var Textarea = (0, import_react16.forwardRef)(
|
|
|
2819
2819
|
const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
|
|
2820
2820
|
const { theme } = useWarqadConfig();
|
|
2821
2821
|
const primaryColor = theme?.primaryColor;
|
|
2822
|
-
let
|
|
2822
|
+
let message92 = error;
|
|
2823
2823
|
if (form && name) {
|
|
2824
2824
|
const {
|
|
2825
2825
|
formState: { errors }
|
|
2826
2826
|
} = form;
|
|
2827
2827
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2828
|
-
|
|
2828
|
+
message92 = errorObj?.message;
|
|
2829
2829
|
}
|
|
2830
2830
|
const renderInput = (inputProps, ref3) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
2831
2831
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
@@ -2863,7 +2863,7 @@ var Textarea = (0, import_react16.forwardRef)(
|
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
2865
|
) }),
|
|
2866
|
-
|
|
2866
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
2867
2867
|
] });
|
|
2868
2868
|
(0, import_react16.useEffect)(() => {
|
|
2869
2869
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -3206,7 +3206,7 @@ var SearchApiRoot = ({
|
|
|
3206
3206
|
const filteredOptions = options10.filter(
|
|
3207
3207
|
(option) => !filter.includes(getOptionValue(option))
|
|
3208
3208
|
);
|
|
3209
|
-
let
|
|
3209
|
+
let message92 = error || errorMessage;
|
|
3210
3210
|
if (form && name) {
|
|
3211
3211
|
const {
|
|
3212
3212
|
formState: { errors }
|
|
@@ -3216,7 +3216,7 @@ var SearchApiRoot = ({
|
|
|
3216
3216
|
for (const part of nameParts) {
|
|
3217
3217
|
currentError = currentError?.[part];
|
|
3218
3218
|
}
|
|
3219
|
-
|
|
3219
|
+
message92 = currentError?.message || message92;
|
|
3220
3220
|
}
|
|
3221
3221
|
const valueCtx = {
|
|
3222
3222
|
isOpen,
|
|
@@ -3250,7 +3250,7 @@ var SearchApiRoot = ({
|
|
|
3250
3250
|
form,
|
|
3251
3251
|
name,
|
|
3252
3252
|
obj,
|
|
3253
|
-
error:
|
|
3253
|
+
error: message92,
|
|
3254
3254
|
onSelect,
|
|
3255
3255
|
onClear
|
|
3256
3256
|
};
|
|
@@ -3613,7 +3613,7 @@ var DateInput = (0, import_react18.forwardRef)(
|
|
|
3613
3613
|
value,
|
|
3614
3614
|
...props
|
|
3615
3615
|
}, ref2) => {
|
|
3616
|
-
let
|
|
3616
|
+
let message92 = error;
|
|
3617
3617
|
const { theme } = useWarqadConfig();
|
|
3618
3618
|
const primaryColor = theme?.primaryColor;
|
|
3619
3619
|
const [isFocused, setIsFocused] = (0, import_react18.useState)(false);
|
|
@@ -3622,13 +3622,13 @@ var DateInput = (0, import_react18.forwardRef)(
|
|
|
3622
3622
|
formState: { errors }
|
|
3623
3623
|
} = form;
|
|
3624
3624
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
3625
|
-
|
|
3625
|
+
message92 = errorObj?.message;
|
|
3626
3626
|
}
|
|
3627
3627
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
3628
3628
|
bg-white! dark:bg-gray-900/80!
|
|
3629
3629
|
text-gray-900! dark:text-zinc-100!
|
|
3630
3630
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
3631
|
-
${
|
|
3631
|
+
${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"}
|
|
3632
3632
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
3633
3633
|
${className}`;
|
|
3634
3634
|
const renderDatePicker = (val, onChangeHandler, onBlur2, refProps) => {
|
|
@@ -3661,8 +3661,8 @@ var DateInput = (0, import_react18.forwardRef)(
|
|
|
3661
3661
|
needConfirm: false,
|
|
3662
3662
|
style: {
|
|
3663
3663
|
height: "var(--input-height, 40px)",
|
|
3664
|
-
borderColor: isFocused && !
|
|
3665
|
-
boxShadow: isFocused && !
|
|
3664
|
+
borderColor: isFocused && !message92 ? primaryColor : void 0,
|
|
3665
|
+
boxShadow: isFocused && !message92 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
3666
3666
|
},
|
|
3667
3667
|
classNames: { popup: { root: "z-50" } },
|
|
3668
3668
|
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Calendar, { className: "h-5 w-5 text-gray-400 group-focus-within:text-primary" }),
|
|
@@ -3677,7 +3677,7 @@ var DateInput = (0, import_react18.forwardRef)(
|
|
|
3677
3677
|
{
|
|
3678
3678
|
className: "block text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-200",
|
|
3679
3679
|
style: {
|
|
3680
|
-
color:
|
|
3680
|
+
color: message92 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3681
3681
|
},
|
|
3682
3682
|
children: [
|
|
3683
3683
|
label,
|
|
@@ -3695,7 +3695,7 @@ var DateInput = (0, import_react18.forwardRef)(
|
|
|
3695
3695
|
}) => renderDatePicker(value2, onC, onBlur2, fieldRef)
|
|
3696
3696
|
}
|
|
3697
3697
|
) : renderDatePicker(value, onChange, onBlur, ref2),
|
|
3698
|
-
|
|
3698
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
3699
3699
|
] });
|
|
3700
3700
|
}
|
|
3701
3701
|
);
|
|
@@ -3724,7 +3724,7 @@ var MonthInput = (0, import_react19.forwardRef)(
|
|
|
3724
3724
|
value,
|
|
3725
3725
|
...props
|
|
3726
3726
|
}, ref2) => {
|
|
3727
|
-
let
|
|
3727
|
+
let message92 = error;
|
|
3728
3728
|
const { theme } = useWarqadConfig();
|
|
3729
3729
|
const primaryColor = theme?.primaryColor;
|
|
3730
3730
|
const [isFocused, setIsFocused] = (0, import_react19.useState)(false);
|
|
@@ -3733,13 +3733,13 @@ var MonthInput = (0, import_react19.forwardRef)(
|
|
|
3733
3733
|
formState: { errors }
|
|
3734
3734
|
} = form;
|
|
3735
3735
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
3736
|
-
|
|
3736
|
+
message92 = errorObj?.message;
|
|
3737
3737
|
}
|
|
3738
3738
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
3739
3739
|
bg-white! dark:bg-gray-900/80!
|
|
3740
3740
|
text-gray-900! dark:text-zinc-100!
|
|
3741
3741
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
3742
|
-
${
|
|
3742
|
+
${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"}
|
|
3743
3743
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
3744
3744
|
${className}`;
|
|
3745
3745
|
const renderDatePicker = (val, onChangeHandler, onBlur2, refProps) => {
|
|
@@ -3773,8 +3773,8 @@ var MonthInput = (0, import_react19.forwardRef)(
|
|
|
3773
3773
|
needConfirm: false,
|
|
3774
3774
|
style: {
|
|
3775
3775
|
height: "var(--input-height, 40px)",
|
|
3776
|
-
borderColor: isFocused && !
|
|
3777
|
-
boxShadow: isFocused && !
|
|
3776
|
+
borderColor: isFocused && !message92 ? primaryColor : void 0,
|
|
3777
|
+
boxShadow: isFocused && !message92 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
3778
3778
|
},
|
|
3779
3779
|
classNames: { popup: { root: "z-50" } },
|
|
3780
3780
|
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Calendar, { className: "h-5 w-5 text-gray-400 group-focus-within:text-primary" }),
|
|
@@ -3789,7 +3789,7 @@ var MonthInput = (0, import_react19.forwardRef)(
|
|
|
3789
3789
|
{
|
|
3790
3790
|
className: "block text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-200",
|
|
3791
3791
|
style: {
|
|
3792
|
-
color:
|
|
3792
|
+
color: message92 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3793
3793
|
},
|
|
3794
3794
|
children: [
|
|
3795
3795
|
label,
|
|
@@ -3807,7 +3807,7 @@ var MonthInput = (0, import_react19.forwardRef)(
|
|
|
3807
3807
|
}) => renderDatePicker(value2, onC, onBlur2, fieldRef)
|
|
3808
3808
|
}
|
|
3809
3809
|
) : renderDatePicker(value, onChange, onBlur, ref2),
|
|
3810
|
-
|
|
3810
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message92 })
|
|
3811
3811
|
] });
|
|
3812
3812
|
}
|
|
3813
3813
|
);
|
|
@@ -9276,17 +9276,17 @@ var preWarningFns = [];
|
|
|
9276
9276
|
var preMessage = (fn) => {
|
|
9277
9277
|
preWarningFns.push(fn);
|
|
9278
9278
|
};
|
|
9279
|
-
function warning(valid,
|
|
9279
|
+
function warning(valid, message92) {
|
|
9280
9280
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
9281
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
9281
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message92);
|
|
9282
9282
|
if (finalMessage) {
|
|
9283
9283
|
console.error(`Warning: ${finalMessage}`);
|
|
9284
9284
|
}
|
|
9285
9285
|
}
|
|
9286
9286
|
}
|
|
9287
|
-
function note(valid,
|
|
9287
|
+
function note(valid, message92) {
|
|
9288
9288
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
9289
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
9289
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message92);
|
|
9290
9290
|
if (finalMessage) {
|
|
9291
9291
|
console.warn(`Note: ${finalMessage}`);
|
|
9292
9292
|
}
|
|
@@ -9295,17 +9295,17 @@ function note(valid, message91) {
|
|
|
9295
9295
|
function resetWarned() {
|
|
9296
9296
|
warned = {};
|
|
9297
9297
|
}
|
|
9298
|
-
function call(method, valid,
|
|
9299
|
-
if (!valid && !warned[
|
|
9300
|
-
method(false,
|
|
9301
|
-
warned[
|
|
9298
|
+
function call(method, valid, message92) {
|
|
9299
|
+
if (!valid && !warned[message92]) {
|
|
9300
|
+
method(false, message92);
|
|
9301
|
+
warned[message92] = true;
|
|
9302
9302
|
}
|
|
9303
9303
|
}
|
|
9304
|
-
function warningOnce(valid,
|
|
9305
|
-
call(warning, valid,
|
|
9304
|
+
function warningOnce(valid, message92) {
|
|
9305
|
+
call(warning, valid, message92);
|
|
9306
9306
|
}
|
|
9307
|
-
function noteOnce(valid,
|
|
9308
|
-
call(note, valid,
|
|
9307
|
+
function noteOnce(valid, message92) {
|
|
9308
|
+
call(note, valid, message92);
|
|
9309
9309
|
}
|
|
9310
9310
|
warningOnce.preMessage = preMessage;
|
|
9311
9311
|
warningOnce.resetWarned = resetWarned;
|
|
@@ -9316,8 +9316,8 @@ var import_react35 = __toESM(require("react"));
|
|
|
9316
9316
|
function camelCase(input) {
|
|
9317
9317
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
9318
9318
|
}
|
|
9319
|
-
function warning2(valid,
|
|
9320
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
9319
|
+
function warning2(valid, message92) {
|
|
9320
|
+
warningOnce(valid, `[@ant-design/icons] ${message92}`);
|
|
9321
9321
|
}
|
|
9322
9322
|
function isIconDefinition(target) {
|
|
9323
9323
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -22977,7 +22977,7 @@ var ForexExpensesReport_default = ForexExpensesReport;
|
|
|
22977
22977
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
22978
22978
|
var ErrorPageBase = ({
|
|
22979
22979
|
title,
|
|
22980
|
-
message:
|
|
22980
|
+
message: message92,
|
|
22981
22981
|
statusCode,
|
|
22982
22982
|
action,
|
|
22983
22983
|
className = ""
|
|
@@ -22994,7 +22994,7 @@ var ErrorPageBase = ({
|
|
|
22994
22994
|
statusCode
|
|
22995
22995
|
] }),
|
|
22996
22996
|
title && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
|
|
22997
|
-
|
|
22997
|
+
message92 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message92 }),
|
|
22998
22998
|
action && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "pt-8", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
22999
22999
|
"button",
|
|
23000
23000
|
{
|
|
@@ -44934,10 +44934,7 @@ function Payments3({ url }) {
|
|
|
44934
44934
|
{
|
|
44935
44935
|
accessorKey: "account",
|
|
44936
44936
|
header: "Account",
|
|
44937
|
-
|
|
44938
|
-
const payment = row.original;
|
|
44939
|
-
return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)("span", { children: payment?.accountData?.name || "N/A" });
|
|
44940
|
-
}
|
|
44937
|
+
accessorFn: (data2) => data2?.accountData?.name || "N/A"
|
|
44941
44938
|
},
|
|
44942
44939
|
{
|
|
44943
44940
|
accessorKey: "wallet",
|
|
@@ -45377,10 +45374,7 @@ function Journals3({ url }) {
|
|
|
45377
45374
|
{
|
|
45378
45375
|
accessorKey: "account",
|
|
45379
45376
|
header: "Account",
|
|
45380
|
-
|
|
45381
|
-
const journal = row.original;
|
|
45382
|
-
return /* @__PURE__ */ (0, import_jsx_runtime251.jsx)("span", { children: journal?.accountData?.name || "N/A" });
|
|
45383
|
-
}
|
|
45377
|
+
accessorFn: (data2) => data2?.accountData?.name || "N/A"
|
|
45384
45378
|
},
|
|
45385
45379
|
{
|
|
45386
45380
|
accessorKey: "amount",
|
|
@@ -48446,7 +48440,7 @@ var Expenses3Reports = () => {
|
|
|
48446
48440
|
const [startDate, setStartDate] = (0, import_react161.useState)(null);
|
|
48447
48441
|
const [endDate, setEndDate] = (0, import_react161.useState)(null);
|
|
48448
48442
|
const { A4DataView, data } = useA4DataView_default({
|
|
48449
|
-
url: `/transactions/get?
|
|
48443
|
+
url: `/transactions/get?isExpenses3=true${branchId ? `&branch=${branchId}` : ""}`,
|
|
48450
48444
|
v: 1
|
|
48451
48445
|
// No prefix
|
|
48452
48446
|
});
|
|
@@ -48577,6 +48571,347 @@ var Reports3 = {
|
|
|
48577
48571
|
};
|
|
48578
48572
|
var reports_default = Reports3;
|
|
48579
48573
|
|
|
48574
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48575
|
+
var import_react_router_dom126 = require("react-router-dom");
|
|
48576
|
+
var import_lucide_react126 = require("lucide-react");
|
|
48577
|
+
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
48578
|
+
function ExpensesJournal3({ url }) {
|
|
48579
|
+
const { branchId } = (0, import_react_router_dom126.useParams)();
|
|
48580
|
+
const navigate = (0, import_react_router_dom126.useNavigate)();
|
|
48581
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48582
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48583
|
+
url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48584
|
+
dateFilter: true
|
|
48585
|
+
});
|
|
48586
|
+
const { Modal: Modal2 } = useModal();
|
|
48587
|
+
const items = (data2) => [
|
|
48588
|
+
{
|
|
48589
|
+
label: `View Expense`,
|
|
48590
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
|
|
48591
|
+
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48592
|
+
},
|
|
48593
|
+
{
|
|
48594
|
+
label: `Edit Expense`,
|
|
48595
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
|
|
48596
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48597
|
+
},
|
|
48598
|
+
{
|
|
48599
|
+
label: `Delete Expense`,
|
|
48600
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
|
|
48601
|
+
onClick: () => {
|
|
48602
|
+
openTransaction({
|
|
48603
|
+
id: data2?._id,
|
|
48604
|
+
type: "expense",
|
|
48605
|
+
reverseable: { reload }
|
|
48606
|
+
});
|
|
48607
|
+
}
|
|
48608
|
+
}
|
|
48609
|
+
].filter(Boolean);
|
|
48610
|
+
const columns = [
|
|
48611
|
+
{
|
|
48612
|
+
accessorKey: "date",
|
|
48613
|
+
header: "Date",
|
|
48614
|
+
cell: ({ row }) => {
|
|
48615
|
+
const expense = row.original;
|
|
48616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col", children: [
|
|
48617
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { children: expense?.date }),
|
|
48618
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48619
|
+
"span",
|
|
48620
|
+
{
|
|
48621
|
+
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
48622
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
48623
|
+
children: expense.ref
|
|
48624
|
+
}
|
|
48625
|
+
)
|
|
48626
|
+
] });
|
|
48627
|
+
}
|
|
48628
|
+
},
|
|
48629
|
+
{
|
|
48630
|
+
accessorKey: "description",
|
|
48631
|
+
header: "Description",
|
|
48632
|
+
cell: ({ row }) => {
|
|
48633
|
+
const expense = row.original;
|
|
48634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col", children: [
|
|
48635
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "capitalize", children: expense?.description }),
|
|
48636
|
+
expense?.note && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48637
|
+
] });
|
|
48638
|
+
}
|
|
48639
|
+
},
|
|
48640
|
+
{
|
|
48641
|
+
accessorKey: "amount",
|
|
48642
|
+
header: "Amount",
|
|
48643
|
+
cell: ({ row }) => {
|
|
48644
|
+
const expense = row.original;
|
|
48645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
|
|
48646
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
48647
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48648
|
+
"rate ",
|
|
48649
|
+
expense?.exchange?.rate,
|
|
48650
|
+
" ,",
|
|
48651
|
+
" ",
|
|
48652
|
+
Formats_default.Price(
|
|
48653
|
+
expense?.exchange?.amount || 0,
|
|
48654
|
+
expense?.exchange?.currency
|
|
48655
|
+
)
|
|
48656
|
+
] })
|
|
48657
|
+
] });
|
|
48658
|
+
}
|
|
48659
|
+
},
|
|
48660
|
+
{
|
|
48661
|
+
accessorKey: "actions",
|
|
48662
|
+
header: "Actions",
|
|
48663
|
+
cell: ({ row }) => {
|
|
48664
|
+
const data2 = row.original;
|
|
48665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48666
|
+
Dropdown,
|
|
48667
|
+
{
|
|
48668
|
+
className: "cursor-pointer w-[150px]",
|
|
48669
|
+
items: items(data2),
|
|
48670
|
+
triggerMode: "hover",
|
|
48671
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.EllipsisVertical, {})
|
|
48672
|
+
}
|
|
48673
|
+
);
|
|
48674
|
+
}
|
|
48675
|
+
}
|
|
48676
|
+
];
|
|
48677
|
+
const expenses = data?.data || [];
|
|
48678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
|
|
48679
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
|
|
48680
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Modal2, {}),
|
|
48681
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48682
|
+
TransactionViewComponent,
|
|
48683
|
+
{
|
|
48684
|
+
columns,
|
|
48685
|
+
data: expenses,
|
|
48686
|
+
title: "Expenses",
|
|
48687
|
+
description: "Track and manage business expenses",
|
|
48688
|
+
index: true,
|
|
48689
|
+
createTitle: "Add Expense",
|
|
48690
|
+
onCreate: () => {
|
|
48691
|
+
navigate("create");
|
|
48692
|
+
}
|
|
48693
|
+
}
|
|
48694
|
+
)
|
|
48695
|
+
] });
|
|
48696
|
+
}
|
|
48697
|
+
var ExpensesJournal_default = ExpensesJournal3;
|
|
48698
|
+
|
|
48699
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48700
|
+
var import_react162 = require("react");
|
|
48701
|
+
var import_react_router_dom127 = require("react-router-dom");
|
|
48702
|
+
var import_react_hook_form75 = require("react-hook-form");
|
|
48703
|
+
var import_zod126 = require("@hookform/resolvers/zod");
|
|
48704
|
+
var import_antd97 = require("antd");
|
|
48705
|
+
|
|
48706
|
+
// src/components/Transactions/3/expenseJournal/schema.ts
|
|
48707
|
+
var import_zod125 = require("zod");
|
|
48708
|
+
var expenseSchema5 = import_zod125.z.object({
|
|
48709
|
+
description: import_zod125.z.string().min(1, "Description is required"),
|
|
48710
|
+
date: zodFields.date,
|
|
48711
|
+
amount: import_zod125.z.number().gt(0, "Amount must be greater than 0"),
|
|
48712
|
+
branch: import_zod125.z.string().optional(),
|
|
48713
|
+
note: import_zod125.z.string().optional(),
|
|
48714
|
+
currency: import_zod125.z.enum(Enums_default.currencies),
|
|
48715
|
+
rate: import_zod125.z.number().optional()
|
|
48716
|
+
});
|
|
48717
|
+
|
|
48718
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48719
|
+
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
48720
|
+
function ExpensesJournal3Form() {
|
|
48721
|
+
const { branchId } = (0, import_react_router_dom127.useParams)();
|
|
48722
|
+
const { getQuery, navigate } = useApp_default();
|
|
48723
|
+
const id = getQuery("id");
|
|
48724
|
+
const isEdit = !!id;
|
|
48725
|
+
const [ref2, setRef] = (0, import_react162.useState)("");
|
|
48726
|
+
const { post, isLoading } = useApis_default();
|
|
48727
|
+
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48728
|
+
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
48729
|
+
const methods = (0, import_react_hook_form75.useForm)({
|
|
48730
|
+
resolver: (0, import_zod126.zodResolver)(expenseSchema5),
|
|
48731
|
+
defaultValues: {
|
|
48732
|
+
date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
|
|
48733
|
+
amount: 0,
|
|
48734
|
+
description: "",
|
|
48735
|
+
rate: void 0,
|
|
48736
|
+
branch: branchId || void 0
|
|
48737
|
+
}
|
|
48738
|
+
});
|
|
48739
|
+
const { handleSubmit, reset, watch } = methods;
|
|
48740
|
+
const currency = watch("currency");
|
|
48741
|
+
const isRate = currency && currency !== defaultCurrency;
|
|
48742
|
+
const amount = watch("amount");
|
|
48743
|
+
const rate = watch("rate");
|
|
48744
|
+
const exchangedAmount2 = (0, import_react162.useMemo)(() => {
|
|
48745
|
+
if (isRate) {
|
|
48746
|
+
const am = forex_default.exchangedAmount({
|
|
48747
|
+
accountCurrency: defaultCurrency,
|
|
48748
|
+
amount,
|
|
48749
|
+
exchangeRate: rate ?? 1,
|
|
48750
|
+
transactionCurrency: currency
|
|
48751
|
+
});
|
|
48752
|
+
return Formats_default.Price(am, defaultCurrency ?? "N/A", false);
|
|
48753
|
+
}
|
|
48754
|
+
}, [amount, currency, rate, isRate]);
|
|
48755
|
+
const onSubmit = async (data) => {
|
|
48756
|
+
try {
|
|
48757
|
+
const payload = {
|
|
48758
|
+
...data,
|
|
48759
|
+
type: "expense-journal-3",
|
|
48760
|
+
defaultCurrency,
|
|
48761
|
+
branch: branchId ?? void 0,
|
|
48762
|
+
rate: data?.rate ?? 1
|
|
48763
|
+
};
|
|
48764
|
+
await post({
|
|
48765
|
+
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
48766
|
+
body: payload
|
|
48767
|
+
});
|
|
48768
|
+
import_antd97.message.success(`Expense saved successfully`);
|
|
48769
|
+
navigate(-1);
|
|
48770
|
+
} catch (error) {
|
|
48771
|
+
import_antd97.message.error(error?.message || "Something went wrong");
|
|
48772
|
+
}
|
|
48773
|
+
};
|
|
48774
|
+
const fetches = async () => {
|
|
48775
|
+
try {
|
|
48776
|
+
const res = await get({
|
|
48777
|
+
url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
|
|
48778
|
+
});
|
|
48779
|
+
const data = res.data;
|
|
48780
|
+
reset({
|
|
48781
|
+
...data,
|
|
48782
|
+
rate: data?.exchange?.rate
|
|
48783
|
+
});
|
|
48784
|
+
setRef(data?.ref);
|
|
48785
|
+
} catch (error) {
|
|
48786
|
+
import_antd97.message.error(error?.message || "Something went wrong");
|
|
48787
|
+
navigate(-1);
|
|
48788
|
+
}
|
|
48789
|
+
};
|
|
48790
|
+
(0, import_react162.useEffect)(() => {
|
|
48791
|
+
if (isEdit) {
|
|
48792
|
+
fetches();
|
|
48793
|
+
}
|
|
48794
|
+
}, [id]);
|
|
48795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
48796
|
+
Card,
|
|
48797
|
+
{
|
|
48798
|
+
className: "max-w-4xl mx-auto mt-10 relative",
|
|
48799
|
+
isLoading: isLoadingGet,
|
|
48800
|
+
loadingText: "Processing...",
|
|
48801
|
+
children: [
|
|
48802
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(Card.Header, { children: [
|
|
48803
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
48804
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
48805
|
+
] }),
|
|
48806
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
48807
|
+
"form",
|
|
48808
|
+
{
|
|
48809
|
+
className: "space-y-4",
|
|
48810
|
+
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
48811
|
+
children: [
|
|
48812
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48813
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48814
|
+
Fields_default.Input,
|
|
48815
|
+
{
|
|
48816
|
+
label: "Description",
|
|
48817
|
+
form: methods,
|
|
48818
|
+
name: "description",
|
|
48819
|
+
placeholder: "What was this expense for?",
|
|
48820
|
+
required: true
|
|
48821
|
+
}
|
|
48822
|
+
),
|
|
48823
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48824
|
+
Fields_default.Select,
|
|
48825
|
+
{
|
|
48826
|
+
label: "Currency",
|
|
48827
|
+
form: methods,
|
|
48828
|
+
enumName: "currencies",
|
|
48829
|
+
name: "currency",
|
|
48830
|
+
required: true
|
|
48831
|
+
}
|
|
48832
|
+
)
|
|
48833
|
+
] }),
|
|
48834
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48835
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48836
|
+
Fields_default.DateInput,
|
|
48837
|
+
{
|
|
48838
|
+
label: "Date",
|
|
48839
|
+
form: methods,
|
|
48840
|
+
name: "date",
|
|
48841
|
+
required: true
|
|
48842
|
+
}
|
|
48843
|
+
),
|
|
48844
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48845
|
+
Fields_default.Input,
|
|
48846
|
+
{
|
|
48847
|
+
label: "Amount",
|
|
48848
|
+
form: methods,
|
|
48849
|
+
name: "amount",
|
|
48850
|
+
type: "number",
|
|
48851
|
+
placeholder: "0.00",
|
|
48852
|
+
required: true
|
|
48853
|
+
}
|
|
48854
|
+
),
|
|
48855
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
|
|
48856
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48857
|
+
Fields_default.Input,
|
|
48858
|
+
{
|
|
48859
|
+
label: "Rate",
|
|
48860
|
+
form: methods,
|
|
48861
|
+
name: "rate",
|
|
48862
|
+
type: "number",
|
|
48863
|
+
placeholder: "Rate",
|
|
48864
|
+
required: true
|
|
48865
|
+
}
|
|
48866
|
+
),
|
|
48867
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48868
|
+
Fields_default.Input,
|
|
48869
|
+
{
|
|
48870
|
+
label: "Exchanged Amount",
|
|
48871
|
+
type: "text",
|
|
48872
|
+
readOnly: true,
|
|
48873
|
+
disabled: true,
|
|
48874
|
+
value: exchangedAmount2
|
|
48875
|
+
}
|
|
48876
|
+
)
|
|
48877
|
+
] })
|
|
48878
|
+
] }),
|
|
48879
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48880
|
+
Fields_default.Textarea,
|
|
48881
|
+
{
|
|
48882
|
+
label: "Note",
|
|
48883
|
+
form: methods,
|
|
48884
|
+
name: "note",
|
|
48885
|
+
placeholder: "Add any additional details..."
|
|
48886
|
+
}
|
|
48887
|
+
),
|
|
48888
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48889
|
+
Button,
|
|
48890
|
+
{
|
|
48891
|
+
isLoading,
|
|
48892
|
+
disabled: isLoading,
|
|
48893
|
+
type: "submit",
|
|
48894
|
+
className: "min-w-[100px]",
|
|
48895
|
+
variant: !isEdit ? "primary" : "warning",
|
|
48896
|
+
children: isEdit ? "Update" : "Add"
|
|
48897
|
+
}
|
|
48898
|
+
) })
|
|
48899
|
+
]
|
|
48900
|
+
}
|
|
48901
|
+
) })
|
|
48902
|
+
]
|
|
48903
|
+
}
|
|
48904
|
+
);
|
|
48905
|
+
}
|
|
48906
|
+
var ExpensesJournal3Form_default = ExpensesJournal3Form;
|
|
48907
|
+
|
|
48908
|
+
// src/components/Transactions/3/expenseJournal/index.tsx
|
|
48909
|
+
var ExpensesJournal32 = {
|
|
48910
|
+
List: ExpensesJournal_default,
|
|
48911
|
+
Form: ExpensesJournal3Form_default
|
|
48912
|
+
};
|
|
48913
|
+
var expenseJournal_default = ExpensesJournal32;
|
|
48914
|
+
|
|
48580
48915
|
// src/components/Transactions/3/index.ts
|
|
48581
48916
|
var Transaction3 = {
|
|
48582
48917
|
Payments: Payments_default3,
|
|
@@ -48589,26 +48924,27 @@ var Transaction3 = {
|
|
|
48589
48924
|
Purchase3Form: purchase3_default.Form,
|
|
48590
48925
|
Expenses: expense_default.List,
|
|
48591
48926
|
ExpenseForm: expense_default.Form,
|
|
48592
|
-
Reports: reports_default
|
|
48927
|
+
Reports: reports_default,
|
|
48928
|
+
ExpensesJournal3: expenseJournal_default
|
|
48593
48929
|
};
|
|
48594
48930
|
var __default = Transaction3;
|
|
48595
48931
|
|
|
48596
48932
|
// src/components/reports/ItemReport.tsx
|
|
48597
|
-
var
|
|
48598
|
-
var
|
|
48599
|
-
var
|
|
48600
|
-
var
|
|
48601
|
-
var
|
|
48602
|
-
var
|
|
48603
|
-
var
|
|
48933
|
+
var import_react_router_dom128 = require("react-router-dom");
|
|
48934
|
+
var import_zod127 = require("zod");
|
|
48935
|
+
var import_react_hook_form76 = require("react-hook-form");
|
|
48936
|
+
var import_zod128 = require("@hookform/resolvers/zod");
|
|
48937
|
+
var import_react163 = require("react");
|
|
48938
|
+
var import_antd98 = require("antd");
|
|
48939
|
+
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
48604
48940
|
var ItemReport = ({
|
|
48605
48941
|
value = false,
|
|
48606
48942
|
type
|
|
48607
48943
|
}) => {
|
|
48608
48944
|
const { apiConfig } = useWarqadConfig();
|
|
48609
|
-
const { branchId } = (0,
|
|
48945
|
+
const { branchId } = (0, import_react_router_dom128.useParams)();
|
|
48610
48946
|
const { branches } = useAuth_default();
|
|
48611
|
-
const [params, setParams] = (0,
|
|
48947
|
+
const [params, setParams] = (0, import_react163.useState)({
|
|
48612
48948
|
id: "",
|
|
48613
48949
|
branch: "all"
|
|
48614
48950
|
});
|
|
@@ -48633,9 +48969,9 @@ var ItemReport = ({
|
|
|
48633
48969
|
header: "Date",
|
|
48634
48970
|
key: "date",
|
|
48635
48971
|
className: "text-xs whitespace-nowrap",
|
|
48636
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48637
|
-
/* @__PURE__ */ (0,
|
|
48638
|
-
/* @__PURE__ */ (0,
|
|
48972
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
|
|
48973
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48974
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48639
48975
|
"span",
|
|
48640
48976
|
{
|
|
48641
48977
|
onClick: () => {
|
|
@@ -48654,7 +48990,7 @@ var ItemReport = ({
|
|
|
48654
48990
|
header: "Description",
|
|
48655
48991
|
key: "description",
|
|
48656
48992
|
className: "text-xs whitespace-nowrap",
|
|
48657
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48993
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.description }) })
|
|
48658
48994
|
},
|
|
48659
48995
|
{
|
|
48660
48996
|
header: "Quantity",
|
|
@@ -48662,7 +48998,7 @@ var ItemReport = ({
|
|
|
48662
48998
|
className: "text-xs whitespace-nowrap",
|
|
48663
48999
|
render: (row) => {
|
|
48664
49000
|
const Qty = row.quantity;
|
|
48665
|
-
return /* @__PURE__ */ (0,
|
|
49001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
|
|
48666
49002
|
"div",
|
|
48667
49003
|
{
|
|
48668
49004
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -48679,7 +49015,7 @@ var ItemReport = ({
|
|
|
48679
49015
|
header: "Balance",
|
|
48680
49016
|
key: "runningBalance",
|
|
48681
49017
|
className: "text-xs whitespace-nowrap",
|
|
48682
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49018
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.XQty(row.runningBalance) }) })
|
|
48683
49019
|
}
|
|
48684
49020
|
];
|
|
48685
49021
|
let runningBalance = 0;
|
|
@@ -48691,10 +49027,10 @@ var ItemReport = ({
|
|
|
48691
49027
|
};
|
|
48692
49028
|
});
|
|
48693
49029
|
const itemName = datas[0]?.name;
|
|
48694
|
-
return /* @__PURE__ */ (0,
|
|
48695
|
-
/* @__PURE__ */ (0,
|
|
48696
|
-
/* @__PURE__ */ (0,
|
|
48697
|
-
/* @__PURE__ */ (0,
|
|
49030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
|
|
49031
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Modal2, {}),
|
|
49032
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(TransactionView, {}),
|
|
49033
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48698
49034
|
A4DataView,
|
|
48699
49035
|
{
|
|
48700
49036
|
columns,
|
|
@@ -48705,14 +49041,14 @@ var ItemReport = ({
|
|
|
48705
49041
|
tableTitle: `${type} Movement Report`,
|
|
48706
49042
|
fixed: false,
|
|
48707
49043
|
error: !id ? "Please select an item" : void 0,
|
|
48708
|
-
headers: /* @__PURE__ */ (0,
|
|
49044
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48709
49045
|
Button,
|
|
48710
49046
|
{
|
|
48711
49047
|
type: "button",
|
|
48712
49048
|
size: "sm",
|
|
48713
49049
|
onClick: () => openState({
|
|
48714
49050
|
title: "Item Transactions",
|
|
48715
|
-
content: /* @__PURE__ */ (0,
|
|
49051
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48716
49052
|
ItemReportHeader2,
|
|
48717
49053
|
{
|
|
48718
49054
|
type,
|
|
@@ -48730,18 +49066,18 @@ var ItemReport = ({
|
|
|
48730
49066
|
)
|
|
48731
49067
|
] });
|
|
48732
49068
|
};
|
|
48733
|
-
var schema3 =
|
|
48734
|
-
pack:
|
|
48735
|
-
product:
|
|
48736
|
-
branch:
|
|
49069
|
+
var schema3 = import_zod127.z.object({
|
|
49070
|
+
pack: import_zod127.z.string().optional(),
|
|
49071
|
+
product: import_zod127.z.string().optional(),
|
|
49072
|
+
branch: import_zod127.z.string()
|
|
48737
49073
|
});
|
|
48738
49074
|
function ItemReportHeader2({
|
|
48739
49075
|
type,
|
|
48740
49076
|
close,
|
|
48741
49077
|
addToParams
|
|
48742
49078
|
}) {
|
|
48743
|
-
const methods = (0,
|
|
48744
|
-
resolver: (0,
|
|
49079
|
+
const methods = (0, import_react_hook_form76.useForm)({
|
|
49080
|
+
resolver: (0, import_zod128.zodResolver)(schema3),
|
|
48745
49081
|
defaultValues: {
|
|
48746
49082
|
pack: "",
|
|
48747
49083
|
product: "",
|
|
@@ -48755,14 +49091,14 @@ function ItemReportHeader2({
|
|
|
48755
49091
|
label: b.name,
|
|
48756
49092
|
value: b._id
|
|
48757
49093
|
}));
|
|
48758
|
-
return /* @__PURE__ */ (0,
|
|
49094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
|
|
48759
49095
|
"form",
|
|
48760
49096
|
{
|
|
48761
49097
|
className: "space-y-3",
|
|
48762
49098
|
onSubmit: handleSubmit((data) => {
|
|
48763
49099
|
const id = type === "pack" ? data.pack : data.product;
|
|
48764
49100
|
if (!id) {
|
|
48765
|
-
|
|
49101
|
+
import_antd98.message.error("Please select an item");
|
|
48766
49102
|
methods.setFocus(type);
|
|
48767
49103
|
return;
|
|
48768
49104
|
}
|
|
@@ -48773,8 +49109,8 @@ function ItemReportHeader2({
|
|
|
48773
49109
|
close();
|
|
48774
49110
|
}),
|
|
48775
49111
|
children: [
|
|
48776
|
-
/* @__PURE__ */ (0,
|
|
48777
|
-
/* @__PURE__ */ (0,
|
|
49112
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49113
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48778
49114
|
Select,
|
|
48779
49115
|
{
|
|
48780
49116
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -48782,7 +49118,7 @@ function ItemReportHeader2({
|
|
|
48782
49118
|
name: "branch"
|
|
48783
49119
|
}
|
|
48784
49120
|
),
|
|
48785
|
-
type === "pack" ? /* @__PURE__ */ (0,
|
|
49121
|
+
type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48786
49122
|
Pack_default.Pack,
|
|
48787
49123
|
{
|
|
48788
49124
|
api: "/packs/get",
|
|
@@ -48790,7 +49126,7 @@ function ItemReportHeader2({
|
|
|
48790
49126
|
form: methods,
|
|
48791
49127
|
name: "pack"
|
|
48792
49128
|
}
|
|
48793
|
-
) : /* @__PURE__ */ (0,
|
|
49129
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48794
49130
|
Feilds_default5.Product,
|
|
48795
49131
|
{
|
|
48796
49132
|
label: "",
|
|
@@ -48801,7 +49137,7 @@ function ItemReportHeader2({
|
|
|
48801
49137
|
}
|
|
48802
49138
|
)
|
|
48803
49139
|
] }),
|
|
48804
|
-
/* @__PURE__ */ (0,
|
|
49140
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("div", { className: "flex gap-2 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Button, { type: "submit", children: "Filter" }) })
|
|
48805
49141
|
]
|
|
48806
49142
|
}
|
|
48807
49143
|
);
|
|
@@ -48809,19 +49145,19 @@ function ItemReportHeader2({
|
|
|
48809
49145
|
var ItemReport_default = ItemReport;
|
|
48810
49146
|
|
|
48811
49147
|
// src/components/accounts/LeaseCollection.tsx
|
|
48812
|
-
var
|
|
48813
|
-
var
|
|
48814
|
-
var
|
|
49148
|
+
var import_react_router_dom129 = require("react-router-dom");
|
|
49149
|
+
var import_react164 = require("react");
|
|
49150
|
+
var import_jsx_runtime269 = require("react/jsx-runtime");
|
|
48815
49151
|
var LeaseCollection = ({
|
|
48816
49152
|
leaseType,
|
|
48817
49153
|
defaultCurrency = "KES"
|
|
48818
49154
|
}) => {
|
|
48819
|
-
const navigate = (0,
|
|
48820
|
-
const [searchParams] = (0,
|
|
49155
|
+
const navigate = (0, import_react_router_dom129.useNavigate)();
|
|
49156
|
+
const [searchParams] = (0, import_react_router_dom129.useSearchParams)();
|
|
48821
49157
|
const { apiConfig } = useWarqadConfig();
|
|
48822
|
-
const { branchId } = (0,
|
|
49158
|
+
const { branchId } = (0, import_react_router_dom129.useParams)();
|
|
48823
49159
|
const { branches } = useAuth_default();
|
|
48824
|
-
const currentBranch = (0,
|
|
49160
|
+
const currentBranch = (0, import_react164.useMemo)(
|
|
48825
49161
|
() => branches?.find((b) => b?._id === branchId),
|
|
48826
49162
|
[branches, branchId]
|
|
48827
49163
|
);
|
|
@@ -48829,16 +49165,16 @@ var LeaseCollection = ({
|
|
|
48829
49165
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
48830
49166
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
48831
49167
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
48832
|
-
const [filter, setFilter] = (0,
|
|
49168
|
+
const [filter, setFilter] = (0, import_react164.useState)(
|
|
48833
49169
|
initialFilter
|
|
48834
49170
|
);
|
|
48835
|
-
const [currencyFilter, setCurrencyFilter] = (0,
|
|
48836
|
-
(0,
|
|
49171
|
+
const [currencyFilter, setCurrencyFilter] = (0, import_react164.useState)(initialCurrency);
|
|
49172
|
+
(0, import_react164.useEffect)(() => {
|
|
48837
49173
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
48838
49174
|
setFilter(urlFilter);
|
|
48839
49175
|
}
|
|
48840
49176
|
}, [urlFilter]);
|
|
48841
|
-
(0,
|
|
49177
|
+
(0, import_react164.useEffect)(() => {
|
|
48842
49178
|
if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
|
|
48843
49179
|
setCurrencyFilter(urlCurrency);
|
|
48844
49180
|
} else {
|
|
@@ -48857,9 +49193,9 @@ var LeaseCollection = ({
|
|
|
48857
49193
|
key: "name",
|
|
48858
49194
|
className: "text-xs whitespace-nowrap ",
|
|
48859
49195
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
48860
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48861
|
-
/* @__PURE__ */ (0,
|
|
48862
|
-
row.unitNames && /* @__PURE__ */ (0,
|
|
49196
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "space-y-1", children: [
|
|
49197
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49198
|
+
row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("p", { className: "text-[9px]! capitalize", children: [
|
|
48863
49199
|
"(",
|
|
48864
49200
|
row.unitNames,
|
|
48865
49201
|
")"
|
|
@@ -48871,7 +49207,7 @@ var LeaseCollection = ({
|
|
|
48871
49207
|
key: "phoneNumber",
|
|
48872
49208
|
maxWidth: 70,
|
|
48873
49209
|
render: (row) => {
|
|
48874
|
-
return /* @__PURE__ */ (0,
|
|
49210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { children: row?.phoneNumber || "N/A" });
|
|
48875
49211
|
}
|
|
48876
49212
|
},
|
|
48877
49213
|
// </span>
|
|
@@ -48881,11 +49217,11 @@ var LeaseCollection = ({
|
|
|
48881
49217
|
className: "text-xs whitespace-nowrap text-right",
|
|
48882
49218
|
render: (row) => {
|
|
48883
49219
|
const Amount = row.totalCollectionString;
|
|
48884
|
-
return /* @__PURE__ */ (0,
|
|
49220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold ", children: Amount }) });
|
|
48885
49221
|
},
|
|
48886
49222
|
renderFooter: (data2) => {
|
|
48887
49223
|
if (currencyFilter === "all") return;
|
|
48888
|
-
return /* @__PURE__ */ (0,
|
|
49224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: " font-bold", children: Formats_default.Price(
|
|
48889
49225
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
48890
49226
|
defaultCurrency,
|
|
48891
49227
|
false
|
|
@@ -48893,7 +49229,7 @@ var LeaseCollection = ({
|
|
|
48893
49229
|
}
|
|
48894
49230
|
}
|
|
48895
49231
|
];
|
|
48896
|
-
const datas = (0,
|
|
49232
|
+
const datas = (0, import_react164.useMemo)(() => {
|
|
48897
49233
|
let runningBalance = 0;
|
|
48898
49234
|
let filteredData = data?.data || [];
|
|
48899
49235
|
const result = filteredData.map((item) => {
|
|
@@ -48906,9 +49242,9 @@ var LeaseCollection = ({
|
|
|
48906
49242
|
});
|
|
48907
49243
|
return result;
|
|
48908
49244
|
}, [filter, currencyFilter, data]);
|
|
48909
|
-
return /* @__PURE__ */ (0,
|
|
48910
|
-
/* @__PURE__ */ (0,
|
|
48911
|
-
/* @__PURE__ */ (0,
|
|
49245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
|
|
49246
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
|
|
49247
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
48912
49248
|
A4DataView,
|
|
48913
49249
|
{
|
|
48914
49250
|
columns,
|
|
@@ -48918,7 +49254,7 @@ var LeaseCollection = ({
|
|
|
48918
49254
|
subtitle: `All Collections`,
|
|
48919
49255
|
fixed: false,
|
|
48920
49256
|
startPage: 1e9,
|
|
48921
|
-
headers: /* @__PURE__ */ (0,
|
|
49257
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex gap-2" })
|
|
48922
49258
|
}
|
|
48923
49259
|
)
|
|
48924
49260
|
] });
|
|
@@ -48926,61 +49262,61 @@ var LeaseCollection = ({
|
|
|
48926
49262
|
var LeaseCollection_default = LeaseCollection;
|
|
48927
49263
|
|
|
48928
49264
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
48929
|
-
var
|
|
48930
|
-
var
|
|
48931
|
-
var
|
|
48932
|
-
var
|
|
49265
|
+
var import_react_router_dom133 = require("react-router-dom");
|
|
49266
|
+
var import_lucide_react128 = require("lucide-react");
|
|
49267
|
+
var import_react168 = require("react");
|
|
49268
|
+
var import_antd102 = require("antd");
|
|
48933
49269
|
|
|
48934
49270
|
// src/components/Transactions/cargoIM/schema.ts
|
|
48935
|
-
var
|
|
48936
|
-
var InvoiceSchema2 =
|
|
48937
|
-
name:
|
|
48938
|
-
quantity:
|
|
48939
|
-
amount:
|
|
49271
|
+
var import_zod130 = require("zod");
|
|
49272
|
+
var InvoiceSchema2 = import_zod130.z.object({
|
|
49273
|
+
name: import_zod130.z.string().min(1, { message: "Item name is required" }),
|
|
49274
|
+
quantity: import_zod130.z.number().gt(0, { message: "Quantity must be greater than 0" }),
|
|
49275
|
+
amount: import_zod130.z.number().gt(0, { message: "Price must be greater than 0" })
|
|
48940
49276
|
});
|
|
48941
|
-
var createInvoiceManagerValidation2 =
|
|
48942
|
-
invoices:
|
|
48943
|
-
date:
|
|
48944
|
-
currency:
|
|
48945
|
-
branch:
|
|
49277
|
+
var createInvoiceManagerValidation2 = import_zod130.z.object({
|
|
49278
|
+
invoices: import_zod130.z.array(InvoiceSchema2),
|
|
49279
|
+
date: import_zod130.z.string(),
|
|
49280
|
+
currency: import_zod130.z.string(),
|
|
49281
|
+
branch: import_zod130.z.string().optional()
|
|
48946
49282
|
});
|
|
48947
|
-
var createAccountSchema3 =
|
|
48948
|
-
name:
|
|
48949
|
-
phoneNumber:
|
|
48950
|
-
branch:
|
|
48951
|
-
currency:
|
|
49283
|
+
var createAccountSchema3 = import_zod130.z.object({
|
|
49284
|
+
name: import_zod130.z.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
49285
|
+
phoneNumber: import_zod130.z.string().optional(),
|
|
49286
|
+
branch: import_zod130.z.string().optional(),
|
|
49287
|
+
currency: import_zod130.z.string().optional()
|
|
48952
49288
|
});
|
|
48953
|
-
var journalSchema5 =
|
|
49289
|
+
var journalSchema5 = import_zod130.z.object({
|
|
48954
49290
|
date: zodFields.date,
|
|
48955
|
-
amount:
|
|
48956
|
-
currency:
|
|
48957
|
-
description:
|
|
48958
|
-
branch:
|
|
48959
|
-
action:
|
|
48960
|
-
note:
|
|
49291
|
+
amount: import_zod130.z.number().gt(0, "Amount must be greater than 0"),
|
|
49292
|
+
currency: import_zod130.z.string(),
|
|
49293
|
+
description: import_zod130.z.string(),
|
|
49294
|
+
branch: import_zod130.z.string().optional(),
|
|
49295
|
+
action: import_zod130.z.enum(Enums_default.actionTypes).optional(),
|
|
49296
|
+
note: import_zod130.z.string().optional()
|
|
48961
49297
|
});
|
|
48962
49298
|
|
|
48963
49299
|
// src/components/Transactions/cargoIM/AccountForm.tsx
|
|
48964
|
-
var
|
|
48965
|
-
var
|
|
48966
|
-
var
|
|
48967
|
-
var
|
|
48968
|
-
var
|
|
48969
|
-
var
|
|
49300
|
+
var import_react_hook_form77 = require("react-hook-form");
|
|
49301
|
+
var import_zod131 = require("@hookform/resolvers/zod");
|
|
49302
|
+
var import_antd99 = require("antd");
|
|
49303
|
+
var import_react165 = require("react");
|
|
49304
|
+
var import_react_router_dom130 = require("react-router-dom");
|
|
49305
|
+
var import_jsx_runtime270 = require("react/jsx-runtime");
|
|
48970
49306
|
function AccountForm3({
|
|
48971
49307
|
onReload,
|
|
48972
49308
|
close,
|
|
48973
49309
|
id
|
|
48974
49310
|
}) {
|
|
48975
|
-
const { branchId } = (0,
|
|
49311
|
+
const { branchId } = (0, import_react_router_dom130.useParams)();
|
|
48976
49312
|
const { currencies } = useWarqadConfig();
|
|
48977
49313
|
const { stock } = currencies;
|
|
48978
49314
|
const isEdit = !!id;
|
|
48979
49315
|
const type = "supplier";
|
|
48980
49316
|
const { post, put, isLoading } = useApis_default();
|
|
48981
49317
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48982
|
-
const methods = (0,
|
|
48983
|
-
resolver: (0,
|
|
49318
|
+
const methods = (0, import_react_hook_form77.useForm)({
|
|
49319
|
+
resolver: (0, import_zod131.zodResolver)(createAccountSchema3),
|
|
48984
49320
|
defaultValues: {
|
|
48985
49321
|
name: "",
|
|
48986
49322
|
phoneNumber: "",
|
|
@@ -49010,7 +49346,7 @@ function AccountForm3({
|
|
|
49010
49346
|
body: payload
|
|
49011
49347
|
});
|
|
49012
49348
|
}
|
|
49013
|
-
|
|
49349
|
+
import_antd99.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
|
|
49014
49350
|
if (onReload) {
|
|
49015
49351
|
onReload();
|
|
49016
49352
|
}
|
|
@@ -49018,7 +49354,7 @@ function AccountForm3({
|
|
|
49018
49354
|
close();
|
|
49019
49355
|
}
|
|
49020
49356
|
} catch (error) {
|
|
49021
|
-
|
|
49357
|
+
import_antd99.message.error(error?.message || "Something went wrong");
|
|
49022
49358
|
}
|
|
49023
49359
|
};
|
|
49024
49360
|
const fetches = async () => {
|
|
@@ -49029,33 +49365,33 @@ function AccountForm3({
|
|
|
49029
49365
|
const data = res.data;
|
|
49030
49366
|
methods.reset(data);
|
|
49031
49367
|
} catch (error) {
|
|
49032
|
-
|
|
49368
|
+
import_antd99.message.error(error?.message || "Something went wrong");
|
|
49033
49369
|
close?.();
|
|
49034
49370
|
}
|
|
49035
49371
|
};
|
|
49036
|
-
(0,
|
|
49372
|
+
(0, import_react165.useEffect)(() => {
|
|
49037
49373
|
if (isEdit) {
|
|
49038
49374
|
fetches();
|
|
49039
49375
|
}
|
|
49040
49376
|
}, [id]);
|
|
49041
|
-
return /* @__PURE__ */ (0,
|
|
49377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
|
|
49042
49378
|
Card,
|
|
49043
49379
|
{
|
|
49044
49380
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49045
49381
|
isLoading: isLoadingGet,
|
|
49046
49382
|
loadingText: "Processing...",
|
|
49047
49383
|
children: [
|
|
49048
|
-
/* @__PURE__ */ (0,
|
|
49049
|
-
/* @__PURE__ */ (0,
|
|
49050
|
-
/* @__PURE__ */ (0,
|
|
49384
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(Card.Header, { children: [
|
|
49385
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49386
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
|
|
49051
49387
|
] }),
|
|
49052
|
-
/* @__PURE__ */ (0,
|
|
49388
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
|
|
49053
49389
|
"form",
|
|
49054
49390
|
{
|
|
49055
49391
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49056
49392
|
children: [
|
|
49057
|
-
/* @__PURE__ */ (0,
|
|
49058
|
-
/* @__PURE__ */ (0,
|
|
49393
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49394
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49059
49395
|
Fields_default.Input,
|
|
49060
49396
|
{
|
|
49061
49397
|
label: "Name",
|
|
@@ -49066,7 +49402,7 @@ function AccountForm3({
|
|
|
49066
49402
|
required: true
|
|
49067
49403
|
}
|
|
49068
49404
|
),
|
|
49069
|
-
/* @__PURE__ */ (0,
|
|
49405
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49070
49406
|
Fields_default.PhoneInput,
|
|
49071
49407
|
{
|
|
49072
49408
|
label: "Phone Number",
|
|
@@ -49075,7 +49411,7 @@ function AccountForm3({
|
|
|
49075
49411
|
placeholder: "Enter phone number"
|
|
49076
49412
|
}
|
|
49077
49413
|
),
|
|
49078
|
-
/* @__PURE__ */ (0,
|
|
49414
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49079
49415
|
Fields_default.Select,
|
|
49080
49416
|
{
|
|
49081
49417
|
label: "Currency",
|
|
@@ -49086,7 +49422,7 @@ function AccountForm3({
|
|
|
49086
49422
|
}
|
|
49087
49423
|
)
|
|
49088
49424
|
] }),
|
|
49089
|
-
/* @__PURE__ */ (0,
|
|
49425
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49090
49426
|
Button,
|
|
49091
49427
|
{
|
|
49092
49428
|
isLoading,
|
|
@@ -49107,33 +49443,33 @@ function AccountForm3({
|
|
|
49107
49443
|
var AccountForm_default3 = AccountForm3;
|
|
49108
49444
|
|
|
49109
49445
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49110
|
-
var
|
|
49111
|
-
var
|
|
49112
|
-
var
|
|
49113
|
-
var
|
|
49114
|
-
var
|
|
49115
|
-
var
|
|
49446
|
+
var import_react166 = require("react");
|
|
49447
|
+
var import_react_hook_form78 = require("react-hook-form");
|
|
49448
|
+
var import_zod132 = require("@hookform/resolvers/zod");
|
|
49449
|
+
var import_react_router_dom131 = require("react-router-dom");
|
|
49450
|
+
var import_antd100 = require("antd");
|
|
49451
|
+
var import_lucide_react127 = require("lucide-react");
|
|
49116
49452
|
var import_dayjs12 = __toESM(require("dayjs"));
|
|
49117
|
-
var
|
|
49453
|
+
var import_jsx_runtime271 = require("react/jsx-runtime");
|
|
49118
49454
|
function InvoiceForm2({
|
|
49119
49455
|
onReload,
|
|
49120
49456
|
close,
|
|
49121
49457
|
accountData,
|
|
49122
49458
|
id
|
|
49123
49459
|
}) {
|
|
49124
|
-
const { branchId } = (0,
|
|
49125
|
-
const [ref2, setRef] = (0,
|
|
49460
|
+
const { branchId } = (0, import_react_router_dom131.useParams)();
|
|
49461
|
+
const [ref2, setRef] = (0, import_react166.useState)(void 0);
|
|
49126
49462
|
const { post, isLoading } = useApis_default();
|
|
49127
49463
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49128
49464
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49129
49465
|
const isEdit = !!id;
|
|
49130
49466
|
const { currencies } = useWarqadConfig();
|
|
49131
49467
|
const { stock: defaultCurrency } = currencies;
|
|
49132
|
-
const [itemName, setItemName] = (0,
|
|
49133
|
-
const [itemQuantity, setItemQuantity] = (0,
|
|
49134
|
-
const [itemPrice, setItemPrice] = (0,
|
|
49135
|
-
const methods = (0,
|
|
49136
|
-
resolver: (0,
|
|
49468
|
+
const [itemName, setItemName] = (0, import_react166.useState)("");
|
|
49469
|
+
const [itemQuantity, setItemQuantity] = (0, import_react166.useState)("");
|
|
49470
|
+
const [itemPrice, setItemPrice] = (0, import_react166.useState)("");
|
|
49471
|
+
const methods = (0, import_react_hook_form78.useForm)({
|
|
49472
|
+
resolver: (0, import_zod132.zodResolver)(createInvoiceManagerValidation2),
|
|
49137
49473
|
defaultValues: {
|
|
49138
49474
|
invoices: [],
|
|
49139
49475
|
date: (0, import_dayjs12.default)().format("DD/MM/YYYY"),
|
|
@@ -49142,7 +49478,7 @@ function InvoiceForm2({
|
|
|
49142
49478
|
}
|
|
49143
49479
|
});
|
|
49144
49480
|
const { handleSubmit, control, register, reset } = methods;
|
|
49145
|
-
const { fields, append, remove } = (0,
|
|
49481
|
+
const { fields, append, remove } = (0, import_react_hook_form78.useFieldArray)({
|
|
49146
49482
|
control,
|
|
49147
49483
|
name: "invoices"
|
|
49148
49484
|
});
|
|
@@ -49157,27 +49493,27 @@ function InvoiceForm2({
|
|
|
49157
49493
|
});
|
|
49158
49494
|
setRef(data?.ref);
|
|
49159
49495
|
} catch (error) {
|
|
49160
|
-
|
|
49496
|
+
import_antd100.message.error(error?.message || "Something went wrong");
|
|
49161
49497
|
}
|
|
49162
49498
|
};
|
|
49163
|
-
(0,
|
|
49499
|
+
(0, import_react166.useEffect)(() => {
|
|
49164
49500
|
if (isEdit) {
|
|
49165
49501
|
fetches();
|
|
49166
49502
|
}
|
|
49167
49503
|
}, [isEdit]);
|
|
49168
49504
|
const handleAddItem = () => {
|
|
49169
49505
|
if (!itemName.trim()) {
|
|
49170
|
-
|
|
49506
|
+
import_antd100.message.error("Item name is required");
|
|
49171
49507
|
return;
|
|
49172
49508
|
}
|
|
49173
49509
|
const qty = Number(itemQuantity);
|
|
49174
49510
|
const price = Number(itemPrice);
|
|
49175
49511
|
if (isNaN(qty) || qty <= 0) {
|
|
49176
|
-
|
|
49512
|
+
import_antd100.message.error("Quantity must be greater than 0");
|
|
49177
49513
|
return;
|
|
49178
49514
|
}
|
|
49179
49515
|
if (isNaN(price) || price <= 0) {
|
|
49180
|
-
|
|
49516
|
+
import_antd100.message.error("Price must be greater than 0");
|
|
49181
49517
|
return;
|
|
49182
49518
|
}
|
|
49183
49519
|
append({
|
|
@@ -49191,7 +49527,7 @@ function InvoiceForm2({
|
|
|
49191
49527
|
};
|
|
49192
49528
|
const onSubmit = async (data) => {
|
|
49193
49529
|
if (data.invoices.length === 0) {
|
|
49194
|
-
|
|
49530
|
+
import_antd100.message.error("Please add at least one item to the invoice");
|
|
49195
49531
|
return;
|
|
49196
49532
|
}
|
|
49197
49533
|
try {
|
|
@@ -49204,13 +49540,13 @@ function InvoiceForm2({
|
|
|
49204
49540
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49205
49541
|
body: payload
|
|
49206
49542
|
});
|
|
49207
|
-
|
|
49543
|
+
import_antd100.message.success(
|
|
49208
49544
|
isEdit ? "Invoice updated successfully" : "Invoice created successfully"
|
|
49209
49545
|
);
|
|
49210
49546
|
if (onReload) onReload();
|
|
49211
49547
|
if (close) close();
|
|
49212
49548
|
} catch (error) {
|
|
49213
|
-
|
|
49549
|
+
import_antd100.message.error(error?.message || "Something went wrong");
|
|
49214
49550
|
}
|
|
49215
49551
|
};
|
|
49216
49552
|
const onReverse = async () => {
|
|
@@ -49219,11 +49555,11 @@ function InvoiceForm2({
|
|
|
49219
49555
|
await put({
|
|
49220
49556
|
url: `/transactions/reverse/${id}`
|
|
49221
49557
|
});
|
|
49222
|
-
|
|
49558
|
+
import_antd100.message.success("Transaction reversed successfully");
|
|
49223
49559
|
if (onReload) onReload();
|
|
49224
49560
|
if (close) close();
|
|
49225
49561
|
} catch (error) {
|
|
49226
|
-
|
|
49562
|
+
import_antd100.message.error(error?.message || "Something went wrong");
|
|
49227
49563
|
}
|
|
49228
49564
|
};
|
|
49229
49565
|
const handleKeyDown = (e) => {
|
|
@@ -49235,25 +49571,25 @@ function InvoiceForm2({
|
|
|
49235
49571
|
e.preventDefault();
|
|
49236
49572
|
}
|
|
49237
49573
|
};
|
|
49238
|
-
return /* @__PURE__ */ (0,
|
|
49574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49239
49575
|
Card,
|
|
49240
49576
|
{
|
|
49241
49577
|
isLoading: getLoading,
|
|
49242
49578
|
className: "max-w-4xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49243
|
-
children: /* @__PURE__ */ (0,
|
|
49244
|
-
/* @__PURE__ */ (0,
|
|
49245
|
-
/* @__PURE__ */ (0,
|
|
49579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Card.Content, { children: [
|
|
49580
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("input", { type: "hidden", ...register("currency") }),
|
|
49581
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49246
49582
|
"form",
|
|
49247
49583
|
{
|
|
49248
49584
|
onSubmit: handleSubmit(onSubmit),
|
|
49249
49585
|
onKeyDown: handleKeyDown,
|
|
49250
49586
|
className: "space-y-6",
|
|
49251
49587
|
children: [
|
|
49252
|
-
/* @__PURE__ */ (0,
|
|
49253
|
-
/* @__PURE__ */ (0,
|
|
49254
|
-
/* @__PURE__ */ (0,
|
|
49255
|
-
/* @__PURE__ */ (0,
|
|
49256
|
-
/* @__PURE__ */ (0,
|
|
49588
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "bg-gray-50 dark:bg-zinc-800/20 p-5 rounded-2xl border border-gray-200 dark:border-zinc-800/60", children: [
|
|
49589
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49590
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49591
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49592
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49257
49593
|
Fields_default.Input,
|
|
49258
49594
|
{
|
|
49259
49595
|
label: "Container No",
|
|
@@ -49262,7 +49598,7 @@ function InvoiceForm2({
|
|
|
49262
49598
|
onChange: (val) => setItemName(val)
|
|
49263
49599
|
}
|
|
49264
49600
|
),
|
|
49265
|
-
/* @__PURE__ */ (0,
|
|
49601
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49266
49602
|
Fields_default.Input,
|
|
49267
49603
|
{
|
|
49268
49604
|
label: "Cbm",
|
|
@@ -49272,7 +49608,7 @@ function InvoiceForm2({
|
|
|
49272
49608
|
onChange: (val) => setItemQuantity(val)
|
|
49273
49609
|
}
|
|
49274
49610
|
),
|
|
49275
|
-
/* @__PURE__ */ (0,
|
|
49611
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49276
49612
|
Fields_default.Input,
|
|
49277
49613
|
{
|
|
49278
49614
|
label: "Price (KES)",
|
|
@@ -49283,7 +49619,7 @@ function InvoiceForm2({
|
|
|
49283
49619
|
}
|
|
49284
49620
|
)
|
|
49285
49621
|
] }),
|
|
49286
|
-
/* @__PURE__ */ (0,
|
|
49622
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49287
49623
|
Button,
|
|
49288
49624
|
{
|
|
49289
49625
|
type: "button",
|
|
@@ -49291,23 +49627,23 @@ function InvoiceForm2({
|
|
|
49291
49627
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49292
49628
|
variant: "outline",
|
|
49293
49629
|
children: [
|
|
49294
|
-
/* @__PURE__ */ (0,
|
|
49630
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(import_lucide_react127.Plus, { size: 16 }),
|
|
49295
49631
|
" Add Item"
|
|
49296
49632
|
]
|
|
49297
49633
|
}
|
|
49298
49634
|
)
|
|
49299
49635
|
] })
|
|
49300
49636
|
] }),
|
|
49301
|
-
/* @__PURE__ */ (0,
|
|
49302
|
-
/* @__PURE__ */ (0,
|
|
49303
|
-
/* @__PURE__ */ (0,
|
|
49304
|
-
/* @__PURE__ */ (0,
|
|
49305
|
-
/* @__PURE__ */ (0,
|
|
49306
|
-
/* @__PURE__ */ (0,
|
|
49307
|
-
/* @__PURE__ */ (0,
|
|
49308
|
-
/* @__PURE__ */ (0,
|
|
49637
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { children: [
|
|
49638
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49639
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "border border-gray-200 dark:border-zinc-800 rounded-2xl overflow-hidden bg-white dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("table", { className: "w-full text-left border-collapse", children: [
|
|
49640
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("thead", { className: "bg-gray-50 dark:bg-zinc-800/40 border-b border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("tr", { children: [
|
|
49641
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 w-8 sm:w-12 text-center", children: "#" }),
|
|
49642
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400", children: "Container No" }),
|
|
49643
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right", children: "total" }),
|
|
49644
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("th", { className: "px-2 sm:px-4 py-1.5 text-[10px] sm:text-xs font-bold uppercase tracking-wider text-gray-500 dark:text-gray-400 text-right w-8 sm:w-12" })
|
|
49309
49645
|
] }) }),
|
|
49310
|
-
/* @__PURE__ */ (0,
|
|
49646
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("tbody", { className: "divide-y divide-gray-100 dark:divide-zinc-800", children: fields.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49311
49647
|
"td",
|
|
49312
49648
|
{
|
|
49313
49649
|
colSpan: 4,
|
|
@@ -49316,30 +49652,30 @@ function InvoiceForm2({
|
|
|
49316
49652
|
}
|
|
49317
49653
|
) }) : fields.map((item, index) => {
|
|
49318
49654
|
const total = item.quantity * item.amount;
|
|
49319
|
-
return /* @__PURE__ */ (0,
|
|
49655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49320
49656
|
"tr",
|
|
49321
49657
|
{
|
|
49322
49658
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49323
49659
|
children: [
|
|
49324
|
-
/* @__PURE__ */ (0,
|
|
49325
|
-
/* @__PURE__ */ (0,
|
|
49326
|
-
/* @__PURE__ */ (0,
|
|
49327
|
-
/* @__PURE__ */ (0,
|
|
49660
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-gray-400 dark:text-zinc-500 font-semibold text-center", children: index + 1 }),
|
|
49661
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
49662
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
49663
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "text-[10px] sm:text-xs text-gray-400 dark:text-zinc-500 mt-0.5", children: [
|
|
49328
49664
|
item.quantity,
|
|
49329
49665
|
" Cbm @",
|
|
49330
49666
|
" ",
|
|
49331
49667
|
Formats_default.Price(item.amount, "KES")
|
|
49332
49668
|
] })
|
|
49333
49669
|
] }),
|
|
49334
|
-
/* @__PURE__ */ (0,
|
|
49335
|
-
/* @__PURE__ */ (0,
|
|
49670
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right font-semibold text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(total, "KES") }),
|
|
49671
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", { className: "px-2 sm:px-4 py-1 text-xs sm:text-sm text-right", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49336
49672
|
"button",
|
|
49337
49673
|
{
|
|
49338
49674
|
type: "button",
|
|
49339
49675
|
onClick: () => remove(index),
|
|
49340
49676
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49341
|
-
children: /* @__PURE__ */ (0,
|
|
49342
|
-
|
|
49677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49678
|
+
import_lucide_react127.Trash2,
|
|
49343
49679
|
{
|
|
49344
49680
|
size: 13,
|
|
49345
49681
|
className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
|
|
@@ -49352,8 +49688,8 @@ function InvoiceForm2({
|
|
|
49352
49688
|
item.id
|
|
49353
49689
|
);
|
|
49354
49690
|
}) }),
|
|
49355
|
-
fields.length > 0 && /* @__PURE__ */ (0,
|
|
49356
|
-
/* @__PURE__ */ (0,
|
|
49691
|
+
fields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-800/10 border-t border-gray-200 dark:border-zinc-800", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("tr", { children: [
|
|
49692
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49357
49693
|
"td",
|
|
49358
49694
|
{
|
|
49359
49695
|
colSpan: 2,
|
|
@@ -49361,20 +49697,20 @@ function InvoiceForm2({
|
|
|
49361
49697
|
children: "Total"
|
|
49362
49698
|
}
|
|
49363
49699
|
),
|
|
49364
|
-
/* @__PURE__ */ (0,
|
|
49700
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", { className: "px-2 sm:px-4 py-1.5 text-xs sm:text-sm font-bold text-right text-gray-900 dark:text-white whitespace-nowrap", children: Formats_default.Price(
|
|
49365
49701
|
fields.reduce(
|
|
49366
49702
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49367
49703
|
0
|
|
49368
49704
|
),
|
|
49369
49705
|
"KES"
|
|
49370
49706
|
) }),
|
|
49371
|
-
/* @__PURE__ */ (0,
|
|
49707
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", {})
|
|
49372
49708
|
] }) })
|
|
49373
49709
|
] }) }) })
|
|
49374
49710
|
] }),
|
|
49375
|
-
/* @__PURE__ */ (0,
|
|
49376
|
-
/* @__PURE__ */ (0,
|
|
49377
|
-
/* @__PURE__ */ (0,
|
|
49711
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
49712
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49713
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49378
49714
|
Fields_default.DateInput,
|
|
49379
49715
|
{
|
|
49380
49716
|
label: "Date",
|
|
@@ -49383,20 +49719,20 @@ function InvoiceForm2({
|
|
|
49383
49719
|
required: true
|
|
49384
49720
|
}
|
|
49385
49721
|
),
|
|
49386
|
-
/* @__PURE__ */ (0,
|
|
49722
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49387
49723
|
] }),
|
|
49388
|
-
/* @__PURE__ */ (0,
|
|
49389
|
-
/* @__PURE__ */ (0,
|
|
49724
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
|
|
49725
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49390
49726
|
ConfirmModal,
|
|
49391
49727
|
{
|
|
49392
49728
|
title: "Reverse Transaction",
|
|
49393
|
-
description: /* @__PURE__ */ (0,
|
|
49394
|
-
/* @__PURE__ */ (0,
|
|
49395
|
-
/* @__PURE__ */ (0,
|
|
49729
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "space-y-3 text-left", children: [
|
|
49730
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49731
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
49396
49732
|
] }),
|
|
49397
49733
|
confirmationWord: "delete",
|
|
49398
49734
|
onSubmit: onReverse,
|
|
49399
|
-
children: /* @__PURE__ */ (0,
|
|
49735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49400
49736
|
Button,
|
|
49401
49737
|
{
|
|
49402
49738
|
type: "button",
|
|
@@ -49409,8 +49745,8 @@ function InvoiceForm2({
|
|
|
49409
49745
|
)
|
|
49410
49746
|
}
|
|
49411
49747
|
) }),
|
|
49412
|
-
/* @__PURE__ */ (0,
|
|
49413
|
-
close && /* @__PURE__ */ (0,
|
|
49748
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex justify-end gap-3", children: [
|
|
49749
|
+
close && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49414
49750
|
Button,
|
|
49415
49751
|
{
|
|
49416
49752
|
type: "button",
|
|
@@ -49420,7 +49756,7 @@ function InvoiceForm2({
|
|
|
49420
49756
|
children: "Cancel"
|
|
49421
49757
|
}
|
|
49422
49758
|
),
|
|
49423
|
-
/* @__PURE__ */ (0,
|
|
49759
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49424
49760
|
Button,
|
|
49425
49761
|
{
|
|
49426
49762
|
isLoading,
|
|
@@ -49444,13 +49780,13 @@ function InvoiceForm2({
|
|
|
49444
49780
|
var InvoiceForm_default2 = InvoiceForm2;
|
|
49445
49781
|
|
|
49446
49782
|
// src/components/Transactions/cargoIM/journalForm.tsx
|
|
49447
|
-
var
|
|
49448
|
-
var
|
|
49449
|
-
var
|
|
49450
|
-
var
|
|
49451
|
-
var
|
|
49783
|
+
var import_react167 = __toESM(require("react"));
|
|
49784
|
+
var import_react_hook_form79 = require("react-hook-form");
|
|
49785
|
+
var import_zod133 = require("@hookform/resolvers/zod");
|
|
49786
|
+
var import_react_router_dom132 = require("react-router-dom");
|
|
49787
|
+
var import_antd101 = require("antd");
|
|
49452
49788
|
var import_dayjs13 = __toESM(require("dayjs"));
|
|
49453
|
-
var
|
|
49789
|
+
var import_jsx_runtime272 = require("react/jsx-runtime");
|
|
49454
49790
|
function JournalForm5({
|
|
49455
49791
|
onReload,
|
|
49456
49792
|
close,
|
|
@@ -49458,16 +49794,16 @@ function JournalForm5({
|
|
|
49458
49794
|
action = "debit",
|
|
49459
49795
|
id
|
|
49460
49796
|
}) {
|
|
49461
|
-
const { branchId } = (0,
|
|
49797
|
+
const { branchId } = (0, import_react_router_dom132.useParams)();
|
|
49462
49798
|
const { currencies } = useWarqadConfig();
|
|
49463
49799
|
const { stock: defaultCurrency } = currencies;
|
|
49464
|
-
const [ref2, setRef] =
|
|
49800
|
+
const [ref2, setRef] = import_react167.default.useState(void 0);
|
|
49465
49801
|
const { post, isLoading } = useApis_default();
|
|
49466
49802
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49467
49803
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49468
49804
|
const isEdit = !!id;
|
|
49469
|
-
const methods = (0,
|
|
49470
|
-
resolver: (0,
|
|
49805
|
+
const methods = (0, import_react_hook_form79.useForm)({
|
|
49806
|
+
resolver: (0, import_zod133.zodResolver)(journalSchema5),
|
|
49471
49807
|
defaultValues: {
|
|
49472
49808
|
date: (0, import_dayjs13.default)().format("DD/MM/YYYY"),
|
|
49473
49809
|
currency: defaultCurrency,
|
|
@@ -49489,10 +49825,10 @@ function JournalForm5({
|
|
|
49489
49825
|
});
|
|
49490
49826
|
setRef(data?.ref);
|
|
49491
49827
|
} catch (error) {
|
|
49492
|
-
|
|
49828
|
+
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49493
49829
|
}
|
|
49494
49830
|
};
|
|
49495
|
-
|
|
49831
|
+
import_react167.default.useEffect(() => {
|
|
49496
49832
|
if (isEdit) {
|
|
49497
49833
|
fetches();
|
|
49498
49834
|
}
|
|
@@ -49510,13 +49846,13 @@ function JournalForm5({
|
|
|
49510
49846
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49511
49847
|
body: payload
|
|
49512
49848
|
});
|
|
49513
|
-
|
|
49849
|
+
import_antd101.message.success(
|
|
49514
49850
|
isEdit ? "Journal updated successfully" : "Journal saved successfully"
|
|
49515
49851
|
);
|
|
49516
49852
|
if (onReload) onReload();
|
|
49517
49853
|
if (close) close();
|
|
49518
49854
|
} catch (error) {
|
|
49519
|
-
|
|
49855
|
+
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49520
49856
|
}
|
|
49521
49857
|
};
|
|
49522
49858
|
const onReverse = async () => {
|
|
@@ -49525,11 +49861,11 @@ function JournalForm5({
|
|
|
49525
49861
|
await put({
|
|
49526
49862
|
url: `/transactions/reverse/${id}`
|
|
49527
49863
|
});
|
|
49528
|
-
|
|
49864
|
+
import_antd101.message.success("Transaction reversed successfully");
|
|
49529
49865
|
if (onReload) onReload();
|
|
49530
49866
|
if (close) close();
|
|
49531
49867
|
} catch (error) {
|
|
49532
|
-
|
|
49868
|
+
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49533
49869
|
}
|
|
49534
49870
|
};
|
|
49535
49871
|
const handleKeyDown = (e) => {
|
|
@@ -49541,19 +49877,19 @@ function JournalForm5({
|
|
|
49541
49877
|
e.preventDefault();
|
|
49542
49878
|
}
|
|
49543
49879
|
};
|
|
49544
|
-
return /* @__PURE__ */ (0,
|
|
49880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49545
49881
|
Card,
|
|
49546
49882
|
{
|
|
49547
49883
|
isLoading: getLoading,
|
|
49548
49884
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49549
|
-
children: /* @__PURE__ */ (0,
|
|
49885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
|
|
49550
49886
|
"form",
|
|
49551
49887
|
{
|
|
49552
49888
|
onSubmit: handleSubmit(onSubmit),
|
|
49553
49889
|
onKeyDown: handleKeyDown,
|
|
49554
49890
|
className: "space-y-4",
|
|
49555
49891
|
children: [
|
|
49556
|
-
/* @__PURE__ */ (0,
|
|
49892
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49557
49893
|
Fields_default.Input,
|
|
49558
49894
|
{
|
|
49559
49895
|
label: "Description",
|
|
@@ -49564,8 +49900,8 @@ function JournalForm5({
|
|
|
49564
49900
|
placeholder: "Enter description"
|
|
49565
49901
|
}
|
|
49566
49902
|
),
|
|
49567
|
-
/* @__PURE__ */ (0,
|
|
49568
|
-
/* @__PURE__ */ (0,
|
|
49903
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49904
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49569
49905
|
Fields_default.DateInput,
|
|
49570
49906
|
{
|
|
49571
49907
|
label: "Date",
|
|
@@ -49574,7 +49910,7 @@ function JournalForm5({
|
|
|
49574
49910
|
required: true
|
|
49575
49911
|
}
|
|
49576
49912
|
),
|
|
49577
|
-
/* @__PURE__ */ (0,
|
|
49913
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49578
49914
|
Fields_default.Input,
|
|
49579
49915
|
{
|
|
49580
49916
|
label: "Currency",
|
|
@@ -49584,8 +49920,8 @@ function JournalForm5({
|
|
|
49584
49920
|
}
|
|
49585
49921
|
)
|
|
49586
49922
|
] }),
|
|
49587
|
-
/* @__PURE__ */ (0,
|
|
49588
|
-
/* @__PURE__ */ (0,
|
|
49923
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49924
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49589
49925
|
Fields_default.Input,
|
|
49590
49926
|
{
|
|
49591
49927
|
label: "Amount",
|
|
@@ -49596,7 +49932,7 @@ function JournalForm5({
|
|
|
49596
49932
|
placeholder: "0.00"
|
|
49597
49933
|
}
|
|
49598
49934
|
),
|
|
49599
|
-
/* @__PURE__ */ (0,
|
|
49935
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49600
49936
|
Fields_default.Select,
|
|
49601
49937
|
{
|
|
49602
49938
|
label: "Action",
|
|
@@ -49610,7 +49946,7 @@ function JournalForm5({
|
|
|
49610
49946
|
}
|
|
49611
49947
|
)
|
|
49612
49948
|
] }),
|
|
49613
|
-
/* @__PURE__ */ (0,
|
|
49949
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49614
49950
|
Fields_default.Textarea,
|
|
49615
49951
|
{
|
|
49616
49952
|
label: "Note",
|
|
@@ -49620,18 +49956,18 @@ function JournalForm5({
|
|
|
49620
49956
|
rows: 3
|
|
49621
49957
|
}
|
|
49622
49958
|
),
|
|
49623
|
-
/* @__PURE__ */ (0,
|
|
49624
|
-
/* @__PURE__ */ (0,
|
|
49959
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-between items-center pt-4 border-t border-gray-100 dark:border-zinc-800", children: [
|
|
49960
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49625
49961
|
ConfirmModal,
|
|
49626
49962
|
{
|
|
49627
49963
|
title: "Reverse Transaction",
|
|
49628
|
-
description: /* @__PURE__ */ (0,
|
|
49629
|
-
/* @__PURE__ */ (0,
|
|
49630
|
-
/* @__PURE__ */ (0,
|
|
49964
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-3 text-left", children: [
|
|
49965
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49966
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { className: "text-xs text-gray-500 bg-gray-50 dark:bg-zinc-800/50 p-3 rounded-lg border border-gray-100 dark:border-zinc-850 italic", children: '"This action will invalidate the transaction and adjust all linked account balances. This process cannot be undone."' })
|
|
49631
49967
|
] }),
|
|
49632
49968
|
confirmationWord: "delete",
|
|
49633
49969
|
onSubmit: onReverse,
|
|
49634
|
-
children: /* @__PURE__ */ (0,
|
|
49970
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49635
49971
|
Button,
|
|
49636
49972
|
{
|
|
49637
49973
|
type: "button",
|
|
@@ -49644,8 +49980,8 @@ function JournalForm5({
|
|
|
49644
49980
|
)
|
|
49645
49981
|
}
|
|
49646
49982
|
) }),
|
|
49647
|
-
/* @__PURE__ */ (0,
|
|
49648
|
-
close && /* @__PURE__ */ (0,
|
|
49983
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-end gap-3", children: [
|
|
49984
|
+
close && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49649
49985
|
Button,
|
|
49650
49986
|
{
|
|
49651
49987
|
type: "button",
|
|
@@ -49655,7 +49991,7 @@ function JournalForm5({
|
|
|
49655
49991
|
children: "Cancel"
|
|
49656
49992
|
}
|
|
49657
49993
|
),
|
|
49658
|
-
/* @__PURE__ */ (0,
|
|
49994
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49659
49995
|
Button,
|
|
49660
49996
|
{
|
|
49661
49997
|
isLoading,
|
|
@@ -49677,15 +50013,15 @@ function JournalForm5({
|
|
|
49677
50013
|
var journalForm_default2 = JournalForm5;
|
|
49678
50014
|
|
|
49679
50015
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49680
|
-
var
|
|
50016
|
+
var import_jsx_runtime273 = require("react/jsx-runtime");
|
|
49681
50017
|
function CargoIM({ v, url }) {
|
|
49682
|
-
const { branchId } = (0,
|
|
50018
|
+
const { branchId } = (0, import_react_router_dom133.useParams)();
|
|
49683
50019
|
const { apiConfig } = useWarqadConfig();
|
|
49684
50020
|
const { width } = useMediaSize();
|
|
49685
50021
|
const isLargeScreen = width > 768;
|
|
49686
|
-
const navigate = (0,
|
|
50022
|
+
const navigate = (0, import_react_router_dom133.useNavigate)();
|
|
49687
50023
|
const type = "supplier";
|
|
49688
|
-
const [deleteAccount, setDeleteAccount] = (0,
|
|
50024
|
+
const [deleteAccount, setDeleteAccount] = (0, import_react168.useState)(null);
|
|
49689
50025
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
49690
50026
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
49691
50027
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -49696,17 +50032,17 @@ function CargoIM({ v, url }) {
|
|
|
49696
50032
|
const items = (data2) => [
|
|
49697
50033
|
{
|
|
49698
50034
|
label: `Edit ${type}`,
|
|
49699
|
-
icon: /* @__PURE__ */ (0,
|
|
50035
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
|
|
49700
50036
|
onClick: () => openState({
|
|
49701
50037
|
type: "Account",
|
|
49702
|
-
content: /* @__PURE__ */ (0,
|
|
50038
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
49703
50039
|
title: "Account Form",
|
|
49704
50040
|
width: 800
|
|
49705
50041
|
})
|
|
49706
50042
|
},
|
|
49707
50043
|
{
|
|
49708
50044
|
label: `Delete ${type}`,
|
|
49709
|
-
icon: /* @__PURE__ */ (0,
|
|
50045
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
|
|
49710
50046
|
onClick: () => setDeleteAccount(data2)
|
|
49711
50047
|
}
|
|
49712
50048
|
].filter(Boolean);
|
|
@@ -49717,7 +50053,7 @@ function CargoIM({ v, url }) {
|
|
|
49717
50053
|
className: "w-full",
|
|
49718
50054
|
cell: ({ row }) => {
|
|
49719
50055
|
const account = row.original;
|
|
49720
|
-
return /* @__PURE__ */ (0,
|
|
50056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49721
50057
|
"span",
|
|
49722
50058
|
{
|
|
49723
50059
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -49746,8 +50082,8 @@ function CargoIM({ v, url }) {
|
|
|
49746
50082
|
className: "w-px whitespace-nowrap",
|
|
49747
50083
|
cell: ({ row }) => {
|
|
49748
50084
|
const data2 = row.original;
|
|
49749
|
-
return /* @__PURE__ */ (0,
|
|
49750
|
-
/* @__PURE__ */ (0,
|
|
50085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex gap-4 items-center", children: [
|
|
50086
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49751
50087
|
"button",
|
|
49752
50088
|
{
|
|
49753
50089
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -49755,7 +50091,7 @@ function CargoIM({ v, url }) {
|
|
|
49755
50091
|
openState({
|
|
49756
50092
|
type: "credit",
|
|
49757
50093
|
closeOnOverlayClick: false,
|
|
49758
|
-
content: /* @__PURE__ */ (0,
|
|
50094
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49759
50095
|
InvoiceForm_default2,
|
|
49760
50096
|
{
|
|
49761
50097
|
onReload: reload,
|
|
@@ -49770,7 +50106,7 @@ function CargoIM({ v, url }) {
|
|
|
49770
50106
|
children: "Inv"
|
|
49771
50107
|
}
|
|
49772
50108
|
),
|
|
49773
|
-
/* @__PURE__ */ (0,
|
|
50109
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49774
50110
|
"button",
|
|
49775
50111
|
{
|
|
49776
50112
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -49778,7 +50114,7 @@ function CargoIM({ v, url }) {
|
|
|
49778
50114
|
openState({
|
|
49779
50115
|
type: "debit",
|
|
49780
50116
|
closeOnOverlayClick: false,
|
|
49781
|
-
content: /* @__PURE__ */ (0,
|
|
50117
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49782
50118
|
journalForm_default2,
|
|
49783
50119
|
{
|
|
49784
50120
|
onReload: reload,
|
|
@@ -49794,14 +50130,14 @@ function CargoIM({ v, url }) {
|
|
|
49794
50130
|
children: "Pay"
|
|
49795
50131
|
}
|
|
49796
50132
|
),
|
|
49797
|
-
/* @__PURE__ */ (0,
|
|
50133
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49798
50134
|
Dropdown,
|
|
49799
50135
|
{
|
|
49800
50136
|
className: "cursor-pointer",
|
|
49801
50137
|
width: "w-[150px]",
|
|
49802
50138
|
items: items(data2),
|
|
49803
50139
|
triggerMode: "hover",
|
|
49804
|
-
children: /* @__PURE__ */ (0,
|
|
50140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.EllipsisVertical, {})
|
|
49805
50141
|
}
|
|
49806
50142
|
)
|
|
49807
50143
|
] });
|
|
@@ -49817,17 +50153,17 @@ function CargoIM({ v, url }) {
|
|
|
49817
50153
|
const onDelete = async (id) => {
|
|
49818
50154
|
try {
|
|
49819
50155
|
await remove({ url: `/accounts/delete/${id}` });
|
|
49820
|
-
|
|
50156
|
+
import_antd102.message.success("Account deleted successfully");
|
|
49821
50157
|
reload();
|
|
49822
50158
|
setDeleteAccount(null);
|
|
49823
50159
|
} catch (error) {
|
|
49824
|
-
|
|
50160
|
+
import_antd102.message.error(error.message || "Something went wrong");
|
|
49825
50161
|
return error;
|
|
49826
50162
|
}
|
|
49827
50163
|
};
|
|
49828
|
-
return /* @__PURE__ */ (0,
|
|
49829
|
-
/* @__PURE__ */ (0,
|
|
49830
|
-
/* @__PURE__ */ (0,
|
|
50164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [
|
|
50165
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Modal2, {}),
|
|
50166
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49831
50167
|
ConfirmModal,
|
|
49832
50168
|
{
|
|
49833
50169
|
isOpen: !!deleteAccount,
|
|
@@ -49840,7 +50176,7 @@ function CargoIM({ v, url }) {
|
|
|
49840
50176
|
children: null
|
|
49841
50177
|
}
|
|
49842
50178
|
),
|
|
49843
|
-
/* @__PURE__ */ (0,
|
|
50179
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49844
50180
|
TransactionViewComponent,
|
|
49845
50181
|
{
|
|
49846
50182
|
columns,
|
|
@@ -49851,7 +50187,7 @@ function CargoIM({ v, url }) {
|
|
|
49851
50187
|
onCreate: () => {
|
|
49852
50188
|
openState({
|
|
49853
50189
|
type: "account",
|
|
49854
|
-
content: /* @__PURE__ */ (0,
|
|
50190
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(AccountForm_default3, { onReload: reload, close }),
|
|
49855
50191
|
title: "Account Form",
|
|
49856
50192
|
width: 800
|
|
49857
50193
|
});
|
|
@@ -49863,9 +50199,9 @@ function CargoIM({ v, url }) {
|
|
|
49863
50199
|
var CargoIM_default = CargoIM;
|
|
49864
50200
|
|
|
49865
50201
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
49866
|
-
var
|
|
49867
|
-
var
|
|
49868
|
-
var
|
|
50202
|
+
var import_react_router_dom134 = require("react-router-dom");
|
|
50203
|
+
var import_react169 = require("react");
|
|
50204
|
+
var import_jsx_runtime274 = require("react/jsx-runtime");
|
|
49869
50205
|
var CargoIMReport = () => {
|
|
49870
50206
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
49871
50207
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -49878,10 +50214,10 @@ var CargoIMReport = () => {
|
|
|
49878
50214
|
value: currency2
|
|
49879
50215
|
};
|
|
49880
50216
|
});
|
|
49881
|
-
const [searchParams, setSearchParams] = (0,
|
|
50217
|
+
const [searchParams, setSearchParams] = (0, import_react_router_dom134.useSearchParams)();
|
|
49882
50218
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49883
50219
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
49884
|
-
const [currencyFilter, setCurrencyFilter] = (0,
|
|
50220
|
+
const [currencyFilter, setCurrencyFilter] = (0, import_react169.useState)(initialCurrency);
|
|
49885
50221
|
const handleCurrencyChange = (value) => {
|
|
49886
50222
|
setCurrencyFilter(value);
|
|
49887
50223
|
setSearchParams((prev) => {
|
|
@@ -49889,7 +50225,7 @@ var CargoIMReport = () => {
|
|
|
49889
50225
|
return prev;
|
|
49890
50226
|
});
|
|
49891
50227
|
};
|
|
49892
|
-
(0,
|
|
50228
|
+
(0, import_react169.useEffect)(() => {
|
|
49893
50229
|
if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
|
|
49894
50230
|
setCurrencyFilter(urlCurrency);
|
|
49895
50231
|
}
|
|
@@ -49909,9 +50245,9 @@ var CargoIMReport = () => {
|
|
|
49909
50245
|
header: "Date",
|
|
49910
50246
|
key: "date",
|
|
49911
50247
|
className: "text-xs whitespace-nowrap",
|
|
49912
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49913
|
-
/* @__PURE__ */ (0,
|
|
49914
|
-
/* @__PURE__ */ (0,
|
|
50248
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "", children: [
|
|
50249
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50250
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49915
50251
|
"span",
|
|
49916
50252
|
{
|
|
49917
50253
|
onClick: () => {
|
|
@@ -49930,13 +50266,13 @@ var CargoIMReport = () => {
|
|
|
49930
50266
|
header: "Container No",
|
|
49931
50267
|
key: "description",
|
|
49932
50268
|
className: "text-xs w-full break-words",
|
|
49933
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50269
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
49934
50270
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
49935
50271
|
/[^a-zA-Z0-9]/g,
|
|
49936
50272
|
""
|
|
49937
50273
|
);
|
|
49938
50274
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
49939
|
-
return /* @__PURE__ */ (0,
|
|
50275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49940
50276
|
"div",
|
|
49941
50277
|
{
|
|
49942
50278
|
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`,
|
|
@@ -49950,13 +50286,13 @@ var CargoIMReport = () => {
|
|
|
49950
50286
|
header: "Cbm",
|
|
49951
50287
|
key: "cbm",
|
|
49952
50288
|
className: "text-xs whitespace-nowrap text-right",
|
|
49953
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50289
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
49954
50290
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
49955
50291
|
/[^a-zA-Z0-9]/g,
|
|
49956
50292
|
""
|
|
49957
50293
|
);
|
|
49958
50294
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
49959
|
-
return /* @__PURE__ */ (0,
|
|
50295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49960
50296
|
"div",
|
|
49961
50297
|
{
|
|
49962
50298
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -49973,20 +50309,20 @@ var CargoIMReport = () => {
|
|
|
49973
50309
|
),
|
|
49974
50310
|
0
|
|
49975
50311
|
);
|
|
49976
|
-
return totalCbm > 0 ? /* @__PURE__ */ (0,
|
|
50312
|
+
return totalCbm > 0 ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: totalCbm }) : null;
|
|
49977
50313
|
}
|
|
49978
50314
|
},
|
|
49979
50315
|
{
|
|
49980
50316
|
header: "Price",
|
|
49981
50317
|
key: "price",
|
|
49982
50318
|
className: "text-xs whitespace-nowrap text-right",
|
|
49983
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50319
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
49984
50320
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
49985
50321
|
/[^a-zA-Z0-9]/g,
|
|
49986
50322
|
""
|
|
49987
50323
|
);
|
|
49988
50324
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
49989
|
-
return /* @__PURE__ */ (0,
|
|
50325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49990
50326
|
"div",
|
|
49991
50327
|
{
|
|
49992
50328
|
className: `${lineClass} min-h-[24px] py-1 flex items-center justify-end font-bold text-black dark:text-white print:text-black whitespace-nowrap`,
|
|
@@ -50000,13 +50336,13 @@ var CargoIMReport = () => {
|
|
|
50000
50336
|
header: "Credit",
|
|
50001
50337
|
key: "credit",
|
|
50002
50338
|
className: "text-xs whitespace-nowrap text-right",
|
|
50003
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50339
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50004
50340
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50005
50341
|
/[^a-zA-Z0-9]/g,
|
|
50006
50342
|
""
|
|
50007
50343
|
);
|
|
50008
50344
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50009
|
-
return /* @__PURE__ */ (0,
|
|
50345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50010
50346
|
"div",
|
|
50011
50347
|
{
|
|
50012
50348
|
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`,
|
|
@@ -50015,7 +50351,7 @@ var CargoIMReport = () => {
|
|
|
50015
50351
|
idx
|
|
50016
50352
|
);
|
|
50017
50353
|
}) }),
|
|
50018
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50354
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50019
50355
|
data2.reduce(
|
|
50020
50356
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50021
50357
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50029,13 +50365,13 @@ var CargoIMReport = () => {
|
|
|
50029
50365
|
header: "Debit",
|
|
50030
50366
|
key: "debit",
|
|
50031
50367
|
className: "text-xs whitespace-nowrap text-right",
|
|
50032
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50368
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex flex-col divide-y divide-gray-100 dark:divide-zinc-800/50 print:divide-gray-100", children: (row.lines || []).map((line, idx) => {
|
|
50033
50369
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50034
50370
|
/[^a-zA-Z0-9]/g,
|
|
50035
50371
|
""
|
|
50036
50372
|
);
|
|
50037
50373
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50038
|
-
return /* @__PURE__ */ (0,
|
|
50374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50039
50375
|
"div",
|
|
50040
50376
|
{
|
|
50041
50377
|
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`,
|
|
@@ -50044,7 +50380,7 @@ var CargoIMReport = () => {
|
|
|
50044
50380
|
idx
|
|
50045
50381
|
);
|
|
50046
50382
|
}) }),
|
|
50047
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50383
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50048
50384
|
data2.reduce(
|
|
50049
50385
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50050
50386
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50058,14 +50394,14 @@ var CargoIMReport = () => {
|
|
|
50058
50394
|
header: "Balance",
|
|
50059
50395
|
key: "runningBalance",
|
|
50060
50396
|
className: "text-xs whitespace-nowrap text-right",
|
|
50061
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50062
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50397
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Price(row.runningBalance, currency) }),
|
|
50398
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold", children: Formats_default.Price(
|
|
50063
50399
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50064
50400
|
currency
|
|
50065
50401
|
) })
|
|
50066
50402
|
}
|
|
50067
50403
|
];
|
|
50068
|
-
const datas = (0,
|
|
50404
|
+
const datas = (0, import_react169.useMemo)(() => {
|
|
50069
50405
|
let runningBalance = 0;
|
|
50070
50406
|
const transactions = data?.data?.transactions;
|
|
50071
50407
|
const res = (transactions || []).map((item) => {
|
|
@@ -50102,10 +50438,10 @@ var CargoIMReport = () => {
|
|
|
50102
50438
|
{ label: "Account Type", value: data?.data?.type },
|
|
50103
50439
|
{ label: "Currency", value: currencyFilter }
|
|
50104
50440
|
];
|
|
50105
|
-
return /* @__PURE__ */ (0,
|
|
50106
|
-
/* @__PURE__ */ (0,
|
|
50107
|
-
/* @__PURE__ */ (0,
|
|
50108
|
-
/* @__PURE__ */ (0,
|
|
50441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_jsx_runtime274.Fragment, { children: [
|
|
50442
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Modal2, {}),
|
|
50443
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(TransactionView, {}),
|
|
50444
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50109
50445
|
A4DataView,
|
|
50110
50446
|
{
|
|
50111
50447
|
columns,
|
|
@@ -50120,7 +50456,7 @@ var CargoIMReport = () => {
|
|
|
50120
50456
|
openState({
|
|
50121
50457
|
type: "debit",
|
|
50122
50458
|
closeOnOverlayClick: false,
|
|
50123
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */ (0,
|
|
50459
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50124
50460
|
InvoiceForm_default2,
|
|
50125
50461
|
{
|
|
50126
50462
|
close: closeTransaction,
|
|
@@ -50128,7 +50464,7 @@ var CargoIMReport = () => {
|
|
|
50128
50464
|
onReload: reload,
|
|
50129
50465
|
id: row._id
|
|
50130
50466
|
}
|
|
50131
|
-
) : /* @__PURE__ */ (0,
|
|
50467
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50132
50468
|
journalForm_default2,
|
|
50133
50469
|
{
|
|
50134
50470
|
close: closeTransaction,
|
|
@@ -50141,7 +50477,7 @@ var CargoIMReport = () => {
|
|
|
50141
50477
|
width: 800
|
|
50142
50478
|
});
|
|
50143
50479
|
},
|
|
50144
|
-
headers: /* @__PURE__ */ (0,
|
|
50480
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50145
50481
|
Fields_default.Select,
|
|
50146
50482
|
{
|
|
50147
50483
|
options: currencies,
|
|
@@ -50157,16 +50493,16 @@ var CargoIMReport = () => {
|
|
|
50157
50493
|
var cargoIMReport_default = CargoIMReport;
|
|
50158
50494
|
|
|
50159
50495
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50160
|
-
var
|
|
50161
|
-
var
|
|
50162
|
-
var
|
|
50163
|
-
var
|
|
50164
|
-
var
|
|
50496
|
+
var import_react_router_dom135 = require("react-router-dom");
|
|
50497
|
+
var import_lucide_react129 = require("lucide-react");
|
|
50498
|
+
var import_react170 = require("react");
|
|
50499
|
+
var import_antd103 = require("antd");
|
|
50500
|
+
var import_jsx_runtime275 = require("react/jsx-runtime");
|
|
50165
50501
|
function Forex2Accounts({ v, url }) {
|
|
50166
|
-
const { branchId } = (0,
|
|
50167
|
-
const navigate = (0,
|
|
50502
|
+
const { branchId } = (0, import_react_router_dom135.useParams)();
|
|
50503
|
+
const navigate = (0, import_react_router_dom135.useNavigate)();
|
|
50168
50504
|
const type = "account";
|
|
50169
|
-
const [deleteAccount, setDeleteAccount] = (0,
|
|
50505
|
+
const [deleteAccount, setDeleteAccount] = (0, import_react170.useState)(null);
|
|
50170
50506
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50171
50507
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50172
50508
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50177,22 +50513,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50177
50513
|
const items = (data2) => [
|
|
50178
50514
|
{
|
|
50179
50515
|
label: `Currency Report`,
|
|
50180
|
-
icon: /* @__PURE__ */ (0,
|
|
50516
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.FileChartLine, { size: 16 }),
|
|
50181
50517
|
onClick: () => navigate(data2?._id)
|
|
50182
50518
|
},
|
|
50183
50519
|
{
|
|
50184
50520
|
label: `Edit ${type}`,
|
|
50185
|
-
icon: /* @__PURE__ */ (0,
|
|
50521
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
|
|
50186
50522
|
onClick: () => openState({
|
|
50187
50523
|
type: "forex account",
|
|
50188
|
-
content: /* @__PURE__ */ (0,
|
|
50524
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50189
50525
|
title: "Forex Account Form",
|
|
50190
50526
|
width: 800
|
|
50191
50527
|
})
|
|
50192
50528
|
},
|
|
50193
50529
|
{
|
|
50194
50530
|
label: `Delete ${type}`,
|
|
50195
|
-
icon: /* @__PURE__ */ (0,
|
|
50531
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
|
|
50196
50532
|
onClick: () => setDeleteAccount(data2)
|
|
50197
50533
|
}
|
|
50198
50534
|
].filter(Boolean);
|
|
@@ -50202,7 +50538,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50202
50538
|
header: "Name",
|
|
50203
50539
|
cell: ({ row }) => {
|
|
50204
50540
|
const account = row.original;
|
|
50205
|
-
return /* @__PURE__ */ (0,
|
|
50541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50206
50542
|
"span",
|
|
50207
50543
|
{
|
|
50208
50544
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50217,7 +50553,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50217
50553
|
header: "Phone",
|
|
50218
50554
|
cell: ({ row }) => {
|
|
50219
50555
|
const account = row.original;
|
|
50220
|
-
return /* @__PURE__ */ (0,
|
|
50556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { children: account?.phoneNumber || "N/A" });
|
|
50221
50557
|
}
|
|
50222
50558
|
},
|
|
50223
50559
|
{
|
|
@@ -50225,14 +50561,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50225
50561
|
header: "Balances",
|
|
50226
50562
|
cell: ({ row }) => {
|
|
50227
50563
|
const account = row.original;
|
|
50228
|
-
return /* @__PURE__ */ (0,
|
|
50229
|
-
([currency, data2]) => /* @__PURE__ */ (0,
|
|
50564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50565
|
+
([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
50230
50566
|
"div",
|
|
50231
50567
|
{
|
|
50232
50568
|
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",
|
|
50233
50569
|
children: [
|
|
50234
|
-
/* @__PURE__ */ (0,
|
|
50235
|
-
/* @__PURE__ */ (0,
|
|
50570
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50571
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50236
50572
|
"span",
|
|
50237
50573
|
{
|
|
50238
50574
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50251,8 +50587,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50251
50587
|
header: "Actions",
|
|
50252
50588
|
cell: ({ row }) => {
|
|
50253
50589
|
const data2 = row.original;
|
|
50254
|
-
return /* @__PURE__ */ (0,
|
|
50255
|
-
/* @__PURE__ */ (0,
|
|
50590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex gap-4 items-center", children: [
|
|
50591
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50256
50592
|
"button",
|
|
50257
50593
|
{
|
|
50258
50594
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50260,7 +50596,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50260
50596
|
openState({
|
|
50261
50597
|
type: "credit",
|
|
50262
50598
|
closeOnOverlayClick: false,
|
|
50263
|
-
content: /* @__PURE__ */ (0,
|
|
50599
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50264
50600
|
Forex2FormTransaction_default,
|
|
50265
50601
|
{
|
|
50266
50602
|
close,
|
|
@@ -50276,7 +50612,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50276
50612
|
children: "Out"
|
|
50277
50613
|
}
|
|
50278
50614
|
),
|
|
50279
|
-
/* @__PURE__ */ (0,
|
|
50615
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50280
50616
|
"button",
|
|
50281
50617
|
{
|
|
50282
50618
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50284,7 +50620,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50284
50620
|
openState({
|
|
50285
50621
|
type: "debit",
|
|
50286
50622
|
closeOnOverlayClick: false,
|
|
50287
|
-
content: /* @__PURE__ */ (0,
|
|
50623
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50288
50624
|
Forex2FormTransaction_default,
|
|
50289
50625
|
{
|
|
50290
50626
|
close,
|
|
@@ -50300,13 +50636,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50300
50636
|
children: "In"
|
|
50301
50637
|
}
|
|
50302
50638
|
),
|
|
50303
|
-
/* @__PURE__ */ (0,
|
|
50639
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50304
50640
|
Dropdown,
|
|
50305
50641
|
{
|
|
50306
50642
|
className: "cursor-pointer w-[150px]",
|
|
50307
50643
|
items: items(data2),
|
|
50308
50644
|
triggerMode: "hover",
|
|
50309
|
-
children: /* @__PURE__ */ (0,
|
|
50645
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.EllipsisVertical, {})
|
|
50310
50646
|
}
|
|
50311
50647
|
)
|
|
50312
50648
|
] });
|
|
@@ -50317,11 +50653,11 @@ function Forex2Accounts({ v, url }) {
|
|
|
50317
50653
|
const onDelete = async (id) => {
|
|
50318
50654
|
try {
|
|
50319
50655
|
await remove({ url: `/accounts/delete/${id}` });
|
|
50320
|
-
|
|
50656
|
+
import_antd103.message.success("Account deleted successfully");
|
|
50321
50657
|
reload();
|
|
50322
50658
|
setDeleteAccount(null);
|
|
50323
50659
|
} catch (error) {
|
|
50324
|
-
|
|
50660
|
+
import_antd103.message.error(error.message || "Something went wrong");
|
|
50325
50661
|
return error;
|
|
50326
50662
|
}
|
|
50327
50663
|
};
|
|
@@ -50345,9 +50681,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50345
50681
|
};
|
|
50346
50682
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50347
50683
|
console.log(currencies);
|
|
50348
|
-
return /* @__PURE__ */ (0,
|
|
50349
|
-
/* @__PURE__ */ (0,
|
|
50350
|
-
/* @__PURE__ */ (0,
|
|
50684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(import_jsx_runtime275.Fragment, { children: [
|
|
50685
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Modal2, {}),
|
|
50686
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50351
50687
|
ConfirmModal,
|
|
50352
50688
|
{
|
|
50353
50689
|
isOpen: !!deleteAccount,
|
|
@@ -50360,9 +50696,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50360
50696
|
children: null
|
|
50361
50697
|
}
|
|
50362
50698
|
),
|
|
50363
|
-
/* @__PURE__ */ (0,
|
|
50364
|
-
/* @__PURE__ */ (0,
|
|
50365
|
-
/* @__PURE__ */ (0,
|
|
50699
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { children: [
|
|
50700
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
|
|
50701
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50366
50702
|
TransactionViewComponent,
|
|
50367
50703
|
{
|
|
50368
50704
|
columns,
|
|
@@ -50374,7 +50710,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50374
50710
|
onCreate: () => {
|
|
50375
50711
|
openState({
|
|
50376
50712
|
type: "forex account",
|
|
50377
|
-
content: /* @__PURE__ */ (0,
|
|
50713
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountForm_default, { close, reloads: reload }),
|
|
50378
50714
|
title: "Forex Account Form",
|
|
50379
50715
|
width: 800
|
|
50380
50716
|
});
|
|
@@ -50387,14 +50723,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50387
50723
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50388
50724
|
|
|
50389
50725
|
// src/components/reports/ProductList.tsx
|
|
50390
|
-
var
|
|
50391
|
-
var
|
|
50726
|
+
var import_react_router_dom136 = require("react-router-dom");
|
|
50727
|
+
var import_jsx_runtime276 = require("react/jsx-runtime");
|
|
50392
50728
|
var options9 = [
|
|
50393
50729
|
{ label: "Product", value: "product" },
|
|
50394
50730
|
{ label: "Pack", value: "pack" }
|
|
50395
50731
|
];
|
|
50396
50732
|
var ProductList2 = ({ value = false }) => {
|
|
50397
|
-
const { branchId } = (0,
|
|
50733
|
+
const { branchId } = (0, import_react_router_dom136.useParams)();
|
|
50398
50734
|
const { branches } = useAuth_default();
|
|
50399
50735
|
const { TransactionView } = useTransactionView_default();
|
|
50400
50736
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50416,7 +50752,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50416
50752
|
key: "name",
|
|
50417
50753
|
className: "text-xs whitespace-nowrap",
|
|
50418
50754
|
render: (row) => {
|
|
50419
|
-
return /* @__PURE__ */ (0,
|
|
50755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.name }) });
|
|
50420
50756
|
}
|
|
50421
50757
|
},
|
|
50422
50758
|
...value ? [
|
|
@@ -50424,14 +50760,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50424
50760
|
header: "Cost",
|
|
50425
50761
|
key: "cost",
|
|
50426
50762
|
className: "text-xs whitespace-nowrap text-right",
|
|
50427
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50763
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime276.jsx)("span", { className: "font-bold text-black dark:text-white print:text-black", children: Formats_default.Amount(row.cost, false) })
|
|
50428
50764
|
}
|
|
50429
50765
|
] : []
|
|
50430
50766
|
];
|
|
50431
50767
|
const datas = data?.data || [];
|
|
50432
|
-
return /* @__PURE__ */ (0,
|
|
50433
|
-
/* @__PURE__ */ (0,
|
|
50434
|
-
/* @__PURE__ */ (0,
|
|
50768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
|
|
50769
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(TransactionView, {}),
|
|
50770
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50435
50771
|
A4DataView,
|
|
50436
50772
|
{
|
|
50437
50773
|
columns,
|
|
@@ -50442,7 +50778,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50442
50778
|
tableTitle: "Stock List",
|
|
50443
50779
|
fixed: false,
|
|
50444
50780
|
startPage: 1e10,
|
|
50445
|
-
headers: /* @__PURE__ */ (0,
|
|
50781
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50446
50782
|
Select,
|
|
50447
50783
|
{
|
|
50448
50784
|
options: options9,
|