warqadui 0.0.279 → 0.0.280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +701 -359
- package/dist/index.mjs +699 -357
- package/package.json +1 -1
package/dist/index.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
|
{
|
|
@@ -48446,7 +48446,7 @@ var Expenses3Reports = () => {
|
|
|
48446
48446
|
const [startDate, setStartDate] = (0, import_react161.useState)(null);
|
|
48447
48447
|
const [endDate, setEndDate] = (0, import_react161.useState)(null);
|
|
48448
48448
|
const { A4DataView, data } = useA4DataView_default({
|
|
48449
|
-
url: `/transactions/get?
|
|
48449
|
+
url: `/transactions/get?isExpenses3=true${branchId ? `&branch=${branchId}` : ""}`,
|
|
48450
48450
|
v: 1
|
|
48451
48451
|
// No prefix
|
|
48452
48452
|
});
|
|
@@ -48577,6 +48577,347 @@ var Reports3 = {
|
|
|
48577
48577
|
};
|
|
48578
48578
|
var reports_default = Reports3;
|
|
48579
48579
|
|
|
48580
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal.tsx
|
|
48581
|
+
var import_react_router_dom126 = require("react-router-dom");
|
|
48582
|
+
var import_lucide_react126 = require("lucide-react");
|
|
48583
|
+
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
48584
|
+
function ExpensesJournal3({ url }) {
|
|
48585
|
+
const { branchId } = (0, import_react_router_dom126.useParams)();
|
|
48586
|
+
const navigate = (0, import_react_router_dom126.useNavigate)();
|
|
48587
|
+
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
48588
|
+
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
48589
|
+
url: url || `/transactions/get?type=expense-journal-3${branchId ? `&branch=${branchId}` : ""}`,
|
|
48590
|
+
dateFilter: true
|
|
48591
|
+
});
|
|
48592
|
+
const { Modal: Modal2 } = useModal();
|
|
48593
|
+
const items = (data2) => [
|
|
48594
|
+
{
|
|
48595
|
+
label: `View Expense`,
|
|
48596
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
|
|
48597
|
+
onClick: () => openTransaction({ id: data2?._id, type: "expense-3" })
|
|
48598
|
+
},
|
|
48599
|
+
{
|
|
48600
|
+
label: `Edit Expense`,
|
|
48601
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.FilePenLine, { size: 16 }),
|
|
48602
|
+
onClick: () => navigate(`update?id=${data2?._id}`)
|
|
48603
|
+
},
|
|
48604
|
+
{
|
|
48605
|
+
label: `Delete Expense`,
|
|
48606
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.Trash2, { className: "text-red-500", size: 16 }),
|
|
48607
|
+
onClick: () => {
|
|
48608
|
+
openTransaction({
|
|
48609
|
+
id: data2?._id,
|
|
48610
|
+
type: "expense",
|
|
48611
|
+
reverseable: { reload }
|
|
48612
|
+
});
|
|
48613
|
+
}
|
|
48614
|
+
}
|
|
48615
|
+
].filter(Boolean);
|
|
48616
|
+
const columns = [
|
|
48617
|
+
{
|
|
48618
|
+
accessorKey: "date",
|
|
48619
|
+
header: "Date",
|
|
48620
|
+
cell: ({ row }) => {
|
|
48621
|
+
const expense = row.original;
|
|
48622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col", children: [
|
|
48623
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { children: expense?.date }),
|
|
48624
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48625
|
+
"span",
|
|
48626
|
+
{
|
|
48627
|
+
onClick: () => openTransaction({ id: expense?._id, type: "expense-3" }),
|
|
48628
|
+
className: "text-xs text-blue-600 italic cursor-pointer hover:underline",
|
|
48629
|
+
children: expense.ref
|
|
48630
|
+
}
|
|
48631
|
+
)
|
|
48632
|
+
] });
|
|
48633
|
+
}
|
|
48634
|
+
},
|
|
48635
|
+
{
|
|
48636
|
+
accessorKey: "description",
|
|
48637
|
+
header: "Description",
|
|
48638
|
+
cell: ({ row }) => {
|
|
48639
|
+
const expense = row.original;
|
|
48640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "flex flex-col", children: [
|
|
48641
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "capitalize", children: expense?.description }),
|
|
48642
|
+
expense?.note && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("span", { className: "text-xs text-gray-500 italic max-w-xs truncate", children: expense?.note })
|
|
48643
|
+
] });
|
|
48644
|
+
}
|
|
48645
|
+
},
|
|
48646
|
+
{
|
|
48647
|
+
accessorKey: "amount",
|
|
48648
|
+
header: "Amount",
|
|
48649
|
+
cell: ({ row }) => {
|
|
48650
|
+
const expense = row.original;
|
|
48651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("div", { className: "", children: [
|
|
48652
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)("p", { className: "font-medium text-red-600", children: Formats_default.Price(expense?.amount, expense?.currency) }),
|
|
48653
|
+
expense?.exchange?.rate && expense?.exchange?.rate > 0 && /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)("p", { className: "text-xs text-gray-500 italic", children: [
|
|
48654
|
+
"rate ",
|
|
48655
|
+
expense?.exchange?.rate,
|
|
48656
|
+
" ,",
|
|
48657
|
+
" ",
|
|
48658
|
+
Formats_default.Price(
|
|
48659
|
+
expense?.exchange?.amount || 0,
|
|
48660
|
+
expense?.exchange?.currency
|
|
48661
|
+
)
|
|
48662
|
+
] })
|
|
48663
|
+
] });
|
|
48664
|
+
}
|
|
48665
|
+
},
|
|
48666
|
+
{
|
|
48667
|
+
accessorKey: "actions",
|
|
48668
|
+
header: "Actions",
|
|
48669
|
+
cell: ({ row }) => {
|
|
48670
|
+
const data2 = row.original;
|
|
48671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48672
|
+
Dropdown,
|
|
48673
|
+
{
|
|
48674
|
+
className: "cursor-pointer w-[150px]",
|
|
48675
|
+
items: items(data2),
|
|
48676
|
+
triggerMode: "hover",
|
|
48677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(import_lucide_react126.EllipsisVertical, {})
|
|
48678
|
+
}
|
|
48679
|
+
);
|
|
48680
|
+
}
|
|
48681
|
+
}
|
|
48682
|
+
];
|
|
48683
|
+
const expenses = data?.data || [];
|
|
48684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime266.jsxs)(import_jsx_runtime266.Fragment, { children: [
|
|
48685
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(TransactionView, {}),
|
|
48686
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(Modal2, {}),
|
|
48687
|
+
/* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
48688
|
+
TransactionViewComponent,
|
|
48689
|
+
{
|
|
48690
|
+
columns,
|
|
48691
|
+
data: expenses,
|
|
48692
|
+
title: "Expenses",
|
|
48693
|
+
description: "Track and manage business expenses",
|
|
48694
|
+
index: true,
|
|
48695
|
+
createTitle: "Add Expense",
|
|
48696
|
+
onCreate: () => {
|
|
48697
|
+
navigate("create");
|
|
48698
|
+
}
|
|
48699
|
+
}
|
|
48700
|
+
)
|
|
48701
|
+
] });
|
|
48702
|
+
}
|
|
48703
|
+
var ExpensesJournal_default = ExpensesJournal3;
|
|
48704
|
+
|
|
48705
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48706
|
+
var import_react162 = require("react");
|
|
48707
|
+
var import_react_router_dom127 = require("react-router-dom");
|
|
48708
|
+
var import_react_hook_form75 = require("react-hook-form");
|
|
48709
|
+
var import_zod126 = require("@hookform/resolvers/zod");
|
|
48710
|
+
var import_antd97 = require("antd");
|
|
48711
|
+
|
|
48712
|
+
// src/components/Transactions/3/expenseJournal/schema.ts
|
|
48713
|
+
var import_zod125 = require("zod");
|
|
48714
|
+
var expenseSchema5 = import_zod125.z.object({
|
|
48715
|
+
description: import_zod125.z.string().min(1, "Description is required"),
|
|
48716
|
+
date: zodFields.date,
|
|
48717
|
+
amount: import_zod125.z.number().gt(0, "Amount must be greater than 0"),
|
|
48718
|
+
branch: import_zod125.z.string().optional(),
|
|
48719
|
+
note: import_zod125.z.string().optional(),
|
|
48720
|
+
currency: import_zod125.z.enum(Enums_default.currencies),
|
|
48721
|
+
rate: import_zod125.z.number().optional()
|
|
48722
|
+
});
|
|
48723
|
+
|
|
48724
|
+
// src/components/Transactions/3/expenseJournal/ExpensesJournal3Form.tsx
|
|
48725
|
+
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
48726
|
+
function ExpensesJournal3Form() {
|
|
48727
|
+
const { branchId } = (0, import_react_router_dom127.useParams)();
|
|
48728
|
+
const { getQuery, navigate } = useApp_default();
|
|
48729
|
+
const id = getQuery("id");
|
|
48730
|
+
const isEdit = !!id;
|
|
48731
|
+
const [ref2, setRef] = (0, import_react162.useState)("");
|
|
48732
|
+
const { post, isLoading } = useApis_default();
|
|
48733
|
+
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48734
|
+
const { defaultCurrency } = useWarqadConfig().currencies;
|
|
48735
|
+
const methods = (0, import_react_hook_form75.useForm)({
|
|
48736
|
+
resolver: (0, import_zod126.zodResolver)(expenseSchema5),
|
|
48737
|
+
defaultValues: {
|
|
48738
|
+
date: (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB"),
|
|
48739
|
+
amount: 0,
|
|
48740
|
+
description: "",
|
|
48741
|
+
rate: void 0,
|
|
48742
|
+
branch: branchId || void 0
|
|
48743
|
+
}
|
|
48744
|
+
});
|
|
48745
|
+
const { handleSubmit, reset, watch } = methods;
|
|
48746
|
+
const currency = watch("currency");
|
|
48747
|
+
const isRate = currency && currency !== defaultCurrency;
|
|
48748
|
+
const amount = watch("amount");
|
|
48749
|
+
const rate = watch("rate");
|
|
48750
|
+
const exchangedAmount2 = (0, import_react162.useMemo)(() => {
|
|
48751
|
+
if (isRate) {
|
|
48752
|
+
const am = forex_default.exchangedAmount({
|
|
48753
|
+
accountCurrency: defaultCurrency,
|
|
48754
|
+
amount,
|
|
48755
|
+
exchangeRate: rate ?? 1,
|
|
48756
|
+
transactionCurrency: currency
|
|
48757
|
+
});
|
|
48758
|
+
return Formats_default.Price(am, defaultCurrency ?? "N/A", false);
|
|
48759
|
+
}
|
|
48760
|
+
}, [amount, currency, rate, isRate]);
|
|
48761
|
+
const onSubmit = async (data) => {
|
|
48762
|
+
try {
|
|
48763
|
+
const payload = {
|
|
48764
|
+
...data,
|
|
48765
|
+
type: "expense-journal-3",
|
|
48766
|
+
defaultCurrency,
|
|
48767
|
+
branch: branchId ?? void 0,
|
|
48768
|
+
rate: data?.rate ?? 1
|
|
48769
|
+
};
|
|
48770
|
+
await post({
|
|
48771
|
+
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
48772
|
+
body: payload
|
|
48773
|
+
});
|
|
48774
|
+
import_antd97.message.success(`Expense saved successfully`);
|
|
48775
|
+
navigate(-1);
|
|
48776
|
+
} catch (error) {
|
|
48777
|
+
import_antd97.message.error(error?.message || "Something went wrong");
|
|
48778
|
+
}
|
|
48779
|
+
};
|
|
48780
|
+
const fetches = async () => {
|
|
48781
|
+
try {
|
|
48782
|
+
const res = await get({
|
|
48783
|
+
url: `/transactions/get?id=${id}${branchId ? `&fromBranch=${branchId}` : ""}`
|
|
48784
|
+
});
|
|
48785
|
+
const data = res.data;
|
|
48786
|
+
reset({
|
|
48787
|
+
...data,
|
|
48788
|
+
rate: data?.exchange?.rate
|
|
48789
|
+
});
|
|
48790
|
+
setRef(data?.ref);
|
|
48791
|
+
} catch (error) {
|
|
48792
|
+
import_antd97.message.error(error?.message || "Something went wrong");
|
|
48793
|
+
navigate(-1);
|
|
48794
|
+
}
|
|
48795
|
+
};
|
|
48796
|
+
(0, import_react162.useEffect)(() => {
|
|
48797
|
+
if (isEdit) {
|
|
48798
|
+
fetches();
|
|
48799
|
+
}
|
|
48800
|
+
}, [id]);
|
|
48801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
48802
|
+
Card,
|
|
48803
|
+
{
|
|
48804
|
+
className: "max-w-4xl mx-auto mt-10 relative",
|
|
48805
|
+
isLoading: isLoadingGet,
|
|
48806
|
+
loadingText: "Processing...",
|
|
48807
|
+
children: [
|
|
48808
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(Card.Header, { children: [
|
|
48809
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Expense` }),
|
|
48810
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Description, { children: isEdit ? `Update the details for this expense entry` : `Record a new business expense` })
|
|
48811
|
+
] }),
|
|
48812
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
48813
|
+
"form",
|
|
48814
|
+
{
|
|
48815
|
+
className: "space-y-4",
|
|
48816
|
+
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
48817
|
+
children: [
|
|
48818
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48819
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48820
|
+
Fields_default.Input,
|
|
48821
|
+
{
|
|
48822
|
+
label: "Description",
|
|
48823
|
+
form: methods,
|
|
48824
|
+
name: "description",
|
|
48825
|
+
placeholder: "What was this expense for?",
|
|
48826
|
+
required: true
|
|
48827
|
+
}
|
|
48828
|
+
),
|
|
48829
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48830
|
+
Fields_default.Select,
|
|
48831
|
+
{
|
|
48832
|
+
label: "Currency",
|
|
48833
|
+
form: methods,
|
|
48834
|
+
enumName: "currencies",
|
|
48835
|
+
name: "currency",
|
|
48836
|
+
required: true
|
|
48837
|
+
}
|
|
48838
|
+
)
|
|
48839
|
+
] }),
|
|
48840
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
48841
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48842
|
+
Fields_default.DateInput,
|
|
48843
|
+
{
|
|
48844
|
+
label: "Date",
|
|
48845
|
+
form: methods,
|
|
48846
|
+
name: "date",
|
|
48847
|
+
required: true
|
|
48848
|
+
}
|
|
48849
|
+
),
|
|
48850
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48851
|
+
Fields_default.Input,
|
|
48852
|
+
{
|
|
48853
|
+
label: "Amount",
|
|
48854
|
+
form: methods,
|
|
48855
|
+
name: "amount",
|
|
48856
|
+
type: "number",
|
|
48857
|
+
placeholder: "0.00",
|
|
48858
|
+
required: true
|
|
48859
|
+
}
|
|
48860
|
+
),
|
|
48861
|
+
isRate && /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(import_jsx_runtime267.Fragment, { children: [
|
|
48862
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48863
|
+
Fields_default.Input,
|
|
48864
|
+
{
|
|
48865
|
+
label: "Rate",
|
|
48866
|
+
form: methods,
|
|
48867
|
+
name: "rate",
|
|
48868
|
+
type: "number",
|
|
48869
|
+
placeholder: "Rate",
|
|
48870
|
+
required: true
|
|
48871
|
+
}
|
|
48872
|
+
),
|
|
48873
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48874
|
+
Fields_default.Input,
|
|
48875
|
+
{
|
|
48876
|
+
label: "Exchanged Amount",
|
|
48877
|
+
type: "text",
|
|
48878
|
+
readOnly: true,
|
|
48879
|
+
disabled: true,
|
|
48880
|
+
value: exchangedAmount2
|
|
48881
|
+
}
|
|
48882
|
+
)
|
|
48883
|
+
] })
|
|
48884
|
+
] }),
|
|
48885
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48886
|
+
Fields_default.Textarea,
|
|
48887
|
+
{
|
|
48888
|
+
label: "Note",
|
|
48889
|
+
form: methods,
|
|
48890
|
+
name: "note",
|
|
48891
|
+
placeholder: "Add any additional details..."
|
|
48892
|
+
}
|
|
48893
|
+
),
|
|
48894
|
+
/* @__PURE__ */ (0, import_jsx_runtime267.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime267.jsx)(
|
|
48895
|
+
Button,
|
|
48896
|
+
{
|
|
48897
|
+
isLoading,
|
|
48898
|
+
disabled: isLoading,
|
|
48899
|
+
type: "submit",
|
|
48900
|
+
className: "min-w-[100px]",
|
|
48901
|
+
variant: !isEdit ? "primary" : "warning",
|
|
48902
|
+
children: isEdit ? "Update" : "Add"
|
|
48903
|
+
}
|
|
48904
|
+
) })
|
|
48905
|
+
]
|
|
48906
|
+
}
|
|
48907
|
+
) })
|
|
48908
|
+
]
|
|
48909
|
+
}
|
|
48910
|
+
);
|
|
48911
|
+
}
|
|
48912
|
+
var ExpensesJournal3Form_default = ExpensesJournal3Form;
|
|
48913
|
+
|
|
48914
|
+
// src/components/Transactions/3/expenseJournal/index.tsx
|
|
48915
|
+
var ExpensesJournal32 = {
|
|
48916
|
+
List: ExpensesJournal_default,
|
|
48917
|
+
Form: ExpensesJournal3Form_default
|
|
48918
|
+
};
|
|
48919
|
+
var expenseJournal_default = ExpensesJournal32;
|
|
48920
|
+
|
|
48580
48921
|
// src/components/Transactions/3/index.ts
|
|
48581
48922
|
var Transaction3 = {
|
|
48582
48923
|
Payments: Payments_default3,
|
|
@@ -48589,26 +48930,27 @@ var Transaction3 = {
|
|
|
48589
48930
|
Purchase3Form: purchase3_default.Form,
|
|
48590
48931
|
Expenses: expense_default.List,
|
|
48591
48932
|
ExpenseForm: expense_default.Form,
|
|
48592
|
-
Reports: reports_default
|
|
48933
|
+
Reports: reports_default,
|
|
48934
|
+
ExpensesJournal3: expenseJournal_default
|
|
48593
48935
|
};
|
|
48594
48936
|
var __default = Transaction3;
|
|
48595
48937
|
|
|
48596
48938
|
// src/components/reports/ItemReport.tsx
|
|
48597
|
-
var
|
|
48598
|
-
var
|
|
48599
|
-
var
|
|
48600
|
-
var
|
|
48601
|
-
var
|
|
48602
|
-
var
|
|
48603
|
-
var
|
|
48939
|
+
var import_react_router_dom128 = require("react-router-dom");
|
|
48940
|
+
var import_zod127 = require("zod");
|
|
48941
|
+
var import_react_hook_form76 = require("react-hook-form");
|
|
48942
|
+
var import_zod128 = require("@hookform/resolvers/zod");
|
|
48943
|
+
var import_react163 = require("react");
|
|
48944
|
+
var import_antd98 = require("antd");
|
|
48945
|
+
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
48604
48946
|
var ItemReport = ({
|
|
48605
48947
|
value = false,
|
|
48606
48948
|
type
|
|
48607
48949
|
}) => {
|
|
48608
48950
|
const { apiConfig } = useWarqadConfig();
|
|
48609
|
-
const { branchId } = (0,
|
|
48951
|
+
const { branchId } = (0, import_react_router_dom128.useParams)();
|
|
48610
48952
|
const { branches } = useAuth_default();
|
|
48611
|
-
const [params, setParams] = (0,
|
|
48953
|
+
const [params, setParams] = (0, import_react163.useState)({
|
|
48612
48954
|
id: "",
|
|
48613
48955
|
branch: "all"
|
|
48614
48956
|
});
|
|
@@ -48633,9 +48975,9 @@ var ItemReport = ({
|
|
|
48633
48975
|
header: "Date",
|
|
48634
48976
|
key: "date",
|
|
48635
48977
|
className: "text-xs whitespace-nowrap",
|
|
48636
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48637
|
-
/* @__PURE__ */ (0,
|
|
48638
|
-
/* @__PURE__ */ (0,
|
|
48978
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "", children: [
|
|
48979
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
48980
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48639
48981
|
"span",
|
|
48640
48982
|
{
|
|
48641
48983
|
onClick: () => {
|
|
@@ -48654,7 +48996,7 @@ var ItemReport = ({
|
|
|
48654
48996
|
header: "Description",
|
|
48655
48997
|
key: "description",
|
|
48656
48998
|
className: "text-xs whitespace-nowrap",
|
|
48657
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48999
|
+
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
49000
|
},
|
|
48659
49001
|
{
|
|
48660
49002
|
header: "Quantity",
|
|
@@ -48662,7 +49004,7 @@ var ItemReport = ({
|
|
|
48662
49004
|
className: "text-xs whitespace-nowrap",
|
|
48663
49005
|
render: (row) => {
|
|
48664
49006
|
const Qty = row.quantity;
|
|
48665
|
-
return /* @__PURE__ */ (0,
|
|
49007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
|
|
48666
49008
|
"div",
|
|
48667
49009
|
{
|
|
48668
49010
|
className: `font-bold ${row.line === "add" ? "text-green-500" : row.line === "sub" ? "text-red-500" : "text-black"}`,
|
|
@@ -48679,7 +49021,7 @@ var ItemReport = ({
|
|
|
48679
49021
|
header: "Balance",
|
|
48680
49022
|
key: "runningBalance",
|
|
48681
49023
|
className: "text-xs whitespace-nowrap",
|
|
48682
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49024
|
+
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
49025
|
}
|
|
48684
49026
|
];
|
|
48685
49027
|
let runningBalance = 0;
|
|
@@ -48691,10 +49033,10 @@ var ItemReport = ({
|
|
|
48691
49033
|
};
|
|
48692
49034
|
});
|
|
48693
49035
|
const itemName = datas[0]?.name;
|
|
48694
|
-
return /* @__PURE__ */ (0,
|
|
48695
|
-
/* @__PURE__ */ (0,
|
|
48696
|
-
/* @__PURE__ */ (0,
|
|
48697
|
-
/* @__PURE__ */ (0,
|
|
49036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(import_jsx_runtime268.Fragment, { children: [
|
|
49037
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(Modal2, {}),
|
|
49038
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(TransactionView, {}),
|
|
49039
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48698
49040
|
A4DataView,
|
|
48699
49041
|
{
|
|
48700
49042
|
columns,
|
|
@@ -48705,14 +49047,14 @@ var ItemReport = ({
|
|
|
48705
49047
|
tableTitle: `${type} Movement Report`,
|
|
48706
49048
|
fixed: false,
|
|
48707
49049
|
error: !id ? "Please select an item" : void 0,
|
|
48708
|
-
headers: /* @__PURE__ */ (0,
|
|
49050
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48709
49051
|
Button,
|
|
48710
49052
|
{
|
|
48711
49053
|
type: "button",
|
|
48712
49054
|
size: "sm",
|
|
48713
49055
|
onClick: () => openState({
|
|
48714
49056
|
title: "Item Transactions",
|
|
48715
|
-
content: /* @__PURE__ */ (0,
|
|
49057
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48716
49058
|
ItemReportHeader2,
|
|
48717
49059
|
{
|
|
48718
49060
|
type,
|
|
@@ -48730,18 +49072,18 @@ var ItemReport = ({
|
|
|
48730
49072
|
)
|
|
48731
49073
|
] });
|
|
48732
49074
|
};
|
|
48733
|
-
var schema3 =
|
|
48734
|
-
pack:
|
|
48735
|
-
product:
|
|
48736
|
-
branch:
|
|
49075
|
+
var schema3 = import_zod127.z.object({
|
|
49076
|
+
pack: import_zod127.z.string().optional(),
|
|
49077
|
+
product: import_zod127.z.string().optional(),
|
|
49078
|
+
branch: import_zod127.z.string()
|
|
48737
49079
|
});
|
|
48738
49080
|
function ItemReportHeader2({
|
|
48739
49081
|
type,
|
|
48740
49082
|
close,
|
|
48741
49083
|
addToParams
|
|
48742
49084
|
}) {
|
|
48743
|
-
const methods = (0,
|
|
48744
|
-
resolver: (0,
|
|
49085
|
+
const methods = (0, import_react_hook_form76.useForm)({
|
|
49086
|
+
resolver: (0, import_zod128.zodResolver)(schema3),
|
|
48745
49087
|
defaultValues: {
|
|
48746
49088
|
pack: "",
|
|
48747
49089
|
product: "",
|
|
@@ -48755,14 +49097,14 @@ function ItemReportHeader2({
|
|
|
48755
49097
|
label: b.name,
|
|
48756
49098
|
value: b._id
|
|
48757
49099
|
}));
|
|
48758
|
-
return /* @__PURE__ */ (0,
|
|
49100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime268.jsxs)(
|
|
48759
49101
|
"form",
|
|
48760
49102
|
{
|
|
48761
49103
|
className: "space-y-3",
|
|
48762
49104
|
onSubmit: handleSubmit((data) => {
|
|
48763
49105
|
const id = type === "pack" ? data.pack : data.product;
|
|
48764
49106
|
if (!id) {
|
|
48765
|
-
|
|
49107
|
+
import_antd98.message.error("Please select an item");
|
|
48766
49108
|
methods.setFocus(type);
|
|
48767
49109
|
return;
|
|
48768
49110
|
}
|
|
@@ -48773,8 +49115,8 @@ function ItemReportHeader2({
|
|
|
48773
49115
|
close();
|
|
48774
49116
|
}),
|
|
48775
49117
|
children: [
|
|
48776
|
-
/* @__PURE__ */ (0,
|
|
48777
|
-
/* @__PURE__ */ (0,
|
|
49118
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
49119
|
+
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48778
49120
|
Select,
|
|
48779
49121
|
{
|
|
48780
49122
|
options: [{ label: "All Branches", value: "all" }, ...branchOptions],
|
|
@@ -48782,7 +49124,7 @@ function ItemReportHeader2({
|
|
|
48782
49124
|
name: "branch"
|
|
48783
49125
|
}
|
|
48784
49126
|
),
|
|
48785
|
-
type === "pack" ? /* @__PURE__ */ (0,
|
|
49127
|
+
type === "pack" ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48786
49128
|
Pack_default.Pack,
|
|
48787
49129
|
{
|
|
48788
49130
|
api: "/packs/get",
|
|
@@ -48790,7 +49132,7 @@ function ItemReportHeader2({
|
|
|
48790
49132
|
form: methods,
|
|
48791
49133
|
name: "pack"
|
|
48792
49134
|
}
|
|
48793
|
-
) : /* @__PURE__ */ (0,
|
|
49135
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime268.jsx)(
|
|
48794
49136
|
Feilds_default5.Product,
|
|
48795
49137
|
{
|
|
48796
49138
|
label: "",
|
|
@@ -48801,7 +49143,7 @@ function ItemReportHeader2({
|
|
|
48801
49143
|
}
|
|
48802
49144
|
)
|
|
48803
49145
|
] }),
|
|
48804
|
-
/* @__PURE__ */ (0,
|
|
49146
|
+
/* @__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
49147
|
]
|
|
48806
49148
|
}
|
|
48807
49149
|
);
|
|
@@ -48809,19 +49151,19 @@ function ItemReportHeader2({
|
|
|
48809
49151
|
var ItemReport_default = ItemReport;
|
|
48810
49152
|
|
|
48811
49153
|
// src/components/accounts/LeaseCollection.tsx
|
|
48812
|
-
var
|
|
48813
|
-
var
|
|
48814
|
-
var
|
|
49154
|
+
var import_react_router_dom129 = require("react-router-dom");
|
|
49155
|
+
var import_react164 = require("react");
|
|
49156
|
+
var import_jsx_runtime269 = require("react/jsx-runtime");
|
|
48815
49157
|
var LeaseCollection = ({
|
|
48816
49158
|
leaseType,
|
|
48817
49159
|
defaultCurrency = "KES"
|
|
48818
49160
|
}) => {
|
|
48819
|
-
const navigate = (0,
|
|
48820
|
-
const [searchParams] = (0,
|
|
49161
|
+
const navigate = (0, import_react_router_dom129.useNavigate)();
|
|
49162
|
+
const [searchParams] = (0, import_react_router_dom129.useSearchParams)();
|
|
48821
49163
|
const { apiConfig } = useWarqadConfig();
|
|
48822
|
-
const { branchId } = (0,
|
|
49164
|
+
const { branchId } = (0, import_react_router_dom129.useParams)();
|
|
48823
49165
|
const { branches } = useAuth_default();
|
|
48824
|
-
const currentBranch = (0,
|
|
49166
|
+
const currentBranch = (0, import_react164.useMemo)(
|
|
48825
49167
|
() => branches?.find((b) => b?._id === branchId),
|
|
48826
49168
|
[branches, branchId]
|
|
48827
49169
|
);
|
|
@@ -48829,16 +49171,16 @@ var LeaseCollection = ({
|
|
|
48829
49171
|
const initialFilter = ["all", "debit", "credit"].includes(urlFilter) ? urlFilter : "all";
|
|
48830
49172
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
48831
49173
|
const initialCurrency = urlCurrency && Enums_default.currencies.includes(urlCurrency) ? urlCurrency : defaultCurrency;
|
|
48832
|
-
const [filter, setFilter] = (0,
|
|
49174
|
+
const [filter, setFilter] = (0, import_react164.useState)(
|
|
48833
49175
|
initialFilter
|
|
48834
49176
|
);
|
|
48835
|
-
const [currencyFilter, setCurrencyFilter] = (0,
|
|
48836
|
-
(0,
|
|
49177
|
+
const [currencyFilter, setCurrencyFilter] = (0, import_react164.useState)(initialCurrency);
|
|
49178
|
+
(0, import_react164.useEffect)(() => {
|
|
48837
49179
|
if (urlFilter && ["all", "debit", "credit"].includes(urlFilter)) {
|
|
48838
49180
|
setFilter(urlFilter);
|
|
48839
49181
|
}
|
|
48840
49182
|
}, [urlFilter]);
|
|
48841
|
-
(0,
|
|
49183
|
+
(0, import_react164.useEffect)(() => {
|
|
48842
49184
|
if (urlCurrency && Enums_default.currencies.includes(urlCurrency)) {
|
|
48843
49185
|
setCurrencyFilter(urlCurrency);
|
|
48844
49186
|
} else {
|
|
@@ -48857,9 +49199,9 @@ var LeaseCollection = ({
|
|
|
48857
49199
|
key: "name",
|
|
48858
49200
|
className: "text-xs whitespace-nowrap ",
|
|
48859
49201
|
searchKeys: ["name", "phoneNumber", "unitNames"],
|
|
48860
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
48861
|
-
/* @__PURE__ */ (0,
|
|
48862
|
-
row.unitNames && /* @__PURE__ */ (0,
|
|
49202
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("div", { className: "space-y-1", children: [
|
|
49203
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold dark:text-white print:text-black uppercase", children: row.name }),
|
|
49204
|
+
row.unitNames && /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)("p", { className: "text-[9px]! capitalize", children: [
|
|
48863
49205
|
"(",
|
|
48864
49206
|
row.unitNames,
|
|
48865
49207
|
")"
|
|
@@ -48871,7 +49213,7 @@ var LeaseCollection = ({
|
|
|
48871
49213
|
key: "phoneNumber",
|
|
48872
49214
|
maxWidth: 70,
|
|
48873
49215
|
render: (row) => {
|
|
48874
|
-
return /* @__PURE__ */ (0,
|
|
49216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { children: row?.phoneNumber || "N/A" });
|
|
48875
49217
|
}
|
|
48876
49218
|
},
|
|
48877
49219
|
// </span>
|
|
@@ -48881,11 +49223,11 @@ var LeaseCollection = ({
|
|
|
48881
49223
|
className: "text-xs whitespace-nowrap text-right",
|
|
48882
49224
|
render: (row) => {
|
|
48883
49225
|
const Amount = row.totalCollectionString;
|
|
48884
|
-
return /* @__PURE__ */ (0,
|
|
49226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("p", { className: "font-bold ", children: Amount }) });
|
|
48885
49227
|
},
|
|
48886
49228
|
renderFooter: (data2) => {
|
|
48887
49229
|
if (currencyFilter === "all") return;
|
|
48888
|
-
return /* @__PURE__ */ (0,
|
|
49230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("span", { className: " font-bold", children: Formats_default.Price(
|
|
48889
49231
|
data2.reduce((acc, row) => acc + row.totalCollection, 0),
|
|
48890
49232
|
defaultCurrency,
|
|
48891
49233
|
false
|
|
@@ -48893,7 +49235,7 @@ var LeaseCollection = ({
|
|
|
48893
49235
|
}
|
|
48894
49236
|
}
|
|
48895
49237
|
];
|
|
48896
|
-
const datas = (0,
|
|
49238
|
+
const datas = (0, import_react164.useMemo)(() => {
|
|
48897
49239
|
let runningBalance = 0;
|
|
48898
49240
|
let filteredData = data?.data || [];
|
|
48899
49241
|
const result = filteredData.map((item) => {
|
|
@@ -48906,9 +49248,9 @@ var LeaseCollection = ({
|
|
|
48906
49248
|
});
|
|
48907
49249
|
return result;
|
|
48908
49250
|
}, [filter, currencyFilter, data]);
|
|
48909
|
-
return /* @__PURE__ */ (0,
|
|
48910
|
-
/* @__PURE__ */ (0,
|
|
48911
|
-
/* @__PURE__ */ (0,
|
|
49251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime269.jsxs)(import_jsx_runtime269.Fragment, { children: [
|
|
49252
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(TransactionView, {}),
|
|
49253
|
+
/* @__PURE__ */ (0, import_jsx_runtime269.jsx)(
|
|
48912
49254
|
A4DataView,
|
|
48913
49255
|
{
|
|
48914
49256
|
columns,
|
|
@@ -48918,7 +49260,7 @@ var LeaseCollection = ({
|
|
|
48918
49260
|
subtitle: `All Collections`,
|
|
48919
49261
|
fixed: false,
|
|
48920
49262
|
startPage: 1e9,
|
|
48921
|
-
headers: /* @__PURE__ */ (0,
|
|
49263
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime269.jsx)("div", { className: "flex gap-2" })
|
|
48922
49264
|
}
|
|
48923
49265
|
)
|
|
48924
49266
|
] });
|
|
@@ -48926,61 +49268,61 @@ var LeaseCollection = ({
|
|
|
48926
49268
|
var LeaseCollection_default = LeaseCollection;
|
|
48927
49269
|
|
|
48928
49270
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
48929
|
-
var
|
|
48930
|
-
var
|
|
48931
|
-
var
|
|
48932
|
-
var
|
|
49271
|
+
var import_react_router_dom133 = require("react-router-dom");
|
|
49272
|
+
var import_lucide_react128 = require("lucide-react");
|
|
49273
|
+
var import_react168 = require("react");
|
|
49274
|
+
var import_antd102 = require("antd");
|
|
48933
49275
|
|
|
48934
49276
|
// src/components/Transactions/cargoIM/schema.ts
|
|
48935
|
-
var
|
|
48936
|
-
var InvoiceSchema2 =
|
|
48937
|
-
name:
|
|
48938
|
-
quantity:
|
|
48939
|
-
amount:
|
|
49277
|
+
var import_zod130 = require("zod");
|
|
49278
|
+
var InvoiceSchema2 = import_zod130.z.object({
|
|
49279
|
+
name: import_zod130.z.string().min(1, { message: "Item name is required" }),
|
|
49280
|
+
quantity: import_zod130.z.number().gt(0, { message: "Quantity must be greater than 0" }),
|
|
49281
|
+
amount: import_zod130.z.number().gt(0, { message: "Price must be greater than 0" })
|
|
48940
49282
|
});
|
|
48941
|
-
var createInvoiceManagerValidation2 =
|
|
48942
|
-
invoices:
|
|
48943
|
-
date:
|
|
48944
|
-
currency:
|
|
48945
|
-
branch:
|
|
49283
|
+
var createInvoiceManagerValidation2 = import_zod130.z.object({
|
|
49284
|
+
invoices: import_zod130.z.array(InvoiceSchema2),
|
|
49285
|
+
date: import_zod130.z.string(),
|
|
49286
|
+
currency: import_zod130.z.string(),
|
|
49287
|
+
branch: import_zod130.z.string().optional()
|
|
48946
49288
|
});
|
|
48947
|
-
var createAccountSchema3 =
|
|
48948
|
-
name:
|
|
48949
|
-
phoneNumber:
|
|
48950
|
-
branch:
|
|
48951
|
-
currency:
|
|
49289
|
+
var createAccountSchema3 = import_zod130.z.object({
|
|
49290
|
+
name: import_zod130.z.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
49291
|
+
phoneNumber: import_zod130.z.string().optional(),
|
|
49292
|
+
branch: import_zod130.z.string().optional(),
|
|
49293
|
+
currency: import_zod130.z.string().optional()
|
|
48952
49294
|
});
|
|
48953
|
-
var journalSchema5 =
|
|
49295
|
+
var journalSchema5 = import_zod130.z.object({
|
|
48954
49296
|
date: zodFields.date,
|
|
48955
|
-
amount:
|
|
48956
|
-
currency:
|
|
48957
|
-
description:
|
|
48958
|
-
branch:
|
|
48959
|
-
action:
|
|
48960
|
-
note:
|
|
49297
|
+
amount: import_zod130.z.number().gt(0, "Amount must be greater than 0"),
|
|
49298
|
+
currency: import_zod130.z.string(),
|
|
49299
|
+
description: import_zod130.z.string(),
|
|
49300
|
+
branch: import_zod130.z.string().optional(),
|
|
49301
|
+
action: import_zod130.z.enum(Enums_default.actionTypes).optional(),
|
|
49302
|
+
note: import_zod130.z.string().optional()
|
|
48961
49303
|
});
|
|
48962
49304
|
|
|
48963
49305
|
// src/components/Transactions/cargoIM/AccountForm.tsx
|
|
48964
|
-
var
|
|
48965
|
-
var
|
|
48966
|
-
var
|
|
48967
|
-
var
|
|
48968
|
-
var
|
|
48969
|
-
var
|
|
49306
|
+
var import_react_hook_form77 = require("react-hook-form");
|
|
49307
|
+
var import_zod131 = require("@hookform/resolvers/zod");
|
|
49308
|
+
var import_antd99 = require("antd");
|
|
49309
|
+
var import_react165 = require("react");
|
|
49310
|
+
var import_react_router_dom130 = require("react-router-dom");
|
|
49311
|
+
var import_jsx_runtime270 = require("react/jsx-runtime");
|
|
48970
49312
|
function AccountForm3({
|
|
48971
49313
|
onReload,
|
|
48972
49314
|
close,
|
|
48973
49315
|
id
|
|
48974
49316
|
}) {
|
|
48975
|
-
const { branchId } = (0,
|
|
49317
|
+
const { branchId } = (0, import_react_router_dom130.useParams)();
|
|
48976
49318
|
const { currencies } = useWarqadConfig();
|
|
48977
49319
|
const { stock } = currencies;
|
|
48978
49320
|
const isEdit = !!id;
|
|
48979
49321
|
const type = "supplier";
|
|
48980
49322
|
const { post, put, isLoading } = useApis_default();
|
|
48981
49323
|
const { isLoading: isLoadingGet, get } = useApis_default();
|
|
48982
|
-
const methods = (0,
|
|
48983
|
-
resolver: (0,
|
|
49324
|
+
const methods = (0, import_react_hook_form77.useForm)({
|
|
49325
|
+
resolver: (0, import_zod131.zodResolver)(createAccountSchema3),
|
|
48984
49326
|
defaultValues: {
|
|
48985
49327
|
name: "",
|
|
48986
49328
|
phoneNumber: "",
|
|
@@ -49010,7 +49352,7 @@ function AccountForm3({
|
|
|
49010
49352
|
body: payload
|
|
49011
49353
|
});
|
|
49012
49354
|
}
|
|
49013
|
-
|
|
49355
|
+
import_antd99.message.success(`${type} ${isEdit ? "updated" : "created"} successfully`);
|
|
49014
49356
|
if (onReload) {
|
|
49015
49357
|
onReload();
|
|
49016
49358
|
}
|
|
@@ -49018,7 +49360,7 @@ function AccountForm3({
|
|
|
49018
49360
|
close();
|
|
49019
49361
|
}
|
|
49020
49362
|
} catch (error) {
|
|
49021
|
-
|
|
49363
|
+
import_antd99.message.error(error?.message || "Something went wrong");
|
|
49022
49364
|
}
|
|
49023
49365
|
};
|
|
49024
49366
|
const fetches = async () => {
|
|
@@ -49029,33 +49371,33 @@ function AccountForm3({
|
|
|
49029
49371
|
const data = res.data;
|
|
49030
49372
|
methods.reset(data);
|
|
49031
49373
|
} catch (error) {
|
|
49032
|
-
|
|
49374
|
+
import_antd99.message.error(error?.message || "Something went wrong");
|
|
49033
49375
|
close?.();
|
|
49034
49376
|
}
|
|
49035
49377
|
};
|
|
49036
|
-
(0,
|
|
49378
|
+
(0, import_react165.useEffect)(() => {
|
|
49037
49379
|
if (isEdit) {
|
|
49038
49380
|
fetches();
|
|
49039
49381
|
}
|
|
49040
49382
|
}, [id]);
|
|
49041
|
-
return /* @__PURE__ */ (0,
|
|
49383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
|
|
49042
49384
|
Card,
|
|
49043
49385
|
{
|
|
49044
49386
|
className: "max-w-4xl mx-auto mt-10 relative",
|
|
49045
49387
|
isLoading: isLoadingGet,
|
|
49046
49388
|
loadingText: "Processing...",
|
|
49047
49389
|
children: [
|
|
49048
|
-
/* @__PURE__ */ (0,
|
|
49049
|
-
/* @__PURE__ */ (0,
|
|
49050
|
-
/* @__PURE__ */ (0,
|
|
49390
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(Card.Header, { children: [
|
|
49391
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
|
|
49392
|
+
/* @__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
49393
|
] }),
|
|
49052
|
-
/* @__PURE__ */ (0,
|
|
49394
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(
|
|
49053
49395
|
"form",
|
|
49054
49396
|
{
|
|
49055
49397
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
49056
49398
|
children: [
|
|
49057
|
-
/* @__PURE__ */ (0,
|
|
49058
|
-
/* @__PURE__ */ (0,
|
|
49399
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49400
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49059
49401
|
Fields_default.Input,
|
|
49060
49402
|
{
|
|
49061
49403
|
label: "Name",
|
|
@@ -49066,7 +49408,7 @@ function AccountForm3({
|
|
|
49066
49408
|
required: true
|
|
49067
49409
|
}
|
|
49068
49410
|
),
|
|
49069
|
-
/* @__PURE__ */ (0,
|
|
49411
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49070
49412
|
Fields_default.PhoneInput,
|
|
49071
49413
|
{
|
|
49072
49414
|
label: "Phone Number",
|
|
@@ -49075,7 +49417,7 @@ function AccountForm3({
|
|
|
49075
49417
|
placeholder: "Enter phone number"
|
|
49076
49418
|
}
|
|
49077
49419
|
),
|
|
49078
|
-
/* @__PURE__ */ (0,
|
|
49420
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49079
49421
|
Fields_default.Select,
|
|
49080
49422
|
{
|
|
49081
49423
|
label: "Currency",
|
|
@@ -49086,7 +49428,7 @@ function AccountForm3({
|
|
|
49086
49428
|
}
|
|
49087
49429
|
)
|
|
49088
49430
|
] }),
|
|
49089
|
-
/* @__PURE__ */ (0,
|
|
49431
|
+
/* @__PURE__ */ (0, import_jsx_runtime270.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
49090
49432
|
Button,
|
|
49091
49433
|
{
|
|
49092
49434
|
isLoading,
|
|
@@ -49107,33 +49449,33 @@ function AccountForm3({
|
|
|
49107
49449
|
var AccountForm_default3 = AccountForm3;
|
|
49108
49450
|
|
|
49109
49451
|
// src/components/Transactions/cargoIM/InvoiceForm.tsx
|
|
49110
|
-
var
|
|
49111
|
-
var
|
|
49112
|
-
var
|
|
49113
|
-
var
|
|
49114
|
-
var
|
|
49115
|
-
var
|
|
49452
|
+
var import_react166 = require("react");
|
|
49453
|
+
var import_react_hook_form78 = require("react-hook-form");
|
|
49454
|
+
var import_zod132 = require("@hookform/resolvers/zod");
|
|
49455
|
+
var import_react_router_dom131 = require("react-router-dom");
|
|
49456
|
+
var import_antd100 = require("antd");
|
|
49457
|
+
var import_lucide_react127 = require("lucide-react");
|
|
49116
49458
|
var import_dayjs12 = __toESM(require("dayjs"));
|
|
49117
|
-
var
|
|
49459
|
+
var import_jsx_runtime271 = require("react/jsx-runtime");
|
|
49118
49460
|
function InvoiceForm2({
|
|
49119
49461
|
onReload,
|
|
49120
49462
|
close,
|
|
49121
49463
|
accountData,
|
|
49122
49464
|
id
|
|
49123
49465
|
}) {
|
|
49124
|
-
const { branchId } = (0,
|
|
49125
|
-
const [ref2, setRef] = (0,
|
|
49466
|
+
const { branchId } = (0, import_react_router_dom131.useParams)();
|
|
49467
|
+
const [ref2, setRef] = (0, import_react166.useState)(void 0);
|
|
49126
49468
|
const { post, isLoading } = useApis_default();
|
|
49127
49469
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49128
49470
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49129
49471
|
const isEdit = !!id;
|
|
49130
49472
|
const { currencies } = useWarqadConfig();
|
|
49131
49473
|
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,
|
|
49474
|
+
const [itemName, setItemName] = (0, import_react166.useState)("");
|
|
49475
|
+
const [itemQuantity, setItemQuantity] = (0, import_react166.useState)("");
|
|
49476
|
+
const [itemPrice, setItemPrice] = (0, import_react166.useState)("");
|
|
49477
|
+
const methods = (0, import_react_hook_form78.useForm)({
|
|
49478
|
+
resolver: (0, import_zod132.zodResolver)(createInvoiceManagerValidation2),
|
|
49137
49479
|
defaultValues: {
|
|
49138
49480
|
invoices: [],
|
|
49139
49481
|
date: (0, import_dayjs12.default)().format("DD/MM/YYYY"),
|
|
@@ -49142,7 +49484,7 @@ function InvoiceForm2({
|
|
|
49142
49484
|
}
|
|
49143
49485
|
});
|
|
49144
49486
|
const { handleSubmit, control, register, reset } = methods;
|
|
49145
|
-
const { fields, append, remove } = (0,
|
|
49487
|
+
const { fields, append, remove } = (0, import_react_hook_form78.useFieldArray)({
|
|
49146
49488
|
control,
|
|
49147
49489
|
name: "invoices"
|
|
49148
49490
|
});
|
|
@@ -49157,27 +49499,27 @@ function InvoiceForm2({
|
|
|
49157
49499
|
});
|
|
49158
49500
|
setRef(data?.ref);
|
|
49159
49501
|
} catch (error) {
|
|
49160
|
-
|
|
49502
|
+
import_antd100.message.error(error?.message || "Something went wrong");
|
|
49161
49503
|
}
|
|
49162
49504
|
};
|
|
49163
|
-
(0,
|
|
49505
|
+
(0, import_react166.useEffect)(() => {
|
|
49164
49506
|
if (isEdit) {
|
|
49165
49507
|
fetches();
|
|
49166
49508
|
}
|
|
49167
49509
|
}, [isEdit]);
|
|
49168
49510
|
const handleAddItem = () => {
|
|
49169
49511
|
if (!itemName.trim()) {
|
|
49170
|
-
|
|
49512
|
+
import_antd100.message.error("Item name is required");
|
|
49171
49513
|
return;
|
|
49172
49514
|
}
|
|
49173
49515
|
const qty = Number(itemQuantity);
|
|
49174
49516
|
const price = Number(itemPrice);
|
|
49175
49517
|
if (isNaN(qty) || qty <= 0) {
|
|
49176
|
-
|
|
49518
|
+
import_antd100.message.error("Quantity must be greater than 0");
|
|
49177
49519
|
return;
|
|
49178
49520
|
}
|
|
49179
49521
|
if (isNaN(price) || price <= 0) {
|
|
49180
|
-
|
|
49522
|
+
import_antd100.message.error("Price must be greater than 0");
|
|
49181
49523
|
return;
|
|
49182
49524
|
}
|
|
49183
49525
|
append({
|
|
@@ -49191,7 +49533,7 @@ function InvoiceForm2({
|
|
|
49191
49533
|
};
|
|
49192
49534
|
const onSubmit = async (data) => {
|
|
49193
49535
|
if (data.invoices.length === 0) {
|
|
49194
|
-
|
|
49536
|
+
import_antd100.message.error("Please add at least one item to the invoice");
|
|
49195
49537
|
return;
|
|
49196
49538
|
}
|
|
49197
49539
|
try {
|
|
@@ -49204,13 +49546,13 @@ function InvoiceForm2({
|
|
|
49204
49546
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49205
49547
|
body: payload
|
|
49206
49548
|
});
|
|
49207
|
-
|
|
49549
|
+
import_antd100.message.success(
|
|
49208
49550
|
isEdit ? "Invoice updated successfully" : "Invoice created successfully"
|
|
49209
49551
|
);
|
|
49210
49552
|
if (onReload) onReload();
|
|
49211
49553
|
if (close) close();
|
|
49212
49554
|
} catch (error) {
|
|
49213
|
-
|
|
49555
|
+
import_antd100.message.error(error?.message || "Something went wrong");
|
|
49214
49556
|
}
|
|
49215
49557
|
};
|
|
49216
49558
|
const onReverse = async () => {
|
|
@@ -49219,11 +49561,11 @@ function InvoiceForm2({
|
|
|
49219
49561
|
await put({
|
|
49220
49562
|
url: `/transactions/reverse/${id}`
|
|
49221
49563
|
});
|
|
49222
|
-
|
|
49564
|
+
import_antd100.message.success("Transaction reversed successfully");
|
|
49223
49565
|
if (onReload) onReload();
|
|
49224
49566
|
if (close) close();
|
|
49225
49567
|
} catch (error) {
|
|
49226
|
-
|
|
49568
|
+
import_antd100.message.error(error?.message || "Something went wrong");
|
|
49227
49569
|
}
|
|
49228
49570
|
};
|
|
49229
49571
|
const handleKeyDown = (e) => {
|
|
@@ -49235,25 +49577,25 @@ function InvoiceForm2({
|
|
|
49235
49577
|
e.preventDefault();
|
|
49236
49578
|
}
|
|
49237
49579
|
};
|
|
49238
|
-
return /* @__PURE__ */ (0,
|
|
49580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49239
49581
|
Card,
|
|
49240
49582
|
{
|
|
49241
49583
|
isLoading: getLoading,
|
|
49242
49584
|
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,
|
|
49585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(Card.Content, { children: [
|
|
49586
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("input", { type: "hidden", ...register("currency") }),
|
|
49587
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49246
49588
|
"form",
|
|
49247
49589
|
{
|
|
49248
49590
|
onSubmit: handleSubmit(onSubmit),
|
|
49249
49591
|
onKeyDown: handleKeyDown,
|
|
49250
49592
|
className: "space-y-6",
|
|
49251
49593
|
children: [
|
|
49252
|
-
/* @__PURE__ */ (0,
|
|
49253
|
-
/* @__PURE__ */ (0,
|
|
49254
|
-
/* @__PURE__ */ (0,
|
|
49255
|
-
/* @__PURE__ */ (0,
|
|
49256
|
-
/* @__PURE__ */ (0,
|
|
49594
|
+
/* @__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: [
|
|
49595
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Add Invoice Item" }),
|
|
49596
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex flex-col md:flex-row gap-4 items-end", children: [
|
|
49597
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 w-full gap-2", children: [
|
|
49598
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49257
49599
|
Fields_default.Input,
|
|
49258
49600
|
{
|
|
49259
49601
|
label: "Container No",
|
|
@@ -49262,7 +49604,7 @@ function InvoiceForm2({
|
|
|
49262
49604
|
onChange: (val) => setItemName(val)
|
|
49263
49605
|
}
|
|
49264
49606
|
),
|
|
49265
|
-
/* @__PURE__ */ (0,
|
|
49607
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49266
49608
|
Fields_default.Input,
|
|
49267
49609
|
{
|
|
49268
49610
|
label: "Cbm",
|
|
@@ -49272,7 +49614,7 @@ function InvoiceForm2({
|
|
|
49272
49614
|
onChange: (val) => setItemQuantity(val)
|
|
49273
49615
|
}
|
|
49274
49616
|
),
|
|
49275
|
-
/* @__PURE__ */ (0,
|
|
49617
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49276
49618
|
Fields_default.Input,
|
|
49277
49619
|
{
|
|
49278
49620
|
label: "Price (KES)",
|
|
@@ -49283,7 +49625,7 @@ function InvoiceForm2({
|
|
|
49283
49625
|
}
|
|
49284
49626
|
)
|
|
49285
49627
|
] }),
|
|
49286
|
-
/* @__PURE__ */ (0,
|
|
49628
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49287
49629
|
Button,
|
|
49288
49630
|
{
|
|
49289
49631
|
type: "button",
|
|
@@ -49291,23 +49633,23 @@ function InvoiceForm2({
|
|
|
49291
49633
|
className: "w-full md:w-auto h-10 flex items-center justify-center gap-2 px-4 whitespace-nowrap",
|
|
49292
49634
|
variant: "outline",
|
|
49293
49635
|
children: [
|
|
49294
|
-
/* @__PURE__ */ (0,
|
|
49636
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(import_lucide_react127.Plus, { size: 16 }),
|
|
49295
49637
|
" Add Item"
|
|
49296
49638
|
]
|
|
49297
49639
|
}
|
|
49298
49640
|
)
|
|
49299
49641
|
] })
|
|
49300
49642
|
] }),
|
|
49301
|
-
/* @__PURE__ */ (0,
|
|
49302
|
-
/* @__PURE__ */ (0,
|
|
49303
|
-
/* @__PURE__ */ (0,
|
|
49304
|
-
/* @__PURE__ */ (0,
|
|
49305
|
-
/* @__PURE__ */ (0,
|
|
49306
|
-
/* @__PURE__ */ (0,
|
|
49307
|
-
/* @__PURE__ */ (0,
|
|
49308
|
-
/* @__PURE__ */ (0,
|
|
49643
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { children: [
|
|
49644
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("h4", { className: "text-xs font-bold text-gray-400 uppercase mb-3 tracking-wider", children: "Invoice Items List" }),
|
|
49645
|
+
/* @__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: [
|
|
49646
|
+
/* @__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: [
|
|
49647
|
+
/* @__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: "#" }),
|
|
49648
|
+
/* @__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" }),
|
|
49649
|
+
/* @__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" }),
|
|
49650
|
+
/* @__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
49651
|
] }) }),
|
|
49310
|
-
/* @__PURE__ */ (0,
|
|
49652
|
+
/* @__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
49653
|
"td",
|
|
49312
49654
|
{
|
|
49313
49655
|
colSpan: 4,
|
|
@@ -49316,30 +49658,30 @@ function InvoiceForm2({
|
|
|
49316
49658
|
}
|
|
49317
49659
|
) }) : fields.map((item, index) => {
|
|
49318
49660
|
const total = item.quantity * item.amount;
|
|
49319
|
-
return /* @__PURE__ */ (0,
|
|
49661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
49320
49662
|
"tr",
|
|
49321
49663
|
{
|
|
49322
49664
|
className: "hover:bg-gray-50/50 dark:hover:bg-zinc-800/10 transition-colors",
|
|
49323
49665
|
children: [
|
|
49324
|
-
/* @__PURE__ */ (0,
|
|
49325
|
-
/* @__PURE__ */ (0,
|
|
49326
|
-
/* @__PURE__ */ (0,
|
|
49327
|
-
/* @__PURE__ */ (0,
|
|
49666
|
+
/* @__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 }),
|
|
49667
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("td", { className: "px-2 sm:px-4 py-1", children: [
|
|
49668
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { className: "font-bold text-gray-900 dark:text-white text-xs sm:text-sm", children: item.name }),
|
|
49669
|
+
/* @__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
49670
|
item.quantity,
|
|
49329
49671
|
" Cbm @",
|
|
49330
49672
|
" ",
|
|
49331
49673
|
Formats_default.Price(item.amount, "KES")
|
|
49332
49674
|
] })
|
|
49333
49675
|
] }),
|
|
49334
|
-
/* @__PURE__ */ (0,
|
|
49335
|
-
/* @__PURE__ */ (0,
|
|
49676
|
+
/* @__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") }),
|
|
49677
|
+
/* @__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
49678
|
"button",
|
|
49337
49679
|
{
|
|
49338
49680
|
type: "button",
|
|
49339
49681
|
onClick: () => remove(index),
|
|
49340
49682
|
className: "text-gray-400 hover:text-red-500 transition-colors p-1",
|
|
49341
|
-
children: /* @__PURE__ */ (0,
|
|
49342
|
-
|
|
49683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49684
|
+
import_lucide_react127.Trash2,
|
|
49343
49685
|
{
|
|
49344
49686
|
size: 13,
|
|
49345
49687
|
className: "sm:w-3.5 sm:h-3.5 w-3 h-3"
|
|
@@ -49352,8 +49694,8 @@ function InvoiceForm2({
|
|
|
49352
49694
|
item.id
|
|
49353
49695
|
);
|
|
49354
49696
|
}) }),
|
|
49355
|
-
fields.length > 0 && /* @__PURE__ */ (0,
|
|
49356
|
-
/* @__PURE__ */ (0,
|
|
49697
|
+
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: [
|
|
49698
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49357
49699
|
"td",
|
|
49358
49700
|
{
|
|
49359
49701
|
colSpan: 2,
|
|
@@ -49361,20 +49703,20 @@ function InvoiceForm2({
|
|
|
49361
49703
|
children: "Total"
|
|
49362
49704
|
}
|
|
49363
49705
|
),
|
|
49364
|
-
/* @__PURE__ */ (0,
|
|
49706
|
+
/* @__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
49707
|
fields.reduce(
|
|
49366
49708
|
(sum, item) => sum + item.quantity * item.amount,
|
|
49367
49709
|
0
|
|
49368
49710
|
),
|
|
49369
49711
|
"KES"
|
|
49370
49712
|
) }),
|
|
49371
|
-
/* @__PURE__ */ (0,
|
|
49713
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("td", {})
|
|
49372
49714
|
] }) })
|
|
49373
49715
|
] }) }) })
|
|
49374
49716
|
] }),
|
|
49375
|
-
/* @__PURE__ */ (0,
|
|
49376
|
-
/* @__PURE__ */ (0,
|
|
49377
|
-
/* @__PURE__ */ (0,
|
|
49717
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "border-t border-gray-200 dark:border-zinc-800 pt-6", children: [
|
|
49718
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49719
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49378
49720
|
Fields_default.DateInput,
|
|
49379
49721
|
{
|
|
49380
49722
|
label: "Date",
|
|
@@ -49383,20 +49725,20 @@ function InvoiceForm2({
|
|
|
49383
49725
|
required: true
|
|
49384
49726
|
}
|
|
49385
49727
|
),
|
|
49386
|
-
/* @__PURE__ */ (0,
|
|
49728
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(Fields_default.Input, { label: "Currency", value: "KES", disabled: true })
|
|
49387
49729
|
] }),
|
|
49388
|
-
/* @__PURE__ */ (0,
|
|
49389
|
-
/* @__PURE__ */ (0,
|
|
49730
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex justify-between items-center mt-6", children: [
|
|
49731
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49390
49732
|
ConfirmModal,
|
|
49391
49733
|
{
|
|
49392
49734
|
title: "Reverse Transaction",
|
|
49393
|
-
description: /* @__PURE__ */ (0,
|
|
49394
|
-
/* @__PURE__ */ (0,
|
|
49395
|
-
/* @__PURE__ */ (0,
|
|
49735
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "space-y-3 text-left", children: [
|
|
49736
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49737
|
+
/* @__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
49738
|
] }),
|
|
49397
49739
|
confirmationWord: "delete",
|
|
49398
49740
|
onSubmit: onReverse,
|
|
49399
|
-
children: /* @__PURE__ */ (0,
|
|
49741
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49400
49742
|
Button,
|
|
49401
49743
|
{
|
|
49402
49744
|
type: "button",
|
|
@@ -49409,8 +49751,8 @@ function InvoiceForm2({
|
|
|
49409
49751
|
)
|
|
49410
49752
|
}
|
|
49411
49753
|
) }),
|
|
49412
|
-
/* @__PURE__ */ (0,
|
|
49413
|
-
close && /* @__PURE__ */ (0,
|
|
49754
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsxs)("div", { className: "flex justify-end gap-3", children: [
|
|
49755
|
+
close && /* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49414
49756
|
Button,
|
|
49415
49757
|
{
|
|
49416
49758
|
type: "button",
|
|
@@ -49420,7 +49762,7 @@ function InvoiceForm2({
|
|
|
49420
49762
|
children: "Cancel"
|
|
49421
49763
|
}
|
|
49422
49764
|
),
|
|
49423
|
-
/* @__PURE__ */ (0,
|
|
49765
|
+
/* @__PURE__ */ (0, import_jsx_runtime271.jsx)(
|
|
49424
49766
|
Button,
|
|
49425
49767
|
{
|
|
49426
49768
|
isLoading,
|
|
@@ -49444,13 +49786,13 @@ function InvoiceForm2({
|
|
|
49444
49786
|
var InvoiceForm_default2 = InvoiceForm2;
|
|
49445
49787
|
|
|
49446
49788
|
// src/components/Transactions/cargoIM/journalForm.tsx
|
|
49447
|
-
var
|
|
49448
|
-
var
|
|
49449
|
-
var
|
|
49450
|
-
var
|
|
49451
|
-
var
|
|
49789
|
+
var import_react167 = __toESM(require("react"));
|
|
49790
|
+
var import_react_hook_form79 = require("react-hook-form");
|
|
49791
|
+
var import_zod133 = require("@hookform/resolvers/zod");
|
|
49792
|
+
var import_react_router_dom132 = require("react-router-dom");
|
|
49793
|
+
var import_antd101 = require("antd");
|
|
49452
49794
|
var import_dayjs13 = __toESM(require("dayjs"));
|
|
49453
|
-
var
|
|
49795
|
+
var import_jsx_runtime272 = require("react/jsx-runtime");
|
|
49454
49796
|
function JournalForm5({
|
|
49455
49797
|
onReload,
|
|
49456
49798
|
close,
|
|
@@ -49458,16 +49800,16 @@ function JournalForm5({
|
|
|
49458
49800
|
action = "debit",
|
|
49459
49801
|
id
|
|
49460
49802
|
}) {
|
|
49461
|
-
const { branchId } = (0,
|
|
49803
|
+
const { branchId } = (0, import_react_router_dom132.useParams)();
|
|
49462
49804
|
const { currencies } = useWarqadConfig();
|
|
49463
49805
|
const { stock: defaultCurrency } = currencies;
|
|
49464
|
-
const [ref2, setRef] =
|
|
49806
|
+
const [ref2, setRef] = import_react167.default.useState(void 0);
|
|
49465
49807
|
const { post, isLoading } = useApis_default();
|
|
49466
49808
|
const { get, isLoading: getLoading } = useApis_default();
|
|
49467
49809
|
const { put, isLoading: isLoadingReverse } = useApis_default();
|
|
49468
49810
|
const isEdit = !!id;
|
|
49469
|
-
const methods = (0,
|
|
49470
|
-
resolver: (0,
|
|
49811
|
+
const methods = (0, import_react_hook_form79.useForm)({
|
|
49812
|
+
resolver: (0, import_zod133.zodResolver)(journalSchema5),
|
|
49471
49813
|
defaultValues: {
|
|
49472
49814
|
date: (0, import_dayjs13.default)().format("DD/MM/YYYY"),
|
|
49473
49815
|
currency: defaultCurrency,
|
|
@@ -49489,10 +49831,10 @@ function JournalForm5({
|
|
|
49489
49831
|
});
|
|
49490
49832
|
setRef(data?.ref);
|
|
49491
49833
|
} catch (error) {
|
|
49492
|
-
|
|
49834
|
+
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49493
49835
|
}
|
|
49494
49836
|
};
|
|
49495
|
-
|
|
49837
|
+
import_react167.default.useEffect(() => {
|
|
49496
49838
|
if (isEdit) {
|
|
49497
49839
|
fetches();
|
|
49498
49840
|
}
|
|
@@ -49510,13 +49852,13 @@ function JournalForm5({
|
|
|
49510
49852
|
url: `/transactions/add${isEdit ? `?ref=${ref2}` : ""}`,
|
|
49511
49853
|
body: payload
|
|
49512
49854
|
});
|
|
49513
|
-
|
|
49855
|
+
import_antd101.message.success(
|
|
49514
49856
|
isEdit ? "Journal updated successfully" : "Journal saved successfully"
|
|
49515
49857
|
);
|
|
49516
49858
|
if (onReload) onReload();
|
|
49517
49859
|
if (close) close();
|
|
49518
49860
|
} catch (error) {
|
|
49519
|
-
|
|
49861
|
+
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49520
49862
|
}
|
|
49521
49863
|
};
|
|
49522
49864
|
const onReverse = async () => {
|
|
@@ -49525,11 +49867,11 @@ function JournalForm5({
|
|
|
49525
49867
|
await put({
|
|
49526
49868
|
url: `/transactions/reverse/${id}`
|
|
49527
49869
|
});
|
|
49528
|
-
|
|
49870
|
+
import_antd101.message.success("Transaction reversed successfully");
|
|
49529
49871
|
if (onReload) onReload();
|
|
49530
49872
|
if (close) close();
|
|
49531
49873
|
} catch (error) {
|
|
49532
|
-
|
|
49874
|
+
import_antd101.message.error(error?.message || "Something went wrong");
|
|
49533
49875
|
}
|
|
49534
49876
|
};
|
|
49535
49877
|
const handleKeyDown = (e) => {
|
|
@@ -49541,19 +49883,19 @@ function JournalForm5({
|
|
|
49541
49883
|
e.preventDefault();
|
|
49542
49884
|
}
|
|
49543
49885
|
};
|
|
49544
|
-
return /* @__PURE__ */ (0,
|
|
49886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49545
49887
|
Card,
|
|
49546
49888
|
{
|
|
49547
49889
|
isLoading: getLoading,
|
|
49548
49890
|
className: "max-w-2xl mx-auto relative border-0 shadow-none p-0 bg-transparent dark:bg-transparent",
|
|
49549
|
-
children: /* @__PURE__ */ (0,
|
|
49891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
|
|
49550
49892
|
"form",
|
|
49551
49893
|
{
|
|
49552
49894
|
onSubmit: handleSubmit(onSubmit),
|
|
49553
49895
|
onKeyDown: handleKeyDown,
|
|
49554
49896
|
className: "space-y-4",
|
|
49555
49897
|
children: [
|
|
49556
|
-
/* @__PURE__ */ (0,
|
|
49898
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49557
49899
|
Fields_default.Input,
|
|
49558
49900
|
{
|
|
49559
49901
|
label: "Description",
|
|
@@ -49564,8 +49906,8 @@ function JournalForm5({
|
|
|
49564
49906
|
placeholder: "Enter description"
|
|
49565
49907
|
}
|
|
49566
49908
|
),
|
|
49567
|
-
/* @__PURE__ */ (0,
|
|
49568
|
-
/* @__PURE__ */ (0,
|
|
49909
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49910
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49569
49911
|
Fields_default.DateInput,
|
|
49570
49912
|
{
|
|
49571
49913
|
label: "Date",
|
|
@@ -49574,7 +49916,7 @@ function JournalForm5({
|
|
|
49574
49916
|
required: true
|
|
49575
49917
|
}
|
|
49576
49918
|
),
|
|
49577
|
-
/* @__PURE__ */ (0,
|
|
49919
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49578
49920
|
Fields_default.Input,
|
|
49579
49921
|
{
|
|
49580
49922
|
label: "Currency",
|
|
@@ -49584,8 +49926,8 @@ function JournalForm5({
|
|
|
49584
49926
|
}
|
|
49585
49927
|
)
|
|
49586
49928
|
] }),
|
|
49587
|
-
/* @__PURE__ */ (0,
|
|
49588
|
-
/* @__PURE__ */ (0,
|
|
49929
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
49930
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49589
49931
|
Fields_default.Input,
|
|
49590
49932
|
{
|
|
49591
49933
|
label: "Amount",
|
|
@@ -49596,7 +49938,7 @@ function JournalForm5({
|
|
|
49596
49938
|
placeholder: "0.00"
|
|
49597
49939
|
}
|
|
49598
49940
|
),
|
|
49599
|
-
/* @__PURE__ */ (0,
|
|
49941
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49600
49942
|
Fields_default.Select,
|
|
49601
49943
|
{
|
|
49602
49944
|
label: "Action",
|
|
@@ -49610,7 +49952,7 @@ function JournalForm5({
|
|
|
49610
49952
|
}
|
|
49611
49953
|
)
|
|
49612
49954
|
] }),
|
|
49613
|
-
/* @__PURE__ */ (0,
|
|
49955
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49614
49956
|
Fields_default.Textarea,
|
|
49615
49957
|
{
|
|
49616
49958
|
label: "Note",
|
|
@@ -49620,18 +49962,18 @@ function JournalForm5({
|
|
|
49620
49962
|
rows: 3
|
|
49621
49963
|
}
|
|
49622
49964
|
),
|
|
49623
|
-
/* @__PURE__ */ (0,
|
|
49624
|
-
/* @__PURE__ */ (0,
|
|
49965
|
+
/* @__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: [
|
|
49966
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { children: isEdit && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49625
49967
|
ConfirmModal,
|
|
49626
49968
|
{
|
|
49627
49969
|
title: "Reverse Transaction",
|
|
49628
|
-
description: /* @__PURE__ */ (0,
|
|
49629
|
-
/* @__PURE__ */ (0,
|
|
49630
|
-
/* @__PURE__ */ (0,
|
|
49970
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "space-y-3 text-left", children: [
|
|
49971
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)("p", { children: "Are you sure you want to reverse this transaction?" }),
|
|
49972
|
+
/* @__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
49973
|
] }),
|
|
49632
49974
|
confirmationWord: "delete",
|
|
49633
49975
|
onSubmit: onReverse,
|
|
49634
|
-
children: /* @__PURE__ */ (0,
|
|
49976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49635
49977
|
Button,
|
|
49636
49978
|
{
|
|
49637
49979
|
type: "button",
|
|
@@ -49644,8 +49986,8 @@ function JournalForm5({
|
|
|
49644
49986
|
)
|
|
49645
49987
|
}
|
|
49646
49988
|
) }),
|
|
49647
|
-
/* @__PURE__ */ (0,
|
|
49648
|
-
close && /* @__PURE__ */ (0,
|
|
49989
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsxs)("div", { className: "flex justify-end gap-3", children: [
|
|
49990
|
+
close && /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49649
49991
|
Button,
|
|
49650
49992
|
{
|
|
49651
49993
|
type: "button",
|
|
@@ -49655,7 +49997,7 @@ function JournalForm5({
|
|
|
49655
49997
|
children: "Cancel"
|
|
49656
49998
|
}
|
|
49657
49999
|
),
|
|
49658
|
-
/* @__PURE__ */ (0,
|
|
50000
|
+
/* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
|
|
49659
50001
|
Button,
|
|
49660
50002
|
{
|
|
49661
50003
|
isLoading,
|
|
@@ -49677,15 +50019,15 @@ function JournalForm5({
|
|
|
49677
50019
|
var journalForm_default2 = JournalForm5;
|
|
49678
50020
|
|
|
49679
50021
|
// src/components/Transactions/cargoIM/CargoIM.tsx
|
|
49680
|
-
var
|
|
50022
|
+
var import_jsx_runtime273 = require("react/jsx-runtime");
|
|
49681
50023
|
function CargoIM({ v, url }) {
|
|
49682
|
-
const { branchId } = (0,
|
|
50024
|
+
const { branchId } = (0, import_react_router_dom133.useParams)();
|
|
49683
50025
|
const { apiConfig } = useWarqadConfig();
|
|
49684
50026
|
const { width } = useMediaSize();
|
|
49685
50027
|
const isLargeScreen = width > 768;
|
|
49686
|
-
const navigate = (0,
|
|
50028
|
+
const navigate = (0, import_react_router_dom133.useNavigate)();
|
|
49687
50029
|
const type = "supplier";
|
|
49688
|
-
const [deleteAccount, setDeleteAccount] = (0,
|
|
50030
|
+
const [deleteAccount, setDeleteAccount] = (0, import_react168.useState)(null);
|
|
49689
50031
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
49690
50032
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
49691
50033
|
url: url || `${apiConfig.accountStatementApi}?type=supplier${branchId ? `&branch=${branchId}` : ""}`,
|
|
@@ -49696,17 +50038,17 @@ function CargoIM({ v, url }) {
|
|
|
49696
50038
|
const items = (data2) => [
|
|
49697
50039
|
{
|
|
49698
50040
|
label: `Edit ${type}`,
|
|
49699
|
-
icon: /* @__PURE__ */ (0,
|
|
50041
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.FilePenLine, { size: 16 }),
|
|
49700
50042
|
onClick: () => openState({
|
|
49701
50043
|
type: "Account",
|
|
49702
|
-
content: /* @__PURE__ */ (0,
|
|
50044
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(AccountForm_default3, { onReload: reload, close, id: data2?._id }),
|
|
49703
50045
|
title: "Account Form",
|
|
49704
50046
|
width: 800
|
|
49705
50047
|
})
|
|
49706
50048
|
},
|
|
49707
50049
|
{
|
|
49708
50050
|
label: `Delete ${type}`,
|
|
49709
|
-
icon: /* @__PURE__ */ (0,
|
|
50051
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.Trash2, { className: "text-red-500", size: 16 }),
|
|
49710
50052
|
onClick: () => setDeleteAccount(data2)
|
|
49711
50053
|
}
|
|
49712
50054
|
].filter(Boolean);
|
|
@@ -49717,7 +50059,7 @@ function CargoIM({ v, url }) {
|
|
|
49717
50059
|
className: "w-full",
|
|
49718
50060
|
cell: ({ row }) => {
|
|
49719
50061
|
const account = row.original;
|
|
49720
|
-
return /* @__PURE__ */ (0,
|
|
50062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49721
50063
|
"span",
|
|
49722
50064
|
{
|
|
49723
50065
|
onClick: () => navigate(`${account?._id}`),
|
|
@@ -49746,8 +50088,8 @@ function CargoIM({ v, url }) {
|
|
|
49746
50088
|
className: "w-px whitespace-nowrap",
|
|
49747
50089
|
cell: ({ row }) => {
|
|
49748
50090
|
const data2 = row.original;
|
|
49749
|
-
return /* @__PURE__ */ (0,
|
|
49750
|
-
/* @__PURE__ */ (0,
|
|
50091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)("div", { className: "flex gap-4 items-center", children: [
|
|
50092
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49751
50093
|
"button",
|
|
49752
50094
|
{
|
|
49753
50095
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -49755,7 +50097,7 @@ function CargoIM({ v, url }) {
|
|
|
49755
50097
|
openState({
|
|
49756
50098
|
type: "credit",
|
|
49757
50099
|
closeOnOverlayClick: false,
|
|
49758
|
-
content: /* @__PURE__ */ (0,
|
|
50100
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49759
50101
|
InvoiceForm_default2,
|
|
49760
50102
|
{
|
|
49761
50103
|
onReload: reload,
|
|
@@ -49770,7 +50112,7 @@ function CargoIM({ v, url }) {
|
|
|
49770
50112
|
children: "Inv"
|
|
49771
50113
|
}
|
|
49772
50114
|
),
|
|
49773
|
-
/* @__PURE__ */ (0,
|
|
50115
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49774
50116
|
"button",
|
|
49775
50117
|
{
|
|
49776
50118
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -49778,7 +50120,7 @@ function CargoIM({ v, url }) {
|
|
|
49778
50120
|
openState({
|
|
49779
50121
|
type: "debit",
|
|
49780
50122
|
closeOnOverlayClick: false,
|
|
49781
|
-
content: /* @__PURE__ */ (0,
|
|
50123
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49782
50124
|
journalForm_default2,
|
|
49783
50125
|
{
|
|
49784
50126
|
onReload: reload,
|
|
@@ -49794,14 +50136,14 @@ function CargoIM({ v, url }) {
|
|
|
49794
50136
|
children: "Pay"
|
|
49795
50137
|
}
|
|
49796
50138
|
),
|
|
49797
|
-
/* @__PURE__ */ (0,
|
|
50139
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49798
50140
|
Dropdown,
|
|
49799
50141
|
{
|
|
49800
50142
|
className: "cursor-pointer",
|
|
49801
50143
|
width: "w-[150px]",
|
|
49802
50144
|
items: items(data2),
|
|
49803
50145
|
triggerMode: "hover",
|
|
49804
|
-
children: /* @__PURE__ */ (0,
|
|
50146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(import_lucide_react128.EllipsisVertical, {})
|
|
49805
50147
|
}
|
|
49806
50148
|
)
|
|
49807
50149
|
] });
|
|
@@ -49817,17 +50159,17 @@ function CargoIM({ v, url }) {
|
|
|
49817
50159
|
const onDelete = async (id) => {
|
|
49818
50160
|
try {
|
|
49819
50161
|
await remove({ url: `/accounts/delete/${id}` });
|
|
49820
|
-
|
|
50162
|
+
import_antd102.message.success("Account deleted successfully");
|
|
49821
50163
|
reload();
|
|
49822
50164
|
setDeleteAccount(null);
|
|
49823
50165
|
} catch (error) {
|
|
49824
|
-
|
|
50166
|
+
import_antd102.message.error(error.message || "Something went wrong");
|
|
49825
50167
|
return error;
|
|
49826
50168
|
}
|
|
49827
50169
|
};
|
|
49828
|
-
return /* @__PURE__ */ (0,
|
|
49829
|
-
/* @__PURE__ */ (0,
|
|
49830
|
-
/* @__PURE__ */ (0,
|
|
50170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime273.jsxs)(import_jsx_runtime273.Fragment, { children: [
|
|
50171
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Modal2, {}),
|
|
50172
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49831
50173
|
ConfirmModal,
|
|
49832
50174
|
{
|
|
49833
50175
|
isOpen: !!deleteAccount,
|
|
@@ -49840,7 +50182,7 @@ function CargoIM({ v, url }) {
|
|
|
49840
50182
|
children: null
|
|
49841
50183
|
}
|
|
49842
50184
|
),
|
|
49843
|
-
/* @__PURE__ */ (0,
|
|
50185
|
+
/* @__PURE__ */ (0, import_jsx_runtime273.jsx)("div", { className: !isLargeScreen ? "origin-top" : "", children: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
|
|
49844
50186
|
TransactionViewComponent,
|
|
49845
50187
|
{
|
|
49846
50188
|
columns,
|
|
@@ -49851,7 +50193,7 @@ function CargoIM({ v, url }) {
|
|
|
49851
50193
|
onCreate: () => {
|
|
49852
50194
|
openState({
|
|
49853
50195
|
type: "account",
|
|
49854
|
-
content: /* @__PURE__ */ (0,
|
|
50196
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(AccountForm_default3, { onReload: reload, close }),
|
|
49855
50197
|
title: "Account Form",
|
|
49856
50198
|
width: 800
|
|
49857
50199
|
});
|
|
@@ -49863,9 +50205,9 @@ function CargoIM({ v, url }) {
|
|
|
49863
50205
|
var CargoIM_default = CargoIM;
|
|
49864
50206
|
|
|
49865
50207
|
// src/components/Transactions/cargoIM/cargoIMReport.tsx
|
|
49866
|
-
var
|
|
49867
|
-
var
|
|
49868
|
-
var
|
|
50208
|
+
var import_react_router_dom134 = require("react-router-dom");
|
|
50209
|
+
var import_react169 = require("react");
|
|
50210
|
+
var import_jsx_runtime274 = require("react/jsx-runtime");
|
|
49869
50211
|
var CargoIMReport = () => {
|
|
49870
50212
|
const { apiConfig, currencies: warqadCurrencies } = useWarqadConfig();
|
|
49871
50213
|
const { TransactionView, openTransaction } = useTransactionView_default();
|
|
@@ -49878,10 +50220,10 @@ var CargoIMReport = () => {
|
|
|
49878
50220
|
value: currency2
|
|
49879
50221
|
};
|
|
49880
50222
|
});
|
|
49881
|
-
const [searchParams, setSearchParams] = (0,
|
|
50223
|
+
const [searchParams, setSearchParams] = (0, import_react_router_dom134.useSearchParams)();
|
|
49882
50224
|
const urlCurrency = searchParams.get("currency")?.toUpperCase();
|
|
49883
50225
|
const initialCurrency = urlCurrency && currencyAllowed.includes(urlCurrency) ? urlCurrency : stock;
|
|
49884
|
-
const [currencyFilter, setCurrencyFilter] = (0,
|
|
50226
|
+
const [currencyFilter, setCurrencyFilter] = (0, import_react169.useState)(initialCurrency);
|
|
49885
50227
|
const handleCurrencyChange = (value) => {
|
|
49886
50228
|
setCurrencyFilter(value);
|
|
49887
50229
|
setSearchParams((prev) => {
|
|
@@ -49889,7 +50231,7 @@ var CargoIMReport = () => {
|
|
|
49889
50231
|
return prev;
|
|
49890
50232
|
});
|
|
49891
50233
|
};
|
|
49892
|
-
(0,
|
|
50234
|
+
(0, import_react169.useEffect)(() => {
|
|
49893
50235
|
if (urlCurrency && currencyAllowed.includes(urlCurrency)) {
|
|
49894
50236
|
setCurrencyFilter(urlCurrency);
|
|
49895
50237
|
}
|
|
@@ -49909,9 +50251,9 @@ var CargoIMReport = () => {
|
|
|
49909
50251
|
header: "Date",
|
|
49910
50252
|
key: "date",
|
|
49911
50253
|
className: "text-xs whitespace-nowrap",
|
|
49912
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
49913
|
-
/* @__PURE__ */ (0,
|
|
49914
|
-
/* @__PURE__ */ (0,
|
|
50254
|
+
render: (row) => /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)("div", { className: "", children: [
|
|
50255
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)("p", { className: "font-bold text-black dark:text-white print:text-black", children: row.date }),
|
|
50256
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49915
50257
|
"span",
|
|
49916
50258
|
{
|
|
49917
50259
|
onClick: () => {
|
|
@@ -49930,13 +50272,13 @@ var CargoIMReport = () => {
|
|
|
49930
50272
|
header: "Container No",
|
|
49931
50273
|
key: "description",
|
|
49932
50274
|
className: "text-xs w-full break-words",
|
|
49933
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50275
|
+
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
50276
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
49935
50277
|
/[^a-zA-Z0-9]/g,
|
|
49936
50278
|
""
|
|
49937
50279
|
);
|
|
49938
50280
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
49939
|
-
return /* @__PURE__ */ (0,
|
|
50281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49940
50282
|
"div",
|
|
49941
50283
|
{
|
|
49942
50284
|
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 +50292,13 @@ var CargoIMReport = () => {
|
|
|
49950
50292
|
header: "Cbm",
|
|
49951
50293
|
key: "cbm",
|
|
49952
50294
|
className: "text-xs whitespace-nowrap text-right",
|
|
49953
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50295
|
+
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
50296
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
49955
50297
|
/[^a-zA-Z0-9]/g,
|
|
49956
50298
|
""
|
|
49957
50299
|
);
|
|
49958
50300
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
49959
|
-
return /* @__PURE__ */ (0,
|
|
50301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49960
50302
|
"div",
|
|
49961
50303
|
{
|
|
49962
50304
|
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 +50315,20 @@ var CargoIMReport = () => {
|
|
|
49973
50315
|
),
|
|
49974
50316
|
0
|
|
49975
50317
|
);
|
|
49976
|
-
return totalCbm > 0 ? /* @__PURE__ */ (0,
|
|
50318
|
+
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
50319
|
}
|
|
49978
50320
|
},
|
|
49979
50321
|
{
|
|
49980
50322
|
header: "Price",
|
|
49981
50323
|
key: "price",
|
|
49982
50324
|
className: "text-xs whitespace-nowrap text-right",
|
|
49983
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50325
|
+
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
50326
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
49985
50327
|
/[^a-zA-Z0-9]/g,
|
|
49986
50328
|
""
|
|
49987
50329
|
);
|
|
49988
50330
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
49989
|
-
return /* @__PURE__ */ (0,
|
|
50331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
49990
50332
|
"div",
|
|
49991
50333
|
{
|
|
49992
50334
|
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 +50342,13 @@ var CargoIMReport = () => {
|
|
|
50000
50342
|
header: "Credit",
|
|
50001
50343
|
key: "credit",
|
|
50002
50344
|
className: "text-xs whitespace-nowrap text-right",
|
|
50003
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50345
|
+
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
50346
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50005
50347
|
/[^a-zA-Z0-9]/g,
|
|
50006
50348
|
""
|
|
50007
50349
|
);
|
|
50008
50350
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50009
|
-
return /* @__PURE__ */ (0,
|
|
50351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50010
50352
|
"div",
|
|
50011
50353
|
{
|
|
50012
50354
|
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 +50357,7 @@ var CargoIMReport = () => {
|
|
|
50015
50357
|
idx
|
|
50016
50358
|
);
|
|
50017
50359
|
}) }),
|
|
50018
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50360
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-green-500 font-bold", children: Formats_default.Amount(
|
|
50019
50361
|
data2.reduce(
|
|
50020
50362
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50021
50363
|
(lineAcc, line) => lineAcc + (line.type === "credit" ? line.amount : 0),
|
|
@@ -50029,13 +50371,13 @@ var CargoIMReport = () => {
|
|
|
50029
50371
|
header: "Debit",
|
|
50030
50372
|
key: "debit",
|
|
50031
50373
|
className: "text-xs whitespace-nowrap text-right",
|
|
50032
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50374
|
+
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
50375
|
const rowId = String(row._id || row.id || row.ref || idx).replace(
|
|
50034
50376
|
/[^a-zA-Z0-9]/g,
|
|
50035
50377
|
""
|
|
50036
50378
|
);
|
|
50037
50379
|
const lineClass = `tx-line-${rowId}-${idx}`;
|
|
50038
|
-
return /* @__PURE__ */ (0,
|
|
50380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50039
50381
|
"div",
|
|
50040
50382
|
{
|
|
50041
50383
|
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 +50386,7 @@ var CargoIMReport = () => {
|
|
|
50044
50386
|
idx
|
|
50045
50387
|
);
|
|
50046
50388
|
}) }),
|
|
50047
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50389
|
+
renderFooter: (data2) => /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("span", { className: "text-red-500 font-bold", children: Formats_default.Amount(
|
|
50048
50390
|
data2.reduce(
|
|
50049
50391
|
(acc, row) => acc + (row.lines || []).reduce(
|
|
50050
50392
|
(lineAcc, line) => lineAcc + (line.type === "debit" ? line.amount : 0),
|
|
@@ -50058,14 +50400,14 @@ var CargoIMReport = () => {
|
|
|
50058
50400
|
header: "Balance",
|
|
50059
50401
|
key: "runningBalance",
|
|
50060
50402
|
className: "text-xs whitespace-nowrap text-right",
|
|
50061
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50062
|
-
renderFooter: (data2) => /* @__PURE__ */ (0,
|
|
50403
|
+
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) }),
|
|
50404
|
+
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
50405
|
data2.reduce((acc, row) => acc + (row.calculatedAmount || 0), 0),
|
|
50064
50406
|
currency
|
|
50065
50407
|
) })
|
|
50066
50408
|
}
|
|
50067
50409
|
];
|
|
50068
|
-
const datas = (0,
|
|
50410
|
+
const datas = (0, import_react169.useMemo)(() => {
|
|
50069
50411
|
let runningBalance = 0;
|
|
50070
50412
|
const transactions = data?.data?.transactions;
|
|
50071
50413
|
const res = (transactions || []).map((item) => {
|
|
@@ -50102,10 +50444,10 @@ var CargoIMReport = () => {
|
|
|
50102
50444
|
{ label: "Account Type", value: data?.data?.type },
|
|
50103
50445
|
{ label: "Currency", value: currencyFilter }
|
|
50104
50446
|
];
|
|
50105
|
-
return /* @__PURE__ */ (0,
|
|
50106
|
-
/* @__PURE__ */ (0,
|
|
50107
|
-
/* @__PURE__ */ (0,
|
|
50108
|
-
/* @__PURE__ */ (0,
|
|
50447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_jsx_runtime274.Fragment, { children: [
|
|
50448
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(Modal2, {}),
|
|
50449
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(TransactionView, {}),
|
|
50450
|
+
/* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50109
50451
|
A4DataView,
|
|
50110
50452
|
{
|
|
50111
50453
|
columns,
|
|
@@ -50120,7 +50462,7 @@ var CargoIMReport = () => {
|
|
|
50120
50462
|
openState({
|
|
50121
50463
|
type: "debit",
|
|
50122
50464
|
closeOnOverlayClick: false,
|
|
50123
|
-
content: row.type === "invoice-manager" ? /* @__PURE__ */ (0,
|
|
50465
|
+
content: row.type === "invoice-manager" ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50124
50466
|
InvoiceForm_default2,
|
|
50125
50467
|
{
|
|
50126
50468
|
close: closeTransaction,
|
|
@@ -50128,7 +50470,7 @@ var CargoIMReport = () => {
|
|
|
50128
50470
|
onReload: reload,
|
|
50129
50471
|
id: row._id
|
|
50130
50472
|
}
|
|
50131
|
-
) : /* @__PURE__ */ (0,
|
|
50473
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50132
50474
|
journalForm_default2,
|
|
50133
50475
|
{
|
|
50134
50476
|
close: closeTransaction,
|
|
@@ -50141,7 +50483,7 @@ var CargoIMReport = () => {
|
|
|
50141
50483
|
width: 800
|
|
50142
50484
|
});
|
|
50143
50485
|
},
|
|
50144
|
-
headers: /* @__PURE__ */ (0,
|
|
50486
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime274.jsx)(
|
|
50145
50487
|
Fields_default.Select,
|
|
50146
50488
|
{
|
|
50147
50489
|
options: currencies,
|
|
@@ -50157,16 +50499,16 @@ var CargoIMReport = () => {
|
|
|
50157
50499
|
var cargoIMReport_default = CargoIMReport;
|
|
50158
50500
|
|
|
50159
50501
|
// src/components/accounts/forex-2/Forex2Accounts.tsx
|
|
50160
|
-
var
|
|
50161
|
-
var
|
|
50162
|
-
var
|
|
50163
|
-
var
|
|
50164
|
-
var
|
|
50502
|
+
var import_react_router_dom135 = require("react-router-dom");
|
|
50503
|
+
var import_lucide_react129 = require("lucide-react");
|
|
50504
|
+
var import_react170 = require("react");
|
|
50505
|
+
var import_antd103 = require("antd");
|
|
50506
|
+
var import_jsx_runtime275 = require("react/jsx-runtime");
|
|
50165
50507
|
function Forex2Accounts({ v, url }) {
|
|
50166
|
-
const { branchId } = (0,
|
|
50167
|
-
const navigate = (0,
|
|
50508
|
+
const { branchId } = (0, import_react_router_dom135.useParams)();
|
|
50509
|
+
const navigate = (0, import_react_router_dom135.useNavigate)();
|
|
50168
50510
|
const type = "account";
|
|
50169
|
-
const [deleteAccount, setDeleteAccount] = (0,
|
|
50511
|
+
const [deleteAccount, setDeleteAccount] = (0, import_react170.useState)(null);
|
|
50170
50512
|
const { isLoading: isActionLoading, remove } = useApis_default();
|
|
50171
50513
|
const { data, TransactionViewComponent, reload, isLoading } = useTransaction_default({
|
|
50172
50514
|
url: url || `/reports/forex-account-report${branchId ? `?branch=${branchId}` : ""}`,
|
|
@@ -50177,22 +50519,22 @@ function Forex2Accounts({ v, url }) {
|
|
|
50177
50519
|
const items = (data2) => [
|
|
50178
50520
|
{
|
|
50179
50521
|
label: `Currency Report`,
|
|
50180
|
-
icon: /* @__PURE__ */ (0,
|
|
50522
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.FileChartLine, { size: 16 }),
|
|
50181
50523
|
onClick: () => navigate(data2?._id)
|
|
50182
50524
|
},
|
|
50183
50525
|
{
|
|
50184
50526
|
label: `Edit ${type}`,
|
|
50185
|
-
icon: /* @__PURE__ */ (0,
|
|
50527
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.FilePenLine, { size: 16 }),
|
|
50186
50528
|
onClick: () => openState({
|
|
50187
50529
|
type: "forex account",
|
|
50188
|
-
content: /* @__PURE__ */ (0,
|
|
50530
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountForm_default, { close, reloads: reload, id: data2?._id }),
|
|
50189
50531
|
title: "Forex Account Form",
|
|
50190
50532
|
width: 800
|
|
50191
50533
|
})
|
|
50192
50534
|
},
|
|
50193
50535
|
{
|
|
50194
50536
|
label: `Delete ${type}`,
|
|
50195
|
-
icon: /* @__PURE__ */ (0,
|
|
50537
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.Trash2, { className: "text-red-500", size: 16 }),
|
|
50196
50538
|
onClick: () => setDeleteAccount(data2)
|
|
50197
50539
|
}
|
|
50198
50540
|
].filter(Boolean);
|
|
@@ -50202,7 +50544,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50202
50544
|
header: "Name",
|
|
50203
50545
|
cell: ({ row }) => {
|
|
50204
50546
|
const account = row.original;
|
|
50205
|
-
return /* @__PURE__ */ (0,
|
|
50547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50206
50548
|
"span",
|
|
50207
50549
|
{
|
|
50208
50550
|
onClick: () => navigate(`statements/${account?._id}`),
|
|
@@ -50217,7 +50559,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50217
50559
|
header: "Phone",
|
|
50218
50560
|
cell: ({ row }) => {
|
|
50219
50561
|
const account = row.original;
|
|
50220
|
-
return /* @__PURE__ */ (0,
|
|
50562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { children: account?.phoneNumber || "N/A" });
|
|
50221
50563
|
}
|
|
50222
50564
|
},
|
|
50223
50565
|
{
|
|
@@ -50225,14 +50567,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50225
50567
|
header: "Balances",
|
|
50226
50568
|
cell: ({ row }) => {
|
|
50227
50569
|
const account = row.original;
|
|
50228
|
-
return /* @__PURE__ */ (0,
|
|
50229
|
-
([currency, data2]) => /* @__PURE__ */ (0,
|
|
50570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: Object.entries(account?.transactions || {}).map(
|
|
50571
|
+
([currency, data2]) => /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
50230
50572
|
"div",
|
|
50231
50573
|
{
|
|
50232
50574
|
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
50575
|
children: [
|
|
50234
|
-
/* @__PURE__ */ (0,
|
|
50235
|
-
/* @__PURE__ */ (0,
|
|
50576
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)("span", { className: "text-[12px] font-bold text-gray-400 dark:text-gray-500 uppercase tracking-tighter", children: currency }),
|
|
50577
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50236
50578
|
"span",
|
|
50237
50579
|
{
|
|
50238
50580
|
className: `text-[12px] font-bold tabular-nums ${data2.balance < 0 ? "text-red-500" : "text-green-600 dark:text-green-500"}`,
|
|
@@ -50251,8 +50593,8 @@ function Forex2Accounts({ v, url }) {
|
|
|
50251
50593
|
header: "Actions",
|
|
50252
50594
|
cell: ({ row }) => {
|
|
50253
50595
|
const data2 = row.original;
|
|
50254
|
-
return /* @__PURE__ */ (0,
|
|
50255
|
-
/* @__PURE__ */ (0,
|
|
50596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { className: "flex gap-4 items-center", children: [
|
|
50597
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50256
50598
|
"button",
|
|
50257
50599
|
{
|
|
50258
50600
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-blue-500",
|
|
@@ -50260,7 +50602,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50260
50602
|
openState({
|
|
50261
50603
|
type: "credit",
|
|
50262
50604
|
closeOnOverlayClick: false,
|
|
50263
|
-
content: /* @__PURE__ */ (0,
|
|
50605
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50264
50606
|
Forex2FormTransaction_default,
|
|
50265
50607
|
{
|
|
50266
50608
|
close,
|
|
@@ -50276,7 +50618,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50276
50618
|
children: "Out"
|
|
50277
50619
|
}
|
|
50278
50620
|
),
|
|
50279
|
-
/* @__PURE__ */ (0,
|
|
50621
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50280
50622
|
"button",
|
|
50281
50623
|
{
|
|
50282
50624
|
className: "cursor-pointer px-2 py-1 text-white rounded-lg text-xs bg-red-500",
|
|
@@ -50284,7 +50626,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50284
50626
|
openState({
|
|
50285
50627
|
type: "debit",
|
|
50286
50628
|
closeOnOverlayClick: false,
|
|
50287
|
-
content: /* @__PURE__ */ (0,
|
|
50629
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50288
50630
|
Forex2FormTransaction_default,
|
|
50289
50631
|
{
|
|
50290
50632
|
close,
|
|
@@ -50300,13 +50642,13 @@ function Forex2Accounts({ v, url }) {
|
|
|
50300
50642
|
children: "In"
|
|
50301
50643
|
}
|
|
50302
50644
|
),
|
|
50303
|
-
/* @__PURE__ */ (0,
|
|
50645
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50304
50646
|
Dropdown,
|
|
50305
50647
|
{
|
|
50306
50648
|
className: "cursor-pointer w-[150px]",
|
|
50307
50649
|
items: items(data2),
|
|
50308
50650
|
triggerMode: "hover",
|
|
50309
|
-
children: /* @__PURE__ */ (0,
|
|
50651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(import_lucide_react129.EllipsisVertical, {})
|
|
50310
50652
|
}
|
|
50311
50653
|
)
|
|
50312
50654
|
] });
|
|
@@ -50317,11 +50659,11 @@ function Forex2Accounts({ v, url }) {
|
|
|
50317
50659
|
const onDelete = async (id) => {
|
|
50318
50660
|
try {
|
|
50319
50661
|
await remove({ url: `/accounts/delete/${id}` });
|
|
50320
|
-
|
|
50662
|
+
import_antd103.message.success("Account deleted successfully");
|
|
50321
50663
|
reload();
|
|
50322
50664
|
setDeleteAccount(null);
|
|
50323
50665
|
} catch (error) {
|
|
50324
|
-
|
|
50666
|
+
import_antd103.message.error(error.message || "Something went wrong");
|
|
50325
50667
|
return error;
|
|
50326
50668
|
}
|
|
50327
50669
|
};
|
|
@@ -50345,9 +50687,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50345
50687
|
};
|
|
50346
50688
|
}).filter((item) => item.debit !== 0 || item.credit !== 0);
|
|
50347
50689
|
console.log(currencies);
|
|
50348
|
-
return /* @__PURE__ */ (0,
|
|
50349
|
-
/* @__PURE__ */ (0,
|
|
50350
|
-
/* @__PURE__ */ (0,
|
|
50690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(import_jsx_runtime275.Fragment, { children: [
|
|
50691
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Modal2, {}),
|
|
50692
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50351
50693
|
ConfirmModal,
|
|
50352
50694
|
{
|
|
50353
50695
|
isOpen: !!deleteAccount,
|
|
@@ -50360,9 +50702,9 @@ function Forex2Accounts({ v, url }) {
|
|
|
50360
50702
|
children: null
|
|
50361
50703
|
}
|
|
50362
50704
|
),
|
|
50363
|
-
/* @__PURE__ */ (0,
|
|
50364
|
-
/* @__PURE__ */ (0,
|
|
50365
|
-
/* @__PURE__ */ (0,
|
|
50705
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)("div", { children: [
|
|
50706
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountSummary_default, { currencies, isLoading }),
|
|
50707
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
50366
50708
|
TransactionViewComponent,
|
|
50367
50709
|
{
|
|
50368
50710
|
columns,
|
|
@@ -50374,7 +50716,7 @@ function Forex2Accounts({ v, url }) {
|
|
|
50374
50716
|
onCreate: () => {
|
|
50375
50717
|
openState({
|
|
50376
50718
|
type: "forex account",
|
|
50377
|
-
content: /* @__PURE__ */ (0,
|
|
50719
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ForexAccountForm_default, { close, reloads: reload }),
|
|
50378
50720
|
title: "Forex Account Form",
|
|
50379
50721
|
width: 800
|
|
50380
50722
|
});
|
|
@@ -50387,14 +50729,14 @@ function Forex2Accounts({ v, url }) {
|
|
|
50387
50729
|
var Forex2Accounts_default = Forex2Accounts;
|
|
50388
50730
|
|
|
50389
50731
|
// src/components/reports/ProductList.tsx
|
|
50390
|
-
var
|
|
50391
|
-
var
|
|
50732
|
+
var import_react_router_dom136 = require("react-router-dom");
|
|
50733
|
+
var import_jsx_runtime276 = require("react/jsx-runtime");
|
|
50392
50734
|
var options9 = [
|
|
50393
50735
|
{ label: "Product", value: "product" },
|
|
50394
50736
|
{ label: "Pack", value: "pack" }
|
|
50395
50737
|
];
|
|
50396
50738
|
var ProductList2 = ({ value = false }) => {
|
|
50397
|
-
const { branchId } = (0,
|
|
50739
|
+
const { branchId } = (0, import_react_router_dom136.useParams)();
|
|
50398
50740
|
const { branches } = useAuth_default();
|
|
50399
50741
|
const { TransactionView } = useTransactionView_default();
|
|
50400
50742
|
const { getQuery, setQuery } = useApp_default();
|
|
@@ -50416,7 +50758,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50416
50758
|
key: "name",
|
|
50417
50759
|
className: "text-xs whitespace-nowrap",
|
|
50418
50760
|
render: (row) => {
|
|
50419
|
-
return /* @__PURE__ */ (0,
|
|
50761
|
+
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
50762
|
}
|
|
50421
50763
|
},
|
|
50422
50764
|
...value ? [
|
|
@@ -50424,14 +50766,14 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50424
50766
|
header: "Cost",
|
|
50425
50767
|
key: "cost",
|
|
50426
50768
|
className: "text-xs whitespace-nowrap text-right",
|
|
50427
|
-
render: (row) => /* @__PURE__ */ (0,
|
|
50769
|
+
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
50770
|
}
|
|
50429
50771
|
] : []
|
|
50430
50772
|
];
|
|
50431
50773
|
const datas = data?.data || [];
|
|
50432
|
-
return /* @__PURE__ */ (0,
|
|
50433
|
-
/* @__PURE__ */ (0,
|
|
50434
|
-
/* @__PURE__ */ (0,
|
|
50774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(import_jsx_runtime276.Fragment, { children: [
|
|
50775
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(TransactionView, {}),
|
|
50776
|
+
/* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50435
50777
|
A4DataView,
|
|
50436
50778
|
{
|
|
50437
50779
|
columns,
|
|
@@ -50442,7 +50784,7 @@ var ProductList2 = ({ value = false }) => {
|
|
|
50442
50784
|
tableTitle: "Stock List",
|
|
50443
50785
|
fixed: false,
|
|
50444
50786
|
startPage: 1e10,
|
|
50445
|
-
headers: /* @__PURE__ */ (0,
|
|
50787
|
+
headers: /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
|
|
50446
50788
|
Select,
|
|
50447
50789
|
{
|
|
50448
50790
|
options: options9,
|