warqadui 0.0.52 → 0.0.53
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 +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +611 -382
- package/dist/index.mjs +574 -347
- package/dist/styles.js +308 -0
- package/dist/styles.mjs +308 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1100,13 +1100,13 @@ var Input = forwardRef(
|
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
}, [props.value, name, form]);
|
|
1103
|
-
let
|
|
1103
|
+
let message4 = error;
|
|
1104
1104
|
if (form && name) {
|
|
1105
1105
|
const {
|
|
1106
1106
|
formState: { errors }
|
|
1107
1107
|
} = form;
|
|
1108
1108
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1109
|
-
|
|
1109
|
+
message4 = errorObj?.message;
|
|
1110
1110
|
}
|
|
1111
1111
|
const watchedValue = form?.watch(name);
|
|
1112
1112
|
useEffect5(() => {
|
|
@@ -1173,7 +1173,7 @@ var Input = forwardRef(
|
|
|
1173
1173
|
}
|
|
1174
1174
|
)
|
|
1175
1175
|
] }),
|
|
1176
|
-
|
|
1176
|
+
message4 && /* @__PURE__ */ jsx17("p", { className: "text-sm text-red-600 dark:text-red-400", children: message4 })
|
|
1177
1177
|
]
|
|
1178
1178
|
}
|
|
1179
1179
|
);
|
|
@@ -1290,7 +1290,7 @@ var PhoneInput = forwardRef2(
|
|
|
1290
1290
|
const [isFocused, setIsFocused] = useState8(false);
|
|
1291
1291
|
const { theme } = useWarqadConfig();
|
|
1292
1292
|
const primaryColor = theme?.primaryColor;
|
|
1293
|
-
let
|
|
1293
|
+
let message4 = error;
|
|
1294
1294
|
if (form && name) {
|
|
1295
1295
|
const {
|
|
1296
1296
|
formState: { errors }
|
|
@@ -1300,7 +1300,7 @@ var PhoneInput = forwardRef2(
|
|
|
1300
1300
|
for (const part of nameParts) {
|
|
1301
1301
|
currentError = currentError?.[part];
|
|
1302
1302
|
}
|
|
1303
|
-
|
|
1303
|
+
message4 = currentError?.message || message4;
|
|
1304
1304
|
}
|
|
1305
1305
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs12("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1306
1306
|
/* @__PURE__ */ jsxs12(
|
|
@@ -1345,7 +1345,7 @@ var PhoneInput = forwardRef2(
|
|
|
1345
1345
|
}
|
|
1346
1346
|
)
|
|
1347
1347
|
] }),
|
|
1348
|
-
|
|
1348
|
+
message4 && /* @__PURE__ */ jsx18("p", { className: "text-sm text-red-600 dark:text-red-400", children: message4 })
|
|
1349
1349
|
] });
|
|
1350
1350
|
if (form && name) {
|
|
1351
1351
|
return /* @__PURE__ */ jsx18(
|
|
@@ -1501,7 +1501,7 @@ var SelectRoot = ({
|
|
|
1501
1501
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1502
1502
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1503
1503
|
}, [fieldInternalProps]);
|
|
1504
|
-
let
|
|
1504
|
+
let message4 = error;
|
|
1505
1505
|
if (form && name) {
|
|
1506
1506
|
const {
|
|
1507
1507
|
formState: { errors }
|
|
@@ -1511,7 +1511,7 @@ var SelectRoot = ({
|
|
|
1511
1511
|
for (const part of nameParts) {
|
|
1512
1512
|
currentError = currentError?.[part];
|
|
1513
1513
|
}
|
|
1514
|
-
|
|
1514
|
+
message4 = currentError?.message || message4;
|
|
1515
1515
|
}
|
|
1516
1516
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
1517
1517
|
const valueCtx = {
|
|
@@ -1572,7 +1572,7 @@ var SelectRoot = ({
|
|
|
1572
1572
|
String(opt.value) || index
|
|
1573
1573
|
)) })
|
|
1574
1574
|
] }),
|
|
1575
|
-
|
|
1575
|
+
message4 && /* @__PURE__ */ jsx19("p", { className: "text-sm text-red-600 dark:text-red-400", children: message4 })
|
|
1576
1576
|
]
|
|
1577
1577
|
}
|
|
1578
1578
|
) });
|
|
@@ -1808,13 +1808,13 @@ var Textarea = forwardRef4(
|
|
|
1808
1808
|
const [isFocused, setIsFocused] = useState10(false);
|
|
1809
1809
|
const { theme } = useWarqadConfig();
|
|
1810
1810
|
const primaryColor = theme?.primaryColor;
|
|
1811
|
-
let
|
|
1811
|
+
let message4 = error;
|
|
1812
1812
|
if (form && name) {
|
|
1813
1813
|
const {
|
|
1814
1814
|
formState: { errors }
|
|
1815
1815
|
} = form;
|
|
1816
1816
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1817
|
-
|
|
1817
|
+
message4 = errorObj?.message;
|
|
1818
1818
|
}
|
|
1819
1819
|
const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs14("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
1820
1820
|
/* @__PURE__ */ jsxs14(
|
|
@@ -1850,7 +1850,7 @@ var Textarea = forwardRef4(
|
|
|
1850
1850
|
...inputProps
|
|
1851
1851
|
}
|
|
1852
1852
|
) }),
|
|
1853
|
-
|
|
1853
|
+
message4 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message4 })
|
|
1854
1854
|
] });
|
|
1855
1855
|
useEffect7(() => {
|
|
1856
1856
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -2343,7 +2343,7 @@ var SearchApiRoot = ({
|
|
|
2343
2343
|
const filteredOptions = options.filter(
|
|
2344
2344
|
(option) => !filter.includes(getOptionValue(option))
|
|
2345
2345
|
);
|
|
2346
|
-
let
|
|
2346
|
+
let message4 = error || errorMessage;
|
|
2347
2347
|
if (form && name) {
|
|
2348
2348
|
const {
|
|
2349
2349
|
formState: { errors }
|
|
@@ -2353,7 +2353,7 @@ var SearchApiRoot = ({
|
|
|
2353
2353
|
for (const part of nameParts) {
|
|
2354
2354
|
currentError = currentError?.[part];
|
|
2355
2355
|
}
|
|
2356
|
-
|
|
2356
|
+
message4 = currentError?.message || message4;
|
|
2357
2357
|
}
|
|
2358
2358
|
const valueCtx = {
|
|
2359
2359
|
isOpen,
|
|
@@ -2387,7 +2387,7 @@ var SearchApiRoot = ({
|
|
|
2387
2387
|
form,
|
|
2388
2388
|
name,
|
|
2389
2389
|
obj,
|
|
2390
|
-
error:
|
|
2390
|
+
error: message4,
|
|
2391
2391
|
onSelect,
|
|
2392
2392
|
onClear
|
|
2393
2393
|
};
|
|
@@ -2744,19 +2744,19 @@ var DateInput = forwardRef6(
|
|
|
2744
2744
|
const { theme } = useWarqadConfig();
|
|
2745
2745
|
const primaryColor = theme?.primaryColor;
|
|
2746
2746
|
const [isFocused, setIsFocused] = useState13(false);
|
|
2747
|
-
let
|
|
2747
|
+
let message4 = error;
|
|
2748
2748
|
if (form && name) {
|
|
2749
2749
|
const {
|
|
2750
2750
|
formState: { errors }
|
|
2751
2751
|
} = form;
|
|
2752
2752
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2753
|
-
|
|
2753
|
+
message4 = errorObj?.message;
|
|
2754
2754
|
}
|
|
2755
2755
|
const inputStyles = `w-full px-2.5 py-1 rounded-xl border! shadow-none transition-all! duration-200! outline-none!
|
|
2756
2756
|
bg-white! dark:bg-zinc-900!
|
|
2757
2757
|
text-gray-900! dark:text-zinc-100!
|
|
2758
2758
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
2759
|
-
${
|
|
2759
|
+
${message4 ? "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"}
|
|
2760
2760
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
2761
2761
|
${className}`;
|
|
2762
2762
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
@@ -2784,8 +2784,8 @@ var DateInput = forwardRef6(
|
|
|
2784
2784
|
needConfirm: false,
|
|
2785
2785
|
style: {
|
|
2786
2786
|
height: "36px",
|
|
2787
|
-
borderColor: isFocused && !
|
|
2788
|
-
boxShadow: isFocused && !
|
|
2787
|
+
borderColor: isFocused && !message4 ? primaryColor : void 0,
|
|
2788
|
+
boxShadow: isFocused && !message4 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
2789
2789
|
},
|
|
2790
2790
|
classNames: { popup: { root: "z-50" } },
|
|
2791
2791
|
suffixIcon: /* @__PURE__ */ jsx22(
|
|
@@ -2806,7 +2806,7 @@ var DateInput = forwardRef6(
|
|
|
2806
2806
|
{
|
|
2807
2807
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
2808
2808
|
style: {
|
|
2809
|
-
color:
|
|
2809
|
+
color: message4 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
2810
2810
|
},
|
|
2811
2811
|
children: [
|
|
2812
2812
|
label,
|
|
@@ -2827,7 +2827,7 @@ var DateInput = forwardRef6(
|
|
|
2827
2827
|
)
|
|
2828
2828
|
}
|
|
2829
2829
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
2830
|
-
|
|
2830
|
+
message4 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message4 })
|
|
2831
2831
|
] });
|
|
2832
2832
|
}
|
|
2833
2833
|
);
|
|
@@ -3004,7 +3004,7 @@ function DataTable({
|
|
|
3004
3004
|
{
|
|
3005
3005
|
placeholder: searchPlaceholder,
|
|
3006
3006
|
value: globalFilter,
|
|
3007
|
-
onChange: (
|
|
3007
|
+
onChange: (val) => setGlobalFilter(val),
|
|
3008
3008
|
icon: /* @__PURE__ */ jsx23(Search2, { size: 16 }),
|
|
3009
3009
|
className: "h-9!"
|
|
3010
3010
|
}
|
|
@@ -4073,8 +4073,220 @@ var Branding = ({
|
|
|
4073
4073
|
);
|
|
4074
4074
|
};
|
|
4075
4075
|
|
|
4076
|
+
// src/components/ProfileCard.tsx
|
|
4077
|
+
import { useState as useState16 } from "react";
|
|
4078
|
+
import { ArrowLeft, Copy as Copy2, Check as Check5, ExternalLink } from "lucide-react";
|
|
4079
|
+
import { useNavigate as useNavigate2 } from "react-router-dom";
|
|
4080
|
+
import { message } from "antd";
|
|
4081
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4082
|
+
var ProfileCard = ({
|
|
4083
|
+
name,
|
|
4084
|
+
role,
|
|
4085
|
+
image,
|
|
4086
|
+
details,
|
|
4087
|
+
backUrl,
|
|
4088
|
+
className
|
|
4089
|
+
}) => {
|
|
4090
|
+
const navigate = useNavigate2();
|
|
4091
|
+
const [copiedKey, setCopiedKey] = useState16(null);
|
|
4092
|
+
const handleBack = () => {
|
|
4093
|
+
if (backUrl) navigate(backUrl);
|
|
4094
|
+
else navigate(-1);
|
|
4095
|
+
};
|
|
4096
|
+
const handleCopy = async (key, value) => {
|
|
4097
|
+
try {
|
|
4098
|
+
await navigator.clipboard.writeText(String(value));
|
|
4099
|
+
setCopiedKey(key);
|
|
4100
|
+
message.success(`${formatLabel(key)} copied to clipboard`);
|
|
4101
|
+
setTimeout(() => setCopiedKey(null), 2e3);
|
|
4102
|
+
} catch (err) {
|
|
4103
|
+
message.error("Failed to copy");
|
|
4104
|
+
}
|
|
4105
|
+
};
|
|
4106
|
+
const formatLabel = (label) => {
|
|
4107
|
+
return label.replace(/_/g, " ").replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
4108
|
+
};
|
|
4109
|
+
const getInitials = (userName) => {
|
|
4110
|
+
return userName.split(" ").filter(Boolean).map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
4111
|
+
};
|
|
4112
|
+
return /* @__PURE__ */ jsxs20(Card, { className: cn(
|
|
4113
|
+
"overflow-hidden border-0 bg-white/70 dark:bg-zinc-950/70 backdrop-blur-xl shadow-2xl",
|
|
4114
|
+
"relative group/card transition-all duration-300",
|
|
4115
|
+
className
|
|
4116
|
+
), children: [
|
|
4117
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute top-0 left-0 w-full h-32 bg-linear-to-br from-blue-600/10 via-indigo-600/5 to-purple-600/10 dark:from-blue-500/10 dark:via-indigo-500/5 dark:to-purple-500/10" }),
|
|
4118
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute top-0 right-0 w-48 h-48 bg-blue-500/20 blur-3xl -mr-24 -mt-24 rounded-full" }),
|
|
4119
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute top-0 left-0 w-32 h-32 bg-indigo-500/10 blur-2xl -ml-16 -mt-16 rounded-full" }),
|
|
4120
|
+
/* @__PURE__ */ jsxs20(Card.Content, { className: "relative px-8 pt-8 pb-10 z-10", children: [
|
|
4121
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex justify-between items-start mb-10", children: [
|
|
4122
|
+
/* @__PURE__ */ jsx28(
|
|
4123
|
+
"button",
|
|
4124
|
+
{
|
|
4125
|
+
onClick: handleBack,
|
|
4126
|
+
className: "p-2.5 rounded-2xl bg-white dark:bg-zinc-900 border border-gray-100 dark:border-zinc-800 text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 shadow-sm transition-all active:scale-95 group/back",
|
|
4127
|
+
children: /* @__PURE__ */ jsx28(ArrowLeft, { size: 20, className: "group-hover/back:-translate-x-0.5 transition-transform" })
|
|
4128
|
+
}
|
|
4129
|
+
),
|
|
4130
|
+
/* @__PURE__ */ jsx28("div", { className: "flex gap-2", children: /* @__PURE__ */ jsx28("div", { className: "px-3 py-1 rounded-full bg-blue-50/50 dark:bg-blue-500/10 text-[10px] font-bold text-blue-600 dark:text-blue-400 uppercase tracking-widest border border-blue-100/50 dark:border-blue-500/20", children: "Active Profile" }) })
|
|
4131
|
+
] }),
|
|
4132
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center sm:flex-row gap-8 mb-12", children: [
|
|
4133
|
+
/* @__PURE__ */ jsxs20("div", { className: "relative shrink-0 group/avatar", children: [
|
|
4134
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute inset-0 bg-blue-500/20 blur-xl opacity-0 group-hover/avatar:opacity-100 transition-opacity" }),
|
|
4135
|
+
/* @__PURE__ */ jsx28("div", { className: "relative h-28 w-28 rounded-3xl ring-4 ring-white dark:ring-zinc-950 shadow-2xl overflow-hidden bg-gray-50 dark:bg-zinc-900 flex items-center justify-center transition-transform hover:rotate-3 duration-300", children: image ? /* @__PURE__ */ jsx28("img", { src: image, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsx28("span", { className: "text-3xl font-black text-blue-600 dark:text-blue-400 select-none", children: getInitials(name) }) }),
|
|
4136
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute bottom-0 right-0 w-6 h-6 bg-green-500 border-4 border-white dark:border-zinc-950 rounded-full shadow-lg" })
|
|
4137
|
+
] }),
|
|
4138
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center sm:items-start text-center sm:text-left gap-1", children: [
|
|
4139
|
+
/* @__PURE__ */ jsx28("h2", { className: "text-3xl font-black text-gray-900 dark:text-white tracking-tight leading-tight", children: name }),
|
|
4140
|
+
role && /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
4141
|
+
/* @__PURE__ */ jsx28("span", { className: "text-sm font-semibold text-gray-500 dark:text-zinc-400 capitalize", children: role }),
|
|
4142
|
+
/* @__PURE__ */ jsx28("span", { className: "w-1 h-1 rounded-full bg-gray-300 dark:bg-zinc-700" }),
|
|
4143
|
+
/* @__PURE__ */ jsx28("span", { className: "text-xs font-medium text-blue-600/70 dark:text-blue-400/70", children: "Verified Account" })
|
|
4144
|
+
] })
|
|
4145
|
+
] })
|
|
4146
|
+
] }),
|
|
4147
|
+
/* @__PURE__ */ jsx28("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: Object.entries(details).map(([key, value]) => {
|
|
4148
|
+
if (value === void 0 || value === null || value === "") return null;
|
|
4149
|
+
return /* @__PURE__ */ jsxs20(
|
|
4150
|
+
"div",
|
|
4151
|
+
{
|
|
4152
|
+
className: "group flex flex-col p-4 rounded-2xl bg-gray-50/50 dark:bg-zinc-900/30 border border-transparent hover:border-blue-100 dark:hover:border-blue-900/30 hover:bg-white dark:hover:bg-zinc-900 transition-all duration-300",
|
|
4153
|
+
children: [
|
|
4154
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between mb-1", children: [
|
|
4155
|
+
/* @__PURE__ */ jsx28("span", { className: "text-[10px] font-black uppercase tracking-widest text-gray-400 dark:text-zinc-500", children: formatLabel(key) }),
|
|
4156
|
+
/* @__PURE__ */ jsx28(
|
|
4157
|
+
"button",
|
|
4158
|
+
{
|
|
4159
|
+
onClick: () => handleCopy(key, value),
|
|
4160
|
+
className: cn(
|
|
4161
|
+
"p-1.5 rounded-lg transition-all duration-200 opacity-0 group-hover:opacity-100",
|
|
4162
|
+
copiedKey === key ? "text-green-500 bg-green-50 dark:bg-green-500/10" : "text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-500/10"
|
|
4163
|
+
),
|
|
4164
|
+
children: copiedKey === key ? /* @__PURE__ */ jsx28(Check5, { size: 12, className: "animate-in zoom-in" }) : /* @__PURE__ */ jsx28(Copy2, { size: 12 })
|
|
4165
|
+
}
|
|
4166
|
+
)
|
|
4167
|
+
] }),
|
|
4168
|
+
/* @__PURE__ */ jsx28("div", { className: "flex items-center justify-between gap-2 overflow-hidden", children: /* @__PURE__ */ jsx28("p", { className: "text-base font-bold text-gray-800 dark:text-zinc-100 truncate", children: value }) })
|
|
4169
|
+
]
|
|
4170
|
+
},
|
|
4171
|
+
key
|
|
4172
|
+
);
|
|
4173
|
+
}) })
|
|
4174
|
+
] }),
|
|
4175
|
+
/* @__PURE__ */ jsxs20("div", { className: "px-8 py-4 bg-gray-50/50 dark:bg-zinc-900/30 border-t border-gray-100 dark:border-zinc-900 flex justify-between items-center", children: [
|
|
4176
|
+
/* @__PURE__ */ jsx28("p", { className: "text-[10px] text-gray-400 dark:text-zinc-600 font-medium italic", children: "All data is securely encrypted." }),
|
|
4177
|
+
/* @__PURE__ */ jsxs20("button", { className: "flex items-center gap-1.5 text-xs font-bold text-blue-600 dark:text-blue-400 hover:underline", children: [
|
|
4178
|
+
"Edit Settings ",
|
|
4179
|
+
/* @__PURE__ */ jsx28(ExternalLink, { size: 12 })
|
|
4180
|
+
] })
|
|
4181
|
+
] })
|
|
4182
|
+
] });
|
|
4183
|
+
};
|
|
4184
|
+
|
|
4185
|
+
// src/components/ProfileView.tsx
|
|
4186
|
+
import React13 from "react";
|
|
4187
|
+
import { User, Shield, Copy as Copy3, Check as Check6 } from "lucide-react";
|
|
4188
|
+
import { message as message2 } from "antd";
|
|
4189
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4190
|
+
var ProfileView = ({
|
|
4191
|
+
name,
|
|
4192
|
+
role,
|
|
4193
|
+
email,
|
|
4194
|
+
imgUrl,
|
|
4195
|
+
userId,
|
|
4196
|
+
info = [],
|
|
4197
|
+
className,
|
|
4198
|
+
title = "My Profile",
|
|
4199
|
+
description = "Manage your account settings and preferences"
|
|
4200
|
+
}) => {
|
|
4201
|
+
const [copiedIndex, setCopiedIndex] = React13.useState(null);
|
|
4202
|
+
const formatLabel = (label) => {
|
|
4203
|
+
return label.replace(/_/g, " ").replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
|
|
4204
|
+
};
|
|
4205
|
+
const handleCopy = async (index, label, value) => {
|
|
4206
|
+
await navigator.clipboard.writeText(String(value));
|
|
4207
|
+
setCopiedIndex(index);
|
|
4208
|
+
message2.success(`${formatLabel(label)} copied!`);
|
|
4209
|
+
setTimeout(() => setCopiedIndex(null), 2e3);
|
|
4210
|
+
};
|
|
4211
|
+
return /* @__PURE__ */ jsxs21(
|
|
4212
|
+
"div",
|
|
4213
|
+
{
|
|
4214
|
+
className: cn(
|
|
4215
|
+
"max-w-5xl mx-auto space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500 pb-12",
|
|
4216
|
+
className
|
|
4217
|
+
),
|
|
4218
|
+
children: [
|
|
4219
|
+
/* @__PURE__ */ jsx29("div", { className: "flex flex-col sm:flex-row sm:items-center justify-between gap-4", children: /* @__PURE__ */ jsxs21("div", { children: [
|
|
4220
|
+
/* @__PURE__ */ jsx29("h1", { className: "text-3xl font-black text-gray-900 dark:text-white tracking-tight leading-none", children: title }),
|
|
4221
|
+
/* @__PURE__ */ jsx29("p", { className: "text-gray-500 dark:text-gray-400 mt-2 font-medium", children: description })
|
|
4222
|
+
] }) }),
|
|
4223
|
+
/* @__PURE__ */ jsxs21("div", { className: "bg-white dark:bg-zinc-900 rounded-[2.5rem] border border-gray-100 dark:border-zinc-800 relative overflow-hidden flex flex-col", children: [
|
|
4224
|
+
/* @__PURE__ */ jsxs21("div", { className: "p-8 sm:p-10 border-b border-gray-50 dark:border-zinc-800/50 relative overflow-hidden bg-gray-50/30 dark:bg-zinc-900/10", children: [
|
|
4225
|
+
/* @__PURE__ */ jsx29("div", { className: "absolute top-0 right-0 w-64 h-64 bg-blue-50 dark:bg-blue-900/10 rounded-full blur-3xl -mr-16 -mt-16 pointer-events-none" }),
|
|
4226
|
+
/* @__PURE__ */ jsxs21("div", { className: "relative flex flex-col sm:flex-row items-center sm:items-start gap-10", children: [
|
|
4227
|
+
/* @__PURE__ */ jsx29("div", { className: "relative shrink-0", children: /* @__PURE__ */ jsx29("div", { className: "w-28 h-28 sm:w-36 sm:h-36 rounded-[2rem] bg-linear-to-br from-blue-50 to-indigo-50 dark:from-blue-900/20 dark:to-indigo-900/20 flex items-center justify-center text-blue-600 dark:text-blue-400 ring-1 ring-black/5 dark:ring-white/10 overflow-hidden", children: imgUrl ? /* @__PURE__ */ jsx29(
|
|
4228
|
+
"img",
|
|
4229
|
+
{
|
|
4230
|
+
src: imgUrl,
|
|
4231
|
+
alt: name,
|
|
4232
|
+
className: "w-full h-full object-cover"
|
|
4233
|
+
}
|
|
4234
|
+
) : /* @__PURE__ */ jsx29(User, { size: 56, className: "opacity-80" }) }) }),
|
|
4235
|
+
/* @__PURE__ */ jsxs21("div", { className: "text-center sm:text-left space-y-4 flex-1 pt-4", children: [
|
|
4236
|
+
/* @__PURE__ */ jsxs21("div", { children: [
|
|
4237
|
+
/* @__PURE__ */ jsx29("h2", { className: "text-3xl font-black text-gray-900 dark:text-white tracking-tight leading-none mb-3", children: name }),
|
|
4238
|
+
/* @__PURE__ */ jsx29("p", { className: "text-gray-500 dark:text-gray-400 font-semibold text-lg", children: email })
|
|
4239
|
+
] }),
|
|
4240
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap justify-center sm:justify-start gap-2.5", children: [
|
|
4241
|
+
role && /* @__PURE__ */ jsxs21("span", { className: "inline-flex items-center gap-2 px-4 py-1.5 rounded-2xl bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 text-xs font-bold capitalize border border-blue-100 dark:border-blue-800 tracking-wide", children: [
|
|
4242
|
+
/* @__PURE__ */ jsx29(Shield, { size: 14 }),
|
|
4243
|
+
role
|
|
4244
|
+
] }),
|
|
4245
|
+
userId && /* @__PURE__ */ jsxs21("span", { className: "inline-flex items-center gap-2 px-4 py-1.5 rounded-2xl bg-gray-50 text-gray-700 dark:bg-zinc-800 dark:text-gray-300 text-xs font-bold border border-gray-100 dark:border-zinc-700 tracking-wide", children: [
|
|
4246
|
+
"#",
|
|
4247
|
+
userId.slice(-6).toUpperCase()
|
|
4248
|
+
] })
|
|
4249
|
+
] })
|
|
4250
|
+
] })
|
|
4251
|
+
] })
|
|
4252
|
+
] }),
|
|
4253
|
+
info && info.length > 0 && /* @__PURE__ */ jsx29("div", { className: "p-8 sm:p-10", children: /* @__PURE__ */ jsx29("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: info.map((item, index) => {
|
|
4254
|
+
if (item.value === void 0 || item.value === null || item.value === "")
|
|
4255
|
+
return null;
|
|
4256
|
+
const isCopiable = item.copiable !== false;
|
|
4257
|
+
return /* @__PURE__ */ jsxs21(
|
|
4258
|
+
"div",
|
|
4259
|
+
{
|
|
4260
|
+
className: "group flex flex-col p-6 rounded-3xl bg-gray-50/50 dark:bg-zinc-800/30 border border-gray-100/50 dark:border-zinc-800/50 hover:bg-white dark:hover:bg-zinc-800 hover:border-blue-100 dark:hover:border-blue-900/30 transition-all duration-300",
|
|
4261
|
+
children: [
|
|
4262
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between mb-2 capitalize", children: [
|
|
4263
|
+
/* @__PURE__ */ jsx29("span", { className: "text-[10px] font-black uppercase tracking-widest text-gray-400 dark:text-zinc-500", children: formatLabel(item.label) }),
|
|
4264
|
+
isCopiable && /* @__PURE__ */ jsx29(
|
|
4265
|
+
"button",
|
|
4266
|
+
{
|
|
4267
|
+
onClick: () => handleCopy(index, item.label, item.value),
|
|
4268
|
+
className: cn(
|
|
4269
|
+
"p-2 rounded-xl transition-all duration-200 opacity-0 group-hover:opacity-100",
|
|
4270
|
+
copiedIndex === index ? "text-green-500 bg-green-50 dark:bg-green-500/10" : "text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-white dark:hover:bg-zinc-900 border border-transparent hover:border-gray-100 dark:hover:border-zinc-700"
|
|
4271
|
+
),
|
|
4272
|
+
children: copiedIndex === index ? /* @__PURE__ */ jsx29(Check6, { size: 14, className: "animate-in zoom-in" }) : /* @__PURE__ */ jsx29(Copy3, { size: 14 })
|
|
4273
|
+
}
|
|
4274
|
+
)
|
|
4275
|
+
] }),
|
|
4276
|
+
/* @__PURE__ */ jsx29("p", { className: "text-base font-black text-gray-800 dark:text-zinc-100 truncate", children: item.value })
|
|
4277
|
+
]
|
|
4278
|
+
},
|
|
4279
|
+
index
|
|
4280
|
+
);
|
|
4281
|
+
}) }) })
|
|
4282
|
+
] })
|
|
4283
|
+
]
|
|
4284
|
+
}
|
|
4285
|
+
);
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4076
4288
|
// src/hooks/useLogin.tsx
|
|
4077
|
-
import
|
|
4289
|
+
import React14 from "react";
|
|
4078
4290
|
import { useForm } from "react-hook-form";
|
|
4079
4291
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
4080
4292
|
import * as z from "zod";
|
|
@@ -4088,10 +4300,10 @@ import {
|
|
|
4088
4300
|
Plane,
|
|
4089
4301
|
HeartPulse,
|
|
4090
4302
|
MonitorCheck,
|
|
4091
|
-
ArrowLeft
|
|
4303
|
+
ArrowLeft as ArrowLeft2
|
|
4092
4304
|
} from "lucide-react";
|
|
4093
|
-
import { useNavigate as
|
|
4094
|
-
import { jsx as
|
|
4305
|
+
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
4306
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4095
4307
|
var TechLogin = ({
|
|
4096
4308
|
form,
|
|
4097
4309
|
onSubmit,
|
|
@@ -4102,65 +4314,65 @@ var TechLogin = ({
|
|
|
4102
4314
|
backUrl,
|
|
4103
4315
|
isLoading
|
|
4104
4316
|
}) => {
|
|
4105
|
-
const navigate =
|
|
4106
|
-
return /* @__PURE__ */
|
|
4107
|
-
/* @__PURE__ */
|
|
4108
|
-
/* @__PURE__ */
|
|
4317
|
+
const navigate = useNavigate3();
|
|
4318
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
|
|
4319
|
+
/* @__PURE__ */ jsxs22("div", { className: "hidden lg:flex lg:w-3/5 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
|
|
4320
|
+
/* @__PURE__ */ jsx30(
|
|
4109
4321
|
"div",
|
|
4110
4322
|
{
|
|
4111
4323
|
className: "absolute inset-0 z-0 opacity-60 bg-cover bg-center transition-transform hover:scale-110 duration-[20s]",
|
|
4112
4324
|
style: { backgroundImage: `url('${image || "/tech_bg.png"}')` }
|
|
4113
4325
|
}
|
|
4114
4326
|
),
|
|
4115
|
-
/* @__PURE__ */
|
|
4116
|
-
/* @__PURE__ */
|
|
4117
|
-
/* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
4119
|
-
/* @__PURE__ */
|
|
4327
|
+
/* @__PURE__ */ jsx30("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-purple-500/10 z-10" }),
|
|
4328
|
+
/* @__PURE__ */ jsxs22("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
|
|
4329
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-3", children: [
|
|
4330
|
+
/* @__PURE__ */ jsx30("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__ */ jsx30(Terminal, { className: "text-white w-6 h-6" }) }),
|
|
4331
|
+
/* @__PURE__ */ jsx30("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: brandName || "DevNode" })
|
|
4120
4332
|
] }),
|
|
4121
|
-
/* @__PURE__ */
|
|
4122
|
-
/* @__PURE__ */
|
|
4333
|
+
/* @__PURE__ */ jsxs22("div", { className: "max-w-md", children: [
|
|
4334
|
+
/* @__PURE__ */ jsxs22("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
|
|
4123
4335
|
"Build the ",
|
|
4124
|
-
/* @__PURE__ */
|
|
4336
|
+
/* @__PURE__ */ jsx30("span", { className: "text-indigo-400", children: "Future" }),
|
|
4125
4337
|
" of Web."
|
|
4126
4338
|
] }),
|
|
4127
|
-
/* @__PURE__ */
|
|
4339
|
+
/* @__PURE__ */ jsx30("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
4340
|
] }),
|
|
4129
|
-
/* @__PURE__ */
|
|
4341
|
+
/* @__PURE__ */ jsxs22("div", { className: "text-slate-500 text-sm", children: [
|
|
4130
4342
|
"\xA9 2026 ",
|
|
4131
4343
|
brandName || "DevNode",
|
|
4132
4344
|
"."
|
|
4133
4345
|
] })
|
|
4134
4346
|
] })
|
|
4135
4347
|
] }),
|
|
4136
|
-
/* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4138
|
-
backUrl && /* @__PURE__ */
|
|
4348
|
+
/* @__PURE__ */ jsxs22("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: [
|
|
4349
|
+
/* @__PURE__ */ jsxs22("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
|
|
4350
|
+
backUrl && /* @__PURE__ */ jsxs22(
|
|
4139
4351
|
"button",
|
|
4140
4352
|
{
|
|
4141
4353
|
onClick: () => navigate(backUrl),
|
|
4142
4354
|
disabled: isLoading,
|
|
4143
4355
|
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
4356
|
children: [
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4357
|
+
/* @__PURE__ */ jsx30(ArrowLeft2, { size: 18 }),
|
|
4358
|
+
/* @__PURE__ */ jsx30("span", { className: "text-sm", children: "Back" })
|
|
4147
4359
|
]
|
|
4148
4360
|
}
|
|
4149
4361
|
),
|
|
4150
|
-
/* @__PURE__ */
|
|
4362
|
+
/* @__PURE__ */ jsx30(ThemeToggle, {})
|
|
4151
4363
|
] }),
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
/* @__PURE__ */
|
|
4154
|
-
/* @__PURE__ */
|
|
4155
|
-
/* @__PURE__ */
|
|
4364
|
+
/* @__PURE__ */ jsxs22("div", { className: "max-w-md w-full mx-auto relative z-10", children: [
|
|
4365
|
+
/* @__PURE__ */ jsxs22("div", { className: "mb-12", children: [
|
|
4366
|
+
/* @__PURE__ */ jsx30("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: title || "Welcome Back" }),
|
|
4367
|
+
/* @__PURE__ */ jsx30("p", { className: "text-slate-500 dark:text-slate-400", children: subtitle || "Please enter your credentials to access your dashboard." })
|
|
4156
4368
|
] }),
|
|
4157
|
-
/* @__PURE__ */
|
|
4369
|
+
/* @__PURE__ */ jsxs22(
|
|
4158
4370
|
"form",
|
|
4159
4371
|
{
|
|
4160
4372
|
onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
|
|
4161
4373
|
className: "space-y-6",
|
|
4162
4374
|
children: [
|
|
4163
|
-
/* @__PURE__ */
|
|
4375
|
+
/* @__PURE__ */ jsx30(
|
|
4164
4376
|
Fields_default.Input,
|
|
4165
4377
|
{
|
|
4166
4378
|
form,
|
|
@@ -4169,7 +4381,7 @@ var TechLogin = ({
|
|
|
4169
4381
|
type: "email",
|
|
4170
4382
|
disabled: isLoading,
|
|
4171
4383
|
placeholder: "maoo@example.com",
|
|
4172
|
-
icon: /* @__PURE__ */
|
|
4384
|
+
icon: /* @__PURE__ */ jsx30(
|
|
4173
4385
|
Mail,
|
|
4174
4386
|
{
|
|
4175
4387
|
size: 18,
|
|
@@ -4179,7 +4391,7 @@ var TechLogin = ({
|
|
|
4179
4391
|
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
4392
|
}
|
|
4181
4393
|
),
|
|
4182
|
-
/* @__PURE__ */
|
|
4394
|
+
/* @__PURE__ */ jsx30(
|
|
4183
4395
|
Fields_default.Input,
|
|
4184
4396
|
{
|
|
4185
4397
|
form,
|
|
@@ -4188,7 +4400,7 @@ var TechLogin = ({
|
|
|
4188
4400
|
type: "password",
|
|
4189
4401
|
disabled: isLoading,
|
|
4190
4402
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
4191
|
-
icon: /* @__PURE__ */
|
|
4403
|
+
icon: /* @__PURE__ */ jsx30(
|
|
4192
4404
|
Lock,
|
|
4193
4405
|
{
|
|
4194
4406
|
size: 18,
|
|
@@ -4198,8 +4410,8 @@ var TechLogin = ({
|
|
|
4198
4410
|
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
4411
|
}
|
|
4200
4412
|
),
|
|
4201
|
-
form.formState.errors.root && /* @__PURE__ */
|
|
4202
|
-
/* @__PURE__ */
|
|
4413
|
+
form.formState.errors.root && /* @__PURE__ */ jsx30("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 }),
|
|
4414
|
+
/* @__PURE__ */ jsxs22(
|
|
4203
4415
|
Button,
|
|
4204
4416
|
{
|
|
4205
4417
|
type: "submit",
|
|
@@ -4207,7 +4419,7 @@ var TechLogin = ({
|
|
|
4207
4419
|
className: "w-full bg-indigo-600 hover:bg-indigo-500 text-white h-12 font-semibold flex items-center justify-center gap-2",
|
|
4208
4420
|
children: [
|
|
4209
4421
|
isLoading ? "Logging in..." : "Authenticate Now",
|
|
4210
|
-
!isLoading && /* @__PURE__ */
|
|
4422
|
+
!isLoading && /* @__PURE__ */ jsx30(ArrowRight, { size: 18 })
|
|
4211
4423
|
]
|
|
4212
4424
|
}
|
|
4213
4425
|
)
|
|
@@ -4228,63 +4440,63 @@ var TravelLogin = ({
|
|
|
4228
4440
|
backUrl,
|
|
4229
4441
|
isLoading
|
|
4230
4442
|
}) => {
|
|
4231
|
-
const navigate =
|
|
4232
|
-
return /* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4443
|
+
const navigate = useNavigate3();
|
|
4444
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-slate-950 transition-colors", children: [
|
|
4445
|
+
/* @__PURE__ */ jsxs22("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-100 border-r border-slate-100", children: [
|
|
4446
|
+
/* @__PURE__ */ jsx30(
|
|
4235
4447
|
"div",
|
|
4236
4448
|
{
|
|
4237
4449
|
className: "absolute inset-0 z-0 bg-cover bg-center transition-transform hover:scale-105 duration-[30s]",
|
|
4238
4450
|
style: { backgroundImage: `url('${image || "/travel_bg.png"}')` }
|
|
4239
4451
|
}
|
|
4240
4452
|
),
|
|
4241
|
-
/* @__PURE__ */
|
|
4242
|
-
/* @__PURE__ */
|
|
4243
|
-
/* @__PURE__ */
|
|
4244
|
-
/* @__PURE__ */
|
|
4245
|
-
/* @__PURE__ */
|
|
4453
|
+
/* @__PURE__ */ jsx30("div", { className: "absolute inset-0 bg-linear-to-br from-orange-500/20 via-transparent to-black/30 z-10" }),
|
|
4454
|
+
/* @__PURE__ */ jsxs22("div", { className: "relative z-20 p-16 flex flex-col justify-between w-full h-full text-white", children: [
|
|
4455
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-3", children: [
|
|
4456
|
+
/* @__PURE__ */ jsx30("div", { className: "h-10 w-10 bg-orange-500 rounded-full flex items-center justify-center shadow-lg", children: /* @__PURE__ */ jsx30(Plane, { className: "text-white w-6 h-6 rotate-45" }) }),
|
|
4457
|
+
/* @__PURE__ */ jsx30("span", { className: "text-2xl font-bold tracking-tight", children: brandName || "Wanderlust" })
|
|
4246
4458
|
] }),
|
|
4247
|
-
/* @__PURE__ */
|
|
4459
|
+
/* @__PURE__ */ jsx30("div", { className: "max-w-md", children: /* @__PURE__ */ jsxs22("h1", { className: "text-6xl font-black mb-8 leading-[1.1]", children: [
|
|
4248
4460
|
"Your Next ",
|
|
4249
|
-
/* @__PURE__ */
|
|
4461
|
+
/* @__PURE__ */ jsx30("span", { className: "text-orange-400", children: "Adventure" }),
|
|
4250
4462
|
" ",
|
|
4251
4463
|
"Starts Now."
|
|
4252
4464
|
] }) }),
|
|
4253
|
-
/* @__PURE__ */
|
|
4465
|
+
/* @__PURE__ */ jsxs22("div", { className: "text-white/70 text-sm", children: [
|
|
4254
4466
|
"Discover the world with ",
|
|
4255
4467
|
brandName || "Wanderlust",
|
|
4256
4468
|
"."
|
|
4257
4469
|
] })
|
|
4258
4470
|
] })
|
|
4259
4471
|
] }),
|
|
4260
|
-
/* @__PURE__ */
|
|
4261
|
-
/* @__PURE__ */
|
|
4262
|
-
backUrl && /* @__PURE__ */
|
|
4472
|
+
/* @__PURE__ */ jsxs22("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: [
|
|
4473
|
+
/* @__PURE__ */ jsxs22("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
|
|
4474
|
+
backUrl && /* @__PURE__ */ jsxs22(
|
|
4263
4475
|
"button",
|
|
4264
4476
|
{
|
|
4265
4477
|
onClick: () => navigate(backUrl),
|
|
4266
4478
|
disabled: isLoading,
|
|
4267
4479
|
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
4480
|
children: [
|
|
4269
|
-
/* @__PURE__ */
|
|
4270
|
-
/* @__PURE__ */
|
|
4481
|
+
/* @__PURE__ */ jsx30(ArrowLeft2, { size: 18 }),
|
|
4482
|
+
/* @__PURE__ */ jsx30("span", { className: "text-sm", children: "Back" })
|
|
4271
4483
|
]
|
|
4272
4484
|
}
|
|
4273
4485
|
),
|
|
4274
|
-
/* @__PURE__ */
|
|
4486
|
+
/* @__PURE__ */ jsx30(ThemeToggle, {})
|
|
4275
4487
|
] }),
|
|
4276
|
-
/* @__PURE__ */
|
|
4277
|
-
/* @__PURE__ */
|
|
4278
|
-
/* @__PURE__ */
|
|
4279
|
-
/* @__PURE__ */
|
|
4488
|
+
/* @__PURE__ */ jsxs22("div", { className: "max-w-md w-full mx-auto relative z-10", children: [
|
|
4489
|
+
/* @__PURE__ */ jsxs22("div", { className: "mb-12 text-center lg:text-left", children: [
|
|
4490
|
+
/* @__PURE__ */ jsx30("h2", { className: "text-4xl font-bold text-slate-900 dark:text-white mb-4 tracking-tight", children: title || "Login to Explore" }),
|
|
4491
|
+
/* @__PURE__ */ jsx30("p", { className: "text-slate-500 dark:text-slate-400 text-lg", children: subtitle || "Enter your details to access your travel dashboard." })
|
|
4280
4492
|
] }),
|
|
4281
|
-
/* @__PURE__ */
|
|
4493
|
+
/* @__PURE__ */ jsxs22(
|
|
4282
4494
|
"form",
|
|
4283
4495
|
{
|
|
4284
4496
|
onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
|
|
4285
4497
|
className: "space-y-6",
|
|
4286
4498
|
children: [
|
|
4287
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ jsx30(
|
|
4288
4500
|
Fields_default.Input,
|
|
4289
4501
|
{
|
|
4290
4502
|
form,
|
|
@@ -4293,7 +4505,7 @@ var TravelLogin = ({
|
|
|
4293
4505
|
type: "email",
|
|
4294
4506
|
disabled: isLoading,
|
|
4295
4507
|
placeholder: "traveler@world.com",
|
|
4296
|
-
icon: /* @__PURE__ */
|
|
4508
|
+
icon: /* @__PURE__ */ jsx30(
|
|
4297
4509
|
Mail,
|
|
4298
4510
|
{
|
|
4299
4511
|
size: 18,
|
|
@@ -4303,7 +4515,7 @@ var TravelLogin = ({
|
|
|
4303
4515
|
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
4516
|
}
|
|
4305
4517
|
),
|
|
4306
|
-
/* @__PURE__ */
|
|
4518
|
+
/* @__PURE__ */ jsx30(
|
|
4307
4519
|
Fields_default.Input,
|
|
4308
4520
|
{
|
|
4309
4521
|
form,
|
|
@@ -4312,7 +4524,7 @@ var TravelLogin = ({
|
|
|
4312
4524
|
type: "password",
|
|
4313
4525
|
disabled: isLoading,
|
|
4314
4526
|
placeholder: "Secret journey phrase",
|
|
4315
|
-
icon: /* @__PURE__ */
|
|
4527
|
+
icon: /* @__PURE__ */ jsx30(
|
|
4316
4528
|
Lock,
|
|
4317
4529
|
{
|
|
4318
4530
|
size: 18,
|
|
@@ -4322,8 +4534,8 @@ var TravelLogin = ({
|
|
|
4322
4534
|
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
4535
|
}
|
|
4324
4536
|
),
|
|
4325
|
-
form.formState.errors.root && /* @__PURE__ */
|
|
4326
|
-
/* @__PURE__ */
|
|
4537
|
+
form.formState.errors.root && /* @__PURE__ */ jsx30("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 }),
|
|
4538
|
+
/* @__PURE__ */ jsxs22(
|
|
4327
4539
|
Button,
|
|
4328
4540
|
{
|
|
4329
4541
|
type: "submit",
|
|
@@ -4331,7 +4543,7 @@ var TravelLogin = ({
|
|
|
4331
4543
|
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
4544
|
children: [
|
|
4333
4545
|
isLoading ? "Logging in..." : "Start Journey",
|
|
4334
|
-
!isLoading && /* @__PURE__ */
|
|
4546
|
+
!isLoading && /* @__PURE__ */ jsx30(Plane, { size: 20, className: "rotate-45" })
|
|
4335
4547
|
]
|
|
4336
4548
|
}
|
|
4337
4549
|
)
|
|
@@ -4352,40 +4564,40 @@ var HealthcareLogin = ({
|
|
|
4352
4564
|
backUrl,
|
|
4353
4565
|
isLoading
|
|
4354
4566
|
}) => {
|
|
4355
|
-
const navigate =
|
|
4356
|
-
return /* @__PURE__ */
|
|
4357
|
-
/* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4359
|
-
backUrl && /* @__PURE__ */
|
|
4567
|
+
const navigate = useNavigate3();
|
|
4568
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex h-screen w-full overflow-hidden bg-[#F0F7FF] dark:bg-slate-950 transition-colors", children: [
|
|
4569
|
+
/* @__PURE__ */ jsxs22("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: [
|
|
4570
|
+
/* @__PURE__ */ jsxs22("div", { className: "absolute top-4 right-4 z-50 flex items-center gap-2", children: [
|
|
4571
|
+
backUrl && /* @__PURE__ */ jsxs22(
|
|
4360
4572
|
"button",
|
|
4361
4573
|
{
|
|
4362
4574
|
onClick: () => navigate(backUrl),
|
|
4363
4575
|
disabled: isLoading,
|
|
4364
4576
|
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
4577
|
children: [
|
|
4366
|
-
/* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4578
|
+
/* @__PURE__ */ jsx30(ArrowLeft2, { size: 18 }),
|
|
4579
|
+
/* @__PURE__ */ jsx30("span", { className: "text-sm font-semibold", children: "Back" })
|
|
4368
4580
|
]
|
|
4369
4581
|
}
|
|
4370
4582
|
),
|
|
4371
|
-
/* @__PURE__ */
|
|
4583
|
+
/* @__PURE__ */ jsx30(ThemeToggle, {})
|
|
4372
4584
|
] }),
|
|
4373
|
-
/* @__PURE__ */
|
|
4374
|
-
/* @__PURE__ */
|
|
4375
|
-
/* @__PURE__ */
|
|
4376
|
-
/* @__PURE__ */
|
|
4377
|
-
/* @__PURE__ */
|
|
4585
|
+
/* @__PURE__ */ jsxs22("div", { className: "max-w-[340px] w-full mx-auto", children: [
|
|
4586
|
+
/* @__PURE__ */ jsxs22("div", { className: "mb-14", children: [
|
|
4587
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-3 mb-8", children: [
|
|
4588
|
+
/* @__PURE__ */ jsx30("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__ */ jsx30(HeartPulse, { className: "text-white w-7 h-7" }) }),
|
|
4589
|
+
/* @__PURE__ */ jsx30("span", { className: "text-2xl font-bold text-slate-800 dark:text-white tracking-tight", children: brandName || "CarePoint" })
|
|
4378
4590
|
] }),
|
|
4379
|
-
/* @__PURE__ */
|
|
4380
|
-
/* @__PURE__ */
|
|
4591
|
+
/* @__PURE__ */ jsx30("h2", { className: "text-3xl font-bold text-slate-800 dark:text-white mb-3 tracking-tight", children: title || "Clinical Login" }),
|
|
4592
|
+
/* @__PURE__ */ jsx30("p", { className: "text-slate-500 dark:text-slate-400 font-medium leading-relaxed", children: subtitle || "Secure access for staff and healthcare professionals." })
|
|
4381
4593
|
] }),
|
|
4382
|
-
/* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ jsxs22(
|
|
4383
4595
|
"form",
|
|
4384
4596
|
{
|
|
4385
4597
|
onSubmit: form.handleSubmit((d) => onSubmit(d, form)),
|
|
4386
4598
|
className: "space-y-7",
|
|
4387
4599
|
children: [
|
|
4388
|
-
/* @__PURE__ */
|
|
4600
|
+
/* @__PURE__ */ jsx30(
|
|
4389
4601
|
Fields_default.Input,
|
|
4390
4602
|
{
|
|
4391
4603
|
form,
|
|
@@ -4394,11 +4606,11 @@ var HealthcareLogin = ({
|
|
|
4394
4606
|
type: "email",
|
|
4395
4607
|
disabled: isLoading,
|
|
4396
4608
|
placeholder: "dr.name@carepoint.org",
|
|
4397
|
-
icon: /* @__PURE__ */
|
|
4609
|
+
icon: /* @__PURE__ */ jsx30(Mail, { size: 18, className: "text-blue-500" }),
|
|
4398
4610
|
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
4611
|
}
|
|
4400
4612
|
),
|
|
4401
|
-
/* @__PURE__ */
|
|
4613
|
+
/* @__PURE__ */ jsx30(
|
|
4402
4614
|
Fields_default.Input,
|
|
4403
4615
|
{
|
|
4404
4616
|
form,
|
|
@@ -4407,12 +4619,12 @@ var HealthcareLogin = ({
|
|
|
4407
4619
|
type: "password",
|
|
4408
4620
|
disabled: isLoading,
|
|
4409
4621
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
4410
|
-
icon: /* @__PURE__ */
|
|
4622
|
+
icon: /* @__PURE__ */ jsx30(Lock, { size: 18, className: "text-blue-500" }),
|
|
4411
4623
|
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
4624
|
}
|
|
4413
4625
|
),
|
|
4414
|
-
form.formState.errors.root && /* @__PURE__ */
|
|
4415
|
-
/* @__PURE__ */
|
|
4626
|
+
form.formState.errors.root && /* @__PURE__ */ jsx30("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 }),
|
|
4627
|
+
/* @__PURE__ */ jsxs22(
|
|
4416
4628
|
Button,
|
|
4417
4629
|
{
|
|
4418
4630
|
type: "submit",
|
|
@@ -4420,7 +4632,7 @@ var HealthcareLogin = ({
|
|
|
4420
4632
|
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
4633
|
children: [
|
|
4422
4634
|
isLoading ? "Logging in..." : "Secure Login",
|
|
4423
|
-
!isLoading && /* @__PURE__ */
|
|
4635
|
+
!isLoading && /* @__PURE__ */ jsx30(MonitorCheck, { size: 18 })
|
|
4424
4636
|
]
|
|
4425
4637
|
}
|
|
4426
4638
|
)
|
|
@@ -4429,19 +4641,19 @@ var HealthcareLogin = ({
|
|
|
4429
4641
|
)
|
|
4430
4642
|
] })
|
|
4431
4643
|
] }),
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4644
|
+
/* @__PURE__ */ jsxs22("div", { className: "hidden lg:flex flex-1 relative overflow-hidden bg-slate-900", children: [
|
|
4645
|
+
/* @__PURE__ */ jsx30(
|
|
4434
4646
|
"div",
|
|
4435
4647
|
{
|
|
4436
4648
|
className: "absolute inset-0 z-0 bg-cover bg-center brightness-110",
|
|
4437
4649
|
style: { backgroundImage: `url('${image || "/medicine_bg.png"}')` }
|
|
4438
4650
|
}
|
|
4439
4651
|
),
|
|
4440
|
-
/* @__PURE__ */
|
|
4441
|
-
/* @__PURE__ */
|
|
4652
|
+
/* @__PURE__ */ jsx30("div", { className: "absolute inset-0 bg-linear-to-l from-transparent via-blue-900/10 to-blue-900/40 z-10" }),
|
|
4653
|
+
/* @__PURE__ */ jsx30("div", { className: "relative z-20 p-20 flex flex-col items-center justify-center w-full h-full text-center", children: /* @__PURE__ */ jsx30("div", { className: "max-w-2xl bg-white/20 backdrop-blur-xl border border-white/30 p-12 rounded-[40px] shadow-2xl", children: /* @__PURE__ */ jsxs22("h1", { className: "text-5xl font-black text-white mb-6 leading-tight drop-shadow-sm", children: [
|
|
4442
4654
|
"Next-Gen ",
|
|
4443
|
-
/* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4655
|
+
/* @__PURE__ */ jsx30("br", {}),
|
|
4656
|
+
/* @__PURE__ */ jsx30("span", { className: "text-blue-100", children: "Patient Management" })
|
|
4445
4657
|
] }) }) })
|
|
4446
4658
|
] })
|
|
4447
4659
|
] });
|
|
@@ -4449,18 +4661,18 @@ var HealthcareLogin = ({
|
|
|
4449
4661
|
var ThemedLogin = (props) => {
|
|
4450
4662
|
switch (props.theme) {
|
|
4451
4663
|
case "tech":
|
|
4452
|
-
return /* @__PURE__ */
|
|
4664
|
+
return /* @__PURE__ */ jsx30(TechLogin, { ...props });
|
|
4453
4665
|
case "travel":
|
|
4454
|
-
return /* @__PURE__ */
|
|
4666
|
+
return /* @__PURE__ */ jsx30(TravelLogin, { ...props });
|
|
4455
4667
|
case "healthcare":
|
|
4456
|
-
return /* @__PURE__ */
|
|
4668
|
+
return /* @__PURE__ */ jsx30(HealthcareLogin, { ...props });
|
|
4457
4669
|
default:
|
|
4458
|
-
return /* @__PURE__ */
|
|
4670
|
+
return /* @__PURE__ */ jsx30(TechLogin, { ...props });
|
|
4459
4671
|
}
|
|
4460
4672
|
};
|
|
4461
4673
|
|
|
4462
4674
|
// src/hooks/useLogin.tsx
|
|
4463
|
-
import { jsx as
|
|
4675
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4464
4676
|
var defaultLoginSchema = z.object({
|
|
4465
4677
|
email: z.string().email("Invalid email address"),
|
|
4466
4678
|
password: z.string().min(1, "Password is required")
|
|
@@ -4473,12 +4685,12 @@ var useLogin = (props) => {
|
|
|
4473
4685
|
password: ""
|
|
4474
4686
|
}
|
|
4475
4687
|
});
|
|
4476
|
-
const propsRef =
|
|
4688
|
+
const propsRef = React14.useRef(props);
|
|
4477
4689
|
propsRef.current = props;
|
|
4478
|
-
const Login =
|
|
4690
|
+
const Login = React14.useMemo(() => {
|
|
4479
4691
|
const StableLogin = () => {
|
|
4480
4692
|
const currentProps = propsRef.current;
|
|
4481
|
-
return /* @__PURE__ */
|
|
4693
|
+
return /* @__PURE__ */ jsx31(
|
|
4482
4694
|
ThemedLogin,
|
|
4483
4695
|
{
|
|
4484
4696
|
form,
|
|
@@ -4502,19 +4714,20 @@ var useLogin = (props) => {
|
|
|
4502
4714
|
};
|
|
4503
4715
|
|
|
4504
4716
|
// src/components/ProfileDropdown.tsx
|
|
4505
|
-
import { useState as
|
|
4506
|
-
import { jsx as
|
|
4717
|
+
import { useState as useState17, useRef as useRef6, useEffect as useEffect11 } from "react";
|
|
4718
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4507
4719
|
var ProfileDropdown = ({
|
|
4508
4720
|
name,
|
|
4509
4721
|
image,
|
|
4510
4722
|
items,
|
|
4511
4723
|
className,
|
|
4512
4724
|
triggerMode = "click",
|
|
4513
|
-
size = "md"
|
|
4725
|
+
size = "md",
|
|
4726
|
+
role
|
|
4514
4727
|
}) => {
|
|
4515
|
-
const [isOpen, setIsOpen] =
|
|
4728
|
+
const [isOpen, setIsOpen] = useState17(false);
|
|
4516
4729
|
const dropdownRef = useRef6(null);
|
|
4517
|
-
const [loadingItems, setLoadingItems] =
|
|
4730
|
+
const [loadingItems, setLoadingItems] = useState17({});
|
|
4518
4731
|
const sizeConfigs = {
|
|
4519
4732
|
sm: {
|
|
4520
4733
|
avatar: "h-8 w-8",
|
|
@@ -4575,7 +4788,7 @@ var ProfileDropdown = ({
|
|
|
4575
4788
|
}
|
|
4576
4789
|
};
|
|
4577
4790
|
const fallbackInitial = name ? name.charAt(0).toUpperCase() : "?";
|
|
4578
|
-
return /* @__PURE__ */
|
|
4791
|
+
return /* @__PURE__ */ jsxs23(
|
|
4579
4792
|
"div",
|
|
4580
4793
|
{
|
|
4581
4794
|
ref: dropdownRef,
|
|
@@ -4583,7 +4796,7 @@ var ProfileDropdown = ({
|
|
|
4583
4796
|
onMouseEnter: openDropdown,
|
|
4584
4797
|
onMouseLeave: closeDropdown,
|
|
4585
4798
|
children: [
|
|
4586
|
-
/* @__PURE__ */
|
|
4799
|
+
/* @__PURE__ */ jsxs23(
|
|
4587
4800
|
"button",
|
|
4588
4801
|
{
|
|
4589
4802
|
type: "button",
|
|
@@ -4593,21 +4806,21 @@ var ProfileDropdown = ({
|
|
|
4593
4806
|
currentSize.container
|
|
4594
4807
|
),
|
|
4595
4808
|
children: [
|
|
4596
|
-
/* @__PURE__ */
|
|
4809
|
+
/* @__PURE__ */ jsx32(
|
|
4597
4810
|
"div",
|
|
4598
4811
|
{
|
|
4599
4812
|
className: cn(
|
|
4600
4813
|
"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
4814
|
currentSize.avatar
|
|
4602
4815
|
),
|
|
4603
|
-
children: image ? /* @__PURE__ */
|
|
4816
|
+
children: image ? /* @__PURE__ */ jsx32(
|
|
4604
4817
|
"img",
|
|
4605
4818
|
{
|
|
4606
4819
|
src: image,
|
|
4607
4820
|
alt: name,
|
|
4608
4821
|
className: "h-full w-full object-cover"
|
|
4609
4822
|
}
|
|
4610
|
-
) : /* @__PURE__ */
|
|
4823
|
+
) : /* @__PURE__ */ jsx32(
|
|
4611
4824
|
"span",
|
|
4612
4825
|
{
|
|
4613
4826
|
className: cn(
|
|
@@ -4619,8 +4832,8 @@ var ProfileDropdown = ({
|
|
|
4619
4832
|
)
|
|
4620
4833
|
}
|
|
4621
4834
|
),
|
|
4622
|
-
/* @__PURE__ */
|
|
4623
|
-
/* @__PURE__ */
|
|
4835
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-start mr-1 min-w-[80px]", children: [
|
|
4836
|
+
/* @__PURE__ */ jsx32(
|
|
4624
4837
|
"span",
|
|
4625
4838
|
{
|
|
4626
4839
|
className: cn(
|
|
@@ -4630,18 +4843,18 @@ var ProfileDropdown = ({
|
|
|
4630
4843
|
children: name
|
|
4631
4844
|
}
|
|
4632
4845
|
),
|
|
4633
|
-
/* @__PURE__ */
|
|
4846
|
+
role && /* @__PURE__ */ jsx32(
|
|
4634
4847
|
"span",
|
|
4635
4848
|
{
|
|
4636
4849
|
className: cn(
|
|
4637
4850
|
"text-gray-500 dark:text-gray-400 uppercase tracking-wider font-medium",
|
|
4638
4851
|
currentSize.role
|
|
4639
4852
|
),
|
|
4640
|
-
children:
|
|
4853
|
+
children: role
|
|
4641
4854
|
}
|
|
4642
4855
|
)
|
|
4643
4856
|
] }),
|
|
4644
|
-
/* @__PURE__ */
|
|
4857
|
+
/* @__PURE__ */ jsx32(
|
|
4645
4858
|
"svg",
|
|
4646
4859
|
{
|
|
4647
4860
|
className: cn(
|
|
@@ -4651,7 +4864,7 @@ var ProfileDropdown = ({
|
|
|
4651
4864
|
fill: "none",
|
|
4652
4865
|
viewBox: "0 0 24 24",
|
|
4653
4866
|
stroke: "currentColor",
|
|
4654
|
-
children: /* @__PURE__ */
|
|
4867
|
+
children: /* @__PURE__ */ jsx32(
|
|
4655
4868
|
"path",
|
|
4656
4869
|
{
|
|
4657
4870
|
strokeLinecap: "round",
|
|
@@ -4665,9 +4878,9 @@ var ProfileDropdown = ({
|
|
|
4665
4878
|
]
|
|
4666
4879
|
}
|
|
4667
4880
|
),
|
|
4668
|
-
isOpen && /* @__PURE__ */
|
|
4881
|
+
isOpen && /* @__PURE__ */ jsx32("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__ */ jsx32("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__ */ jsx32("div", { className: "py-2", children: items.map((item, index) => {
|
|
4669
4882
|
const isLoading = loadingItems[index];
|
|
4670
|
-
return /* @__PURE__ */
|
|
4883
|
+
return /* @__PURE__ */ jsxs23(
|
|
4671
4884
|
"button",
|
|
4672
4885
|
{
|
|
4673
4886
|
onClick: () => handleItemClick(item, index),
|
|
@@ -4679,8 +4892,8 @@ var ProfileDropdown = ({
|
|
|
4679
4892
|
item.className
|
|
4680
4893
|
),
|
|
4681
4894
|
children: [
|
|
4682
|
-
/* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4895
|
+
/* @__PURE__ */ jsx32("span", { className: "flex-shrink-0 flex items-center justify-center w-5 h-5", children: isLoading ? /* @__PURE__ */ jsx32(LoadingSpin, { size: "sm", className: "text-blue-500" }) : item.icon }),
|
|
4896
|
+
/* @__PURE__ */ jsx32("span", { className: "flex-grow text-left font-medium", children: item.label })
|
|
4684
4897
|
]
|
|
4685
4898
|
},
|
|
4686
4899
|
index
|
|
@@ -4692,7 +4905,7 @@ var ProfileDropdown = ({
|
|
|
4692
4905
|
};
|
|
4693
4906
|
|
|
4694
4907
|
// src/hooks/Fetches/useA4DataView.tsx
|
|
4695
|
-
import { useEffect as useEffect12, useRef as useRef7, useState as
|
|
4908
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState18 } from "react";
|
|
4696
4909
|
import { useReactToPrint } from "react-to-print";
|
|
4697
4910
|
import {
|
|
4698
4911
|
RefreshCw,
|
|
@@ -4702,7 +4915,7 @@ import {
|
|
|
4702
4915
|
ChevronLeft,
|
|
4703
4916
|
ChevronRight as ChevronRight2
|
|
4704
4917
|
} from "lucide-react";
|
|
4705
|
-
import { jsx as
|
|
4918
|
+
import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4706
4919
|
var useA4StatementView = ({
|
|
4707
4920
|
url,
|
|
4708
4921
|
v = 1,
|
|
@@ -4753,11 +4966,11 @@ var useA4StatementView = ({
|
|
|
4753
4966
|
const { store } = useWarqadConfig();
|
|
4754
4967
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4755
4968
|
const measureContainerRef = useRef7(null);
|
|
4756
|
-
const [pages, setPages] =
|
|
4757
|
-
const [isMeasuring, setIsMeasuring] =
|
|
4758
|
-
const [globalFilter, setGlobalFilter] =
|
|
4759
|
-
const [currentPageIndex, setCurrentPageIndex] =
|
|
4760
|
-
const [pageSearch, setPageSearch] =
|
|
4969
|
+
const [pages, setPages] = useState18([]);
|
|
4970
|
+
const [isMeasuring, setIsMeasuring] = useState18(true);
|
|
4971
|
+
const [globalFilter, setGlobalFilter] = useState18("");
|
|
4972
|
+
const [currentPageIndex, setCurrentPageIndex] = useState18(0);
|
|
4973
|
+
const [pageSearch, setPageSearch] = useState18("");
|
|
4761
4974
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4762
4975
|
const filteredDisplayData = data.filter((row) => {
|
|
4763
4976
|
if (!globalFilter) return true;
|
|
@@ -4773,20 +4986,20 @@ var useA4StatementView = ({
|
|
|
4773
4986
|
const columnsWithFooters = columns.filter(
|
|
4774
4987
|
(col) => col.renderFooter && !col.hide
|
|
4775
4988
|
);
|
|
4776
|
-
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */
|
|
4989
|
+
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ jsxs24(
|
|
4777
4990
|
"div",
|
|
4778
4991
|
{
|
|
4779
4992
|
id: "a4-final-total",
|
|
4780
4993
|
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",
|
|
4781
4994
|
children: [
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
columnsWithFooters.map((col, idx) => /* @__PURE__ */
|
|
4995
|
+
/* @__PURE__ */ jsx33("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
|
|
4996
|
+
columnsWithFooters.map((col, idx) => /* @__PURE__ */ jsxs24(
|
|
4784
4997
|
"div",
|
|
4785
4998
|
{
|
|
4786
4999
|
className: "flex items-center gap-3 px-4 py-2 rounded-md border border-black dark:border-zinc-700 print:border-black",
|
|
4787
5000
|
children: [
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
5001
|
+
/* @__PURE__ */ jsx33("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" }),
|
|
5002
|
+
/* @__PURE__ */ jsx33("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
|
|
4790
5003
|
]
|
|
4791
5004
|
},
|
|
4792
5005
|
col.key || idx
|
|
@@ -4873,28 +5086,28 @@ var useA4StatementView = ({
|
|
|
4873
5086
|
}, 150);
|
|
4874
5087
|
return () => clearTimeout(timer);
|
|
4875
5088
|
}, [isMeasuring, depsString]);
|
|
4876
|
-
const HeaderEl = /* @__PURE__ */
|
|
5089
|
+
const HeaderEl = /* @__PURE__ */ jsxs24(
|
|
4877
5090
|
"div",
|
|
4878
5091
|
{
|
|
4879
5092
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
4880
5093
|
id: "a4-header-section",
|
|
4881
5094
|
children: [
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
/* @__PURE__ */
|
|
5095
|
+
/* @__PURE__ */ jsx33("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx33("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs24("section", { children: [
|
|
5096
|
+
/* @__PURE__ */ jsx33("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
|
|
5097
|
+
/* @__PURE__ */ jsx33("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
|
|
4885
5098
|
] }) }) }),
|
|
4886
|
-
/* @__PURE__ */
|
|
4887
|
-
/* @__PURE__ */
|
|
4888
|
-
/* @__PURE__ */
|
|
4889
|
-
store?.address && /* @__PURE__ */
|
|
4890
|
-
store?.phone && /* @__PURE__ */
|
|
4891
|
-
store?.email && /* @__PURE__ */
|
|
5099
|
+
/* @__PURE__ */ jsxs24("div", { className: "text-right", children: [
|
|
5100
|
+
/* @__PURE__ */ jsx33("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
|
|
5101
|
+
/* @__PURE__ */ jsxs24("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: [
|
|
5102
|
+
store?.address && /* @__PURE__ */ jsx33("span", { className: "whitespace-pre-line", children: store.address }),
|
|
5103
|
+
store?.phone && /* @__PURE__ */ jsx33("span", { children: store.phone }),
|
|
5104
|
+
store?.email && /* @__PURE__ */ jsx33("span", { children: store.email })
|
|
4892
5105
|
] })
|
|
4893
5106
|
] })
|
|
4894
5107
|
]
|
|
4895
5108
|
}
|
|
4896
5109
|
);
|
|
4897
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */
|
|
5110
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx33("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx33(
|
|
4898
5111
|
InfoGrid,
|
|
4899
5112
|
{
|
|
4900
5113
|
className: "mb-4",
|
|
@@ -4902,29 +5115,29 @@ var useA4StatementView = ({
|
|
|
4902
5115
|
isLoading: isActuallyLoading
|
|
4903
5116
|
}
|
|
4904
5117
|
) }) : null;
|
|
4905
|
-
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */
|
|
4906
|
-
isActuallyLoading ? /* @__PURE__ */
|
|
4907
|
-
/* @__PURE__ */
|
|
4908
|
-
/* @__PURE__ */
|
|
4909
|
-
url && !isActuallyLoading && /* @__PURE__ */
|
|
5118
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ jsx33("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", 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: [
|
|
5119
|
+
isActuallyLoading ? /* @__PURE__ */ jsx33("div", { className: "mb-4", children: /* @__PURE__ */ jsx33(ClassicSpin, {}) }) : 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(AlertCircle, { 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(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
5120
|
+
/* @__PURE__ */ jsx33("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" }),
|
|
5121
|
+
/* @__PURE__ */ jsx33("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." }),
|
|
5122
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs24(
|
|
4910
5123
|
"button",
|
|
4911
5124
|
{
|
|
4912
5125
|
onClick: () => getData(),
|
|
4913
5126
|
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",
|
|
4914
5127
|
children: [
|
|
4915
|
-
/* @__PURE__ */
|
|
5128
|
+
/* @__PURE__ */ jsx33(RefreshCw, { size: 14 }),
|
|
4916
5129
|
"Try Again"
|
|
4917
5130
|
]
|
|
4918
5131
|
}
|
|
4919
5132
|
)
|
|
4920
5133
|
] }) }) : null;
|
|
4921
|
-
return /* @__PURE__ */
|
|
4922
|
-
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */
|
|
5134
|
+
return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
5135
|
+
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ jsx33("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx33(
|
|
4923
5136
|
"div",
|
|
4924
5137
|
{
|
|
4925
5138
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
4926
5139
|
className: "bg-white",
|
|
4927
|
-
children: /* @__PURE__ */
|
|
5140
|
+
children: /* @__PURE__ */ jsxs24(
|
|
4928
5141
|
"div",
|
|
4929
5142
|
{
|
|
4930
5143
|
ref: measureContainerRef,
|
|
@@ -4932,9 +5145,9 @@ var useA4StatementView = ({
|
|
|
4932
5145
|
children: [
|
|
4933
5146
|
HeaderEl,
|
|
4934
5147
|
DisplayInfoGridEl,
|
|
4935
|
-
/* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
5148
|
+
/* @__PURE__ */ jsxs24("div", { className: "grow w-full px-8 pb-8", children: [
|
|
5149
|
+
/* @__PURE__ */ jsx33("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__ */ jsx33("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
5150
|
+
/* @__PURE__ */ jsx33(
|
|
4938
5151
|
SimpleTable,
|
|
4939
5152
|
{
|
|
4940
5153
|
columns,
|
|
@@ -4952,52 +5165,52 @@ var useA4StatementView = ({
|
|
|
4952
5165
|
)
|
|
4953
5166
|
}
|
|
4954
5167
|
) }),
|
|
4955
|
-
/* @__PURE__ */
|
|
5168
|
+
/* @__PURE__ */ jsx33("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx33("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ jsx33(
|
|
4956
5169
|
"div",
|
|
4957
5170
|
{
|
|
4958
5171
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4959
|
-
children: /* @__PURE__ */
|
|
5172
|
+
children: /* @__PURE__ */ jsx33(
|
|
4960
5173
|
PageA4,
|
|
4961
5174
|
{
|
|
4962
5175
|
className: "w-full",
|
|
4963
5176
|
pageNumber: pageIndex + 1,
|
|
4964
5177
|
totalPages: pages.length,
|
|
4965
5178
|
isLastPage: pageIndex === pages.length - 1,
|
|
4966
|
-
children: /* @__PURE__ */
|
|
4967
|
-
/* @__PURE__ */
|
|
5179
|
+
children: /* @__PURE__ */ jsxs24("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
5180
|
+
/* @__PURE__ */ jsxs24("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4968
5181
|
headers,
|
|
4969
|
-
printable && pageIndex === currentPageIndex && /* @__PURE__ */
|
|
4970
|
-
/* @__PURE__ */
|
|
5182
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
5183
|
+
/* @__PURE__ */ jsxs24(
|
|
4971
5184
|
"button",
|
|
4972
5185
|
{
|
|
4973
5186
|
onClick: async () => await getData(),
|
|
4974
5187
|
disabled: isLoading,
|
|
4975
5188
|
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",
|
|
4976
5189
|
children: [
|
|
4977
|
-
/* @__PURE__ */
|
|
5190
|
+
/* @__PURE__ */ jsx33(
|
|
4978
5191
|
RefreshCw,
|
|
4979
5192
|
{
|
|
4980
5193
|
size: 16,
|
|
4981
5194
|
className: isLoading ? "animate-spin" : ""
|
|
4982
5195
|
}
|
|
4983
5196
|
),
|
|
4984
|
-
/* @__PURE__ */
|
|
5197
|
+
/* @__PURE__ */ jsx33("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4985
5198
|
]
|
|
4986
5199
|
}
|
|
4987
5200
|
),
|
|
4988
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsxs24(
|
|
4989
5202
|
"button",
|
|
4990
5203
|
{
|
|
4991
5204
|
onClick: () => reactToPrintFn(),
|
|
4992
5205
|
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",
|
|
4993
5206
|
children: [
|
|
4994
|
-
/* @__PURE__ */
|
|
5207
|
+
/* @__PURE__ */ jsx33(Printer, { size: 16 }),
|
|
4995
5208
|
"Print"
|
|
4996
5209
|
]
|
|
4997
5210
|
}
|
|
4998
5211
|
),
|
|
4999
|
-
/* @__PURE__ */
|
|
5000
|
-
/* @__PURE__ */
|
|
5212
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
5213
|
+
/* @__PURE__ */ jsx33(
|
|
5001
5214
|
"button",
|
|
5002
5215
|
{
|
|
5003
5216
|
onClick: (e) => {
|
|
@@ -5008,11 +5221,11 @@ var useA4StatementView = ({
|
|
|
5008
5221
|
},
|
|
5009
5222
|
disabled: currentPageIndex === 0,
|
|
5010
5223
|
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",
|
|
5011
|
-
children: /* @__PURE__ */
|
|
5224
|
+
children: /* @__PURE__ */ jsx33(ChevronLeft, { size: 18 })
|
|
5012
5225
|
}
|
|
5013
5226
|
),
|
|
5014
|
-
/* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5227
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
5228
|
+
/* @__PURE__ */ jsxs24(
|
|
5016
5229
|
Select,
|
|
5017
5230
|
{
|
|
5018
5231
|
value: currentPageIndex + 1,
|
|
@@ -5025,9 +5238,9 @@ var useA4StatementView = ({
|
|
|
5025
5238
|
variant: "ghost",
|
|
5026
5239
|
containerClassName: "inline-block",
|
|
5027
5240
|
children: [
|
|
5028
|
-
/* @__PURE__ */
|
|
5029
|
-
/* @__PURE__ */
|
|
5030
|
-
/* @__PURE__ */
|
|
5241
|
+
/* @__PURE__ */ jsx33(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__ */ jsx33("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
5242
|
+
/* @__PURE__ */ jsxs24(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
5243
|
+
/* @__PURE__ */ jsx33("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__ */ jsx33(
|
|
5031
5244
|
"input",
|
|
5032
5245
|
{
|
|
5033
5246
|
type: "text",
|
|
@@ -5039,17 +5252,17 @@ var useA4StatementView = ({
|
|
|
5039
5252
|
autoFocus: true
|
|
5040
5253
|
}
|
|
5041
5254
|
) }),
|
|
5042
|
-
/* @__PURE__ */
|
|
5255
|
+
/* @__PURE__ */ jsx33("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
5043
5256
|
(p) => String(p).includes(pageSearch)
|
|
5044
|
-
).map((p) => /* @__PURE__ */
|
|
5257
|
+
).map((p) => /* @__PURE__ */ jsx33(SelectItem, { value: p, children: p }, p)) })
|
|
5045
5258
|
] })
|
|
5046
5259
|
]
|
|
5047
5260
|
}
|
|
5048
5261
|
),
|
|
5049
|
-
/* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5262
|
+
/* @__PURE__ */ jsx33("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
5263
|
+
/* @__PURE__ */ jsx33("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
5051
5264
|
] }),
|
|
5052
|
-
/* @__PURE__ */
|
|
5265
|
+
/* @__PURE__ */ jsx33(
|
|
5053
5266
|
"button",
|
|
5054
5267
|
{
|
|
5055
5268
|
onClick: (e) => {
|
|
@@ -5060,7 +5273,7 @@ var useA4StatementView = ({
|
|
|
5060
5273
|
},
|
|
5061
5274
|
disabled: currentPageIndex === pages.length - 1,
|
|
5062
5275
|
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",
|
|
5063
|
-
children: /* @__PURE__ */
|
|
5276
|
+
children: /* @__PURE__ */ jsx33(ChevronRight2, { size: 18 })
|
|
5064
5277
|
}
|
|
5065
5278
|
)
|
|
5066
5279
|
] })
|
|
@@ -5068,10 +5281,10 @@ var useA4StatementView = ({
|
|
|
5068
5281
|
] }),
|
|
5069
5282
|
pageIndex === 0 && HeaderEl,
|
|
5070
5283
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
5071
|
-
/* @__PURE__ */
|
|
5072
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
5073
|
-
/* @__PURE__ */
|
|
5074
|
-
/* @__PURE__ */
|
|
5284
|
+
/* @__PURE__ */ jsxs24("div", { className: "grow w-full px-8 pb-8", children: [
|
|
5285
|
+
pageIndex === 0 && /* @__PURE__ */ jsxs24("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: [
|
|
5286
|
+
/* @__PURE__ */ jsx33("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
5287
|
+
/* @__PURE__ */ jsx33(
|
|
5075
5288
|
"input",
|
|
5076
5289
|
{
|
|
5077
5290
|
type: "text",
|
|
@@ -5082,9 +5295,9 @@ var useA4StatementView = ({
|
|
|
5082
5295
|
}
|
|
5083
5296
|
)
|
|
5084
5297
|
] }),
|
|
5085
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
5086
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
5087
|
-
statusOverlay ? /* @__PURE__ */
|
|
5298
|
+
pageIndex === 0 && /* @__PURE__ */ jsx33("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__ */ jsx33("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
5299
|
+
pageIndex > 0 && /* @__PURE__ */ jsx33("div", { className: "h-7 print:h-0" }),
|
|
5300
|
+
statusOverlay ? /* @__PURE__ */ jsx33("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx33(
|
|
5088
5301
|
SimpleTable,
|
|
5089
5302
|
{
|
|
5090
5303
|
columns,
|
|
@@ -5120,7 +5333,7 @@ var useA4StatementView = ({
|
|
|
5120
5333
|
var useA4DataView_default = useA4StatementView;
|
|
5121
5334
|
|
|
5122
5335
|
// src/hooks/Fetches/useA4CategoryView.tsx
|
|
5123
|
-
import { useEffect as useEffect13, useRef as useRef8, useState as
|
|
5336
|
+
import { useEffect as useEffect13, useRef as useRef8, useState as useState19 } from "react";
|
|
5124
5337
|
import { useReactToPrint as useReactToPrint2 } from "react-to-print";
|
|
5125
5338
|
import {
|
|
5126
5339
|
RefreshCw as RefreshCw2,
|
|
@@ -5130,7 +5343,7 @@ import {
|
|
|
5130
5343
|
ChevronLeft as ChevronLeft2,
|
|
5131
5344
|
ChevronRight as ChevronRight3
|
|
5132
5345
|
} from "lucide-react";
|
|
5133
|
-
import { jsx as
|
|
5346
|
+
import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5134
5347
|
var useA4CategoryView = ({
|
|
5135
5348
|
url,
|
|
5136
5349
|
v = 1,
|
|
@@ -5168,11 +5381,11 @@ var useA4CategoryView = ({
|
|
|
5168
5381
|
const { store } = useWarqadConfig();
|
|
5169
5382
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
5170
5383
|
const measureContainerRef = useRef8(null);
|
|
5171
|
-
const [pages, setPages] =
|
|
5172
|
-
const [isMeasuring, setIsMeasuring] =
|
|
5173
|
-
const [globalFilter, setGlobalFilter] =
|
|
5174
|
-
const [currentPageIndex, setCurrentPageIndex] =
|
|
5175
|
-
const [pageSearch, setPageSearch] =
|
|
5384
|
+
const [pages, setPages] = useState19([]);
|
|
5385
|
+
const [isMeasuring, setIsMeasuring] = useState19(true);
|
|
5386
|
+
const [globalFilter, setGlobalFilter] = useState19("");
|
|
5387
|
+
const [currentPageIndex, setCurrentPageIndex] = useState19(0);
|
|
5388
|
+
const [pageSearch, setPageSearch] = useState19("");
|
|
5176
5389
|
const groups = incomingGroups ? [...incomingGroups].sort(
|
|
5177
5390
|
(a, b) => a.title.localeCompare(b.title)
|
|
5178
5391
|
) : data ? [{ title: gridTitle, items: data }] : [];
|
|
@@ -5255,28 +5468,28 @@ var useA4CategoryView = ({
|
|
|
5255
5468
|
}, 150);
|
|
5256
5469
|
return () => clearTimeout(timer);
|
|
5257
5470
|
}, [isMeasuring, depsString]);
|
|
5258
|
-
const HeaderEl = /* @__PURE__ */
|
|
5471
|
+
const HeaderEl = /* @__PURE__ */ jsxs25(
|
|
5259
5472
|
"div",
|
|
5260
5473
|
{
|
|
5261
5474
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
5262
5475
|
id: "a4-header-section",
|
|
5263
5476
|
children: [
|
|
5264
|
-
/* @__PURE__ */
|
|
5265
|
-
/* @__PURE__ */
|
|
5266
|
-
/* @__PURE__ */
|
|
5477
|
+
/* @__PURE__ */ jsx34("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx34("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxs25("section", { children: [
|
|
5478
|
+
/* @__PURE__ */ jsx34("h1", { className: "text-4xl font-black text-black dark:text-white print:text-black tracking-tighter uppercase", children: title }),
|
|
5479
|
+
/* @__PURE__ */ jsx34("p", { className: "text-gray-600 dark:text-gray-400 print:text-gray-600 mt-1 uppercase text-xs font-bold tracking-widest", children: subtitle })
|
|
5267
5480
|
] }) }) }),
|
|
5268
|
-
/* @__PURE__ */
|
|
5269
|
-
/* @__PURE__ */
|
|
5270
|
-
/* @__PURE__ */
|
|
5271
|
-
store?.address && /* @__PURE__ */
|
|
5272
|
-
store?.phone && /* @__PURE__ */
|
|
5273
|
-
store?.email && /* @__PURE__ */
|
|
5481
|
+
/* @__PURE__ */ jsxs25("div", { className: "text-right", children: [
|
|
5482
|
+
/* @__PURE__ */ jsx34("h2", { className: "text-lg font-black text-black dark:text-white print:text-black uppercase tracking-tight", children: store?.name }),
|
|
5483
|
+
/* @__PURE__ */ jsxs25("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: [
|
|
5484
|
+
store?.address && /* @__PURE__ */ jsx34("span", { className: "whitespace-pre-line", children: store.address }),
|
|
5485
|
+
store?.phone && /* @__PURE__ */ jsx34("span", { children: store.phone }),
|
|
5486
|
+
store?.email && /* @__PURE__ */ jsx34("span", { children: store.email })
|
|
5274
5487
|
] })
|
|
5275
5488
|
] })
|
|
5276
5489
|
]
|
|
5277
5490
|
}
|
|
5278
5491
|
);
|
|
5279
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */
|
|
5492
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx34("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx34(
|
|
5280
5493
|
InfoGrid,
|
|
5281
5494
|
{
|
|
5282
5495
|
className: "mb-4",
|
|
@@ -5286,40 +5499,40 @@ var useA4CategoryView = ({
|
|
|
5286
5499
|
) }) : null;
|
|
5287
5500
|
const renderNode = (node) => {
|
|
5288
5501
|
if (node.type === "header") {
|
|
5289
|
-
return /* @__PURE__ */
|
|
5502
|
+
return /* @__PURE__ */ jsx34("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__ */ jsx34("h3", { className: "text-sm font-black text-black dark:text-white print:text-black uppercase tracking-[0.2em]", children: node.title }) });
|
|
5290
5503
|
}
|
|
5291
|
-
return /* @__PURE__ */
|
|
5504
|
+
return /* @__PURE__ */ jsx34(
|
|
5292
5505
|
"div",
|
|
5293
5506
|
{
|
|
5294
5507
|
className: "grid gap-4 px-2",
|
|
5295
5508
|
style: { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` },
|
|
5296
|
-
children: node.items.map((item, j) => /* @__PURE__ */
|
|
5509
|
+
children: node.items.map((item, j) => /* @__PURE__ */ jsx34("div", { children: renderItem(item) }, j))
|
|
5297
5510
|
}
|
|
5298
5511
|
);
|
|
5299
5512
|
};
|
|
5300
|
-
const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */
|
|
5301
|
-
isActuallyLoading ? /* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
5303
|
-
/* @__PURE__ */
|
|
5304
|
-
url && !isActuallyLoading && /* @__PURE__ */
|
|
5513
|
+
const statusOverlay = isActuallyLoading || error || flattenedNodes.length === 0 ? /* @__PURE__ */ jsx34("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs25("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: [
|
|
5514
|
+
isActuallyLoading ? /* @__PURE__ */ jsx34("div", { className: "mb-4", children: /* @__PURE__ */ jsx34(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx34("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__ */ jsx34(AlertCircle2, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx34("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx34(FileX2, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
5515
|
+
/* @__PURE__ */ jsx34("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" }),
|
|
5516
|
+
/* @__PURE__ */ jsx34("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." }),
|
|
5517
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs25(
|
|
5305
5518
|
"button",
|
|
5306
5519
|
{
|
|
5307
5520
|
onClick: () => getData(),
|
|
5308
5521
|
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",
|
|
5309
5522
|
children: [
|
|
5310
|
-
/* @__PURE__ */
|
|
5523
|
+
/* @__PURE__ */ jsx34(RefreshCw2, { size: 14 }),
|
|
5311
5524
|
"Try Again"
|
|
5312
5525
|
]
|
|
5313
5526
|
}
|
|
5314
5527
|
)
|
|
5315
5528
|
] }) }) : null;
|
|
5316
|
-
return /* @__PURE__ */
|
|
5317
|
-
isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
5530
|
+
isMeasuring && flattenedNodes.length > 0 && /* @__PURE__ */ jsx34("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx34(
|
|
5318
5531
|
"div",
|
|
5319
5532
|
{
|
|
5320
5533
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
5321
5534
|
className: "bg-white",
|
|
5322
|
-
children: /* @__PURE__ */
|
|
5535
|
+
children: /* @__PURE__ */ jsxs25(
|
|
5323
5536
|
"div",
|
|
5324
5537
|
{
|
|
5325
5538
|
ref: measureContainerRef,
|
|
@@ -5327,56 +5540,56 @@ var useA4CategoryView = ({
|
|
|
5327
5540
|
children: [
|
|
5328
5541
|
HeaderEl,
|
|
5329
5542
|
DisplayInfoGridEl,
|
|
5330
|
-
/* @__PURE__ */
|
|
5543
|
+
/* @__PURE__ */ jsx34("div", { className: "grow w-full px-8 pb-8", children: /* @__PURE__ */ jsx34("div", { className: "flex flex-col gap-2", children: flattenedNodes.map((node, i) => /* @__PURE__ */ jsx34("div", { className: "a4-measure-node", children: renderNode(node) }, i)) }) })
|
|
5331
5544
|
]
|
|
5332
5545
|
}
|
|
5333
5546
|
)
|
|
5334
5547
|
}
|
|
5335
5548
|
) }),
|
|
5336
|
-
/* @__PURE__ */
|
|
5549
|
+
/* @__PURE__ */ jsx34("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx34("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageNodes, pageIndex) => /* @__PURE__ */ jsx34(
|
|
5337
5550
|
"div",
|
|
5338
5551
|
{
|
|
5339
5552
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
5340
|
-
children: /* @__PURE__ */
|
|
5553
|
+
children: /* @__PURE__ */ jsx34(
|
|
5341
5554
|
PageA4,
|
|
5342
5555
|
{
|
|
5343
5556
|
className: "w-full",
|
|
5344
5557
|
pageNumber: pageIndex + 1,
|
|
5345
5558
|
totalPages: pages.length,
|
|
5346
5559
|
isLastPage: pageIndex === pages.length - 1,
|
|
5347
|
-
children: /* @__PURE__ */
|
|
5348
|
-
/* @__PURE__ */
|
|
5349
|
-
/* @__PURE__ */
|
|
5560
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
5561
|
+
/* @__PURE__ */ jsx34("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx34("div", { className: "flex items-center justify-end", children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
|
|
5562
|
+
/* @__PURE__ */ jsxs25(
|
|
5350
5563
|
"button",
|
|
5351
5564
|
{
|
|
5352
5565
|
onClick: async () => await getData(),
|
|
5353
5566
|
disabled: isLoading,
|
|
5354
5567
|
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",
|
|
5355
5568
|
children: [
|
|
5356
|
-
/* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsx34(
|
|
5357
5570
|
RefreshCw2,
|
|
5358
5571
|
{
|
|
5359
5572
|
size: 16,
|
|
5360
5573
|
className: isLoading ? "animate-spin" : ""
|
|
5361
5574
|
}
|
|
5362
5575
|
),
|
|
5363
|
-
/* @__PURE__ */
|
|
5576
|
+
/* @__PURE__ */ jsx34("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
5364
5577
|
]
|
|
5365
5578
|
}
|
|
5366
5579
|
),
|
|
5367
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsxs25(
|
|
5368
5581
|
"button",
|
|
5369
5582
|
{
|
|
5370
5583
|
onClick: () => reactToPrintFn(),
|
|
5371
5584
|
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",
|
|
5372
5585
|
children: [
|
|
5373
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsx34(Printer2, { size: 16 }),
|
|
5374
5587
|
"Print"
|
|
5375
5588
|
]
|
|
5376
5589
|
}
|
|
5377
5590
|
),
|
|
5378
|
-
/* @__PURE__ */
|
|
5379
|
-
/* @__PURE__ */
|
|
5591
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
5592
|
+
/* @__PURE__ */ jsx34(
|
|
5380
5593
|
"button",
|
|
5381
5594
|
{
|
|
5382
5595
|
onClick: (e) => {
|
|
@@ -5387,11 +5600,11 @@ var useA4CategoryView = ({
|
|
|
5387
5600
|
},
|
|
5388
5601
|
disabled: currentPageIndex === 0,
|
|
5389
5602
|
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",
|
|
5390
|
-
children: /* @__PURE__ */
|
|
5603
|
+
children: /* @__PURE__ */ jsx34(ChevronLeft2, { size: 18 })
|
|
5391
5604
|
}
|
|
5392
5605
|
),
|
|
5393
|
-
/* @__PURE__ */
|
|
5394
|
-
/* @__PURE__ */
|
|
5606
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
5607
|
+
/* @__PURE__ */ jsxs25(
|
|
5395
5608
|
Select,
|
|
5396
5609
|
{
|
|
5397
5610
|
value: currentPageIndex + 1,
|
|
@@ -5404,9 +5617,9 @@ var useA4CategoryView = ({
|
|
|
5404
5617
|
variant: "ghost",
|
|
5405
5618
|
containerClassName: "inline-block",
|
|
5406
5619
|
children: [
|
|
5407
|
-
/* @__PURE__ */
|
|
5408
|
-
/* @__PURE__ */
|
|
5409
|
-
/* @__PURE__ */
|
|
5620
|
+
/* @__PURE__ */ jsx34(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__ */ jsx34("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
5621
|
+
/* @__PURE__ */ jsxs25(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
5622
|
+
/* @__PURE__ */ jsx34("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__ */ jsx34(
|
|
5410
5623
|
"input",
|
|
5411
5624
|
{
|
|
5412
5625
|
type: "text",
|
|
@@ -5418,17 +5631,17 @@ var useA4CategoryView = ({
|
|
|
5418
5631
|
autoFocus: true
|
|
5419
5632
|
}
|
|
5420
5633
|
) }),
|
|
5421
|
-
/* @__PURE__ */
|
|
5634
|
+
/* @__PURE__ */ jsx34("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
5422
5635
|
(p) => String(p).includes(pageSearch)
|
|
5423
|
-
).map((p) => /* @__PURE__ */
|
|
5636
|
+
).map((p) => /* @__PURE__ */ jsx34(SelectItem, { value: p, children: p }, p)) })
|
|
5424
5637
|
] })
|
|
5425
5638
|
]
|
|
5426
5639
|
}
|
|
5427
5640
|
),
|
|
5428
|
-
/* @__PURE__ */
|
|
5429
|
-
/* @__PURE__ */
|
|
5641
|
+
/* @__PURE__ */ jsx34("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
5642
|
+
/* @__PURE__ */ jsx34("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
5430
5643
|
] }),
|
|
5431
|
-
/* @__PURE__ */
|
|
5644
|
+
/* @__PURE__ */ jsx34(
|
|
5432
5645
|
"button",
|
|
5433
5646
|
{
|
|
5434
5647
|
onClick: (e) => {
|
|
@@ -5439,15 +5652,15 @@ var useA4CategoryView = ({
|
|
|
5439
5652
|
},
|
|
5440
5653
|
disabled: currentPageIndex === pages.length - 1,
|
|
5441
5654
|
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",
|
|
5442
|
-
children: /* @__PURE__ */
|
|
5655
|
+
children: /* @__PURE__ */ jsx34(ChevronRight3, { size: 18 })
|
|
5443
5656
|
}
|
|
5444
5657
|
)
|
|
5445
5658
|
] })
|
|
5446
5659
|
] }) }) }),
|
|
5447
5660
|
pageIndex === 0 && HeaderEl,
|
|
5448
5661
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
5449
|
-
/* @__PURE__ */
|
|
5450
|
-
pageIndex === 0 && /* @__PURE__ */
|
|
5662
|
+
/* @__PURE__ */ jsxs25("div", { className: "grow w-full px-8 pb-8", children: [
|
|
5663
|
+
pageIndex === 0 && /* @__PURE__ */ jsx34("div", { className: "flex items-center justify-end px-2 mt-2 print:hidden mb-4", children: /* @__PURE__ */ jsx34(
|
|
5451
5664
|
"input",
|
|
5452
5665
|
{
|
|
5453
5666
|
type: "text",
|
|
@@ -5457,8 +5670,8 @@ var useA4CategoryView = ({
|
|
|
5457
5670
|
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"
|
|
5458
5671
|
}
|
|
5459
5672
|
) }),
|
|
5460
|
-
pageIndex > 0 && /* @__PURE__ */
|
|
5461
|
-
statusOverlay ? /* @__PURE__ */
|
|
5673
|
+
pageIndex > 0 && /* @__PURE__ */ jsx34("div", { className: "h-14 print:h-14" }),
|
|
5674
|
+
statusOverlay ? /* @__PURE__ */ jsx34("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx34("div", { className: "flex flex-col gap-2", children: pageNodes.map((node, i) => /* @__PURE__ */ jsx34("div", { children: renderNode(node) }, i)) })
|
|
5462
5675
|
] })
|
|
5463
5676
|
] })
|
|
5464
5677
|
},
|
|
@@ -5480,10 +5693,10 @@ var useA4CategoryView = ({
|
|
|
5480
5693
|
var useA4CategoryView_default = useA4CategoryView;
|
|
5481
5694
|
|
|
5482
5695
|
// src/hooks/Fetches/useTransaction.tsx
|
|
5483
|
-
import { useEffect as useEffect14, useState as
|
|
5696
|
+
import { useEffect as useEffect14, useState as useState20 } from "react";
|
|
5484
5697
|
import { AlertCircle as AlertCircle3, FileX as FileX3, Plus as Plus2, RefreshCw as RefreshCw3 } from "lucide-react";
|
|
5485
5698
|
import moment from "moment";
|
|
5486
|
-
import { jsx as
|
|
5699
|
+
import { jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5487
5700
|
var useTransaction = ({
|
|
5488
5701
|
url,
|
|
5489
5702
|
v = 1,
|
|
@@ -5491,7 +5704,7 @@ var useTransaction = ({
|
|
|
5491
5704
|
params = {},
|
|
5492
5705
|
dateFilter = true
|
|
5493
5706
|
}) => {
|
|
5494
|
-
const [date, setDate] =
|
|
5707
|
+
const [date, setDate] = useState20(
|
|
5495
5708
|
moment().format("DD/MM/YYYY")
|
|
5496
5709
|
);
|
|
5497
5710
|
const dateObj = {};
|
|
@@ -5531,25 +5744,26 @@ var useTransaction = ({
|
|
|
5531
5744
|
className = "",
|
|
5532
5745
|
title = "Untitled Transaction",
|
|
5533
5746
|
description = "View your transactions",
|
|
5747
|
+
showReload = true,
|
|
5534
5748
|
onCreate,
|
|
5535
5749
|
createTitle = "Add New",
|
|
5536
5750
|
...rest
|
|
5537
5751
|
}) => {
|
|
5538
|
-
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */
|
|
5752
|
+
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ jsx35(
|
|
5539
5753
|
"div",
|
|
5540
5754
|
{
|
|
5541
5755
|
className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
|
|
5542
|
-
children: /* @__PURE__ */
|
|
5543
|
-
error ? /* @__PURE__ */
|
|
5544
|
-
/* @__PURE__ */
|
|
5545
|
-
/* @__PURE__ */
|
|
5546
|
-
url && /* @__PURE__ */
|
|
5756
|
+
children: /* @__PURE__ */ jsxs26("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: [
|
|
5757
|
+
error ? /* @__PURE__ */ jsx35("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__ */ jsx35(AlertCircle3, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx35("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx35(FileX3, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
5758
|
+
/* @__PURE__ */ jsx35("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
|
|
5759
|
+
/* @__PURE__ */ jsx35("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." }),
|
|
5760
|
+
url && /* @__PURE__ */ jsxs26(
|
|
5547
5761
|
"button",
|
|
5548
5762
|
{
|
|
5549
5763
|
onClick: () => getData(),
|
|
5550
5764
|
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",
|
|
5551
5765
|
children: [
|
|
5552
|
-
/* @__PURE__ */
|
|
5766
|
+
/* @__PURE__ */ jsx35(RefreshCw3, { size: 14 }),
|
|
5553
5767
|
"Try Again"
|
|
5554
5768
|
]
|
|
5555
5769
|
}
|
|
@@ -5557,14 +5771,14 @@ var useTransaction = ({
|
|
|
5557
5771
|
] })
|
|
5558
5772
|
}
|
|
5559
5773
|
) : void 0;
|
|
5560
|
-
return /* @__PURE__ */
|
|
5561
|
-
/* @__PURE__ */
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
/* @__PURE__ */
|
|
5564
|
-
/* @__PURE__ */
|
|
5774
|
+
return /* @__PURE__ */ jsxs26(Card, { children: [
|
|
5775
|
+
/* @__PURE__ */ jsx35(Card.Header, { children: /* @__PURE__ */ jsxs26("header", { className: "flex items-center justify-between gap-4 py-2", children: [
|
|
5776
|
+
/* @__PURE__ */ jsxs26("div", { className: "space-y-1", children: [
|
|
5777
|
+
/* @__PURE__ */ jsx35(Card.Title, { children: title }),
|
|
5778
|
+
/* @__PURE__ */ jsx35(Card.Description, { children: description })
|
|
5565
5779
|
] }),
|
|
5566
|
-
/* @__PURE__ */
|
|
5567
|
-
dateFilter && /* @__PURE__ */
|
|
5780
|
+
/* @__PURE__ */ jsxs26("section", { className: "flex gap-2 items-center", children: [
|
|
5781
|
+
dateFilter && /* @__PURE__ */ jsx35(
|
|
5568
5782
|
Fields_default.DateInput,
|
|
5569
5783
|
{
|
|
5570
5784
|
value: date,
|
|
@@ -5574,20 +5788,31 @@ var useTransaction = ({
|
|
|
5574
5788
|
}
|
|
5575
5789
|
}
|
|
5576
5790
|
),
|
|
5577
|
-
/* @__PURE__ */
|
|
5791
|
+
showReload && /* @__PURE__ */ jsx35(
|
|
5792
|
+
Button,
|
|
5793
|
+
{
|
|
5794
|
+
size: "sm",
|
|
5795
|
+
variant: "outline",
|
|
5796
|
+
className: "rounded-md! px-3!",
|
|
5797
|
+
onClick: () => getData(),
|
|
5798
|
+
isLoading,
|
|
5799
|
+
icon: /* @__PURE__ */ jsx35(RefreshCw3, { size: 16 })
|
|
5800
|
+
}
|
|
5801
|
+
),
|
|
5802
|
+
onCreate && /* @__PURE__ */ jsx35(
|
|
5578
5803
|
Button,
|
|
5579
5804
|
{
|
|
5580
5805
|
size: "sm",
|
|
5581
5806
|
className: "rounded-md!",
|
|
5582
5807
|
onClick: onCreate,
|
|
5583
5808
|
variant: "primary",
|
|
5584
|
-
icon: /* @__PURE__ */
|
|
5809
|
+
icon: /* @__PURE__ */ jsx35(Plus2, {}),
|
|
5585
5810
|
children: createTitle
|
|
5586
5811
|
}
|
|
5587
5812
|
)
|
|
5588
5813
|
] })
|
|
5589
5814
|
] }) }),
|
|
5590
|
-
/* @__PURE__ */
|
|
5815
|
+
/* @__PURE__ */ jsx35(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ jsx35("div", { className: `w-full ${className}`, children: /* @__PURE__ */ jsx35(
|
|
5591
5816
|
DataTable,
|
|
5592
5817
|
{
|
|
5593
5818
|
columns,
|
|
@@ -5804,7 +6029,7 @@ var storage = {
|
|
|
5804
6029
|
};
|
|
5805
6030
|
|
|
5806
6031
|
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
5807
|
-
import { useState as
|
|
6032
|
+
import { useState as useState21 } from "react";
|
|
5808
6033
|
|
|
5809
6034
|
// ../../node_modules/@ant-design/icons/es/components/Context.js
|
|
5810
6035
|
import { createContext as createContext5 } from "react";
|
|
@@ -5812,7 +6037,7 @@ var IconContext = /* @__PURE__ */ createContext5({});
|
|
|
5812
6037
|
var Context_default = IconContext;
|
|
5813
6038
|
|
|
5814
6039
|
// ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
|
|
5815
|
-
import * as
|
|
6040
|
+
import * as React18 from "react";
|
|
5816
6041
|
import { clsx as clsx2 } from "clsx";
|
|
5817
6042
|
|
|
5818
6043
|
// ../../node_modules/@ant-design/fast-color/es/presetColors.js
|
|
@@ -6659,7 +6884,7 @@ var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a"
|
|
|
6659
6884
|
greyDark.primary = greyDark[5];
|
|
6660
6885
|
|
|
6661
6886
|
// ../../node_modules/@ant-design/icons/es/components/IconBase.js
|
|
6662
|
-
import * as
|
|
6887
|
+
import * as React17 from "react";
|
|
6663
6888
|
|
|
6664
6889
|
// ../../node_modules/@rc-component/util/es/Dom/canUseDom.js
|
|
6665
6890
|
function canUseDom() {
|
|
@@ -6815,17 +7040,17 @@ var preWarningFns = [];
|
|
|
6815
7040
|
var preMessage = (fn) => {
|
|
6816
7041
|
preWarningFns.push(fn);
|
|
6817
7042
|
};
|
|
6818
|
-
function warning(valid,
|
|
7043
|
+
function warning(valid, message4) {
|
|
6819
7044
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
6820
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
7045
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message4);
|
|
6821
7046
|
if (finalMessage) {
|
|
6822
7047
|
console.error(`Warning: ${finalMessage}`);
|
|
6823
7048
|
}
|
|
6824
7049
|
}
|
|
6825
7050
|
}
|
|
6826
|
-
function note(valid,
|
|
7051
|
+
function note(valid, message4) {
|
|
6827
7052
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
6828
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
7053
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message4);
|
|
6829
7054
|
if (finalMessage) {
|
|
6830
7055
|
console.warn(`Note: ${finalMessage}`);
|
|
6831
7056
|
}
|
|
@@ -6834,29 +7059,29 @@ function note(valid, message2) {
|
|
|
6834
7059
|
function resetWarned() {
|
|
6835
7060
|
warned = {};
|
|
6836
7061
|
}
|
|
6837
|
-
function call(method, valid,
|
|
6838
|
-
if (!valid && !warned[
|
|
6839
|
-
method(false,
|
|
6840
|
-
warned[
|
|
7062
|
+
function call(method, valid, message4) {
|
|
7063
|
+
if (!valid && !warned[message4]) {
|
|
7064
|
+
method(false, message4);
|
|
7065
|
+
warned[message4] = true;
|
|
6841
7066
|
}
|
|
6842
7067
|
}
|
|
6843
|
-
function warningOnce(valid,
|
|
6844
|
-
call(warning, valid,
|
|
7068
|
+
function warningOnce(valid, message4) {
|
|
7069
|
+
call(warning, valid, message4);
|
|
6845
7070
|
}
|
|
6846
|
-
function noteOnce(valid,
|
|
6847
|
-
call(note, valid,
|
|
7071
|
+
function noteOnce(valid, message4) {
|
|
7072
|
+
call(note, valid, message4);
|
|
6848
7073
|
}
|
|
6849
7074
|
warningOnce.preMessage = preMessage;
|
|
6850
7075
|
warningOnce.resetWarned = resetWarned;
|
|
6851
7076
|
warningOnce.noteOnce = noteOnce;
|
|
6852
7077
|
|
|
6853
7078
|
// ../../node_modules/@ant-design/icons/es/utils.js
|
|
6854
|
-
import
|
|
7079
|
+
import React16, { useContext as useContext5, useEffect as useEffect15 } from "react";
|
|
6855
7080
|
function camelCase(input) {
|
|
6856
7081
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
6857
7082
|
}
|
|
6858
|
-
function warning2(valid,
|
|
6859
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
7083
|
+
function warning2(valid, message4) {
|
|
7084
|
+
warningOnce(valid, `[@ant-design/icons] ${message4}`);
|
|
6860
7085
|
}
|
|
6861
7086
|
function isIconDefinition(target) {
|
|
6862
7087
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -6878,12 +7103,12 @@ function normalizeAttrs(attrs = {}) {
|
|
|
6878
7103
|
}
|
|
6879
7104
|
function generate2(node, key, rootProps) {
|
|
6880
7105
|
if (!rootProps) {
|
|
6881
|
-
return /* @__PURE__ */
|
|
7106
|
+
return /* @__PURE__ */ React16.createElement(node.tag, {
|
|
6882
7107
|
key,
|
|
6883
7108
|
...normalizeAttrs(node.attrs)
|
|
6884
7109
|
}, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
|
|
6885
7110
|
}
|
|
6886
|
-
return /* @__PURE__ */
|
|
7111
|
+
return /* @__PURE__ */ React16.createElement(node.tag, {
|
|
6887
7112
|
key,
|
|
6888
7113
|
...normalizeAttrs(node.attrs),
|
|
6889
7114
|
...rootProps
|
|
@@ -7010,7 +7235,7 @@ var IconBase = (props) => {
|
|
|
7010
7235
|
secondaryColor,
|
|
7011
7236
|
...restProps
|
|
7012
7237
|
} = props;
|
|
7013
|
-
const svgRef =
|
|
7238
|
+
const svgRef = React17.useRef(null);
|
|
7014
7239
|
let colors = twoToneColorPalette;
|
|
7015
7240
|
if (primaryColor) {
|
|
7016
7241
|
colors = {
|
|
@@ -7080,7 +7305,7 @@ function _extends() {
|
|
|
7080
7305
|
return _extends.apply(this, arguments);
|
|
7081
7306
|
}
|
|
7082
7307
|
setTwoToneColor(blue.primary);
|
|
7083
|
-
var Icon = /* @__PURE__ */
|
|
7308
|
+
var Icon = /* @__PURE__ */ React18.forwardRef((props, ref) => {
|
|
7084
7309
|
const {
|
|
7085
7310
|
// affect outter <i>...</i>
|
|
7086
7311
|
className,
|
|
@@ -7097,7 +7322,7 @@ var Icon = /* @__PURE__ */ React16.forwardRef((props, ref) => {
|
|
|
7097
7322
|
const {
|
|
7098
7323
|
prefixCls = "anticon",
|
|
7099
7324
|
rootClassName
|
|
7100
|
-
} =
|
|
7325
|
+
} = React18.useContext(Context_default);
|
|
7101
7326
|
const classString = clsx2(rootClassName, prefixCls, {
|
|
7102
7327
|
[`${prefixCls}-${icon.name}`]: !!icon.name,
|
|
7103
7328
|
[`${prefixCls}-spin`]: !!spin || icon.name === "loading"
|
|
@@ -7111,7 +7336,7 @@ var Icon = /* @__PURE__ */ React16.forwardRef((props, ref) => {
|
|
|
7111
7336
|
transform: `rotate(${rotate}deg)`
|
|
7112
7337
|
} : void 0;
|
|
7113
7338
|
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
|
|
7114
|
-
return /* @__PURE__ */
|
|
7339
|
+
return /* @__PURE__ */ React18.createElement("span", _extends({
|
|
7115
7340
|
role: "img",
|
|
7116
7341
|
"aria-label": icon.name
|
|
7117
7342
|
}, restProps, {
|
|
@@ -7119,7 +7344,7 @@ var Icon = /* @__PURE__ */ React16.forwardRef((props, ref) => {
|
|
|
7119
7344
|
tabIndex: iconTabIndex,
|
|
7120
7345
|
onClick,
|
|
7121
7346
|
className: classString
|
|
7122
|
-
}), /* @__PURE__ */
|
|
7347
|
+
}), /* @__PURE__ */ React18.createElement(IconBase_default, {
|
|
7123
7348
|
icon,
|
|
7124
7349
|
primaryColor,
|
|
7125
7350
|
secondaryColor,
|
|
@@ -7134,7 +7359,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
7134
7359
|
var AntdIcon_default = Icon;
|
|
7135
7360
|
|
|
7136
7361
|
// ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
7137
|
-
import * as
|
|
7362
|
+
import * as React19 from "react";
|
|
7138
7363
|
|
|
7139
7364
|
// ../../node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js
|
|
7140
7365
|
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" };
|
|
@@ -7155,11 +7380,11 @@ function _extends2() {
|
|
|
7155
7380
|
};
|
|
7156
7381
|
return _extends2.apply(this, arguments);
|
|
7157
7382
|
}
|
|
7158
|
-
var PlusOutlined2 = (props, ref) => /* @__PURE__ */
|
|
7383
|
+
var PlusOutlined2 = (props, ref) => /* @__PURE__ */ React19.createElement(AntdIcon_default, _extends2({}, props, {
|
|
7159
7384
|
ref,
|
|
7160
7385
|
icon: PlusOutlined_default
|
|
7161
7386
|
}));
|
|
7162
|
-
var RefIcon = /* @__PURE__ */
|
|
7387
|
+
var RefIcon = /* @__PURE__ */ React19.forwardRef(PlusOutlined2);
|
|
7163
7388
|
if (process.env.NODE_ENV !== "production") {
|
|
7164
7389
|
RefIcon.displayName = "PlusOutlined";
|
|
7165
7390
|
}
|
|
@@ -7167,7 +7392,7 @@ var PlusOutlined_default2 = RefIcon;
|
|
|
7167
7392
|
|
|
7168
7393
|
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
7169
7394
|
import { Image, Upload } from "antd";
|
|
7170
|
-
import { Fragment as Fragment7, jsx as
|
|
7395
|
+
import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7171
7396
|
var getBase64 = (file) => new Promise((resolve, reject) => {
|
|
7172
7397
|
const reader = new FileReader();
|
|
7173
7398
|
reader.readAsDataURL(file);
|
|
@@ -7175,9 +7400,9 @@ var getBase64 = (file) => new Promise((resolve, reject) => {
|
|
|
7175
7400
|
reader.onerror = (error) => reject(error);
|
|
7176
7401
|
});
|
|
7177
7402
|
var useAntdImageUpload = ({ length = 1 }) => {
|
|
7178
|
-
const [fileList, setFileList] =
|
|
7179
|
-
const [previewOpen, setPreviewOpen] =
|
|
7180
|
-
const [previewImage, setPreviewImage] =
|
|
7403
|
+
const [fileList, setFileList] = useState21([]);
|
|
7404
|
+
const [previewOpen, setPreviewOpen] = useState21(false);
|
|
7405
|
+
const [previewImage, setPreviewImage] = useState21("");
|
|
7181
7406
|
const handlePreview = async (file) => {
|
|
7182
7407
|
if (!file.url && !file.preview) {
|
|
7183
7408
|
file.preview = await getBase64(file.originFileObj);
|
|
@@ -7194,8 +7419,8 @@ var useAntdImageUpload = ({ length = 1 }) => {
|
|
|
7194
7419
|
}))
|
|
7195
7420
|
);
|
|
7196
7421
|
};
|
|
7197
|
-
const ImageBox = () => /* @__PURE__ */
|
|
7198
|
-
/* @__PURE__ */
|
|
7422
|
+
const ImageBox = () => /* @__PURE__ */ jsxs27(Fragment7, { children: [
|
|
7423
|
+
/* @__PURE__ */ jsx36(
|
|
7199
7424
|
Upload,
|
|
7200
7425
|
{
|
|
7201
7426
|
listType: "picture-card",
|
|
@@ -7203,13 +7428,13 @@ var useAntdImageUpload = ({ length = 1 }) => {
|
|
|
7203
7428
|
onPreview: handlePreview,
|
|
7204
7429
|
onChange: handleChange,
|
|
7205
7430
|
beforeUpload: () => false,
|
|
7206
|
-
children: fileList.length >= length ? null : /* @__PURE__ */
|
|
7207
|
-
/* @__PURE__ */
|
|
7208
|
-
/* @__PURE__ */
|
|
7431
|
+
children: fileList.length >= length ? null : /* @__PURE__ */ jsxs27("button", { style: { border: 0, background: "none" }, type: "button", children: [
|
|
7432
|
+
/* @__PURE__ */ jsx36(PlusOutlined_default2, {}),
|
|
7433
|
+
/* @__PURE__ */ jsx36("div", { style: { marginTop: 8 }, children: "Upload" })
|
|
7209
7434
|
] })
|
|
7210
7435
|
}
|
|
7211
7436
|
),
|
|
7212
|
-
previewImage && /* @__PURE__ */
|
|
7437
|
+
previewImage && /* @__PURE__ */ jsx36(
|
|
7213
7438
|
Image,
|
|
7214
7439
|
{
|
|
7215
7440
|
style: { display: "none" },
|
|
@@ -7227,10 +7452,10 @@ var useAntdImageUpload = ({ length = 1 }) => {
|
|
|
7227
7452
|
var useAntdImageUpload_default = useAntdImageUpload;
|
|
7228
7453
|
|
|
7229
7454
|
// src/components/Views/CategoryView.tsx
|
|
7230
|
-
import { jsx as
|
|
7455
|
+
import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7231
7456
|
var CategoryCard = ({ item }) => {
|
|
7232
|
-
return /* @__PURE__ */
|
|
7233
|
-
/* @__PURE__ */
|
|
7457
|
+
return /* @__PURE__ */ jsxs28("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: [
|
|
7458
|
+
/* @__PURE__ */ jsx37("div", { className: "relative aspect-square w-full overflow-hidden bg-gray-50 flex-shrink-0 border-b border-black/10", children: /* @__PURE__ */ jsx37(
|
|
7234
7459
|
"img",
|
|
7235
7460
|
{
|
|
7236
7461
|
src: item.image,
|
|
@@ -7238,7 +7463,7 @@ var CategoryCard = ({ item }) => {
|
|
|
7238
7463
|
className: "w-full h-full object-cover"
|
|
7239
7464
|
}
|
|
7240
7465
|
) }),
|
|
7241
|
-
/* @__PURE__ */
|
|
7466
|
+
/* @__PURE__ */ jsx37("div", { className: "p-1.5 flex flex-col justify-center flex-grow", children: /* @__PURE__ */ jsx37("h3", { className: "text-[10px] font-bold text-black line-clamp-2 leading-tight text-center", children: item.name }) })
|
|
7242
7467
|
] });
|
|
7243
7468
|
};
|
|
7244
7469
|
var CategoryView = ({
|
|
@@ -7246,20 +7471,20 @@ var CategoryView = ({
|
|
|
7246
7471
|
items,
|
|
7247
7472
|
className
|
|
7248
7473
|
}) => {
|
|
7249
|
-
return /* @__PURE__ */
|
|
7250
|
-
/* @__PURE__ */
|
|
7251
|
-
/* @__PURE__ */
|
|
7252
|
-
/* @__PURE__ */
|
|
7474
|
+
return /* @__PURE__ */ jsx37("div", { className: cn("p-6 bg-gray-50 min-h-full", className), children: /* @__PURE__ */ jsxs28("div", { className: "max-w-7xl mx-auto", children: [
|
|
7475
|
+
/* @__PURE__ */ jsxs28("div", { className: "mb-8", children: [
|
|
7476
|
+
/* @__PURE__ */ jsx37("h2", { className: "text-2xl md:text-3xl font-bold text-gray-900 tracking-tight", children: categoryName }),
|
|
7477
|
+
/* @__PURE__ */ jsx37("div", { className: "mt-2 h-1.5 w-16 bg-green-500 rounded-full" })
|
|
7253
7478
|
] }),
|
|
7254
|
-
/* @__PURE__ */
|
|
7479
|
+
/* @__PURE__ */ jsx37("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 md:gap-6", children: items.map((item) => /* @__PURE__ */ jsx37(CategoryCard, { item }, item.id)) })
|
|
7255
7480
|
] }) });
|
|
7256
7481
|
};
|
|
7257
7482
|
var CategoryView_default = CategoryView;
|
|
7258
7483
|
|
|
7259
7484
|
// src/components/Views/Transaction.tsx
|
|
7260
|
-
import { jsx as
|
|
7485
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
7261
7486
|
var Transaction = () => {
|
|
7262
|
-
return /* @__PURE__ */
|
|
7487
|
+
return /* @__PURE__ */ jsx38("div", { children: "Transaction" });
|
|
7263
7488
|
};
|
|
7264
7489
|
var Transaction_default = Transaction;
|
|
7265
7490
|
|
|
@@ -7274,7 +7499,7 @@ var Views_default = Views;
|
|
|
7274
7499
|
// src/components/Guard.tsx
|
|
7275
7500
|
import { useEffect as useEffect16, useLayoutEffect } from "react";
|
|
7276
7501
|
import { Navigate, Outlet, useLocation as useLocation2 } from "react-router-dom";
|
|
7277
|
-
import { message } from "antd";
|
|
7502
|
+
import { message as message3 } from "antd";
|
|
7278
7503
|
|
|
7279
7504
|
// src/store/useAuthStore.ts
|
|
7280
7505
|
import { create } from "zustand";
|
|
@@ -7366,7 +7591,7 @@ var useAuth = () => {
|
|
|
7366
7591
|
var useAuth_default = useAuth;
|
|
7367
7592
|
|
|
7368
7593
|
// src/components/Guard.tsx
|
|
7369
|
-
import { jsx as
|
|
7594
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
7370
7595
|
var Guard = () => {
|
|
7371
7596
|
const { get } = useApis_default();
|
|
7372
7597
|
const location = useLocation2();
|
|
@@ -7391,27 +7616,27 @@ var Guard = () => {
|
|
|
7391
7616
|
fetchProfile();
|
|
7392
7617
|
}, [location.pathname]);
|
|
7393
7618
|
if (!isFetched) {
|
|
7394
|
-
return /* @__PURE__ */
|
|
7619
|
+
return /* @__PURE__ */ jsx39("div", { className: "min-h-screen flex items-center justify-center", children: /* @__PURE__ */ jsx39(LoadingSpin, { size: "lg" }) });
|
|
7395
7620
|
}
|
|
7396
|
-
return /* @__PURE__ */
|
|
7621
|
+
return /* @__PURE__ */ jsx39(Outlet, {});
|
|
7397
7622
|
};
|
|
7398
7623
|
var ProtectedRoute = () => {
|
|
7399
7624
|
const { isLoggedIn } = useAuth();
|
|
7400
7625
|
const location = useLocation2();
|
|
7401
|
-
return isLoggedIn ? /* @__PURE__ */
|
|
7626
|
+
return isLoggedIn ? /* @__PURE__ */ jsx39(Outlet, {}) : /* @__PURE__ */ jsx39(Navigate, { to: "/login", state: { from: location }, replace: true });
|
|
7402
7627
|
};
|
|
7403
7628
|
var UnProtectedRoute = () => {
|
|
7404
7629
|
const { isLoggedIn, user } = useAuth();
|
|
7405
|
-
return !isLoggedIn ? /* @__PURE__ */
|
|
7630
|
+
return !isLoggedIn ? /* @__PURE__ */ jsx39(Outlet, {}) : /* @__PURE__ */ jsx39(Navigate, { to: user?.homePath || "/", replace: true });
|
|
7406
7631
|
};
|
|
7407
7632
|
var AdminProtectedRoute = () => {
|
|
7408
7633
|
const { role } = useAuth();
|
|
7409
7634
|
useEffect16(() => {
|
|
7410
7635
|
if (role && !["admin"].includes(role)) {
|
|
7411
|
-
|
|
7636
|
+
message3.error("Only admin can access this page");
|
|
7412
7637
|
}
|
|
7413
7638
|
}, [role]);
|
|
7414
|
-
return role && ["admin"].includes(role) ? /* @__PURE__ */
|
|
7639
|
+
return role && ["admin"].includes(role) ? /* @__PURE__ */ jsx39(Outlet, {}) : /* @__PURE__ */ jsx39(Navigate, { to: "/", replace: true });
|
|
7415
7640
|
};
|
|
7416
7641
|
export {
|
|
7417
7642
|
AdminProtectedRoute,
|
|
@@ -7442,7 +7667,9 @@ export {
|
|
|
7442
7667
|
PageHeader,
|
|
7443
7668
|
PhoneInput,
|
|
7444
7669
|
PostTable,
|
|
7670
|
+
ProfileCard,
|
|
7445
7671
|
ProfileDropdown,
|
|
7672
|
+
ProfileView,
|
|
7446
7673
|
ProtectedRoute,
|
|
7447
7674
|
SearchApi,
|
|
7448
7675
|
SearchApiContent,
|