warqadui 0.0.50 → 0.0.52
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 +220 -1
- package/dist/index.d.ts +220 -1
- package/dist/index.js +1012 -238
- package/dist/index.mjs +1004 -230
- package/dist/styles.js +375 -0
- package/dist/styles.mjs +375 -0
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -280,7 +280,10 @@ var ThemeProvider = ({ children }) => {
|
|
|
280
280
|
localStorage.setItem("theme", "light");
|
|
281
281
|
}
|
|
282
282
|
}, [isDarkMode]);
|
|
283
|
-
const toggleTheme = () =>
|
|
283
|
+
const toggleTheme = () => {
|
|
284
|
+
console.log("Toggle theme clicked, currently isDarkMode:", isDarkMode);
|
|
285
|
+
setTheme(isDarkMode ? "light" : "dark");
|
|
286
|
+
};
|
|
284
287
|
const setTheme = (theme) => setIsDarkMode(theme === "dark");
|
|
285
288
|
return /* @__PURE__ */ jsx4(ThemeContext.Provider, { value: { isDarkMode, toggleTheme, setTheme }, children });
|
|
286
289
|
};
|
|
@@ -1097,19 +1100,20 @@ var Input = forwardRef(
|
|
|
1097
1100
|
}
|
|
1098
1101
|
}
|
|
1099
1102
|
}, [props.value, name, form]);
|
|
1100
|
-
let
|
|
1103
|
+
let message2 = error;
|
|
1101
1104
|
if (form && name) {
|
|
1102
1105
|
const {
|
|
1103
1106
|
formState: { errors }
|
|
1104
1107
|
} = form;
|
|
1105
1108
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1106
|
-
|
|
1109
|
+
message2 = errorObj?.message;
|
|
1107
1110
|
}
|
|
1111
|
+
const watchedValue = form?.watch(name);
|
|
1108
1112
|
useEffect5(() => {
|
|
1109
|
-
if (form && name) {
|
|
1113
|
+
if (form && name && form.formState.errors?.root) {
|
|
1110
1114
|
form.clearErrors("root");
|
|
1111
1115
|
}
|
|
1112
|
-
}, [form
|
|
1116
|
+
}, [watchedValue, name, form]);
|
|
1113
1117
|
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */ jsxs11(
|
|
1114
1118
|
"div",
|
|
1115
1119
|
{
|
|
@@ -1169,7 +1173,7 @@ var Input = forwardRef(
|
|
|
1169
1173
|
}
|
|
1170
1174
|
)
|
|
1171
1175
|
] }),
|
|
1172
|
-
|
|
1176
|
+
message2 && /* @__PURE__ */ jsx17("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
|
|
1173
1177
|
]
|
|
1174
1178
|
}
|
|
1175
1179
|
);
|
|
@@ -1286,7 +1290,7 @@ var PhoneInput = forwardRef2(
|
|
|
1286
1290
|
const [isFocused, setIsFocused] = useState8(false);
|
|
1287
1291
|
const { theme } = useWarqadConfig();
|
|
1288
1292
|
const primaryColor = theme?.primaryColor;
|
|
1289
|
-
let
|
|
1293
|
+
let message2 = error;
|
|
1290
1294
|
if (form && name) {
|
|
1291
1295
|
const {
|
|
1292
1296
|
formState: { errors }
|
|
@@ -1296,7 +1300,7 @@ var PhoneInput = forwardRef2(
|
|
|
1296
1300
|
for (const part of nameParts) {
|
|
1297
1301
|
currentError = currentError?.[part];
|
|
1298
1302
|
}
|
|
1299
|
-
|
|
1303
|
+
message2 = currentError?.message || message2;
|
|
1300
1304
|
}
|
|
1301
1305
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs12("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1302
1306
|
/* @__PURE__ */ jsxs12(
|
|
@@ -1341,7 +1345,7 @@ var PhoneInput = forwardRef2(
|
|
|
1341
1345
|
}
|
|
1342
1346
|
)
|
|
1343
1347
|
] }),
|
|
1344
|
-
|
|
1348
|
+
message2 && /* @__PURE__ */ jsx18("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
|
|
1345
1349
|
] });
|
|
1346
1350
|
if (form && name) {
|
|
1347
1351
|
return /* @__PURE__ */ jsx18(
|
|
@@ -1497,7 +1501,7 @@ var SelectRoot = ({
|
|
|
1497
1501
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1498
1502
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1499
1503
|
}, [fieldInternalProps]);
|
|
1500
|
-
let
|
|
1504
|
+
let message2 = error;
|
|
1501
1505
|
if (form && name) {
|
|
1502
1506
|
const {
|
|
1503
1507
|
formState: { errors }
|
|
@@ -1507,7 +1511,7 @@ var SelectRoot = ({
|
|
|
1507
1511
|
for (const part of nameParts) {
|
|
1508
1512
|
currentError = currentError?.[part];
|
|
1509
1513
|
}
|
|
1510
|
-
|
|
1514
|
+
message2 = currentError?.message || message2;
|
|
1511
1515
|
}
|
|
1512
1516
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
1513
1517
|
const valueCtx = {
|
|
@@ -1568,7 +1572,7 @@ var SelectRoot = ({
|
|
|
1568
1572
|
String(opt.value) || index
|
|
1569
1573
|
)) })
|
|
1570
1574
|
] }),
|
|
1571
|
-
|
|
1575
|
+
message2 && /* @__PURE__ */ jsx19("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
|
|
1572
1576
|
]
|
|
1573
1577
|
}
|
|
1574
1578
|
) });
|
|
@@ -1804,13 +1808,13 @@ var Textarea = forwardRef4(
|
|
|
1804
1808
|
const [isFocused, setIsFocused] = useState10(false);
|
|
1805
1809
|
const { theme } = useWarqadConfig();
|
|
1806
1810
|
const primaryColor = theme?.primaryColor;
|
|
1807
|
-
let
|
|
1811
|
+
let message2 = error;
|
|
1808
1812
|
if (form && name) {
|
|
1809
1813
|
const {
|
|
1810
1814
|
formState: { errors }
|
|
1811
1815
|
} = form;
|
|
1812
1816
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1813
|
-
|
|
1817
|
+
message2 = errorObj?.message;
|
|
1814
1818
|
}
|
|
1815
1819
|
const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs14("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
1816
1820
|
/* @__PURE__ */ jsxs14(
|
|
@@ -1846,7 +1850,7 @@ var Textarea = forwardRef4(
|
|
|
1846
1850
|
...inputProps
|
|
1847
1851
|
}
|
|
1848
1852
|
) }),
|
|
1849
|
-
|
|
1853
|
+
message2 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
|
|
1850
1854
|
] });
|
|
1851
1855
|
useEffect7(() => {
|
|
1852
1856
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -2339,7 +2343,7 @@ var SearchApiRoot = ({
|
|
|
2339
2343
|
const filteredOptions = options.filter(
|
|
2340
2344
|
(option) => !filter.includes(getOptionValue(option))
|
|
2341
2345
|
);
|
|
2342
|
-
let
|
|
2346
|
+
let message2 = error || errorMessage;
|
|
2343
2347
|
if (form && name) {
|
|
2344
2348
|
const {
|
|
2345
2349
|
formState: { errors }
|
|
@@ -2349,7 +2353,7 @@ var SearchApiRoot = ({
|
|
|
2349
2353
|
for (const part of nameParts) {
|
|
2350
2354
|
currentError = currentError?.[part];
|
|
2351
2355
|
}
|
|
2352
|
-
|
|
2356
|
+
message2 = currentError?.message || message2;
|
|
2353
2357
|
}
|
|
2354
2358
|
const valueCtx = {
|
|
2355
2359
|
isOpen,
|
|
@@ -2383,7 +2387,7 @@ var SearchApiRoot = ({
|
|
|
2383
2387
|
form,
|
|
2384
2388
|
name,
|
|
2385
2389
|
obj,
|
|
2386
|
-
error:
|
|
2390
|
+
error: message2,
|
|
2387
2391
|
onSelect,
|
|
2388
2392
|
onClear
|
|
2389
2393
|
};
|
|
@@ -2740,19 +2744,19 @@ var DateInput = forwardRef6(
|
|
|
2740
2744
|
const { theme } = useWarqadConfig();
|
|
2741
2745
|
const primaryColor = theme?.primaryColor;
|
|
2742
2746
|
const [isFocused, setIsFocused] = useState13(false);
|
|
2743
|
-
let
|
|
2747
|
+
let message2 = error;
|
|
2744
2748
|
if (form && name) {
|
|
2745
2749
|
const {
|
|
2746
2750
|
formState: { errors }
|
|
2747
2751
|
} = form;
|
|
2748
2752
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2749
|
-
|
|
2753
|
+
message2 = errorObj?.message;
|
|
2750
2754
|
}
|
|
2751
2755
|
const inputStyles = `w-full px-2.5 py-1 rounded-xl border! shadow-none transition-all! duration-200! outline-none!
|
|
2752
2756
|
bg-white! dark:bg-zinc-900!
|
|
2753
2757
|
text-gray-900! dark:text-zinc-100!
|
|
2754
2758
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
2755
|
-
${
|
|
2759
|
+
${message2 ? "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"}
|
|
2756
2760
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
2757
2761
|
${className}`;
|
|
2758
2762
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
@@ -2780,8 +2784,8 @@ var DateInput = forwardRef6(
|
|
|
2780
2784
|
needConfirm: false,
|
|
2781
2785
|
style: {
|
|
2782
2786
|
height: "36px",
|
|
2783
|
-
borderColor: isFocused && !
|
|
2784
|
-
boxShadow: isFocused && !
|
|
2787
|
+
borderColor: isFocused && !message2 ? primaryColor : void 0,
|
|
2788
|
+
boxShadow: isFocused && !message2 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
2785
2789
|
},
|
|
2786
2790
|
classNames: { popup: { root: "z-50" } },
|
|
2787
2791
|
suffixIcon: /* @__PURE__ */ jsx22(
|
|
@@ -2802,7 +2806,7 @@ var DateInput = forwardRef6(
|
|
|
2802
2806
|
{
|
|
2803
2807
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
2804
2808
|
style: {
|
|
2805
|
-
color:
|
|
2809
|
+
color: message2 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
2806
2810
|
},
|
|
2807
2811
|
children: [
|
|
2808
2812
|
label,
|
|
@@ -2823,7 +2827,7 @@ var DateInput = forwardRef6(
|
|
|
2823
2827
|
)
|
|
2824
2828
|
}
|
|
2825
2829
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
2826
|
-
|
|
2830
|
+
message2 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message2 })
|
|
2827
2831
|
] });
|
|
2828
2832
|
}
|
|
2829
2833
|
);
|
|
@@ -4069,8 +4073,626 @@ var Branding = ({
|
|
|
4069
4073
|
);
|
|
4070
4074
|
};
|
|
4071
4075
|
|
|
4076
|
+
// src/hooks/useLogin.tsx
|
|
4077
|
+
import React12 from "react";
|
|
4078
|
+
import { useForm } from "react-hook-form";
|
|
4079
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4080
|
+
import * as z from "zod";
|
|
4081
|
+
|
|
4082
|
+
// src/components/Login/ThemedLogins.tsx
|
|
4083
|
+
import {
|
|
4084
|
+
Mail,
|
|
4085
|
+
Lock,
|
|
4086
|
+
Terminal,
|
|
4087
|
+
ArrowRight,
|
|
4088
|
+
Plane,
|
|
4089
|
+
HeartPulse,
|
|
4090
|
+
MonitorCheck,
|
|
4091
|
+
ArrowLeft
|
|
4092
|
+
} from "lucide-react";
|
|
4093
|
+
import { useNavigate as useNavigate2 } from "react-router-dom";
|
|
4094
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4095
|
+
var TechLogin = ({
|
|
4096
|
+
form,
|
|
4097
|
+
onSubmit,
|
|
4098
|
+
image,
|
|
4099
|
+
title,
|
|
4100
|
+
subtitle,
|
|
4101
|
+
brandName,
|
|
4102
|
+
backUrl,
|
|
4103
|
+
isLoading
|
|
4104
|
+
}) => {
|
|
4105
|
+
const navigate = useNavigate2();
|
|
4106
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
|
|
4107
|
+
/* @__PURE__ */ jsxs20("div", { className: "hidden lg:flex lg:w-3/5 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
|
|
4108
|
+
/* @__PURE__ */ jsx28(
|
|
4109
|
+
"div",
|
|
4110
|
+
{
|
|
4111
|
+
className: "absolute inset-0 z-0 opacity-60 bg-cover bg-center transition-transform hover:scale-110 duration-[20s]",
|
|
4112
|
+
style: { backgroundImage: `url('${image || "/tech_bg.png"}')` }
|
|
4113
|
+
}
|
|
4114
|
+
),
|
|
4115
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-purple-500/10 z-10" }),
|
|
4116
|
+
/* @__PURE__ */ jsxs20("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
|
|
4117
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3", children: [
|
|
4118
|
+
/* @__PURE__ */ jsx28("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-[0_0_20px_rgba(79,70,229,0.5)]", children: /* @__PURE__ */ jsx28(Terminal, { className: "text-white w-6 h-6" }) }),
|
|
4119
|
+
/* @__PURE__ */ jsx28("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: brandName || "DevNode" })
|
|
4120
|
+
] }),
|
|
4121
|
+
/* @__PURE__ */ jsxs20("div", { className: "max-w-md", children: [
|
|
4122
|
+
/* @__PURE__ */ jsxs20("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
|
|
4123
|
+
"Build the ",
|
|
4124
|
+
/* @__PURE__ */ jsx28("span", { className: "text-indigo-400", children: "Future" }),
|
|
4125
|
+
" of Web."
|
|
4126
|
+
] }),
|
|
4127
|
+
/* @__PURE__ */ jsx28("p", { className: "text-slate-400 text-lg leading-relaxed mb-8", children: "Join thousands of developers building scalable applications with our state-of-the-art infrastructure." })
|
|
4128
|
+
] }),
|
|
4129
|
+
/* @__PURE__ */ jsxs20("div", { className: "text-slate-500 text-sm", children: [
|
|
4130
|
+
"\xA9 2026 ",
|
|
4131
|
+
brandName || "DevNode",
|
|
4132
|
+
"."
|
|
4133
|
+
] })
|
|
4134
|
+
] })
|
|
4135
|
+
] }),
|
|
4136
|
+
/* @__PURE__ */ jsxs20("div", { className: "w-full lg:w-2/5 p-8 lg:p-16 flex flex-col justify-center bg-white dark:bg-[#0A0B10] relative transition-colors duration-300", children: [
|
|
4137
|
+
/* @__PURE__ */ jsxs20("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
|
|
4138
|
+
backUrl && /* @__PURE__ */ jsxs20(
|
|
4139
|
+
"button",
|
|
4140
|
+
{
|
|
4141
|
+
onClick: () => navigate(backUrl),
|
|
4142
|
+
disabled: isLoading,
|
|
4143
|
+
className: "p-2 rounded-lg text-slate-500 hover:text-indigo-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-indigo-400 dark:hover:bg-slate-800 transition-colors flex items-center gap-2 font-medium disabled:opacity-50",
|
|
4144
|
+
children: [
|
|
4145
|
+
/* @__PURE__ */ jsx28(ArrowLeft, { size: 18 }),
|
|
4146
|
+
/* @__PURE__ */ jsx28("span", { className: "text-sm", children: "Back" })
|
|
4147
|
+
]
|
|
4148
|
+
}
|
|
4149
|
+
),
|
|
4150
|
+
/* @__PURE__ */ jsx28(ThemeToggle, {})
|
|
4151
|
+
] }),
|
|
4152
|
+
/* @__PURE__ */ jsxs20("div", { className: "max-w-md w-full mx-auto relative z-10", children: [
|
|
4153
|
+
/* @__PURE__ */ jsxs20("div", { className: "mb-12", children: [
|
|
4154
|
+
/* @__PURE__ */ jsx28("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: title || "Welcome Back" }),
|
|
4155
|
+
/* @__PURE__ */ jsx28("p", { className: "text-slate-500 dark:text-slate-400", children: subtitle || "Please enter your credentials to access your dashboard." })
|
|
4156
|
+
] }),
|
|
4157
|
+
/* @__PURE__ */ jsxs20(
|
|
4158
|
+
"form",
|
|
4159
|
+
{
|
|
4160
|
+
onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
|
|
4161
|
+
className: "space-y-6",
|
|
4162
|
+
children: [
|
|
4163
|
+
/* @__PURE__ */ jsx28(
|
|
4164
|
+
Fields_default.Input,
|
|
4165
|
+
{
|
|
4166
|
+
form,
|
|
4167
|
+
name: "email",
|
|
4168
|
+
label: "Email Address",
|
|
4169
|
+
type: "email",
|
|
4170
|
+
disabled: isLoading,
|
|
4171
|
+
placeholder: "maoo@example.com",
|
|
4172
|
+
icon: /* @__PURE__ */ jsx28(
|
|
4173
|
+
Mail,
|
|
4174
|
+
{
|
|
4175
|
+
size: 18,
|
|
4176
|
+
className: "text-slate-400 dark:text-slate-500"
|
|
4177
|
+
}
|
|
4178
|
+
),
|
|
4179
|
+
className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-12"
|
|
4180
|
+
}
|
|
4181
|
+
),
|
|
4182
|
+
/* @__PURE__ */ jsx28(
|
|
4183
|
+
Fields_default.Input,
|
|
4184
|
+
{
|
|
4185
|
+
form,
|
|
4186
|
+
name: "password",
|
|
4187
|
+
label: "Password",
|
|
4188
|
+
type: "password",
|
|
4189
|
+
disabled: isLoading,
|
|
4190
|
+
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
4191
|
+
icon: /* @__PURE__ */ jsx28(
|
|
4192
|
+
Lock,
|
|
4193
|
+
{
|
|
4194
|
+
size: 18,
|
|
4195
|
+
className: "text-slate-400 dark:text-slate-500"
|
|
4196
|
+
}
|
|
4197
|
+
),
|
|
4198
|
+
className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-12"
|
|
4199
|
+
}
|
|
4200
|
+
),
|
|
4201
|
+
form.formState.errors.root && /* @__PURE__ */ jsx28("p", { className: "text-red-500 text-sm font-medium animate-in fade-in slide-in-from-top-1 duration-200", children: form.formState.errors.root.message }),
|
|
4202
|
+
/* @__PURE__ */ jsxs20(
|
|
4203
|
+
Button,
|
|
4204
|
+
{
|
|
4205
|
+
type: "submit",
|
|
4206
|
+
isLoading,
|
|
4207
|
+
className: "w-full bg-indigo-600 hover:bg-indigo-500 text-white h-12 font-semibold flex items-center justify-center gap-2",
|
|
4208
|
+
children: [
|
|
4209
|
+
isLoading ? "Logging in..." : "Authenticate Now",
|
|
4210
|
+
!isLoading && /* @__PURE__ */ jsx28(ArrowRight, { size: 18 })
|
|
4211
|
+
]
|
|
4212
|
+
}
|
|
4213
|
+
)
|
|
4214
|
+
]
|
|
4215
|
+
}
|
|
4216
|
+
)
|
|
4217
|
+
] })
|
|
4218
|
+
] })
|
|
4219
|
+
] });
|
|
4220
|
+
};
|
|
4221
|
+
var TravelLogin = ({
|
|
4222
|
+
form,
|
|
4223
|
+
onSubmit,
|
|
4224
|
+
image,
|
|
4225
|
+
title,
|
|
4226
|
+
subtitle,
|
|
4227
|
+
brandName,
|
|
4228
|
+
backUrl,
|
|
4229
|
+
isLoading
|
|
4230
|
+
}) => {
|
|
4231
|
+
const navigate = useNavigate2();
|
|
4232
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-slate-950 transition-colors", children: [
|
|
4233
|
+
/* @__PURE__ */ jsxs20("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-100 border-r border-slate-100", children: [
|
|
4234
|
+
/* @__PURE__ */ jsx28(
|
|
4235
|
+
"div",
|
|
4236
|
+
{
|
|
4237
|
+
className: "absolute inset-0 z-0 bg-cover bg-center transition-transform hover:scale-105 duration-[30s]",
|
|
4238
|
+
style: { backgroundImage: `url('${image || "/travel_bg.png"}')` }
|
|
4239
|
+
}
|
|
4240
|
+
),
|
|
4241
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute inset-0 bg-linear-to-br from-orange-500/20 via-transparent to-black/30 z-10" }),
|
|
4242
|
+
/* @__PURE__ */ jsxs20("div", { className: "relative z-20 p-16 flex flex-col justify-between w-full h-full text-white", children: [
|
|
4243
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3", children: [
|
|
4244
|
+
/* @__PURE__ */ jsx28("div", { className: "h-10 w-10 bg-orange-500 rounded-full flex items-center justify-center shadow-lg", children: /* @__PURE__ */ jsx28(Plane, { className: "text-white w-6 h-6 rotate-45" }) }),
|
|
4245
|
+
/* @__PURE__ */ jsx28("span", { className: "text-2xl font-bold tracking-tight", children: brandName || "Wanderlust" })
|
|
4246
|
+
] }),
|
|
4247
|
+
/* @__PURE__ */ jsx28("div", { className: "max-w-md", children: /* @__PURE__ */ jsxs20("h1", { className: "text-6xl font-black mb-8 leading-[1.1]", children: [
|
|
4248
|
+
"Your Next ",
|
|
4249
|
+
/* @__PURE__ */ jsx28("span", { className: "text-orange-400", children: "Adventure" }),
|
|
4250
|
+
" ",
|
|
4251
|
+
"Starts Now."
|
|
4252
|
+
] }) }),
|
|
4253
|
+
/* @__PURE__ */ jsxs20("div", { className: "text-white/70 text-sm", children: [
|
|
4254
|
+
"Discover the world with ",
|
|
4255
|
+
brandName || "Wanderlust",
|
|
4256
|
+
"."
|
|
4257
|
+
] })
|
|
4258
|
+
] })
|
|
4259
|
+
] }),
|
|
4260
|
+
/* @__PURE__ */ jsxs20("div", { className: "w-full lg:w-1/2 p-10 lg:p-24 flex flex-col justify-center bg-white dark:bg-slate-950 relative transition-colors", children: [
|
|
4261
|
+
/* @__PURE__ */ jsxs20("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
|
|
4262
|
+
backUrl && /* @__PURE__ */ jsxs20(
|
|
4263
|
+
"button",
|
|
4264
|
+
{
|
|
4265
|
+
onClick: () => navigate(backUrl),
|
|
4266
|
+
disabled: isLoading,
|
|
4267
|
+
className: "p-2 rounded-lg text-slate-500 hover:text-orange-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-orange-400 dark:hover:bg-slate-800 transition-colors flex items-center gap-2 font-medium disabled:opacity-50",
|
|
4268
|
+
children: [
|
|
4269
|
+
/* @__PURE__ */ jsx28(ArrowLeft, { size: 18 }),
|
|
4270
|
+
/* @__PURE__ */ jsx28("span", { className: "text-sm", children: "Back" })
|
|
4271
|
+
]
|
|
4272
|
+
}
|
|
4273
|
+
),
|
|
4274
|
+
/* @__PURE__ */ jsx28(ThemeToggle, {})
|
|
4275
|
+
] }),
|
|
4276
|
+
/* @__PURE__ */ jsxs20("div", { className: "max-w-md w-full mx-auto relative z-10", children: [
|
|
4277
|
+
/* @__PURE__ */ jsxs20("div", { className: "mb-12 text-center lg:text-left", children: [
|
|
4278
|
+
/* @__PURE__ */ jsx28("h2", { className: "text-4xl font-bold text-slate-900 dark:text-white mb-4 tracking-tight", children: title || "Login to Explore" }),
|
|
4279
|
+
/* @__PURE__ */ jsx28("p", { className: "text-slate-500 dark:text-slate-400 text-lg", children: subtitle || "Enter your details to access your travel dashboard." })
|
|
4280
|
+
] }),
|
|
4281
|
+
/* @__PURE__ */ jsxs20(
|
|
4282
|
+
"form",
|
|
4283
|
+
{
|
|
4284
|
+
onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
|
|
4285
|
+
className: "space-y-6",
|
|
4286
|
+
children: [
|
|
4287
|
+
/* @__PURE__ */ jsx28(
|
|
4288
|
+
Fields_default.Input,
|
|
4289
|
+
{
|
|
4290
|
+
form,
|
|
4291
|
+
name: "email",
|
|
4292
|
+
label: "Email Address",
|
|
4293
|
+
type: "email",
|
|
4294
|
+
disabled: isLoading,
|
|
4295
|
+
placeholder: "traveler@world.com",
|
|
4296
|
+
icon: /* @__PURE__ */ jsx28(
|
|
4297
|
+
Mail,
|
|
4298
|
+
{
|
|
4299
|
+
size: 18,
|
|
4300
|
+
className: "text-slate-400 dark:text-slate-500"
|
|
4301
|
+
}
|
|
4302
|
+
),
|
|
4303
|
+
className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-14 rounded-xl"
|
|
4304
|
+
}
|
|
4305
|
+
),
|
|
4306
|
+
/* @__PURE__ */ jsx28(
|
|
4307
|
+
Fields_default.Input,
|
|
4308
|
+
{
|
|
4309
|
+
form,
|
|
4310
|
+
name: "password",
|
|
4311
|
+
label: "Password",
|
|
4312
|
+
type: "password",
|
|
4313
|
+
disabled: isLoading,
|
|
4314
|
+
placeholder: "Secret journey phrase",
|
|
4315
|
+
icon: /* @__PURE__ */ jsx28(
|
|
4316
|
+
Lock,
|
|
4317
|
+
{
|
|
4318
|
+
size: 18,
|
|
4319
|
+
className: "text-slate-400 dark:text-slate-500"
|
|
4320
|
+
}
|
|
4321
|
+
),
|
|
4322
|
+
className: "bg-slate-50 dark:bg-slate-900/50 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-white h-14 rounded-xl"
|
|
4323
|
+
}
|
|
4324
|
+
),
|
|
4325
|
+
form.formState.errors.root && /* @__PURE__ */ jsx28("p", { className: "text-orange-600 dark:text-orange-400 text-sm font-bold text-center lg:text-left animate-in fade-in slide-in-from-top-1 duration-200", children: form.formState.errors.root.message }),
|
|
4326
|
+
/* @__PURE__ */ jsxs20(
|
|
4327
|
+
Button,
|
|
4328
|
+
{
|
|
4329
|
+
type: "submit",
|
|
4330
|
+
isLoading,
|
|
4331
|
+
className: "w-full bg-orange-500 hover:bg-orange-600 text-white h-14 rounded-xl font-bold text-lg flex items-center justify-center gap-2 transition-all",
|
|
4332
|
+
children: [
|
|
4333
|
+
isLoading ? "Logging in..." : "Start Journey",
|
|
4334
|
+
!isLoading && /* @__PURE__ */ jsx28(Plane, { size: 20, className: "rotate-45" })
|
|
4335
|
+
]
|
|
4336
|
+
}
|
|
4337
|
+
)
|
|
4338
|
+
]
|
|
4339
|
+
}
|
|
4340
|
+
)
|
|
4341
|
+
] })
|
|
4342
|
+
] })
|
|
4343
|
+
] });
|
|
4344
|
+
};
|
|
4345
|
+
var HealthcareLogin = ({
|
|
4346
|
+
form,
|
|
4347
|
+
onSubmit,
|
|
4348
|
+
image,
|
|
4349
|
+
title,
|
|
4350
|
+
subtitle,
|
|
4351
|
+
brandName,
|
|
4352
|
+
backUrl,
|
|
4353
|
+
isLoading
|
|
4354
|
+
}) => {
|
|
4355
|
+
const navigate = useNavigate2();
|
|
4356
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex h-screen w-full overflow-hidden bg-[#F0F7FF] dark:bg-slate-950 transition-colors", children: [
|
|
4357
|
+
/* @__PURE__ */ jsxs20("div", { className: "w-full lg:w-[450px] flex flex-col justify-center bg-white dark:bg-slate-900 shadow-2xl z-30 relative px-10 lg:px-14 transition-colors", children: [
|
|
4358
|
+
/* @__PURE__ */ jsxs20("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
|
|
4359
|
+
backUrl && /* @__PURE__ */ jsxs20(
|
|
4360
|
+
"button",
|
|
4361
|
+
{
|
|
4362
|
+
onClick: () => navigate(backUrl),
|
|
4363
|
+
disabled: isLoading,
|
|
4364
|
+
className: "p-2 rounded-lg text-slate-500 hover:text-blue-600 hover:bg-slate-100 dark:text-slate-400 dark:hover:text-blue-400 dark:hover:bg-slate-800 transition-colors flex items-center gap-2 font-medium disabled:opacity-50",
|
|
4365
|
+
children: [
|
|
4366
|
+
/* @__PURE__ */ jsx28(ArrowLeft, { size: 18 }),
|
|
4367
|
+
/* @__PURE__ */ jsx28("span", { className: "text-sm font-semibold", children: "Back" })
|
|
4368
|
+
]
|
|
4369
|
+
}
|
|
4370
|
+
),
|
|
4371
|
+
/* @__PURE__ */ jsx28(ThemeToggle, {})
|
|
4372
|
+
] }),
|
|
4373
|
+
/* @__PURE__ */ jsxs20("div", { className: "max-w-[340px] w-full mx-auto", children: [
|
|
4374
|
+
/* @__PURE__ */ jsxs20("div", { className: "mb-14", children: [
|
|
4375
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-3 mb-8", children: [
|
|
4376
|
+
/* @__PURE__ */ jsx28("div", { className: "h-12 w-12 bg-blue-600 rounded-xl flex items-center justify-center shadow-md shadow-blue-200 dark:shadow-blue-900/20", children: /* @__PURE__ */ jsx28(HeartPulse, { className: "text-white w-7 h-7" }) }),
|
|
4377
|
+
/* @__PURE__ */ jsx28("span", { className: "text-2xl font-bold text-slate-800 dark:text-white tracking-tight", children: brandName || "CarePoint" })
|
|
4378
|
+
] }),
|
|
4379
|
+
/* @__PURE__ */ jsx28("h2", { className: "text-3xl font-bold text-slate-800 dark:text-white mb-3 tracking-tight", children: title || "Clinical Login" }),
|
|
4380
|
+
/* @__PURE__ */ jsx28("p", { className: "text-slate-500 dark:text-slate-400 font-medium leading-relaxed", children: subtitle || "Secure access for staff and healthcare professionals." })
|
|
4381
|
+
] }),
|
|
4382
|
+
/* @__PURE__ */ jsxs20(
|
|
4383
|
+
"form",
|
|
4384
|
+
{
|
|
4385
|
+
onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
|
|
4386
|
+
className: "space-y-7",
|
|
4387
|
+
children: [
|
|
4388
|
+
/* @__PURE__ */ jsx28(
|
|
4389
|
+
Fields_default.Input,
|
|
4390
|
+
{
|
|
4391
|
+
form,
|
|
4392
|
+
name: "email",
|
|
4393
|
+
label: "Employee Email",
|
|
4394
|
+
type: "email",
|
|
4395
|
+
disabled: isLoading,
|
|
4396
|
+
placeholder: "dr.name@carepoint.org",
|
|
4397
|
+
icon: /* @__PURE__ */ jsx28(Mail, { size: 18, className: "text-blue-500" }),
|
|
4398
|
+
className: "bg-slate-50/50 dark:bg-slate-800/50 border-slate-200 dark:border-slate-700 text-slate-900 dark:text-white h-13 rounded-lg border-2"
|
|
4399
|
+
}
|
|
4400
|
+
),
|
|
4401
|
+
/* @__PURE__ */ jsx28(
|
|
4402
|
+
Fields_default.Input,
|
|
4403
|
+
{
|
|
4404
|
+
form,
|
|
4405
|
+
name: "password",
|
|
4406
|
+
label: "Staff Password",
|
|
4407
|
+
type: "password",
|
|
4408
|
+
disabled: isLoading,
|
|
4409
|
+
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
4410
|
+
icon: /* @__PURE__ */ jsx28(Lock, { size: 18, className: "text-blue-500" }),
|
|
4411
|
+
className: "bg-slate-50/50 dark:bg-slate-800/50 border-slate-200 dark:border-slate-700 text-slate-900 dark:text-white h-13 rounded-lg border-2"
|
|
4412
|
+
}
|
|
4413
|
+
),
|
|
4414
|
+
form.formState.errors.root && /* @__PURE__ */ jsx28("p", { className: "text-red-600 dark:text-red-400 text-sm font-bold animate-in fade-in slide-in-from-top-1 duration-200", children: form.formState.errors.root.message }),
|
|
4415
|
+
/* @__PURE__ */ jsxs20(
|
|
4416
|
+
Button,
|
|
4417
|
+
{
|
|
4418
|
+
type: "submit",
|
|
4419
|
+
isLoading,
|
|
4420
|
+
className: "w-full bg-blue-600 hover:bg-blue-700 text-white h-13 rounded-lg font-bold flex items-center justify-center gap-2 transition-all shadow-lg active:translate-y-0.5",
|
|
4421
|
+
children: [
|
|
4422
|
+
isLoading ? "Logging in..." : "Secure Login",
|
|
4423
|
+
!isLoading && /* @__PURE__ */ jsx28(MonitorCheck, { size: 18 })
|
|
4424
|
+
]
|
|
4425
|
+
}
|
|
4426
|
+
)
|
|
4427
|
+
]
|
|
4428
|
+
}
|
|
4429
|
+
)
|
|
4430
|
+
] })
|
|
4431
|
+
] }),
|
|
4432
|
+
/* @__PURE__ */ jsxs20("div", { className: "hidden lg:flex flex-1 relative overflow-hidden bg-slate-900", children: [
|
|
4433
|
+
/* @__PURE__ */ jsx28(
|
|
4434
|
+
"div",
|
|
4435
|
+
{
|
|
4436
|
+
className: "absolute inset-0 z-0 bg-cover bg-center brightness-110",
|
|
4437
|
+
style: { backgroundImage: `url('${image || "/medicine_bg.png"}')` }
|
|
4438
|
+
}
|
|
4439
|
+
),
|
|
4440
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute inset-0 bg-linear-to-l from-transparent via-blue-900/10 to-blue-900/40 z-10" }),
|
|
4441
|
+
/* @__PURE__ */ jsx28("div", { className: "relative z-20 p-20 flex flex-col items-center justify-center w-full h-full text-center", children: /* @__PURE__ */ jsx28("div", { className: "max-w-2xl bg-white/20 backdrop-blur-xl border border-white/30 p-12 rounded-[40px] shadow-2xl", children: /* @__PURE__ */ jsxs20("h1", { className: "text-5xl font-black text-white mb-6 leading-tight drop-shadow-sm", children: [
|
|
4442
|
+
"Next-Gen ",
|
|
4443
|
+
/* @__PURE__ */ jsx28("br", {}),
|
|
4444
|
+
/* @__PURE__ */ jsx28("span", { className: "text-blue-100", children: "Patient Management" })
|
|
4445
|
+
] }) }) })
|
|
4446
|
+
] })
|
|
4447
|
+
] });
|
|
4448
|
+
};
|
|
4449
|
+
var ThemedLogin = (props) => {
|
|
4450
|
+
switch (props.theme) {
|
|
4451
|
+
case "tech":
|
|
4452
|
+
return /* @__PURE__ */ jsx28(TechLogin, { ...props });
|
|
4453
|
+
case "travel":
|
|
4454
|
+
return /* @__PURE__ */ jsx28(TravelLogin, { ...props });
|
|
4455
|
+
case "healthcare":
|
|
4456
|
+
return /* @__PURE__ */ jsx28(HealthcareLogin, { ...props });
|
|
4457
|
+
default:
|
|
4458
|
+
return /* @__PURE__ */ jsx28(TechLogin, { ...props });
|
|
4459
|
+
}
|
|
4460
|
+
};
|
|
4461
|
+
|
|
4462
|
+
// src/hooks/useLogin.tsx
|
|
4463
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4464
|
+
var defaultLoginSchema = z.object({
|
|
4465
|
+
email: z.string().email("Invalid email address"),
|
|
4466
|
+
password: z.string().min(1, "Password is required")
|
|
4467
|
+
});
|
|
4468
|
+
var useLogin = (props) => {
|
|
4469
|
+
const form = useForm({
|
|
4470
|
+
resolver: zodResolver(props.schema || defaultLoginSchema),
|
|
4471
|
+
defaultValues: props.defaultValues || {
|
|
4472
|
+
email: "",
|
|
4473
|
+
password: ""
|
|
4474
|
+
}
|
|
4475
|
+
});
|
|
4476
|
+
const propsRef = React12.useRef(props);
|
|
4477
|
+
propsRef.current = props;
|
|
4478
|
+
const Login = React12.useMemo(() => {
|
|
4479
|
+
const StableLogin = () => {
|
|
4480
|
+
const currentProps = propsRef.current;
|
|
4481
|
+
return /* @__PURE__ */ jsx29(
|
|
4482
|
+
ThemedLogin,
|
|
4483
|
+
{
|
|
4484
|
+
form,
|
|
4485
|
+
onSubmit: currentProps.onSubmit,
|
|
4486
|
+
theme: currentProps.theme,
|
|
4487
|
+
image: currentProps.image,
|
|
4488
|
+
brandName: currentProps.brandName,
|
|
4489
|
+
title: currentProps.title,
|
|
4490
|
+
subtitle: currentProps.subtitle,
|
|
4491
|
+
backUrl: currentProps.backUrl,
|
|
4492
|
+
isLoading: currentProps.isLoading
|
|
4493
|
+
}
|
|
4494
|
+
);
|
|
4495
|
+
};
|
|
4496
|
+
return StableLogin;
|
|
4497
|
+
}, [form]);
|
|
4498
|
+
return {
|
|
4499
|
+
form,
|
|
4500
|
+
Login
|
|
4501
|
+
};
|
|
4502
|
+
};
|
|
4503
|
+
|
|
4504
|
+
// src/components/ProfileDropdown.tsx
|
|
4505
|
+
import { useState as useState16, useRef as useRef6, useEffect as useEffect11 } from "react";
|
|
4506
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4507
|
+
var ProfileDropdown = ({
|
|
4508
|
+
name,
|
|
4509
|
+
image,
|
|
4510
|
+
items,
|
|
4511
|
+
className,
|
|
4512
|
+
triggerMode = "click",
|
|
4513
|
+
size = "md"
|
|
4514
|
+
}) => {
|
|
4515
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
4516
|
+
const dropdownRef = useRef6(null);
|
|
4517
|
+
const [loadingItems, setLoadingItems] = useState16({});
|
|
4518
|
+
const sizeConfigs = {
|
|
4519
|
+
sm: {
|
|
4520
|
+
avatar: "h-8 w-8",
|
|
4521
|
+
initials: "text-base",
|
|
4522
|
+
container: "gap-2 px-2 py-1.5",
|
|
4523
|
+
name: "text-xs",
|
|
4524
|
+
role: "text-[8px]"
|
|
4525
|
+
},
|
|
4526
|
+
md: {
|
|
4527
|
+
avatar: "h-10 w-10",
|
|
4528
|
+
initials: "text-lg",
|
|
4529
|
+
container: "gap-3 px-3 py-2",
|
|
4530
|
+
name: "text-sm",
|
|
4531
|
+
role: "text-[10px]"
|
|
4532
|
+
},
|
|
4533
|
+
lg: {
|
|
4534
|
+
avatar: "h-12 w-12",
|
|
4535
|
+
initials: "text-xl",
|
|
4536
|
+
container: "gap-4 px-4 py-2.5",
|
|
4537
|
+
name: "text-base",
|
|
4538
|
+
role: "text-[12px]"
|
|
4539
|
+
}
|
|
4540
|
+
};
|
|
4541
|
+
const currentSize = sizeConfigs[size];
|
|
4542
|
+
useEffect11(() => {
|
|
4543
|
+
const handleClickOutside = (event) => {
|
|
4544
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
4545
|
+
setIsOpen(false);
|
|
4546
|
+
}
|
|
4547
|
+
};
|
|
4548
|
+
if (isOpen) {
|
|
4549
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
4550
|
+
}
|
|
4551
|
+
return () => {
|
|
4552
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
4553
|
+
};
|
|
4554
|
+
}, [isOpen]);
|
|
4555
|
+
const toggleDropdown = () => setIsOpen(!isOpen);
|
|
4556
|
+
const openDropdown = () => triggerMode === "hover" && setIsOpen(true);
|
|
4557
|
+
const closeDropdown = () => triggerMode === "hover" && setIsOpen(false);
|
|
4558
|
+
const handleItemClick = async (item, index) => {
|
|
4559
|
+
if (item.disabled || loadingItems[index]) return;
|
|
4560
|
+
if (item.onClick) {
|
|
4561
|
+
const result = item.onClick();
|
|
4562
|
+
if (result instanceof Promise) {
|
|
4563
|
+
setLoadingItems((prev) => ({ ...prev, [index]: true }));
|
|
4564
|
+
try {
|
|
4565
|
+
await result;
|
|
4566
|
+
} finally {
|
|
4567
|
+
setLoadingItems((prev) => ({ ...prev, [index]: false }));
|
|
4568
|
+
setIsOpen(false);
|
|
4569
|
+
}
|
|
4570
|
+
} else {
|
|
4571
|
+
setIsOpen(false);
|
|
4572
|
+
}
|
|
4573
|
+
} else {
|
|
4574
|
+
setIsOpen(false);
|
|
4575
|
+
}
|
|
4576
|
+
};
|
|
4577
|
+
const fallbackInitial = name ? name.charAt(0).toUpperCase() : "?";
|
|
4578
|
+
return /* @__PURE__ */ jsxs21(
|
|
4579
|
+
"div",
|
|
4580
|
+
{
|
|
4581
|
+
ref: dropdownRef,
|
|
4582
|
+
className: cn("relative inline-block text-left ", className),
|
|
4583
|
+
onMouseEnter: openDropdown,
|
|
4584
|
+
onMouseLeave: closeDropdown,
|
|
4585
|
+
children: [
|
|
4586
|
+
/* @__PURE__ */ jsxs21(
|
|
4587
|
+
"button",
|
|
4588
|
+
{
|
|
4589
|
+
type: "button",
|
|
4590
|
+
onClick: triggerMode === "click" ? toggleDropdown : void 0,
|
|
4591
|
+
className: cn(
|
|
4592
|
+
"flex items-center rounded-xl transition-all duration-200 hover:bg-gray-100 dark:hover:bg-white/5 group focus:outline-none cursor-pointer",
|
|
4593
|
+
currentSize.container
|
|
4594
|
+
),
|
|
4595
|
+
children: [
|
|
4596
|
+
/* @__PURE__ */ jsx30(
|
|
4597
|
+
"div",
|
|
4598
|
+
{
|
|
4599
|
+
className: cn(
|
|
4600
|
+
"relative overflow-hidden rounded-full ring-2 ring-transparent group-hover:ring-blue-500/30 transition-all duration-300 shadow-sm border border-gray-100 dark:border-white/10 flex items-center justify-center bg-blue-50 dark:bg-blue-900/20",
|
|
4601
|
+
currentSize.avatar
|
|
4602
|
+
),
|
|
4603
|
+
children: image ? /* @__PURE__ */ jsx30(
|
|
4604
|
+
"img",
|
|
4605
|
+
{
|
|
4606
|
+
src: image,
|
|
4607
|
+
alt: name,
|
|
4608
|
+
className: "h-full w-full object-cover"
|
|
4609
|
+
}
|
|
4610
|
+
) : /* @__PURE__ */ jsx30(
|
|
4611
|
+
"span",
|
|
4612
|
+
{
|
|
4613
|
+
className: cn(
|
|
4614
|
+
"text-blue-600 dark:text-blue-400 font-semibold",
|
|
4615
|
+
currentSize.initials
|
|
4616
|
+
),
|
|
4617
|
+
children: fallbackInitial
|
|
4618
|
+
}
|
|
4619
|
+
)
|
|
4620
|
+
}
|
|
4621
|
+
),
|
|
4622
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-start mr-1", children: [
|
|
4623
|
+
/* @__PURE__ */ jsx30(
|
|
4624
|
+
"span",
|
|
4625
|
+
{
|
|
4626
|
+
className: cn(
|
|
4627
|
+
"font-semibold text-gray-700 dark:text-gray-200 leading-tight",
|
|
4628
|
+
currentSize.name
|
|
4629
|
+
),
|
|
4630
|
+
children: name
|
|
4631
|
+
}
|
|
4632
|
+
),
|
|
4633
|
+
/* @__PURE__ */ jsx30(
|
|
4634
|
+
"span",
|
|
4635
|
+
{
|
|
4636
|
+
className: cn(
|
|
4637
|
+
"text-gray-500 dark:text-gray-400 uppercase tracking-wider font-medium",
|
|
4638
|
+
currentSize.role
|
|
4639
|
+
),
|
|
4640
|
+
children: "Account"
|
|
4641
|
+
}
|
|
4642
|
+
)
|
|
4643
|
+
] }),
|
|
4644
|
+
/* @__PURE__ */ jsx30(
|
|
4645
|
+
"svg",
|
|
4646
|
+
{
|
|
4647
|
+
className: cn(
|
|
4648
|
+
"h-4 w-4 text-gray-400 transition-transform duration-300",
|
|
4649
|
+
isOpen && "rotate-180"
|
|
4650
|
+
),
|
|
4651
|
+
fill: "none",
|
|
4652
|
+
viewBox: "0 0 24 24",
|
|
4653
|
+
stroke: "currentColor",
|
|
4654
|
+
children: /* @__PURE__ */ jsx30(
|
|
4655
|
+
"path",
|
|
4656
|
+
{
|
|
4657
|
+
strokeLinecap: "round",
|
|
4658
|
+
strokeLinejoin: "round",
|
|
4659
|
+
strokeWidth: 2,
|
|
4660
|
+
d: "M19 9l-7 7-7-7"
|
|
4661
|
+
}
|
|
4662
|
+
)
|
|
4663
|
+
}
|
|
4664
|
+
)
|
|
4665
|
+
]
|
|
4666
|
+
}
|
|
4667
|
+
),
|
|
4668
|
+
isOpen && /* @__PURE__ */ jsx30("div", { className: "absolute right-0 top-full pt-2 w-64 origin-top-right z-50 group-data-[state=open]:animate-in group-data-[state=closed]:animate-out fade-in zoom-in duration-200", children: /* @__PURE__ */ jsx30("div", { className: "rounded-2xl bg-white dark:bg-gray-900 shadow-2xl ring-1 ring-black/5 dark:ring-white/10 overflow-hidden", children: /* @__PURE__ */ jsx30("div", { className: "py-2", children: items.map((item, index) => {
|
|
4669
|
+
const isLoading = loadingItems[index];
|
|
4670
|
+
return /* @__PURE__ */ jsxs21(
|
|
4671
|
+
"button",
|
|
4672
|
+
{
|
|
4673
|
+
onClick: () => handleItemClick(item, index),
|
|
4674
|
+
disabled: item.disabled || isLoading,
|
|
4675
|
+
className: cn(
|
|
4676
|
+
"flex w-full items-center gap-3 px-4 py-3 text-sm transition-all duration-150",
|
|
4677
|
+
"text-gray-700 dark:text-gray-200",
|
|
4678
|
+
!item.disabled && !isLoading ? "hover:bg-blue-50/50 dark:hover:bg-blue-900/10 active:bg-blue-100 dark:active:bg-blue-900/20" : "opacity-40 cursor-not-allowed grayscale",
|
|
4679
|
+
item.className
|
|
4680
|
+
),
|
|
4681
|
+
children: [
|
|
4682
|
+
/* @__PURE__ */ jsx30("span", { className: "flex-shrink-0 flex items-center justify-center w-5 h-5", children: isLoading ? /* @__PURE__ */ jsx30(LoadingSpin, { size: "sm", className: "text-blue-500" }) : item.icon }),
|
|
4683
|
+
/* @__PURE__ */ jsx30("span", { className: "flex-grow text-left font-medium", children: item.label })
|
|
4684
|
+
]
|
|
4685
|
+
},
|
|
4686
|
+
index
|
|
4687
|
+
);
|
|
4688
|
+
}) }) }) })
|
|
4689
|
+
]
|
|
4690
|
+
}
|
|
4691
|
+
);
|
|
4692
|
+
};
|
|
4693
|
+
|
|
4072
4694
|
// src/hooks/Fetches/useA4DataView.tsx
|
|
4073
|
-
import { useEffect as
|
|
4695
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState17 } from "react";
|
|
4074
4696
|
import { useReactToPrint } from "react-to-print";
|
|
4075
4697
|
import {
|
|
4076
4698
|
RefreshCw,
|
|
@@ -4080,7 +4702,7 @@ import {
|
|
|
4080
4702
|
ChevronLeft,
|
|
4081
4703
|
ChevronRight as ChevronRight2
|
|
4082
4704
|
} from "lucide-react";
|
|
4083
|
-
import { jsx as
|
|
4705
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4084
4706
|
var useA4StatementView = ({
|
|
4085
4707
|
url,
|
|
4086
4708
|
v = 1,
|
|
@@ -4089,7 +4711,7 @@ var useA4StatementView = ({
|
|
|
4089
4711
|
startPage = 1
|
|
4090
4712
|
} = {}) => {
|
|
4091
4713
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4092
|
-
const contentRef =
|
|
4714
|
+
const contentRef = useRef7(null);
|
|
4093
4715
|
const reactToPrintFn = useReactToPrint({
|
|
4094
4716
|
contentRef
|
|
4095
4717
|
});
|
|
@@ -4099,7 +4721,7 @@ var useA4StatementView = ({
|
|
|
4099
4721
|
await get({ url, v, params, delay });
|
|
4100
4722
|
}
|
|
4101
4723
|
};
|
|
4102
|
-
|
|
4724
|
+
useEffect12(() => {
|
|
4103
4725
|
getData();
|
|
4104
4726
|
}, [url, v, JSON.stringify(params), delay]);
|
|
4105
4727
|
const A4DataViewComponent = ({
|
|
@@ -4130,12 +4752,12 @@ var useA4StatementView = ({
|
|
|
4130
4752
|
}) => {
|
|
4131
4753
|
const { store } = useWarqadConfig();
|
|
4132
4754
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4133
|
-
const measureContainerRef =
|
|
4134
|
-
const [pages, setPages] =
|
|
4135
|
-
const [isMeasuring, setIsMeasuring] =
|
|
4136
|
-
const [globalFilter, setGlobalFilter] =
|
|
4137
|
-
const [currentPageIndex, setCurrentPageIndex] =
|
|
4138
|
-
const [pageSearch, setPageSearch] =
|
|
4755
|
+
const measureContainerRef = useRef7(null);
|
|
4756
|
+
const [pages, setPages] = useState17([]);
|
|
4757
|
+
const [isMeasuring, setIsMeasuring] = useState17(true);
|
|
4758
|
+
const [globalFilter, setGlobalFilter] = useState17("");
|
|
4759
|
+
const [currentPageIndex, setCurrentPageIndex] = useState17(0);
|
|
4760
|
+
const [pageSearch, setPageSearch] = useState17("");
|
|
4139
4761
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4140
4762
|
const filteredDisplayData = data.filter((row) => {
|
|
4141
4763
|
if (!globalFilter) return true;
|
|
@@ -4151,20 +4773,20 @@ var useA4StatementView = ({
|
|
|
4151
4773
|
const columnsWithFooters = columns.filter(
|
|
4152
4774
|
(col) => col.renderFooter && !col.hide
|
|
4153
4775
|
);
|
|
4154
|
-
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */
|
|
4776
|
+
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ jsxs22(
|
|
4155
4777
|
"div",
|
|
4156
4778
|
{
|
|
4157
4779
|
id: "a4-final-total",
|
|
4158
4780
|
className: "mt-6 flex flex-wrap justify-end items-center pt-4 border-t border-black dark:border-zinc-700 print:border-black gap-4",
|
|
4159
4781
|
children: [
|
|
4160
|
-
/* @__PURE__ */
|
|
4161
|
-
columnsWithFooters.map((col, idx) => /* @__PURE__ */
|
|
4782
|
+
/* @__PURE__ */ jsx31("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
|
|
4783
|
+
columnsWithFooters.map((col, idx) => /* @__PURE__ */ jsxs22(
|
|
4162
4784
|
"div",
|
|
4163
4785
|
{
|
|
4164
4786
|
className: "flex items-center gap-3 px-4 py-2 rounded-md border border-black dark:border-zinc-700 print:border-black",
|
|
4165
4787
|
children: [
|
|
4166
|
-
/* @__PURE__ */
|
|
4167
|
-
/* @__PURE__ */
|
|
4788
|
+
/* @__PURE__ */ jsx31("span", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs", children: typeof col.header === "string" ? col.header : typeof col.key === "string" ? col.key : "Total" }),
|
|
4789
|
+
/* @__PURE__ */ jsx31("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
|
|
4168
4790
|
]
|
|
4169
4791
|
},
|
|
4170
4792
|
col.key || idx
|
|
@@ -4180,7 +4802,7 @@ var useA4StatementView = ({
|
|
|
4180
4802
|
renderFooter: c.renderFooter ? c.renderFooter.toString() : ""
|
|
4181
4803
|
}))
|
|
4182
4804
|
});
|
|
4183
|
-
|
|
4805
|
+
useEffect12(() => {
|
|
4184
4806
|
if (filteredDisplayData && filteredDisplayData.length > 0) {
|
|
4185
4807
|
setIsMeasuring(true);
|
|
4186
4808
|
setPages((prev) => prev.length === 0 ? [[]] : prev);
|
|
@@ -4195,7 +4817,7 @@ var useA4StatementView = ({
|
|
|
4195
4817
|
setCurrentPageIndex(0);
|
|
4196
4818
|
}
|
|
4197
4819
|
}, [depsString]);
|
|
4198
|
-
|
|
4820
|
+
useEffect12(() => {
|
|
4199
4821
|
if (!isMeasuring || filteredDisplayData.length === 0) return;
|
|
4200
4822
|
const timer = setTimeout(() => {
|
|
4201
4823
|
if (!measureContainerRef.current) return;
|
|
@@ -4251,28 +4873,28 @@ var useA4StatementView = ({
|
|
|
4251
4873
|
}, 150);
|
|
4252
4874
|
return () => clearTimeout(timer);
|
|
4253
4875
|
}, [isMeasuring, depsString]);
|
|
4254
|
-
const HeaderEl = /* @__PURE__ */
|
|
4876
|
+
const HeaderEl = /* @__PURE__ */ jsxs22(
|
|
4255
4877
|
"div",
|
|
4256
4878
|
{
|
|
4257
4879
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
4258
4880
|
id: "a4-header-section",
|
|
4259
4881
|
children: [
|
|
4260
|
-
/* @__PURE__ */
|
|
4261
|
-
/* @__PURE__ */
|
|
4262
|
-
/* @__PURE__ */
|
|
4882
|
+
/* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx31("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs22("section", { children: [
|
|
4883
|
+
/* @__PURE__ */ jsx31("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
|
|
4884
|
+
/* @__PURE__ */ jsx31("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
|
|
4263
4885
|
] }) }) }),
|
|
4264
|
-
/* @__PURE__ */
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
store?.address && /* @__PURE__ */
|
|
4268
|
-
store?.phone && /* @__PURE__ */
|
|
4269
|
-
store?.email && /* @__PURE__ */
|
|
4886
|
+
/* @__PURE__ */ jsxs22("div", { className: "text-right", children: [
|
|
4887
|
+
/* @__PURE__ */ jsx31("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
|
|
4888
|
+
/* @__PURE__ */ jsxs22("div", { className: "text-sm text-gray-500 dark:text-gray-400 print:text-gray-500 leading-relaxed text-right flex flex-col items-end", children: [
|
|
4889
|
+
store?.address && /* @__PURE__ */ jsx31("span", { className: "whitespace-pre-line", children: store.address }),
|
|
4890
|
+
store?.phone && /* @__PURE__ */ jsx31("span", { children: store.phone }),
|
|
4891
|
+
store?.email && /* @__PURE__ */ jsx31("span", { children: store.email })
|
|
4270
4892
|
] })
|
|
4271
4893
|
] })
|
|
4272
4894
|
]
|
|
4273
4895
|
}
|
|
4274
4896
|
);
|
|
4275
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */
|
|
4897
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx31("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx31(
|
|
4276
4898
|
InfoGrid,
|
|
4277
4899
|
{
|
|
4278
4900
|
className: "mb-4",
|
|
@@ -4280,29 +4902,29 @@ var useA4StatementView = ({
|
|
|
4280
4902
|
isLoading: isActuallyLoading
|
|
4281
4903
|
}
|
|
4282
4904
|
) }) : null;
|
|
4283
|
-
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */
|
|
4284
|
-
isActuallyLoading ? /* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4287
|
-
url && !isActuallyLoading && /* @__PURE__ */
|
|
4905
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
4906
|
+
isActuallyLoading ? /* @__PURE__ */ jsx31("div", { className: "mb-4", children: /* @__PURE__ */ jsx31(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx31("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx31(AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx31("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx31(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4907
|
+
/* @__PURE__ */ jsx31("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
|
|
4908
|
+
/* @__PURE__ */ jsx31("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
|
|
4909
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs22(
|
|
4288
4910
|
"button",
|
|
4289
4911
|
{
|
|
4290
4912
|
onClick: () => getData(),
|
|
4291
4913
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4292
4914
|
children: [
|
|
4293
|
-
/* @__PURE__ */
|
|
4915
|
+
/* @__PURE__ */ jsx31(RefreshCw, { size: 14 }),
|
|
4294
4916
|
"Try Again"
|
|
4295
4917
|
]
|
|
4296
4918
|
}
|
|
4297
4919
|
)
|
|
4298
4920
|
] }) }) : null;
|
|
4299
|
-
return /* @__PURE__ */
|
|
4300
|
-
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */
|
|
4921
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
4922
|
+
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ jsx31("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx31(
|
|
4301
4923
|
"div",
|
|
4302
4924
|
{
|
|
4303
4925
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
4304
4926
|
className: "bg-white",
|
|
4305
|
-
children: /* @__PURE__ */
|
|
4927
|
+
children: /* @__PURE__ */ jsxs22(
|
|
4306
4928
|
"div",
|
|
4307
4929
|
{
|
|
4308
4930
|
ref: measureContainerRef,
|
|
@@ -4310,9 +4932,9 @@ var useA4StatementView = ({
|
|
|
4310
4932
|
children: [
|
|
4311
4933
|
HeaderEl,
|
|
4312
4934
|
DisplayInfoGridEl,
|
|
4313
|
-
/* @__PURE__ */
|
|
4314
|
-
/* @__PURE__ */
|
|
4315
|
-
/* @__PURE__ */
|
|
4935
|
+
/* @__PURE__ */ jsxs22("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4936
|
+
/* @__PURE__ */ jsx31("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-800 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ jsx31("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4937
|
+
/* @__PURE__ */ jsx31(
|
|
4316
4938
|
SimpleTable,
|
|
4317
4939
|
{
|
|
4318
4940
|
columns,
|
|
@@ -4330,52 +4952,52 @@ var useA4StatementView = ({
|
|
|
4330
4952
|
)
|
|
4331
4953
|
}
|
|
4332
4954
|
) }),
|
|
4333
|
-
/* @__PURE__ */
|
|
4955
|
+
/* @__PURE__ */ jsx31("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ jsx31(
|
|
4334
4956
|
"div",
|
|
4335
4957
|
{
|
|
4336
4958
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4337
|
-
children: /* @__PURE__ */
|
|
4959
|
+
children: /* @__PURE__ */ jsx31(
|
|
4338
4960
|
PageA4,
|
|
4339
4961
|
{
|
|
4340
4962
|
className: "w-full",
|
|
4341
4963
|
pageNumber: pageIndex + 1,
|
|
4342
4964
|
totalPages: pages.length,
|
|
4343
4965
|
isLastPage: pageIndex === pages.length - 1,
|
|
4344
|
-
children: /* @__PURE__ */
|
|
4345
|
-
/* @__PURE__ */
|
|
4966
|
+
children: /* @__PURE__ */ jsxs22("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
4967
|
+
/* @__PURE__ */ jsxs22("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4346
4968
|
headers,
|
|
4347
|
-
printable && pageIndex === currentPageIndex && /* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4969
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx31("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
|
|
4970
|
+
/* @__PURE__ */ jsxs22(
|
|
4349
4971
|
"button",
|
|
4350
4972
|
{
|
|
4351
4973
|
onClick: async () => await getData(),
|
|
4352
4974
|
disabled: isLoading,
|
|
4353
4975
|
className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
|
|
4354
4976
|
children: [
|
|
4355
|
-
/* @__PURE__ */
|
|
4977
|
+
/* @__PURE__ */ jsx31(
|
|
4356
4978
|
RefreshCw,
|
|
4357
4979
|
{
|
|
4358
4980
|
size: 16,
|
|
4359
4981
|
className: isLoading ? "animate-spin" : ""
|
|
4360
4982
|
}
|
|
4361
4983
|
),
|
|
4362
|
-
/* @__PURE__ */
|
|
4984
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4363
4985
|
]
|
|
4364
4986
|
}
|
|
4365
4987
|
),
|
|
4366
|
-
/* @__PURE__ */
|
|
4988
|
+
/* @__PURE__ */ jsxs22(
|
|
4367
4989
|
"button",
|
|
4368
4990
|
{
|
|
4369
4991
|
onClick: () => reactToPrintFn(),
|
|
4370
4992
|
className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
|
|
4371
4993
|
children: [
|
|
4372
|
-
/* @__PURE__ */
|
|
4994
|
+
/* @__PURE__ */ jsx31(Printer, { size: 16 }),
|
|
4373
4995
|
"Print"
|
|
4374
4996
|
]
|
|
4375
4997
|
}
|
|
4376
4998
|
),
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4999
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
5000
|
+
/* @__PURE__ */ jsx31(
|
|
4379
5001
|
"button",
|
|
4380
5002
|
{
|
|
4381
5003
|
onClick: (e) => {
|
|
@@ -4386,11 +5008,11 @@ var useA4StatementView = ({
|
|
|
4386
5008
|
},
|
|
4387
5009
|
disabled: currentPageIndex === 0,
|
|
4388
5010
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4389
|
-
children: /* @__PURE__ */
|
|
5011
|
+
children: /* @__PURE__ */ jsx31(ChevronLeft, { size: 18 })
|
|
4390
5012
|
}
|
|
4391
5013
|
),
|
|
4392
|
-
/* @__PURE__ */
|
|
4393
|
-
/* @__PURE__ */
|
|
5014
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
5015
|
+
/* @__PURE__ */ jsxs22(
|
|
4394
5016
|
Select,
|
|
4395
5017
|
{
|
|
4396
5018
|
value: currentPageIndex + 1,
|
|
@@ -4403,9 +5025,9 @@ var useA4StatementView = ({
|
|
|
4403
5025
|
variant: "ghost",
|
|
4404
5026
|
containerClassName: "inline-block",
|
|
4405
5027
|
children: [
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
/* @__PURE__ */
|
|
4408
|
-
/* @__PURE__ */
|
|
5028
|
+
/* @__PURE__ */ jsx31(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ jsx31("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
5029
|
+
/* @__PURE__ */ jsxs22(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
5030
|
+
/* @__PURE__ */ jsx31("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ jsx31(
|
|
4409
5031
|
"input",
|
|
4410
5032
|
{
|
|
4411
5033
|
type: "text",
|
|
@@ -4417,17 +5039,17 @@ var useA4StatementView = ({
|
|
|
4417
5039
|
autoFocus: true
|
|
4418
5040
|
}
|
|
4419
5041
|
) }),
|
|
4420
|
-
/* @__PURE__ */
|
|
5042
|
+
/* @__PURE__ */ jsx31("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4421
5043
|
(p) => String(p).includes(pageSearch)
|
|
4422
|
-
).map((p) => /* @__PURE__ */
|
|
5044
|
+
).map((p) => /* @__PURE__ */ jsx31(SelectItem, { value: p, children: p }, p)) })
|
|
4423
5045
|
] })
|
|
4424
5046
|
]
|
|
4425
5047
|
}
|
|
4426
5048
|
),
|
|
4427
|
-
/* @__PURE__ */
|
|
4428
|
-
/* @__PURE__ */
|
|
5049
|
+
/* @__PURE__ */ jsx31("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
5050
|
+
/* @__PURE__ */ jsx31("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4429
5051
|
] }),
|
|
4430
|
-
/* @__PURE__ */
|
|
5052
|
+
/* @__PURE__ */ jsx31(
|
|
4431
5053
|
"button",
|
|
4432
5054
|
{
|
|
4433
5055
|
onClick: (e) => {
|
|
@@ -4438,7 +5060,7 @@ var useA4StatementView = ({
|
|
|
4438
5060
|
},
|
|
4439
5061
|
disabled: currentPageIndex === pages.length - 1,
|
|
4440
5062
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4441
|
-
children: /* @__PURE__ */
|
|
5063
|
+
children: /* @__PURE__ */ jsx31(ChevronRight2, { size: 18 })
|
|
4442
5064
|
}
|
|
4443
5065
|
)
|
|
4444
5066
|
] })
|
|
@@ -4446,10 +5068,10 @@ var useA4StatementView = ({
|
|
|
4446
5068
|
] }),
|
|
4447
5069
|
pageIndex === 0 && HeaderEl,
|
|
4448
5070
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
4449
|
-
/* @__PURE__ */
|
|
4450
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
4451
|
-
/* @__PURE__ */
|
|
4452
|
-
/* @__PURE__ */
|
|
5071
|
+
/* @__PURE__ */ jsxs22("div", { className: "grow w-full px-8 pb-8", children: [
|
|
5072
|
+
pageIndex === 0 && /* @__PURE__ */ jsxs22("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
|
|
5073
|
+
/* @__PURE__ */ jsx31("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
5074
|
+
/* @__PURE__ */ jsx31(
|
|
4453
5075
|
"input",
|
|
4454
5076
|
{
|
|
4455
5077
|
type: "text",
|
|
@@ -4460,9 +5082,9 @@ var useA4StatementView = ({
|
|
|
4460
5082
|
}
|
|
4461
5083
|
)
|
|
4462
5084
|
] }),
|
|
4463
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
4464
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
4465
|
-
statusOverlay ? /* @__PURE__ */
|
|
5085
|
+
pageIndex === 0 && /* @__PURE__ */ jsx31("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ jsx31("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
5086
|
+
pageIndex > 0 && /* @__PURE__ */ jsx31("div", { className: "h-7 print:h-0" }),
|
|
5087
|
+
statusOverlay ? /* @__PURE__ */ jsx31("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx31(
|
|
4466
5088
|
SimpleTable,
|
|
4467
5089
|
{
|
|
4468
5090
|
columns,
|
|
@@ -4498,7 +5120,7 @@ var useA4StatementView = ({
|
|
|
4498
5120
|
var useA4DataView_default = useA4StatementView;
|
|
4499
5121
|
|
|
4500
5122
|
// src/hooks/Fetches/useA4CategoryView.tsx
|
|
4501
|
-
import { useEffect as
|
|
5123
|
+
import { useEffect as useEffect13, useRef as useRef8, useState as useState18 } from "react";
|
|
4502
5124
|
import { useReactToPrint as useReactToPrint2 } from "react-to-print";
|
|
4503
5125
|
import {
|
|
4504
5126
|
RefreshCw as RefreshCw2,
|
|
@@ -4508,7 +5130,7 @@ import {
|
|
|
4508
5130
|
ChevronLeft as ChevronLeft2,
|
|
4509
5131
|
ChevronRight as ChevronRight3
|
|
4510
5132
|
} from "lucide-react";
|
|
4511
|
-
import { jsx as
|
|
5133
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4512
5134
|
var useA4CategoryView = ({
|
|
4513
5135
|
url,
|
|
4514
5136
|
v = 1,
|
|
@@ -4517,7 +5139,7 @@ var useA4CategoryView = ({
|
|
|
4517
5139
|
startPage = 1
|
|
4518
5140
|
} = {}) => {
|
|
4519
5141
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4520
|
-
const contentRef =
|
|
5142
|
+
const contentRef = useRef8(null);
|
|
4521
5143
|
const reactToPrintFn = useReactToPrint2({
|
|
4522
5144
|
contentRef
|
|
4523
5145
|
});
|
|
@@ -4526,7 +5148,7 @@ var useA4CategoryView = ({
|
|
|
4526
5148
|
await get({ url, v, params, delay });
|
|
4527
5149
|
}
|
|
4528
5150
|
};
|
|
4529
|
-
|
|
5151
|
+
useEffect13(() => {
|
|
4530
5152
|
getData();
|
|
4531
5153
|
}, [url, v, JSON.stringify(params), delay]);
|
|
4532
5154
|
const A4CategoryView = ({
|
|
@@ -4545,12 +5167,12 @@ var useA4CategoryView = ({
|
|
|
4545
5167
|
}) => {
|
|
4546
5168
|
const { store } = useWarqadConfig();
|
|
4547
5169
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4548
|
-
const measureContainerRef =
|
|
4549
|
-
const [pages, setPages] =
|
|
4550
|
-
const [isMeasuring, setIsMeasuring] =
|
|
4551
|
-
const [globalFilter, setGlobalFilter] =
|
|
4552
|
-
const [currentPageIndex, setCurrentPageIndex] =
|
|
4553
|
-
const [pageSearch, setPageSearch] =
|
|
5170
|
+
const measureContainerRef = useRef8(null);
|
|
5171
|
+
const [pages, setPages] = useState18([]);
|
|
5172
|
+
const [isMeasuring, setIsMeasuring] = useState18(true);
|
|
5173
|
+
const [globalFilter, setGlobalFilter] = useState18("");
|
|
5174
|
+
const [currentPageIndex, setCurrentPageIndex] = useState18(0);
|
|
5175
|
+
const [pageSearch, setPageSearch] = useState18("");
|
|
4554
5176
|
const groups = incomingGroups ? [...incomingGroups].sort(
|
|
4555
5177
|
(a, b) => a.title.localeCompare(b.title)
|
|
4556
5178
|
) : data ? [{ title: gridTitle, items: data }] : [];
|
|
@@ -4581,7 +5203,7 @@ var useA4CategoryView = ({
|
|
|
4581
5203
|
gridColumns,
|
|
4582
5204
|
globalFilter
|
|
4583
5205
|
});
|
|
4584
|
-
|
|
5206
|
+
useEffect13(() => {
|
|
4585
5207
|
if (flattenedNodes.length > 0) {
|
|
4586
5208
|
setIsMeasuring(true);
|
|
4587
5209
|
setPages((prev) => prev.length === 0 ? [[]] : prev);
|
|
@@ -4594,7 +5216,7 @@ var useA4CategoryView = ({
|
|
|
4594
5216
|
setCurrentPageIndex(0);
|
|
4595
5217
|
}
|
|
4596
5218
|
}, [depsString]);
|
|
4597
|
-
|
|
5219
|
+
useEffect13(() => {
|
|
4598
5220
|
if (!isMeasuring || flattenedNodes.length === 0) return;
|
|
4599
5221
|
const timer = setTimeout(() => {
|
|
4600
5222
|
if (!measureContainerRef.current) return;
|
|
@@ -4633,28 +5255,28 @@ var useA4CategoryView = ({
|
|
|
4633
5255
|
}, 150);
|
|
4634
5256
|
return () => clearTimeout(timer);
|
|
4635
5257
|
}, [isMeasuring, depsString]);
|
|
4636
|
-
const HeaderEl = /* @__PURE__ */
|
|
5258
|
+
const HeaderEl = /* @__PURE__ */ jsxs23(
|
|
4637
5259
|
"div",
|
|
4638
5260
|
{
|
|
4639
5261
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
4640
5262
|
id: "a4-header-section",
|
|
4641
5263
|
children: [
|
|
4642
|
-
/* @__PURE__ */
|
|
4643
|
-
/* @__PURE__ */
|
|
4644
|
-
/* @__PURE__ */
|
|
5264
|
+
/* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx32("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs23("section", { children: [
|
|
5265
|
+
/* @__PURE__ */ jsx32("h1", { className: "text-4xl font-black text-black dark:text-white print:text-black tracking-tighter uppercase", children: title }),
|
|
5266
|
+
/* @__PURE__ */ jsx32("p", { className: "text-gray-600 dark:text-gray-400 print:text-gray-600 mt-1 uppercase text-xs font-bold tracking-widest", children: subtitle })
|
|
4645
5267
|
] }) }) }),
|
|
4646
|
-
/* @__PURE__ */
|
|
4647
|
-
/* @__PURE__ */
|
|
4648
|
-
/* @__PURE__ */
|
|
4649
|
-
store?.address && /* @__PURE__ */
|
|
4650
|
-
store?.phone && /* @__PURE__ */
|
|
4651
|
-
store?.email && /* @__PURE__ */
|
|
5268
|
+
/* @__PURE__ */ jsxs23("div", { className: "text-right", children: [
|
|
5269
|
+
/* @__PURE__ */ jsx32("h2", { className: "text-lg font-black text-black dark:text-white print:text-black uppercase tracking-tight", children: store?.name }),
|
|
5270
|
+
/* @__PURE__ */ jsxs23("div", { className: "text-sm text-gray-600 dark:text-gray-400 print:text-gray-600 leading-relaxed text-right flex flex-col items-end font-medium", children: [
|
|
5271
|
+
store?.address && /* @__PURE__ */ jsx32("span", { className: "whitespace-pre-line", children: store.address }),
|
|
5272
|
+
store?.phone && /* @__PURE__ */ jsx32("span", { children: store.phone }),
|
|
5273
|
+
store?.email && /* @__PURE__ */ jsx32("span", { children: store.email })
|
|
4652
5274
|
] })
|
|
4653
5275
|
] })
|
|
4654
5276
|
]
|
|
4655
5277
|
}
|
|
4656
5278
|
);
|
|
4657
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */
|
|
5279
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx32("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx32(
|
|
4658
5280
|
InfoGrid,
|
|
4659
5281
|
{
|
|
4660
5282
|
className: "mb-4",
|
|
@@ -4664,40 +5286,40 @@ var useA4CategoryView = ({
|
|
|
4664
5286
|
) }) : null;
|
|
4665
5287
|
const renderNode = (node) => {
|
|
4666
5288
|
if (node.type === "header") {
|
|
4667
|
-
return /* @__PURE__ */
|
|
5289
|
+
return /* @__PURE__ */ jsx32("div", { className: "mb-4 border-b border-black print:border-black pb-2 flex items-center gap-2 justify-between px-2 mt-4", children: /* @__PURE__ */ jsx32("h3", { className: "text-sm font-black text-black dark:text-white print:text-black uppercase tracking-[0.2em]", children: node.title }) });
|
|
4668
5290
|
}
|
|
4669
|
-
return /* @__PURE__ */
|
|
5291
|
+
return /* @__PURE__ */ jsx32(
|
|
4670
5292
|
"div",
|
|
4671
5293
|
{
|
|
4672
5294
|
className: "grid gap-4 px-2",
|
|
4673
5295
|
style: { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` },
|
|
4674
|
-
children: node.items.map((item, j) => /* @__PURE__ */
|
|
5296
|
+
children: node.items.map((item, j) => /* @__PURE__ */ jsx32("div", { children: renderItem(item) }, j))
|
|
4675
5297
|
}
|
|
4676
5298
|
);
|
|
4677
5299
|
};
|
|
4678
|
-
const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */
|
|
4679
|
-
isActuallyLoading ? /* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
url && !isActuallyLoading && /* @__PURE__ */
|
|
5300
|
+
const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */ jsx32("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
5301
|
+
isActuallyLoading ? /* @__PURE__ */ jsx32("div", { className: "mb-4", children: /* @__PURE__ */ jsx32(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx32("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx32(AlertCircle2, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx32("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx32(FileX2, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
5302
|
+
/* @__PURE__ */ jsx32("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Report" : "No Records Found" }),
|
|
5303
|
+
/* @__PURE__ */ jsx32("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your report." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no items available in this requested report." }),
|
|
5304
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs23(
|
|
4683
5305
|
"button",
|
|
4684
5306
|
{
|
|
4685
5307
|
onClick: () => getData(),
|
|
4686
5308
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4687
5309
|
children: [
|
|
4688
|
-
/* @__PURE__ */
|
|
5310
|
+
/* @__PURE__ */ jsx32(RefreshCw2, { size: 14 }),
|
|
4689
5311
|
"Try Again"
|
|
4690
5312
|
]
|
|
4691
5313
|
}
|
|
4692
5314
|
)
|
|
4693
5315
|
] }) }) : null;
|
|
4694
|
-
return /* @__PURE__ */
|
|
4695
|
-
isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */
|
|
5316
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
5317
|
+
isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */ jsx32("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx32(
|
|
4696
5318
|
"div",
|
|
4697
5319
|
{
|
|
4698
5320
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
4699
5321
|
className: "bg-white",
|
|
4700
|
-
children: /* @__PURE__ */
|
|
5322
|
+
children: /* @__PURE__ */ jsxs23(
|
|
4701
5323
|
"div",
|
|
4702
5324
|
{
|
|
4703
5325
|
ref: measureContainerRef,
|
|
@@ -4705,56 +5327,56 @@ var useA4CategoryView = ({
|
|
|
4705
5327
|
children: [
|
|
4706
5328
|
HeaderEl,
|
|
4707
5329
|
DisplayInfoGridEl,
|
|
4708
|
-
/* @__PURE__ */
|
|
5330
|
+
/* @__PURE__ */ jsx32("div", { className: "grow w-full px-8 pb-8", children: /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-2", children: flattenedNodes.map((node, i) => /* @__PURE__ */ jsx32("div", { className: "a4-measure-node", children: renderNode(node) }, i)) }) })
|
|
4709
5331
|
]
|
|
4710
5332
|
}
|
|
4711
5333
|
)
|
|
4712
5334
|
}
|
|
4713
5335
|
) }),
|
|
4714
|
-
/* @__PURE__ */
|
|
5336
|
+
/* @__PURE__ */ jsx32("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageNodes, pageIndex) => /* @__PURE__ */ jsx32(
|
|
4715
5337
|
"div",
|
|
4716
5338
|
{
|
|
4717
5339
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4718
|
-
children: /* @__PURE__ */
|
|
5340
|
+
children: /* @__PURE__ */ jsx32(
|
|
4719
5341
|
PageA4,
|
|
4720
5342
|
{
|
|
4721
5343
|
className: "w-full",
|
|
4722
5344
|
pageNumber: pageIndex + 1,
|
|
4723
5345
|
totalPages: pages.length,
|
|
4724
5346
|
isLastPage: pageIndex === pages.length - 1,
|
|
4725
|
-
children: /* @__PURE__ */
|
|
4726
|
-
/* @__PURE__ */
|
|
4727
|
-
/* @__PURE__ */
|
|
5347
|
+
children: /* @__PURE__ */ jsxs23("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
5348
|
+
/* @__PURE__ */ jsx32("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx32("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", children: [
|
|
5349
|
+
/* @__PURE__ */ jsxs23(
|
|
4728
5350
|
"button",
|
|
4729
5351
|
{
|
|
4730
5352
|
onClick: async () => await getData(),
|
|
4731
5353
|
disabled: isLoading,
|
|
4732
5354
|
className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
|
|
4733
5355
|
children: [
|
|
4734
|
-
/* @__PURE__ */
|
|
5356
|
+
/* @__PURE__ */ jsx32(
|
|
4735
5357
|
RefreshCw2,
|
|
4736
5358
|
{
|
|
4737
5359
|
size: 16,
|
|
4738
5360
|
className: isLoading ? "animate-spin" : ""
|
|
4739
5361
|
}
|
|
4740
5362
|
),
|
|
4741
|
-
/* @__PURE__ */
|
|
5363
|
+
/* @__PURE__ */ jsx32("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4742
5364
|
]
|
|
4743
5365
|
}
|
|
4744
5366
|
),
|
|
4745
|
-
/* @__PURE__ */
|
|
5367
|
+
/* @__PURE__ */ jsxs23(
|
|
4746
5368
|
"button",
|
|
4747
5369
|
{
|
|
4748
5370
|
onClick: () => reactToPrintFn(),
|
|
4749
5371
|
className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
|
|
4750
5372
|
children: [
|
|
4751
|
-
/* @__PURE__ */
|
|
5373
|
+
/* @__PURE__ */ jsx32(Printer2, { size: 16 }),
|
|
4752
5374
|
"Print"
|
|
4753
5375
|
]
|
|
4754
5376
|
}
|
|
4755
5377
|
),
|
|
4756
|
-
/* @__PURE__ */
|
|
4757
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
5379
|
+
/* @__PURE__ */ jsx32(
|
|
4758
5380
|
"button",
|
|
4759
5381
|
{
|
|
4760
5382
|
onClick: (e) => {
|
|
@@ -4765,11 +5387,11 @@ var useA4CategoryView = ({
|
|
|
4765
5387
|
},
|
|
4766
5388
|
disabled: currentPageIndex === 0,
|
|
4767
5389
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4768
|
-
children: /* @__PURE__ */
|
|
5390
|
+
children: /* @__PURE__ */ jsx32(ChevronLeft2, { size: 18 })
|
|
4769
5391
|
}
|
|
4770
5392
|
),
|
|
4771
|
-
/* @__PURE__ */
|
|
4772
|
-
/* @__PURE__ */
|
|
5393
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
5394
|
+
/* @__PURE__ */ jsxs23(
|
|
4773
5395
|
Select,
|
|
4774
5396
|
{
|
|
4775
5397
|
value: currentPageIndex + 1,
|
|
@@ -4782,9 +5404,9 @@ var useA4CategoryView = ({
|
|
|
4782
5404
|
variant: "ghost",
|
|
4783
5405
|
containerClassName: "inline-block",
|
|
4784
5406
|
children: [
|
|
4785
|
-
/* @__PURE__ */
|
|
4786
|
-
/* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
5407
|
+
/* @__PURE__ */ jsx32(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ jsx32("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
5408
|
+
/* @__PURE__ */ jsxs23(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
5409
|
+
/* @__PURE__ */ jsx32("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ jsx32(
|
|
4788
5410
|
"input",
|
|
4789
5411
|
{
|
|
4790
5412
|
type: "text",
|
|
@@ -4796,17 +5418,17 @@ var useA4CategoryView = ({
|
|
|
4796
5418
|
autoFocus: true
|
|
4797
5419
|
}
|
|
4798
5420
|
) }),
|
|
4799
|
-
/* @__PURE__ */
|
|
5421
|
+
/* @__PURE__ */ jsx32("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4800
5422
|
(p) => String(p).includes(pageSearch)
|
|
4801
|
-
).map((p) => /* @__PURE__ */
|
|
5423
|
+
).map((p) => /* @__PURE__ */ jsx32(SelectItem, { value: p, children: p }, p)) })
|
|
4802
5424
|
] })
|
|
4803
5425
|
]
|
|
4804
5426
|
}
|
|
4805
5427
|
),
|
|
4806
|
-
/* @__PURE__ */
|
|
4807
|
-
/* @__PURE__ */
|
|
5428
|
+
/* @__PURE__ */ jsx32("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
5429
|
+
/* @__PURE__ */ jsx32("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4808
5430
|
] }),
|
|
4809
|
-
/* @__PURE__ */
|
|
5431
|
+
/* @__PURE__ */ jsx32(
|
|
4810
5432
|
"button",
|
|
4811
5433
|
{
|
|
4812
5434
|
onClick: (e) => {
|
|
@@ -4817,15 +5439,15 @@ var useA4CategoryView = ({
|
|
|
4817
5439
|
},
|
|
4818
5440
|
disabled: currentPageIndex === pages.length - 1,
|
|
4819
5441
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4820
|
-
children: /* @__PURE__ */
|
|
5442
|
+
children: /* @__PURE__ */ jsx32(ChevronRight3, { size: 18 })
|
|
4821
5443
|
}
|
|
4822
5444
|
)
|
|
4823
5445
|
] })
|
|
4824
5446
|
] }) }) }),
|
|
4825
5447
|
pageIndex === 0 && HeaderEl,
|
|
4826
5448
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
4827
|
-
/* @__PURE__ */
|
|
4828
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
5449
|
+
/* @__PURE__ */ jsxs23("div", { className: "grow w-full px-8 pb-8", children: [
|
|
5450
|
+
pageIndex === 0 && /* @__PURE__ */ jsx32("div", { className: "flex items-center justify-end px-2 mt-2 print:hidden mb-4", children: /* @__PURE__ */ jsx32(
|
|
4829
5451
|
"input",
|
|
4830
5452
|
{
|
|
4831
5453
|
type: "text",
|
|
@@ -4835,8 +5457,8 @@ var useA4CategoryView = ({
|
|
|
4835
5457
|
className: "block w-full max-w-xs px-3 py-2 border border-gray-300 rounded-md text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-900 dark:border-zinc-700 dark:text-white"
|
|
4836
5458
|
}
|
|
4837
5459
|
) }),
|
|
4838
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
4839
|
-
statusOverlay ? /* @__PURE__ */
|
|
5460
|
+
pageIndex > 0 && /* @__PURE__ */ jsx32("div", { className: "h-14 print:h-14" }),
|
|
5461
|
+
statusOverlay ? /* @__PURE__ */ jsx32("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-2", children: pageNodes.map((node, i) => /* @__PURE__ */ jsx32("div", { children: renderNode(node) }, i)) })
|
|
4840
5462
|
] })
|
|
4841
5463
|
] })
|
|
4842
5464
|
},
|
|
@@ -4858,10 +5480,10 @@ var useA4CategoryView = ({
|
|
|
4858
5480
|
var useA4CategoryView_default = useA4CategoryView;
|
|
4859
5481
|
|
|
4860
5482
|
// src/hooks/Fetches/useTransaction.tsx
|
|
4861
|
-
import { useEffect as
|
|
5483
|
+
import { useEffect as useEffect14, useState as useState19 } from "react";
|
|
4862
5484
|
import { AlertCircle as AlertCircle3, FileX as FileX3, Plus as Plus2, RefreshCw as RefreshCw3 } from "lucide-react";
|
|
4863
5485
|
import moment from "moment";
|
|
4864
|
-
import { jsx as
|
|
5486
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4865
5487
|
var useTransaction = ({
|
|
4866
5488
|
url,
|
|
4867
5489
|
v = 1,
|
|
@@ -4869,7 +5491,7 @@ var useTransaction = ({
|
|
|
4869
5491
|
params = {},
|
|
4870
5492
|
dateFilter = true
|
|
4871
5493
|
}) => {
|
|
4872
|
-
const [date, setDate] =
|
|
5494
|
+
const [date, setDate] = useState19(
|
|
4873
5495
|
moment().format("DD/MM/YYYY")
|
|
4874
5496
|
);
|
|
4875
5497
|
const dateObj = {};
|
|
@@ -4886,7 +5508,7 @@ var useTransaction = ({
|
|
|
4886
5508
|
delay
|
|
4887
5509
|
});
|
|
4888
5510
|
};
|
|
4889
|
-
|
|
5511
|
+
useEffect14(() => {
|
|
4890
5512
|
getData();
|
|
4891
5513
|
}, [url, v, JSON.stringify(params), delay, date]);
|
|
4892
5514
|
const TransactionViewComponent = ({
|
|
@@ -4913,21 +5535,21 @@ var useTransaction = ({
|
|
|
4913
5535
|
createTitle = "Add New",
|
|
4914
5536
|
...rest
|
|
4915
5537
|
}) => {
|
|
4916
|
-
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */
|
|
5538
|
+
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx33(
|
|
4917
5539
|
"div",
|
|
4918
5540
|
{
|
|
4919
5541
|
className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
|
|
4920
|
-
children: /* @__PURE__ */
|
|
4921
|
-
error ? /* @__PURE__ */
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
url && /* @__PURE__ */
|
|
5542
|
+
children: /* @__PURE__ */ jsxs24("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
5543
|
+
error ? /* @__PURE__ */ jsx33("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx33(AlertCircle3, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx33("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx33(FileX3, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
5544
|
+
/* @__PURE__ */ jsx33("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
|
|
5545
|
+
/* @__PURE__ */ jsx33("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
|
|
5546
|
+
url && /* @__PURE__ */ jsxs24(
|
|
4925
5547
|
"button",
|
|
4926
5548
|
{
|
|
4927
5549
|
onClick: () => getData(),
|
|
4928
5550
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4929
5551
|
children: [
|
|
4930
|
-
/* @__PURE__ */
|
|
5552
|
+
/* @__PURE__ */ jsx33(RefreshCw3, { size: 14 }),
|
|
4931
5553
|
"Try Again"
|
|
4932
5554
|
]
|
|
4933
5555
|
}
|
|
@@ -4935,14 +5557,14 @@ var useTransaction = ({
|
|
|
4935
5557
|
] })
|
|
4936
5558
|
}
|
|
4937
5559
|
) : void 0;
|
|
4938
|
-
return /* @__PURE__ */
|
|
4939
|
-
/* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
4941
|
-
/* @__PURE__ */
|
|
4942
|
-
/* @__PURE__ */
|
|
5560
|
+
return /* @__PURE__ */ jsxs24(Card, { children: [
|
|
5561
|
+
/* @__PURE__ */ jsx33(Card.Header, { children: /* @__PURE__ */ jsxs24("header", { className: "flex items-center justify-between gap-4 py-2", children: [
|
|
5562
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
5563
|
+
/* @__PURE__ */ jsx33(Card.Title, { children: title }),
|
|
5564
|
+
/* @__PURE__ */ jsx33(Card.Description, { children: description })
|
|
4943
5565
|
] }),
|
|
4944
|
-
/* @__PURE__ */
|
|
4945
|
-
dateFilter && /* @__PURE__ */
|
|
5566
|
+
/* @__PURE__ */ jsxs24("section", { className: "flex gap-2 items-center", children: [
|
|
5567
|
+
dateFilter && /* @__PURE__ */ jsx33(
|
|
4946
5568
|
Fields_default.DateInput,
|
|
4947
5569
|
{
|
|
4948
5570
|
value: date,
|
|
@@ -4952,20 +5574,20 @@ var useTransaction = ({
|
|
|
4952
5574
|
}
|
|
4953
5575
|
}
|
|
4954
5576
|
),
|
|
4955
|
-
/* @__PURE__ */
|
|
5577
|
+
/* @__PURE__ */ jsx33(
|
|
4956
5578
|
Button,
|
|
4957
5579
|
{
|
|
4958
5580
|
size: "sm",
|
|
4959
5581
|
className: "rounded-md!",
|
|
4960
5582
|
onClick: onCreate,
|
|
4961
5583
|
variant: "primary",
|
|
4962
|
-
icon: /* @__PURE__ */
|
|
5584
|
+
icon: /* @__PURE__ */ jsx33(Plus2, {}),
|
|
4963
5585
|
children: createTitle
|
|
4964
5586
|
}
|
|
4965
5587
|
)
|
|
4966
5588
|
] })
|
|
4967
5589
|
] }) }),
|
|
4968
|
-
/* @__PURE__ */
|
|
5590
|
+
/* @__PURE__ */ jsx33(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx33("div", { className: `w-full ${className}`, children: /* @__PURE__ */ jsx33(
|
|
4969
5591
|
DataTable,
|
|
4970
5592
|
{
|
|
4971
5593
|
columns,
|
|
@@ -5182,7 +5804,7 @@ var storage = {
|
|
|
5182
5804
|
};
|
|
5183
5805
|
|
|
5184
5806
|
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
5185
|
-
import { useState as
|
|
5807
|
+
import { useState as useState20 } from "react";
|
|
5186
5808
|
|
|
5187
5809
|
// ../../node_modules/@ant-design/icons/es/components/Context.js
|
|
5188
5810
|
import { createContext as createContext5 } from "react";
|
|
@@ -5190,7 +5812,7 @@ var IconContext = /* @__PURE__ */ createContext5({});
|
|
|
5190
5812
|
var Context_default = IconContext;
|
|
5191
5813
|
|
|
5192
5814
|
// ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
|
|
5193
|
-
import * as
|
|
5815
|
+
import * as React16 from "react";
|
|
5194
5816
|
import { clsx as clsx2 } from "clsx";
|
|
5195
5817
|
|
|
5196
5818
|
// ../../node_modules/@ant-design/fast-color/es/presetColors.js
|
|
@@ -6037,7 +6659,7 @@ var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a"
|
|
|
6037
6659
|
greyDark.primary = greyDark[5];
|
|
6038
6660
|
|
|
6039
6661
|
// ../../node_modules/@ant-design/icons/es/components/IconBase.js
|
|
6040
|
-
import * as
|
|
6662
|
+
import * as React15 from "react";
|
|
6041
6663
|
|
|
6042
6664
|
// ../../node_modules/@rc-component/util/es/Dom/canUseDom.js
|
|
6043
6665
|
function canUseDom() {
|
|
@@ -6193,17 +6815,17 @@ var preWarningFns = [];
|
|
|
6193
6815
|
var preMessage = (fn) => {
|
|
6194
6816
|
preWarningFns.push(fn);
|
|
6195
6817
|
};
|
|
6196
|
-
function warning(valid,
|
|
6818
|
+
function warning(valid, message2) {
|
|
6197
6819
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
6198
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
6820
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message2);
|
|
6199
6821
|
if (finalMessage) {
|
|
6200
6822
|
console.error(`Warning: ${finalMessage}`);
|
|
6201
6823
|
}
|
|
6202
6824
|
}
|
|
6203
6825
|
}
|
|
6204
|
-
function note(valid,
|
|
6826
|
+
function note(valid, message2) {
|
|
6205
6827
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
6206
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
6828
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message2);
|
|
6207
6829
|
if (finalMessage) {
|
|
6208
6830
|
console.warn(`Note: ${finalMessage}`);
|
|
6209
6831
|
}
|
|
@@ -6212,29 +6834,29 @@ function note(valid, message) {
|
|
|
6212
6834
|
function resetWarned() {
|
|
6213
6835
|
warned = {};
|
|
6214
6836
|
}
|
|
6215
|
-
function call(method, valid,
|
|
6216
|
-
if (!valid && !warned[
|
|
6217
|
-
method(false,
|
|
6218
|
-
warned[
|
|
6837
|
+
function call(method, valid, message2) {
|
|
6838
|
+
if (!valid && !warned[message2]) {
|
|
6839
|
+
method(false, message2);
|
|
6840
|
+
warned[message2] = true;
|
|
6219
6841
|
}
|
|
6220
6842
|
}
|
|
6221
|
-
function warningOnce(valid,
|
|
6222
|
-
call(warning, valid,
|
|
6843
|
+
function warningOnce(valid, message2) {
|
|
6844
|
+
call(warning, valid, message2);
|
|
6223
6845
|
}
|
|
6224
|
-
function noteOnce(valid,
|
|
6225
|
-
call(note, valid,
|
|
6846
|
+
function noteOnce(valid, message2) {
|
|
6847
|
+
call(note, valid, message2);
|
|
6226
6848
|
}
|
|
6227
6849
|
warningOnce.preMessage = preMessage;
|
|
6228
6850
|
warningOnce.resetWarned = resetWarned;
|
|
6229
6851
|
warningOnce.noteOnce = noteOnce;
|
|
6230
6852
|
|
|
6231
6853
|
// ../../node_modules/@ant-design/icons/es/utils.js
|
|
6232
|
-
import
|
|
6854
|
+
import React14, { useContext as useContext5, useEffect as useEffect15 } from "react";
|
|
6233
6855
|
function camelCase(input) {
|
|
6234
6856
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
6235
6857
|
}
|
|
6236
|
-
function warning2(valid,
|
|
6237
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
6858
|
+
function warning2(valid, message2) {
|
|
6859
|
+
warningOnce(valid, `[@ant-design/icons] ${message2}`);
|
|
6238
6860
|
}
|
|
6239
6861
|
function isIconDefinition(target) {
|
|
6240
6862
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -6256,12 +6878,12 @@ function normalizeAttrs(attrs = {}) {
|
|
|
6256
6878
|
}
|
|
6257
6879
|
function generate2(node, key, rootProps) {
|
|
6258
6880
|
if (!rootProps) {
|
|
6259
|
-
return /* @__PURE__ */
|
|
6881
|
+
return /* @__PURE__ */ React14.createElement(node.tag, {
|
|
6260
6882
|
key,
|
|
6261
6883
|
...normalizeAttrs(node.attrs)
|
|
6262
6884
|
}, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
|
|
6263
6885
|
}
|
|
6264
|
-
return /* @__PURE__ */
|
|
6886
|
+
return /* @__PURE__ */ React14.createElement(node.tag, {
|
|
6265
6887
|
key,
|
|
6266
6888
|
...normalizeAttrs(node.attrs),
|
|
6267
6889
|
...rootProps
|
|
@@ -6348,7 +6970,7 @@ var useInsertStyles = (eleRef) => {
|
|
|
6348
6970
|
${mergedStyleStr}
|
|
6349
6971
|
}`;
|
|
6350
6972
|
}
|
|
6351
|
-
|
|
6973
|
+
useEffect15(() => {
|
|
6352
6974
|
const ele = eleRef.current;
|
|
6353
6975
|
const shadowRoot = getShadowRoot(ele);
|
|
6354
6976
|
updateCSS(mergedStyleStr, "@ant-design-icons", {
|
|
@@ -6388,7 +7010,7 @@ var IconBase = (props) => {
|
|
|
6388
7010
|
secondaryColor,
|
|
6389
7011
|
...restProps
|
|
6390
7012
|
} = props;
|
|
6391
|
-
const svgRef =
|
|
7013
|
+
const svgRef = React15.useRef(null);
|
|
6392
7014
|
let colors = twoToneColorPalette;
|
|
6393
7015
|
if (primaryColor) {
|
|
6394
7016
|
colors = {
|
|
@@ -6458,7 +7080,7 @@ function _extends() {
|
|
|
6458
7080
|
return _extends.apply(this, arguments);
|
|
6459
7081
|
}
|
|
6460
7082
|
setTwoToneColor(blue.primary);
|
|
6461
|
-
var Icon = /* @__PURE__ */
|
|
7083
|
+
var Icon = /* @__PURE__ */ React16.forwardRef((props, ref) => {
|
|
6462
7084
|
const {
|
|
6463
7085
|
// affect outter <i>...</i>
|
|
6464
7086
|
className,
|
|
@@ -6475,7 +7097,7 @@ var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
|
|
|
6475
7097
|
const {
|
|
6476
7098
|
prefixCls = "anticon",
|
|
6477
7099
|
rootClassName
|
|
6478
|
-
} =
|
|
7100
|
+
} = React16.useContext(Context_default);
|
|
6479
7101
|
const classString = clsx2(rootClassName, prefixCls, {
|
|
6480
7102
|
[`${prefixCls}-${icon.name}`]: !!icon.name,
|
|
6481
7103
|
[`${prefixCls}-spin`]: !!spin || icon.name === "loading"
|
|
@@ -6489,7 +7111,7 @@ var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
|
|
|
6489
7111
|
transform: `rotate(${rotate}deg)`
|
|
6490
7112
|
} : void 0;
|
|
6491
7113
|
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
|
|
6492
|
-
return /* @__PURE__ */
|
|
7114
|
+
return /* @__PURE__ */ React16.createElement("span", _extends({
|
|
6493
7115
|
role: "img",
|
|
6494
7116
|
"aria-label": icon.name
|
|
6495
7117
|
}, restProps, {
|
|
@@ -6497,7 +7119,7 @@ var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
|
|
|
6497
7119
|
tabIndex: iconTabIndex,
|
|
6498
7120
|
onClick,
|
|
6499
7121
|
className: classString
|
|
6500
|
-
}), /* @__PURE__ */
|
|
7122
|
+
}), /* @__PURE__ */ React16.createElement(IconBase_default, {
|
|
6501
7123
|
icon,
|
|
6502
7124
|
primaryColor,
|
|
6503
7125
|
secondaryColor,
|
|
@@ -6512,7 +7134,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
6512
7134
|
var AntdIcon_default = Icon;
|
|
6513
7135
|
|
|
6514
7136
|
// ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
6515
|
-
import * as
|
|
7137
|
+
import * as React17 from "react";
|
|
6516
7138
|
|
|
6517
7139
|
// ../../node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js
|
|
6518
7140
|
var PlusOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
|
|
@@ -6533,11 +7155,11 @@ function _extends2() {
|
|
|
6533
7155
|
};
|
|
6534
7156
|
return _extends2.apply(this, arguments);
|
|
6535
7157
|
}
|
|
6536
|
-
var PlusOutlined2 = (props, ref) => /* @__PURE__ */
|
|
7158
|
+
var PlusOutlined2 = (props, ref) => /* @__PURE__ */ React17.createElement(AntdIcon_default, _extends2({}, props, {
|
|
6537
7159
|
ref,
|
|
6538
7160
|
icon: PlusOutlined_default
|
|
6539
7161
|
}));
|
|
6540
|
-
var RefIcon = /* @__PURE__ */
|
|
7162
|
+
var RefIcon = /* @__PURE__ */ React17.forwardRef(PlusOutlined2);
|
|
6541
7163
|
if (process.env.NODE_ENV !== "production") {
|
|
6542
7164
|
RefIcon.displayName = "PlusOutlined";
|
|
6543
7165
|
}
|
|
@@ -6545,7 +7167,7 @@ var PlusOutlined_default2 = RefIcon;
|
|
|
6545
7167
|
|
|
6546
7168
|
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
6547
7169
|
import { Image, Upload } from "antd";
|
|
6548
|
-
import { Fragment as Fragment7, jsx as
|
|
7170
|
+
import { Fragment as Fragment7, jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6549
7171
|
var getBase64 = (file) => new Promise((resolve, reject) => {
|
|
6550
7172
|
const reader = new FileReader();
|
|
6551
7173
|
reader.readAsDataURL(file);
|
|
@@ -6553,9 +7175,9 @@ var getBase64 = (file) => new Promise((resolve, reject) => {
|
|
|
6553
7175
|
reader.onerror = (error) => reject(error);
|
|
6554
7176
|
});
|
|
6555
7177
|
var useAntdImageUpload = ({ length = 1 }) => {
|
|
6556
|
-
const [fileList, setFileList] =
|
|
6557
|
-
const [previewOpen, setPreviewOpen] =
|
|
6558
|
-
const [previewImage, setPreviewImage] =
|
|
7178
|
+
const [fileList, setFileList] = useState20([]);
|
|
7179
|
+
const [previewOpen, setPreviewOpen] = useState20(false);
|
|
7180
|
+
const [previewImage, setPreviewImage] = useState20("");
|
|
6559
7181
|
const handlePreview = async (file) => {
|
|
6560
7182
|
if (!file.url && !file.preview) {
|
|
6561
7183
|
file.preview = await getBase64(file.originFileObj);
|
|
@@ -6572,8 +7194,8 @@ var useAntdImageUpload = ({ length = 1 }) => {
|
|
|
6572
7194
|
}))
|
|
6573
7195
|
);
|
|
6574
7196
|
};
|
|
6575
|
-
const ImageBox = () => /* @__PURE__ */
|
|
6576
|
-
/* @__PURE__ */
|
|
7197
|
+
const ImageBox = () => /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
7198
|
+
/* @__PURE__ */ jsx34(
|
|
6577
7199
|
Upload,
|
|
6578
7200
|
{
|
|
6579
7201
|
listType: "picture-card",
|
|
@@ -6581,13 +7203,13 @@ var useAntdImageUpload = ({ length = 1 }) => {
|
|
|
6581
7203
|
onPreview: handlePreview,
|
|
6582
7204
|
onChange: handleChange,
|
|
6583
7205
|
beforeUpload: () => false,
|
|
6584
|
-
children: fileList.length >= length ? null : /* @__PURE__ */
|
|
6585
|
-
/* @__PURE__ */
|
|
6586
|
-
/* @__PURE__ */
|
|
7206
|
+
children: fileList.length >= length ? null : /* @__PURE__ */ jsxs25("button", { style: { border: 0, background: "none" }, type: "button", children: [
|
|
7207
|
+
/* @__PURE__ */ jsx34(PlusOutlined_default2, {}),
|
|
7208
|
+
/* @__PURE__ */ jsx34("div", { style: { marginTop: 8 }, children: "Upload" })
|
|
6587
7209
|
] })
|
|
6588
7210
|
}
|
|
6589
7211
|
),
|
|
6590
|
-
previewImage && /* @__PURE__ */
|
|
7212
|
+
previewImage && /* @__PURE__ */ jsx34(
|
|
6591
7213
|
Image,
|
|
6592
7214
|
{
|
|
6593
7215
|
style: { display: "none" },
|
|
@@ -6605,10 +7227,10 @@ var useAntdImageUpload = ({ length = 1 }) => {
|
|
|
6605
7227
|
var useAntdImageUpload_default = useAntdImageUpload;
|
|
6606
7228
|
|
|
6607
7229
|
// src/components/Views/CategoryView.tsx
|
|
6608
|
-
import { jsx as
|
|
7230
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6609
7231
|
var CategoryCard = ({ item }) => {
|
|
6610
|
-
return /* @__PURE__ */
|
|
6611
|
-
/* @__PURE__ */
|
|
7232
|
+
return /* @__PURE__ */ jsxs26("div", { className: "group bg-white rounded-md overflow-hidden border border-black/80 flex flex-col h-full print:border-black transition-all duration-300", children: [
|
|
7233
|
+
/* @__PURE__ */ jsx35("div", { className: "relative aspect-square w-full overflow-hidden bg-gray-50 flex-shrink-0 border-b border-black/10", children: /* @__PURE__ */ jsx35(
|
|
6612
7234
|
"img",
|
|
6613
7235
|
{
|
|
6614
7236
|
src: item.image,
|
|
@@ -6616,7 +7238,7 @@ var CategoryCard = ({ item }) => {
|
|
|
6616
7238
|
className: "w-full h-full object-cover"
|
|
6617
7239
|
}
|
|
6618
7240
|
) }),
|
|
6619
|
-
/* @__PURE__ */
|
|
7241
|
+
/* @__PURE__ */ jsx35("div", { className: "p-1.5 flex flex-col justify-center flex-grow", children: /* @__PURE__ */ jsx35("h3", { className: "text-[10px] font-bold text-black line-clamp-2 leading-tight text-center", children: item.name }) })
|
|
6620
7242
|
] });
|
|
6621
7243
|
};
|
|
6622
7244
|
var CategoryView = ({
|
|
@@ -6624,20 +7246,20 @@ var CategoryView = ({
|
|
|
6624
7246
|
items,
|
|
6625
7247
|
className
|
|
6626
7248
|
}) => {
|
|
6627
|
-
return /* @__PURE__ */
|
|
6628
|
-
/* @__PURE__ */
|
|
6629
|
-
/* @__PURE__ */
|
|
6630
|
-
/* @__PURE__ */
|
|
7249
|
+
return /* @__PURE__ */ jsx35("div", { className: cn("p-6 bg-gray-50 min-h-full", className), children: /* @__PURE__ */ jsxs26("div", { className: "max-w-7xl mx-auto", children: [
|
|
7250
|
+
/* @__PURE__ */ jsxs26("div", { className: "mb-8", children: [
|
|
7251
|
+
/* @__PURE__ */ jsx35("h2", { className: "text-2xl md:text-3xl font-bold text-gray-900 tracking-tight", children: categoryName }),
|
|
7252
|
+
/* @__PURE__ */ jsx35("div", { className: "mt-2 h-1.5 w-16 bg-green-500 rounded-full" })
|
|
6631
7253
|
] }),
|
|
6632
|
-
/* @__PURE__ */
|
|
7254
|
+
/* @__PURE__ */ jsx35("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6", children: items.map((item) => /* @__PURE__ */ jsx35(CategoryCard, { item }, item.id)) })
|
|
6633
7255
|
] }) });
|
|
6634
7256
|
};
|
|
6635
7257
|
var CategoryView_default = CategoryView;
|
|
6636
7258
|
|
|
6637
7259
|
// src/components/Views/Transaction.tsx
|
|
6638
|
-
import { jsx as
|
|
7260
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
6639
7261
|
var Transaction = () => {
|
|
6640
|
-
return /* @__PURE__ */
|
|
7262
|
+
return /* @__PURE__ */ jsx36("div", { children: "Transaction" });
|
|
6641
7263
|
};
|
|
6642
7264
|
var Transaction_default = Transaction;
|
|
6643
7265
|
|
|
@@ -6648,7 +7270,151 @@ var Views = {
|
|
|
6648
7270
|
CategoryCard
|
|
6649
7271
|
};
|
|
6650
7272
|
var Views_default = Views;
|
|
7273
|
+
|
|
7274
|
+
// src/components/Guard.tsx
|
|
7275
|
+
import { useEffect as useEffect16, useLayoutEffect } from "react";
|
|
7276
|
+
import { Navigate, Outlet, useLocation as useLocation2 } from "react-router-dom";
|
|
7277
|
+
import { message } from "antd";
|
|
7278
|
+
|
|
7279
|
+
// src/store/useAuthStore.ts
|
|
7280
|
+
import { create } from "zustand";
|
|
7281
|
+
var useAuthStore = create((set, get) => ({
|
|
7282
|
+
auth: null,
|
|
7283
|
+
account: null,
|
|
7284
|
+
isLoggedIn: false,
|
|
7285
|
+
isFetched: false,
|
|
7286
|
+
setAuth: (auth, account) => set({
|
|
7287
|
+
auth,
|
|
7288
|
+
account,
|
|
7289
|
+
isLoggedIn: true
|
|
7290
|
+
}),
|
|
7291
|
+
setIsLoggedIn: (isLoggedIn) => set({ isLoggedIn }),
|
|
7292
|
+
setIsFetched: (isFetched) => set({ isFetched }),
|
|
7293
|
+
logout: () => set({
|
|
7294
|
+
auth: null,
|
|
7295
|
+
account: null,
|
|
7296
|
+
isLoggedIn: false,
|
|
7297
|
+
isFetched: true
|
|
7298
|
+
}),
|
|
7299
|
+
updateAuth: (data) => set((state) => ({
|
|
7300
|
+
auth: state.auth ? { ...state.auth, ...data } : state.auth
|
|
7301
|
+
})),
|
|
7302
|
+
updateAccount: (data) => set((state) => ({
|
|
7303
|
+
account: state.account ? { ...state.account, ...data } : state.account
|
|
7304
|
+
})),
|
|
7305
|
+
hasPermission: (key) => !!get().auth?.permissions?.[key]
|
|
7306
|
+
}));
|
|
7307
|
+
|
|
7308
|
+
// src/hooks/useAuth.ts
|
|
7309
|
+
var useAuth = () => {
|
|
7310
|
+
const auth = useAuthStore((state) => state.auth);
|
|
7311
|
+
const account = useAuthStore((state) => state.account);
|
|
7312
|
+
const isLoggedIn = useAuthStore((state) => state.isLoggedIn);
|
|
7313
|
+
const isFetched = useAuthStore((state) => state.isFetched);
|
|
7314
|
+
const setIsLoggedIn = useAuthStore((state) => state.setIsLoggedIn);
|
|
7315
|
+
const setIsFetched = useAuthStore((state) => state.setIsFetched);
|
|
7316
|
+
const logout = useAuthStore((state) => state.logout);
|
|
7317
|
+
const setAuth = useAuthStore((state) => state.setAuth);
|
|
7318
|
+
const updateAuth = useAuthStore((state) => state.updateAuth);
|
|
7319
|
+
const updateAccount = useAuthStore((state) => state.updateAccount);
|
|
7320
|
+
const hasPermission = useAuthStore((state) => state.hasPermission);
|
|
7321
|
+
return {
|
|
7322
|
+
// ----- State -----
|
|
7323
|
+
auth,
|
|
7324
|
+
user: auth,
|
|
7325
|
+
// Alias for 'auth'
|
|
7326
|
+
account,
|
|
7327
|
+
isLoggedIn,
|
|
7328
|
+
isFetched,
|
|
7329
|
+
// ----- Shorthand Accessors -----
|
|
7330
|
+
role: auth?.role,
|
|
7331
|
+
userId: auth?._id,
|
|
7332
|
+
accountId: account?._id,
|
|
7333
|
+
userName: account?.name,
|
|
7334
|
+
userEmail: auth?.email || account?.email,
|
|
7335
|
+
permissions: auth?.permissions || {},
|
|
7336
|
+
// ----- Derived Flags -----
|
|
7337
|
+
isAdmin: auth?.role === "admin",
|
|
7338
|
+
isActive: auth?.isActive ?? false,
|
|
7339
|
+
isVerified: !!(auth?.isEmailVerified || auth?.isPhoneVerified),
|
|
7340
|
+
isEmailVerified: auth?.isEmailVerified ?? false,
|
|
7341
|
+
isPhoneVerified: auth?.isPhoneVerified ?? false,
|
|
7342
|
+
// ----- Actions -----
|
|
7343
|
+
logout,
|
|
7344
|
+
setIsLoggedIn,
|
|
7345
|
+
setIsFetched,
|
|
7346
|
+
setAuth,
|
|
7347
|
+
login: (data) => {
|
|
7348
|
+
if (data?.auth && data?.account) {
|
|
7349
|
+
setAuth(data.auth, data.account);
|
|
7350
|
+
} else if (data?.user && data?.account) {
|
|
7351
|
+
setAuth(data.user, data.account);
|
|
7352
|
+
} else {
|
|
7353
|
+
setAuth(data, data?.account || data);
|
|
7354
|
+
}
|
|
7355
|
+
},
|
|
7356
|
+
updateAuth,
|
|
7357
|
+
updateUser: updateAuth,
|
|
7358
|
+
// Alias for 'updateAuth'
|
|
7359
|
+
updateAccount,
|
|
7360
|
+
// ----- Helper Functions -----
|
|
7361
|
+
hasPermission,
|
|
7362
|
+
can: (key) => hasPermission(key)
|
|
7363
|
+
// Shorthand for 'hasPermission'
|
|
7364
|
+
};
|
|
7365
|
+
};
|
|
7366
|
+
var useAuth_default = useAuth;
|
|
7367
|
+
|
|
7368
|
+
// src/components/Guard.tsx
|
|
7369
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
7370
|
+
var Guard = () => {
|
|
7371
|
+
const { get } = useApis_default();
|
|
7372
|
+
const location = useLocation2();
|
|
7373
|
+
const { login, setIsLoggedIn, setIsFetched, isFetched } = useAuth();
|
|
7374
|
+
useLayoutEffect(() => {
|
|
7375
|
+
const fetchProfile = async () => {
|
|
7376
|
+
try {
|
|
7377
|
+
const res = await get({
|
|
7378
|
+
url: "/users/me",
|
|
7379
|
+
v: 1
|
|
7380
|
+
});
|
|
7381
|
+
console.log("res", res);
|
|
7382
|
+
login(res?.data);
|
|
7383
|
+
setIsLoggedIn(true);
|
|
7384
|
+
setIsFetched(true);
|
|
7385
|
+
} catch (error) {
|
|
7386
|
+
console.log(error);
|
|
7387
|
+
setIsFetched(true);
|
|
7388
|
+
setIsLoggedIn(false);
|
|
7389
|
+
}
|
|
7390
|
+
};
|
|
7391
|
+
fetchProfile();
|
|
7392
|
+
}, [location.pathname]);
|
|
7393
|
+
if (!isFetched) {
|
|
7394
|
+
return /* @__PURE__ */ jsx37("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ jsx37(LoadingSpin, { size: "lg" }) });
|
|
7395
|
+
}
|
|
7396
|
+
return /* @__PURE__ */ jsx37(Outlet, {});
|
|
7397
|
+
};
|
|
7398
|
+
var ProtectedRoute = () => {
|
|
7399
|
+
const { isLoggedIn } = useAuth();
|
|
7400
|
+
const location = useLocation2();
|
|
7401
|
+
return isLoggedIn ? /* @__PURE__ */ jsx37(Outlet, {}) : /* @__PURE__ */ jsx37(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
7402
|
+
};
|
|
7403
|
+
var UnProtectedRoute = () => {
|
|
7404
|
+
const { isLoggedIn, user } = useAuth();
|
|
7405
|
+
return !isLoggedIn ? /* @__PURE__ */ jsx37(Outlet, {}) : /* @__PURE__ */ jsx37(Navigate, { to: user?.homePath || "/", replace: true });
|
|
7406
|
+
};
|
|
7407
|
+
var AdminProtectedRoute = () => {
|
|
7408
|
+
const { role } = useAuth();
|
|
7409
|
+
useEffect16(() => {
|
|
7410
|
+
if (role && !["admin"].includes(role)) {
|
|
7411
|
+
message.error("Only admin can access this page");
|
|
7412
|
+
}
|
|
7413
|
+
}, [role]);
|
|
7414
|
+
return role && ["admin"].includes(role) ? /* @__PURE__ */ jsx37(Outlet, {}) : /* @__PURE__ */ jsx37(Navigate, { to: "/", replace: true });
|
|
7415
|
+
};
|
|
6651
7416
|
export {
|
|
7417
|
+
AdminProtectedRoute,
|
|
6652
7418
|
Badge,
|
|
6653
7419
|
Branding,
|
|
6654
7420
|
Button,
|
|
@@ -6665,6 +7431,7 @@ export {
|
|
|
6665
7431
|
DataTable,
|
|
6666
7432
|
DateInput,
|
|
6667
7433
|
Fields_default as Fields,
|
|
7434
|
+
Guard,
|
|
6668
7435
|
InfoGrid,
|
|
6669
7436
|
Input,
|
|
6670
7437
|
LoadingBox,
|
|
@@ -6675,6 +7442,8 @@ export {
|
|
|
6675
7442
|
PageHeader,
|
|
6676
7443
|
PhoneInput,
|
|
6677
7444
|
PostTable,
|
|
7445
|
+
ProfileDropdown,
|
|
7446
|
+
ProtectedRoute,
|
|
6678
7447
|
SearchApi,
|
|
6679
7448
|
SearchApiContent,
|
|
6680
7449
|
SearchApiInput,
|
|
@@ -6688,6 +7457,8 @@ export {
|
|
|
6688
7457
|
Textarea,
|
|
6689
7458
|
ThemeProvider,
|
|
6690
7459
|
ThemeToggle,
|
|
7460
|
+
ThemedLogin,
|
|
7461
|
+
UnProtectedRoute,
|
|
6691
7462
|
Views_default as Views,
|
|
6692
7463
|
WarqadProvider,
|
|
6693
7464
|
generatePdf,
|
|
@@ -6696,6 +7467,9 @@ export {
|
|
|
6696
7467
|
useA4DataView_default as useA4StatementView,
|
|
6697
7468
|
useAntdImageUpload_default as useAntdImageUpload,
|
|
6698
7469
|
useApis_default as useApi,
|
|
7470
|
+
useAuth_default as useAuth,
|
|
7471
|
+
useAuthStore,
|
|
7472
|
+
useLogin,
|
|
6699
7473
|
useModal,
|
|
6700
7474
|
useSearchApiContext,
|
|
6701
7475
|
useSelectContext,
|