warqadui 0.0.71 → 0.0.72
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 +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +248 -127
- package/dist/index.mjs +246 -133
- package/dist/styles.js +3 -0
- package/dist/styles.mjs +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -84,11 +84,13 @@ __export(index_exports, {
|
|
|
84
84
|
ThemeToggle: () => ThemeToggle,
|
|
85
85
|
ThemedLogin: () => ThemedLogin,
|
|
86
86
|
UnProtectedRoute: () => UnProtectedRoute,
|
|
87
|
+
UserForm: () => UserForm_default,
|
|
87
88
|
UserProfile: () => UserProfile_default,
|
|
88
89
|
Users: () => users_default,
|
|
89
90
|
Views: () => Views_default,
|
|
90
91
|
WarqadProvider: () => WarqadProvider,
|
|
91
92
|
createAccountSchema: () => createAccountSchema,
|
|
93
|
+
createUserSchema: () => createUserSchema,
|
|
92
94
|
generatePdf: () => generatePdf,
|
|
93
95
|
linkUserSchema: () => linkUserSchema,
|
|
94
96
|
resetPasswordSchema: () => resetPasswordSchema,
|
|
@@ -1042,7 +1044,7 @@ var CardTitle = ({
|
|
|
1042
1044
|
"h3",
|
|
1043
1045
|
{
|
|
1044
1046
|
className: cn(
|
|
1045
|
-
"text-
|
|
1047
|
+
"text-xl capitalize font-bold leading-none tracking-tight text-gray-900 dark:text-gray-100 ",
|
|
1046
1048
|
className
|
|
1047
1049
|
),
|
|
1048
1050
|
children
|
|
@@ -1171,13 +1173,13 @@ var Input = (0, import_react8.forwardRef)(
|
|
|
1171
1173
|
}
|
|
1172
1174
|
}
|
|
1173
1175
|
}, [props.value, name, form]);
|
|
1174
|
-
let
|
|
1176
|
+
let message14 = error;
|
|
1175
1177
|
if (form && name) {
|
|
1176
1178
|
const {
|
|
1177
1179
|
formState: { errors }
|
|
1178
1180
|
} = form;
|
|
1179
1181
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1180
|
-
|
|
1182
|
+
message14 = errorObj?.message;
|
|
1181
1183
|
}
|
|
1182
1184
|
const watchedValue = form?.watch(name);
|
|
1183
1185
|
(0, import_react8.useEffect)(() => {
|
|
@@ -1246,7 +1248,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
|
1246
1248
|
}
|
|
1247
1249
|
)
|
|
1248
1250
|
] }),
|
|
1249
|
-
|
|
1251
|
+
message14 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
1250
1252
|
]
|
|
1251
1253
|
}
|
|
1252
1254
|
);
|
|
@@ -1569,7 +1571,7 @@ var PhoneInput = (0, import_react11.forwardRef)(
|
|
|
1569
1571
|
const [isFocused, setIsFocused] = (0, import_react11.useState)(false);
|
|
1570
1572
|
const { theme } = useWarqadConfig();
|
|
1571
1573
|
const primaryColor = theme?.primaryColor;
|
|
1572
|
-
let
|
|
1574
|
+
let message14 = error;
|
|
1573
1575
|
if (form && name) {
|
|
1574
1576
|
const {
|
|
1575
1577
|
formState: { errors }
|
|
@@ -1579,7 +1581,7 @@ var PhoneInput = (0, import_react11.forwardRef)(
|
|
|
1579
1581
|
for (const part of nameParts) {
|
|
1580
1582
|
currentError = currentError?.[part];
|
|
1581
1583
|
}
|
|
1582
|
-
|
|
1584
|
+
message14 = currentError?.message || message14;
|
|
1583
1585
|
}
|
|
1584
1586
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1585
1587
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
@@ -1630,7 +1632,7 @@ var PhoneInput = (0, import_react11.forwardRef)(
|
|
|
1630
1632
|
}
|
|
1631
1633
|
)
|
|
1632
1634
|
] }),
|
|
1633
|
-
|
|
1635
|
+
message14 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
1634
1636
|
] });
|
|
1635
1637
|
if (form && name) {
|
|
1636
1638
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -1779,7 +1781,7 @@ var SelectRoot = ({
|
|
|
1779
1781
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1780
1782
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1781
1783
|
}, [fieldInternalProps]);
|
|
1782
|
-
let
|
|
1784
|
+
let message14 = error;
|
|
1783
1785
|
if (form && name) {
|
|
1784
1786
|
const {
|
|
1785
1787
|
formState: { errors }
|
|
@@ -1789,7 +1791,7 @@ var SelectRoot = ({
|
|
|
1789
1791
|
for (const part of nameParts) {
|
|
1790
1792
|
currentError = currentError?.[part];
|
|
1791
1793
|
}
|
|
1792
|
-
|
|
1794
|
+
message14 = currentError?.message || message14;
|
|
1793
1795
|
}
|
|
1794
1796
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
1795
1797
|
const valueCtx = {
|
|
@@ -1850,7 +1852,7 @@ var SelectRoot = ({
|
|
|
1850
1852
|
String(opt.value) || index
|
|
1851
1853
|
)) })
|
|
1852
1854
|
] }),
|
|
1853
|
-
|
|
1855
|
+
message14 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
1854
1856
|
]
|
|
1855
1857
|
}
|
|
1856
1858
|
) });
|
|
@@ -2086,13 +2088,13 @@ var Textarea = (0, import_react13.forwardRef)(
|
|
|
2086
2088
|
const [isFocused, setIsFocused] = (0, import_react13.useState)(false);
|
|
2087
2089
|
const { theme } = useWarqadConfig();
|
|
2088
2090
|
const primaryColor = theme?.primaryColor;
|
|
2089
|
-
let
|
|
2091
|
+
let message14 = error;
|
|
2090
2092
|
if (form && name) {
|
|
2091
2093
|
const {
|
|
2092
2094
|
formState: { errors }
|
|
2093
2095
|
} = form;
|
|
2094
2096
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2095
|
-
|
|
2097
|
+
message14 = errorObj?.message;
|
|
2096
2098
|
}
|
|
2097
2099
|
const renderInput = (inputProps, ref2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
2098
2100
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
@@ -2130,7 +2132,7 @@ var Textarea = (0, import_react13.forwardRef)(
|
|
|
2130
2132
|
}
|
|
2131
2133
|
}
|
|
2132
2134
|
) }),
|
|
2133
|
-
|
|
2135
|
+
message14 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
2134
2136
|
] });
|
|
2135
2137
|
(0, import_react13.useEffect)(() => {
|
|
2136
2138
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -2616,7 +2618,7 @@ var SearchApiRoot = ({
|
|
|
2616
2618
|
const filteredOptions = options.filter(
|
|
2617
2619
|
(option) => !filter.includes(getOptionValue(option))
|
|
2618
2620
|
);
|
|
2619
|
-
let
|
|
2621
|
+
let message14 = error || errorMessage;
|
|
2620
2622
|
if (form && name) {
|
|
2621
2623
|
const {
|
|
2622
2624
|
formState: { errors }
|
|
@@ -2626,7 +2628,7 @@ var SearchApiRoot = ({
|
|
|
2626
2628
|
for (const part of nameParts) {
|
|
2627
2629
|
currentError = currentError?.[part];
|
|
2628
2630
|
}
|
|
2629
|
-
|
|
2631
|
+
message14 = currentError?.message || message14;
|
|
2630
2632
|
}
|
|
2631
2633
|
const valueCtx = {
|
|
2632
2634
|
isOpen,
|
|
@@ -2660,7 +2662,7 @@ var SearchApiRoot = ({
|
|
|
2660
2662
|
form,
|
|
2661
2663
|
name,
|
|
2662
2664
|
obj,
|
|
2663
|
-
error:
|
|
2665
|
+
error: message14,
|
|
2664
2666
|
onSelect,
|
|
2665
2667
|
onClear
|
|
2666
2668
|
};
|
|
@@ -3027,19 +3029,19 @@ var DateInput = (0, import_react16.forwardRef)(
|
|
|
3027
3029
|
const { theme } = useWarqadConfig();
|
|
3028
3030
|
const primaryColor = theme?.primaryColor;
|
|
3029
3031
|
const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
|
|
3030
|
-
let
|
|
3032
|
+
let message14 = error;
|
|
3031
3033
|
if (form && name) {
|
|
3032
3034
|
const {
|
|
3033
3035
|
formState: { errors }
|
|
3034
3036
|
} = form;
|
|
3035
3037
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
3036
|
-
|
|
3038
|
+
message14 = errorObj?.message;
|
|
3037
3039
|
}
|
|
3038
3040
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
3039
3041
|
bg-white! dark:bg-zinc-900!
|
|
3040
3042
|
text-gray-900! dark:text-zinc-100!
|
|
3041
3043
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
3042
|
-
${
|
|
3044
|
+
${message14 ? "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"}
|
|
3043
3045
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
3044
3046
|
${className}`;
|
|
3045
3047
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
@@ -3062,8 +3064,8 @@ var DateInput = (0, import_react16.forwardRef)(
|
|
|
3062
3064
|
needConfirm: false,
|
|
3063
3065
|
style: {
|
|
3064
3066
|
height: "var(--input-height, 40px)",
|
|
3065
|
-
borderColor: isFocused && !
|
|
3066
|
-
boxShadow: isFocused && !
|
|
3067
|
+
borderColor: isFocused && !message14 ? primaryColor : void 0,
|
|
3068
|
+
boxShadow: isFocused && !message14 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
3067
3069
|
},
|
|
3068
3070
|
classNames: { popup: { root: "z-50" } },
|
|
3069
3071
|
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -3093,7 +3095,7 @@ var DateInput = (0, import_react16.forwardRef)(
|
|
|
3093
3095
|
{
|
|
3094
3096
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
3095
3097
|
style: {
|
|
3096
|
-
color:
|
|
3098
|
+
color: message14 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3097
3099
|
},
|
|
3098
3100
|
children: [
|
|
3099
3101
|
label,
|
|
@@ -3114,7 +3116,7 @@ var DateInput = (0, import_react16.forwardRef)(
|
|
|
3114
3116
|
)
|
|
3115
3117
|
}
|
|
3116
3118
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
3117
|
-
|
|
3119
|
+
message14 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
3118
3120
|
] });
|
|
3119
3121
|
}
|
|
3120
3122
|
);
|
|
@@ -7383,17 +7385,17 @@ var preWarningFns = [];
|
|
|
7383
7385
|
var preMessage = (fn) => {
|
|
7384
7386
|
preWarningFns.push(fn);
|
|
7385
7387
|
};
|
|
7386
|
-
function warning(valid,
|
|
7388
|
+
function warning(valid, message14) {
|
|
7387
7389
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
7388
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
7390
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message14);
|
|
7389
7391
|
if (finalMessage) {
|
|
7390
7392
|
console.error(`Warning: ${finalMessage}`);
|
|
7391
7393
|
}
|
|
7392
7394
|
}
|
|
7393
7395
|
}
|
|
7394
|
-
function note(valid,
|
|
7396
|
+
function note(valid, message14) {
|
|
7395
7397
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
7396
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
7398
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message14);
|
|
7397
7399
|
if (finalMessage) {
|
|
7398
7400
|
console.warn(`Note: ${finalMessage}`);
|
|
7399
7401
|
}
|
|
@@ -7402,17 +7404,17 @@ function note(valid, message13) {
|
|
|
7402
7404
|
function resetWarned() {
|
|
7403
7405
|
warned = {};
|
|
7404
7406
|
}
|
|
7405
|
-
function call(method, valid,
|
|
7406
|
-
if (!valid && !warned[
|
|
7407
|
-
method(false,
|
|
7408
|
-
warned[
|
|
7407
|
+
function call(method, valid, message14) {
|
|
7408
|
+
if (!valid && !warned[message14]) {
|
|
7409
|
+
method(false, message14);
|
|
7410
|
+
warned[message14] = true;
|
|
7409
7411
|
}
|
|
7410
7412
|
}
|
|
7411
|
-
function warningOnce(valid,
|
|
7412
|
-
call(warning, valid,
|
|
7413
|
+
function warningOnce(valid, message14) {
|
|
7414
|
+
call(warning, valid, message14);
|
|
7413
7415
|
}
|
|
7414
|
-
function noteOnce(valid,
|
|
7415
|
-
call(note, valid,
|
|
7416
|
+
function noteOnce(valid, message14) {
|
|
7417
|
+
call(note, valid, message14);
|
|
7416
7418
|
}
|
|
7417
7419
|
warningOnce.preMessage = preMessage;
|
|
7418
7420
|
warningOnce.resetWarned = resetWarned;
|
|
@@ -7423,8 +7425,8 @@ var import_react30 = __toESM(require("react"));
|
|
|
7423
7425
|
function camelCase(input) {
|
|
7424
7426
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
7425
7427
|
}
|
|
7426
|
-
function warning2(valid,
|
|
7427
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
7428
|
+
function warning2(valid, message14) {
|
|
7429
|
+
warningOnce(valid, `[@ant-design/icons] ${message14}`);
|
|
7428
7430
|
}
|
|
7429
7431
|
function isIconDefinition(target) {
|
|
7430
7432
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -8330,6 +8332,13 @@ var resetPasswordSchema = import_zod4.z.object({
|
|
|
8330
8332
|
token: import_zod4.z.string().min(1, { message: "Token is required" }),
|
|
8331
8333
|
password: import_zod4.z.string().min(6, { message: "Password must be at least 6 characters" })
|
|
8332
8334
|
});
|
|
8335
|
+
var createUserSchema = import_zod4.z.object({
|
|
8336
|
+
email: import_zod4.z.string().refine((val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
|
|
8337
|
+
message: "Please enter a valid email address"
|
|
8338
|
+
}).transform((val) => val?.toLowerCase()),
|
|
8339
|
+
phoneNumber: import_zod4.z.string().optional(),
|
|
8340
|
+
role: import_zod4.z.enum(["admin"])
|
|
8341
|
+
});
|
|
8333
8342
|
|
|
8334
8343
|
// src/components/users/linkUser.tsx
|
|
8335
8344
|
var import_react_hook_form9 = require("react-hook-form");
|
|
@@ -8608,7 +8617,8 @@ var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
|
8608
8617
|
function UpdateEmailForm({
|
|
8609
8618
|
data,
|
|
8610
8619
|
close,
|
|
8611
|
-
reload
|
|
8620
|
+
reload,
|
|
8621
|
+
app = ""
|
|
8612
8622
|
}) {
|
|
8613
8623
|
const { put, isLoading } = useApis_default();
|
|
8614
8624
|
const currentEmail = data?.email;
|
|
@@ -8623,7 +8633,7 @@ function UpdateEmailForm({
|
|
|
8623
8633
|
const onSubmit = async (formData) => {
|
|
8624
8634
|
try {
|
|
8625
8635
|
await put({
|
|
8626
|
-
url:
|
|
8636
|
+
url: `${app}/users/change_email/${data._id}`,
|
|
8627
8637
|
body: {
|
|
8628
8638
|
email: formData.newEmail
|
|
8629
8639
|
}
|
|
@@ -8696,7 +8706,8 @@ var { Countdown: Countdown2 } = import_antd11.Statistic;
|
|
|
8696
8706
|
function ResetPasswordForm({
|
|
8697
8707
|
data,
|
|
8698
8708
|
close,
|
|
8699
|
-
reload
|
|
8709
|
+
reload,
|
|
8710
|
+
app = ""
|
|
8700
8711
|
}) {
|
|
8701
8712
|
const { put, isLoading } = useApis_default();
|
|
8702
8713
|
const [datas, setDatas] = (0, import_react37.useState)(data);
|
|
@@ -8705,7 +8716,9 @@ function ResetPasswordForm({
|
|
|
8705
8716
|
);
|
|
8706
8717
|
(0, import_react37.useEffect)(() => {
|
|
8707
8718
|
setDatas(data);
|
|
8708
|
-
setHasPassed(
|
|
8719
|
+
setHasPassed(
|
|
8720
|
+
data?.passwordReset?.passed || !data?.passwordReset?.createdAt
|
|
8721
|
+
);
|
|
8709
8722
|
}, [data]);
|
|
8710
8723
|
const userEmail = data?.email;
|
|
8711
8724
|
const methods = (0, import_react_hook_form12.useForm)({
|
|
@@ -8728,7 +8741,7 @@ function ResetPasswordForm({
|
|
|
8728
8741
|
const resendToken = async () => {
|
|
8729
8742
|
try {
|
|
8730
8743
|
const res = await put({
|
|
8731
|
-
url:
|
|
8744
|
+
url: `${app}/users/reset_password/${data._id}`,
|
|
8732
8745
|
body: {
|
|
8733
8746
|
email: userEmail
|
|
8734
8747
|
}
|
|
@@ -8799,22 +8812,26 @@ var ResetPasswordForm_default = ResetPasswordForm;
|
|
|
8799
8812
|
var import_antd12 = require("antd");
|
|
8800
8813
|
var import_react38 = require("react");
|
|
8801
8814
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8802
|
-
var ActivateUser = ({ data }) => {
|
|
8815
|
+
var ActivateUser = ({ data, app = "" }) => {
|
|
8803
8816
|
const [checked, setChecked] = (0, import_react38.useState)(data?.isActive);
|
|
8804
8817
|
const { put, isLoading } = useApis_default();
|
|
8805
8818
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8806
8819
|
import_antd12.Switch,
|
|
8807
8820
|
{
|
|
8808
8821
|
onChange: async (e) => {
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8822
|
+
try {
|
|
8823
|
+
const res = await put({
|
|
8824
|
+
url: `${app}/users/activate/${data?._id}`,
|
|
8825
|
+
v: 1,
|
|
8826
|
+
body: { isActive: e }
|
|
8827
|
+
});
|
|
8828
|
+
import_antd12.message.success(
|
|
8829
|
+
res?.data?.isActive ? "User Activated" : "User Deactivated"
|
|
8830
|
+
);
|
|
8831
|
+
setChecked(res?.data?.isActive);
|
|
8832
|
+
} catch (error) {
|
|
8833
|
+
import_antd12.message.error(error?.message || "Failed to update user status");
|
|
8834
|
+
}
|
|
8818
8835
|
},
|
|
8819
8836
|
loading: isLoading,
|
|
8820
8837
|
checked,
|
|
@@ -8825,15 +8842,16 @@ var ActivateUser = ({ data }) => {
|
|
|
8825
8842
|
var Activate_default = ActivateUser;
|
|
8826
8843
|
|
|
8827
8844
|
// src/components/users/users.tsx
|
|
8845
|
+
var import_react_router_dom7 = require("react-router-dom");
|
|
8828
8846
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
8829
|
-
function Users() {
|
|
8847
|
+
function Users({ app = "" }) {
|
|
8848
|
+
const navigate = (0, import_react_router_dom7.useNavigate)();
|
|
8830
8849
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
8831
|
-
url:
|
|
8850
|
+
url: `${app}/users/get`,
|
|
8832
8851
|
v: 1,
|
|
8833
8852
|
dateFilter: false
|
|
8834
8853
|
});
|
|
8835
8854
|
const { Modal: Modal2, openState, close } = useModal();
|
|
8836
|
-
const { put, isLoading } = useApis_default();
|
|
8837
8855
|
const items = (data2) => [
|
|
8838
8856
|
{
|
|
8839
8857
|
label: `Reset Password`,
|
|
@@ -8845,6 +8863,7 @@ function Users() {
|
|
|
8845
8863
|
ResetPasswordForm_default,
|
|
8846
8864
|
{
|
|
8847
8865
|
data: data2,
|
|
8866
|
+
app,
|
|
8848
8867
|
close: () => close(),
|
|
8849
8868
|
reload: () => reload()
|
|
8850
8869
|
}
|
|
@@ -8863,7 +8882,8 @@ function Users() {
|
|
|
8863
8882
|
{
|
|
8864
8883
|
data: data2,
|
|
8865
8884
|
close: () => close(),
|
|
8866
|
-
reload: () => reload()
|
|
8885
|
+
reload: () => reload(),
|
|
8886
|
+
app
|
|
8867
8887
|
}
|
|
8868
8888
|
),
|
|
8869
8889
|
width: 600
|
|
@@ -8910,12 +8930,27 @@ function Users() {
|
|
|
8910
8930
|
] });
|
|
8911
8931
|
}
|
|
8912
8932
|
},
|
|
8933
|
+
{
|
|
8934
|
+
accessorKey: "role",
|
|
8935
|
+
header: "Role",
|
|
8936
|
+
cell: ({ row }) => {
|
|
8937
|
+
const data2 = row.original;
|
|
8938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
8939
|
+
Badge,
|
|
8940
|
+
{
|
|
8941
|
+
variant: data2?.role === "admin" ? "primary" : "warning",
|
|
8942
|
+
size: "sm",
|
|
8943
|
+
children: data2?.role || "N/A"
|
|
8944
|
+
}
|
|
8945
|
+
);
|
|
8946
|
+
}
|
|
8947
|
+
},
|
|
8913
8948
|
{
|
|
8914
8949
|
accessorKey: "account.name",
|
|
8915
8950
|
header: "Employee Name",
|
|
8916
8951
|
cell: ({ row }) => {
|
|
8917
8952
|
const account = row.original?.account;
|
|
8918
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: account?.name });
|
|
8953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: account?.name || "N/A" });
|
|
8919
8954
|
}
|
|
8920
8955
|
},
|
|
8921
8956
|
{
|
|
@@ -8923,7 +8958,7 @@ function Users() {
|
|
|
8923
8958
|
header: "Status",
|
|
8924
8959
|
cell: ({ row }) => {
|
|
8925
8960
|
const data2 = row.original;
|
|
8926
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2 });
|
|
8961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2, app });
|
|
8927
8962
|
}
|
|
8928
8963
|
},
|
|
8929
8964
|
{
|
|
@@ -8955,7 +8990,9 @@ function Users() {
|
|
|
8955
8990
|
data: users,
|
|
8956
8991
|
index: true,
|
|
8957
8992
|
title: "User",
|
|
8958
|
-
description: "Manage users"
|
|
8993
|
+
description: "Manage users",
|
|
8994
|
+
createTitle: "Add User",
|
|
8995
|
+
onCreate: () => navigate("/users/create")
|
|
8959
8996
|
}
|
|
8960
8997
|
),
|
|
8961
8998
|
" "
|
|
@@ -8963,15 +9000,97 @@ function Users() {
|
|
|
8963
9000
|
}
|
|
8964
9001
|
var users_default = Users;
|
|
8965
9002
|
|
|
8966
|
-
// src/components/users/
|
|
8967
|
-
var import_react40 = require("react");
|
|
8968
|
-
var import_react_router_dom7 = require("react-router-dom");
|
|
8969
|
-
var import_lucide_react21 = require("lucide-react");
|
|
9003
|
+
// src/components/users/UserForm.tsx
|
|
8970
9004
|
var import_react_hook_form13 = require("react-hook-form");
|
|
8971
9005
|
var import_zod8 = require("@hookform/resolvers/zod");
|
|
8972
|
-
var z4 = __toESM(require("zod"));
|
|
8973
9006
|
var import_antd13 = require("antd");
|
|
8974
9007
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9008
|
+
function UserForm({ app = "" }) {
|
|
9009
|
+
const { navigate } = useApp_default();
|
|
9010
|
+
const { post, isLoading } = useApis_default();
|
|
9011
|
+
const methods = (0, import_react_hook_form13.useForm)({
|
|
9012
|
+
resolver: (0, import_zod8.zodResolver)(createUserSchema),
|
|
9013
|
+
defaultValues: {
|
|
9014
|
+
email: "",
|
|
9015
|
+
phoneNumber: "",
|
|
9016
|
+
role: "admin"
|
|
9017
|
+
}
|
|
9018
|
+
});
|
|
9019
|
+
const { handleSubmit } = methods;
|
|
9020
|
+
const onSubmit = async (data) => {
|
|
9021
|
+
try {
|
|
9022
|
+
await post({
|
|
9023
|
+
url: `${app}/users/create`,
|
|
9024
|
+
body: data
|
|
9025
|
+
});
|
|
9026
|
+
import_antd13.message.success("User created successfully");
|
|
9027
|
+
navigate(-1);
|
|
9028
|
+
} catch (error) {
|
|
9029
|
+
import_antd13.message.error(error?.message || "Something went wrong");
|
|
9030
|
+
}
|
|
9031
|
+
};
|
|
9032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Card, { className: "max-w-xl mx-auto mt-10 relative", children: [
|
|
9033
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Card.Header, { children: [
|
|
9034
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Card.Title, { children: "Add User" }),
|
|
9035
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Card.Description, { children: "Create a new user by providing their email and phone number." })
|
|
9036
|
+
] }),
|
|
9037
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Card.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("form", { onSubmit: handleSubmit(onSubmit), children: [
|
|
9038
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "space-y-4", children: [
|
|
9039
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9040
|
+
Fields_default.Input,
|
|
9041
|
+
{
|
|
9042
|
+
label: "Email",
|
|
9043
|
+
form: methods,
|
|
9044
|
+
name: "email",
|
|
9045
|
+
type: "email",
|
|
9046
|
+
placeholder: "e.g. user@example.com",
|
|
9047
|
+
required: true
|
|
9048
|
+
}
|
|
9049
|
+
),
|
|
9050
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9051
|
+
Fields_default.PhoneInput,
|
|
9052
|
+
{
|
|
9053
|
+
label: "Phone Number",
|
|
9054
|
+
form: methods,
|
|
9055
|
+
name: "phoneNumber",
|
|
9056
|
+
placeholder: "Enter phone number"
|
|
9057
|
+
}
|
|
9058
|
+
),
|
|
9059
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9060
|
+
Fields_default.Select,
|
|
9061
|
+
{
|
|
9062
|
+
label: "Role",
|
|
9063
|
+
form: methods,
|
|
9064
|
+
name: "role",
|
|
9065
|
+
options: [{ label: "Admin", value: "admin" }],
|
|
9066
|
+
required: true
|
|
9067
|
+
}
|
|
9068
|
+
)
|
|
9069
|
+
] }),
|
|
9070
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("footer", { className: "flex justify-end mt-6", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9071
|
+
Button,
|
|
9072
|
+
{
|
|
9073
|
+
isLoading,
|
|
9074
|
+
disabled: isLoading,
|
|
9075
|
+
type: "submit",
|
|
9076
|
+
className: "min-w-[100px]",
|
|
9077
|
+
children: "Add User"
|
|
9078
|
+
}
|
|
9079
|
+
) })
|
|
9080
|
+
] }) })
|
|
9081
|
+
] });
|
|
9082
|
+
}
|
|
9083
|
+
var UserForm_default = UserForm;
|
|
9084
|
+
|
|
9085
|
+
// src/components/users/ResetPasswordPage.tsx
|
|
9086
|
+
var import_react40 = require("react");
|
|
9087
|
+
var import_react_router_dom8 = require("react-router-dom");
|
|
9088
|
+
var import_lucide_react21 = require("lucide-react");
|
|
9089
|
+
var import_react_hook_form14 = require("react-hook-form");
|
|
9090
|
+
var import_zod9 = require("@hookform/resolvers/zod");
|
|
9091
|
+
var z4 = __toESM(require("zod"));
|
|
9092
|
+
var import_antd14 = require("antd");
|
|
9093
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
8975
9094
|
var resetPageSchema = z4.object({
|
|
8976
9095
|
password: z4.string().min(6, "Password must be at least 6 characters"),
|
|
8977
9096
|
confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
|
|
@@ -8980,8 +9099,8 @@ var resetPageSchema = z4.object({
|
|
|
8980
9099
|
path: ["confirmPassword"]
|
|
8981
9100
|
});
|
|
8982
9101
|
function ResetPasswordPage() {
|
|
8983
|
-
const [searchParams] = (0,
|
|
8984
|
-
const navigate = (0,
|
|
9102
|
+
const [searchParams] = (0, import_react_router_dom8.useSearchParams)();
|
|
9103
|
+
const navigate = (0, import_react_router_dom8.useNavigate)();
|
|
8985
9104
|
const { put, isLoading } = useApis_default();
|
|
8986
9105
|
const [isVerified, setIsVerified] = (0, import_react40.useState)(false);
|
|
8987
9106
|
const [verifying, setVerifying] = (0, import_react40.useState)(true);
|
|
@@ -8989,8 +9108,8 @@ function ResetPasswordPage() {
|
|
|
8989
9108
|
const token = searchParams.get("token");
|
|
8990
9109
|
const email = searchParams.get("email");
|
|
8991
9110
|
const id = searchParams.get("id");
|
|
8992
|
-
const methods = (0,
|
|
8993
|
-
resolver: (0,
|
|
9111
|
+
const methods = (0, import_react_hook_form14.useForm)({
|
|
9112
|
+
resolver: (0, import_zod9.zodResolver)(resetPageSchema),
|
|
8994
9113
|
defaultValues: {
|
|
8995
9114
|
password: "",
|
|
8996
9115
|
confirmPassword: ""
|
|
@@ -9028,23 +9147,23 @@ function ResetPasswordPage() {
|
|
|
9028
9147
|
password: data.password
|
|
9029
9148
|
}
|
|
9030
9149
|
});
|
|
9031
|
-
|
|
9150
|
+
import_antd14.message.success(
|
|
9032
9151
|
"Password has been reset successfully. You can now login."
|
|
9033
9152
|
);
|
|
9034
9153
|
navigate("/login", { replace: true });
|
|
9035
9154
|
} catch (err) {
|
|
9036
|
-
|
|
9155
|
+
import_antd14.message.error(err?.message || "Failed to reset password.");
|
|
9037
9156
|
}
|
|
9038
9157
|
};
|
|
9039
9158
|
if (verifying) {
|
|
9040
|
-
return /* @__PURE__ */ (0,
|
|
9041
|
-
/* @__PURE__ */ (0,
|
|
9042
|
-
/* @__PURE__ */ (0,
|
|
9159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "h-screen w-full flex items-center justify-center bg-slate-50 dark:bg-[#0A0B10]", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center space-y-4", children: [
|
|
9160
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_antd14.Spin, { size: "large" }),
|
|
9161
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
|
|
9043
9162
|
] }) });
|
|
9044
9163
|
}
|
|
9045
|
-
return /* @__PURE__ */ (0,
|
|
9046
|
-
/* @__PURE__ */ (0,
|
|
9047
|
-
/* @__PURE__ */ (0,
|
|
9164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
|
|
9165
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
|
|
9166
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9048
9167
|
"div",
|
|
9049
9168
|
{
|
|
9050
9169
|
className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
|
|
@@ -9053,35 +9172,35 @@ function ResetPasswordPage() {
|
|
|
9053
9172
|
}
|
|
9054
9173
|
}
|
|
9055
9174
|
),
|
|
9056
|
-
/* @__PURE__ */ (0,
|
|
9057
|
-
/* @__PURE__ */ (0,
|
|
9058
|
-
/* @__PURE__ */ (0,
|
|
9059
|
-
/* @__PURE__ */ (0,
|
|
9060
|
-
/* @__PURE__ */ (0,
|
|
9175
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
|
|
9176
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
|
|
9177
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
9178
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-indigo-500/20 shadow-xl", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.Terminal, { className: "text-white w-6 h-6" }) }),
|
|
9179
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
|
|
9061
9180
|
] }),
|
|
9062
|
-
/* @__PURE__ */ (0,
|
|
9063
|
-
/* @__PURE__ */ (0,
|
|
9181
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "max-w-md", children: [
|
|
9182
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
|
|
9064
9183
|
"Secure ",
|
|
9065
|
-
/* @__PURE__ */ (0,
|
|
9184
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-indigo-400", children: "Access" }),
|
|
9066
9185
|
" ",
|
|
9067
|
-
/* @__PURE__ */ (0,
|
|
9186
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("br", {}),
|
|
9068
9187
|
" ",
|
|
9069
9188
|
"Simplified."
|
|
9070
9189
|
] }),
|
|
9071
|
-
/* @__PURE__ */ (0,
|
|
9190
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
|
|
9072
9191
|
] }),
|
|
9073
|
-
/* @__PURE__ */ (0,
|
|
9192
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
|
|
9074
9193
|
] })
|
|
9075
9194
|
] }),
|
|
9076
|
-
/* @__PURE__ */ (0,
|
|
9077
|
-
/* @__PURE__ */ (0,
|
|
9078
|
-
/* @__PURE__ */ (0,
|
|
9079
|
-
/* @__PURE__ */ (0,
|
|
9080
|
-
/* @__PURE__ */ (0,
|
|
9081
|
-
/* @__PURE__ */ (0,
|
|
9082
|
-
/* @__PURE__ */ (0,
|
|
9195
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "w-full lg:w-1/2 p-8 lg:p-16 flex flex-col justify-center bg-white dark:bg-[#0A0B10] relative", children: [
|
|
9196
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ThemeToggle, {}) }),
|
|
9197
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center space-y-6", children: [
|
|
9198
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "mx-auto w-16 h-16 bg-red-100 dark:bg-red-900/20 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.ShieldCheck, { className: "text-red-600 dark:text-red-400 w-8 h-8" }) }),
|
|
9199
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { children: [
|
|
9200
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
|
|
9201
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
|
|
9083
9202
|
] }),
|
|
9084
|
-
/* @__PURE__ */ (0,
|
|
9203
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9085
9204
|
Button,
|
|
9086
9205
|
{
|
|
9087
9206
|
onClick: () => navigate("/login"),
|
|
@@ -9089,22 +9208,22 @@ function ResetPasswordPage() {
|
|
|
9089
9208
|
children: "Back to Login"
|
|
9090
9209
|
}
|
|
9091
9210
|
)
|
|
9092
|
-
] }) : /* @__PURE__ */ (0,
|
|
9093
|
-
/* @__PURE__ */ (0,
|
|
9094
|
-
/* @__PURE__ */ (0,
|
|
9095
|
-
/* @__PURE__ */ (0,
|
|
9211
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
9212
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "mb-10", children: [
|
|
9213
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
|
|
9214
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
9096
9215
|
"Set a new, strong password for",
|
|
9097
9216
|
" ",
|
|
9098
|
-
/* @__PURE__ */ (0,
|
|
9217
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-indigo-600 font-medium", children: email })
|
|
9099
9218
|
] })
|
|
9100
9219
|
] }),
|
|
9101
|
-
/* @__PURE__ */ (0,
|
|
9220
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9102
9221
|
"form",
|
|
9103
9222
|
{
|
|
9104
9223
|
onSubmit: methods.handleSubmit(onSubmit),
|
|
9105
9224
|
className: "space-y-6",
|
|
9106
9225
|
children: [
|
|
9107
|
-
/* @__PURE__ */ (0,
|
|
9226
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9108
9227
|
Fields_default.Input,
|
|
9109
9228
|
{
|
|
9110
9229
|
form: methods,
|
|
@@ -9113,11 +9232,11 @@ function ResetPasswordPage() {
|
|
|
9113
9232
|
type: "password",
|
|
9114
9233
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
9115
9234
|
required: true,
|
|
9116
|
-
icon: /* @__PURE__ */ (0,
|
|
9235
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.Lock, { size: 18, className: "text-slate-400" }),
|
|
9117
9236
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
9118
9237
|
}
|
|
9119
9238
|
),
|
|
9120
|
-
/* @__PURE__ */ (0,
|
|
9239
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9121
9240
|
Fields_default.Input,
|
|
9122
9241
|
{
|
|
9123
9242
|
form: methods,
|
|
@@ -9126,11 +9245,11 @@ function ResetPasswordPage() {
|
|
|
9126
9245
|
type: "password",
|
|
9127
9246
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
9128
9247
|
required: true,
|
|
9129
|
-
icon: /* @__PURE__ */ (0,
|
|
9248
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.ShieldCheck, { size: 18, className: "text-slate-400" }),
|
|
9130
9249
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
9131
9250
|
}
|
|
9132
9251
|
),
|
|
9133
|
-
/* @__PURE__ */ (0,
|
|
9252
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9134
9253
|
Button,
|
|
9135
9254
|
{
|
|
9136
9255
|
type: "submit",
|
|
@@ -9138,7 +9257,7 @@ function ResetPasswordPage() {
|
|
|
9138
9257
|
className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
|
|
9139
9258
|
children: [
|
|
9140
9259
|
"Update Password",
|
|
9141
|
-
!isLoading && /* @__PURE__ */ (0,
|
|
9260
|
+
!isLoading && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.ArrowRight, { size: 18 })
|
|
9142
9261
|
]
|
|
9143
9262
|
}
|
|
9144
9263
|
)
|
|
@@ -9153,9 +9272,9 @@ var ResetPasswordPage_default = ResetPasswordPage;
|
|
|
9153
9272
|
|
|
9154
9273
|
// src/components/users/UserProfile.tsx
|
|
9155
9274
|
var import_lucide_react22 = require("lucide-react");
|
|
9156
|
-
var
|
|
9157
|
-
var
|
|
9158
|
-
var
|
|
9275
|
+
var import_react_router_dom9 = require("react-router-dom");
|
|
9276
|
+
var import_antd15 = require("antd");
|
|
9277
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
9159
9278
|
var UserProfile = ({
|
|
9160
9279
|
items,
|
|
9161
9280
|
name,
|
|
@@ -9166,7 +9285,7 @@ var UserProfile = ({
|
|
|
9166
9285
|
}) => {
|
|
9167
9286
|
const { post } = useApis_default();
|
|
9168
9287
|
const { user, logout: authLogout, account } = useAuth_default();
|
|
9169
|
-
const navigate = (0,
|
|
9288
|
+
const navigate = (0, import_react_router_dom9.useNavigate)();
|
|
9170
9289
|
const logout = async () => {
|
|
9171
9290
|
if (onLogout) {
|
|
9172
9291
|
onLogout();
|
|
@@ -9177,32 +9296,32 @@ var UserProfile = ({
|
|
|
9177
9296
|
url: `/users/logout/${user?._id}`,
|
|
9178
9297
|
v: 1
|
|
9179
9298
|
});
|
|
9180
|
-
|
|
9299
|
+
import_antd15.message.success("Logout successfully");
|
|
9181
9300
|
authLogout();
|
|
9182
9301
|
navigate("/login");
|
|
9183
9302
|
} catch (error) {
|
|
9184
9303
|
console.log(error);
|
|
9185
|
-
|
|
9304
|
+
import_antd15.message.error(error?.message);
|
|
9186
9305
|
}
|
|
9187
9306
|
};
|
|
9188
9307
|
const defaultItems = [
|
|
9189
9308
|
{
|
|
9190
9309
|
label: "My Profile",
|
|
9191
|
-
icon: /* @__PURE__ */ (0,
|
|
9310
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react22.User, { size: 18 }),
|
|
9192
9311
|
onClick: () => navigate("/profile"),
|
|
9193
9312
|
className: "min-w-[150px]"
|
|
9194
9313
|
},
|
|
9195
9314
|
{
|
|
9196
9315
|
label: "Logout",
|
|
9197
|
-
icon: /* @__PURE__ */ (0,
|
|
9316
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react22.LogOut, { size: 18 }),
|
|
9198
9317
|
onClick: logout,
|
|
9199
9318
|
className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
|
|
9200
9319
|
}
|
|
9201
9320
|
];
|
|
9202
|
-
return /* @__PURE__ */ (0,
|
|
9203
|
-
showThemeToggle && /* @__PURE__ */ (0,
|
|
9204
|
-
showThemeToggle && /* @__PURE__ */ (0,
|
|
9205
|
-
/* @__PURE__ */ (0,
|
|
9321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
9322
|
+
showThemeToggle && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ThemeToggle, {}),
|
|
9323
|
+
showThemeToggle && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
|
|
9324
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9206
9325
|
ProfileDropdown,
|
|
9207
9326
|
{
|
|
9208
9327
|
name: name || account?.name || "User",
|
|
@@ -9218,14 +9337,14 @@ var UserProfile = ({
|
|
|
9218
9337
|
var UserProfile_default = UserProfile;
|
|
9219
9338
|
|
|
9220
9339
|
// src/components/users/ProfilePage.tsx
|
|
9221
|
-
var
|
|
9340
|
+
var import_react_router_dom10 = require("react-router-dom");
|
|
9222
9341
|
var import_lucide_react23 = require("lucide-react");
|
|
9223
|
-
var
|
|
9342
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
9224
9343
|
var ProfilePage = () => {
|
|
9225
|
-
const navigate = (0,
|
|
9344
|
+
const navigate = (0, import_react_router_dom10.useNavigate)();
|
|
9226
9345
|
const { user, account } = useAuth();
|
|
9227
9346
|
if (!user) {
|
|
9228
|
-
return /* @__PURE__ */ (0,
|
|
9347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h1", { children: "Please login to view your profile" }) });
|
|
9229
9348
|
}
|
|
9230
9349
|
const extraInfo = [
|
|
9231
9350
|
{
|
|
@@ -9244,19 +9363,19 @@ var ProfilePage = () => {
|
|
|
9244
9363
|
copiable: false
|
|
9245
9364
|
}
|
|
9246
9365
|
];
|
|
9247
|
-
return /* @__PURE__ */ (0,
|
|
9248
|
-
/* @__PURE__ */ (0,
|
|
9366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-4 sm:p-8 space-y-6", children: [
|
|
9367
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9249
9368
|
Button,
|
|
9250
9369
|
{
|
|
9251
9370
|
variant: "outline",
|
|
9252
9371
|
size: "sm",
|
|
9253
9372
|
onClick: () => navigate(-1),
|
|
9254
|
-
icon: /* @__PURE__ */ (0,
|
|
9373
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react23.ArrowLeft, { size: 16 }),
|
|
9255
9374
|
className: "rounded-full font-bold px-5",
|
|
9256
9375
|
children: "Back"
|
|
9257
9376
|
}
|
|
9258
9377
|
) }),
|
|
9259
|
-
/* @__PURE__ */ (0,
|
|
9378
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9260
9379
|
ProfileView,
|
|
9261
9380
|
{
|
|
9262
9381
|
name: account?.name || "User Account",
|
|
@@ -9326,11 +9445,13 @@ var ProfilePage_default = ProfilePage;
|
|
|
9326
9445
|
ThemeToggle,
|
|
9327
9446
|
ThemedLogin,
|
|
9328
9447
|
UnProtectedRoute,
|
|
9448
|
+
UserForm,
|
|
9329
9449
|
UserProfile,
|
|
9330
9450
|
Users,
|
|
9331
9451
|
Views,
|
|
9332
9452
|
WarqadProvider,
|
|
9333
9453
|
createAccountSchema,
|
|
9454
|
+
createUserSchema,
|
|
9334
9455
|
generatePdf,
|
|
9335
9456
|
linkUserSchema,
|
|
9336
9457
|
resetPasswordSchema,
|