warqadui 0.0.70 → 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 -8
- package/dist/index.d.ts +22 -8
- package/dist/index.js +250 -155
- package/dist/index.mjs +248 -161
- 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");
|
|
@@ -8159,9 +8161,7 @@ var createAccountSchema = import_zod2.z.object({
|
|
|
8159
8161
|
message: "Please enter a valid email address"
|
|
8160
8162
|
}).transform((val) => val?.toLowerCase()),
|
|
8161
8163
|
phoneNumber: import_zod2.z.string().optional(),
|
|
8162
|
-
sex: import_zod2.z.enum(Enums_default.sex)
|
|
8163
|
-
owner: import_zod2.z.string().min(1, { message: "Owner is required" }),
|
|
8164
|
-
host: import_zod2.z.string().min(1, { message: "Host is required" })
|
|
8164
|
+
sex: import_zod2.z.enum(Enums_default.sex)
|
|
8165
8165
|
});
|
|
8166
8166
|
|
|
8167
8167
|
// src/components/accounts/AccountForm.tsx
|
|
@@ -8183,9 +8183,7 @@ function AccountForm() {
|
|
|
8183
8183
|
name: "",
|
|
8184
8184
|
email: "",
|
|
8185
8185
|
phoneNumber: "",
|
|
8186
|
-
sex: "male"
|
|
8187
|
-
owner: "",
|
|
8188
|
-
host: ""
|
|
8186
|
+
sex: "male"
|
|
8189
8187
|
},
|
|
8190
8188
|
shouldUnregister: false
|
|
8191
8189
|
});
|
|
@@ -8287,28 +8285,6 @@ function AccountForm() {
|
|
|
8287
8285
|
name: "phoneNumber",
|
|
8288
8286
|
placeholder: "Enter phone number"
|
|
8289
8287
|
}
|
|
8290
|
-
),
|
|
8291
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8292
|
-
Fields_default.SearchApi,
|
|
8293
|
-
{
|
|
8294
|
-
label: "Owner",
|
|
8295
|
-
form: methods,
|
|
8296
|
-
name: "owner",
|
|
8297
|
-
api: "/accounts/get/customer",
|
|
8298
|
-
placeholder: "Search for account owner...",
|
|
8299
|
-
required: true
|
|
8300
|
-
}
|
|
8301
|
-
),
|
|
8302
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
8303
|
-
Fields_default.Input,
|
|
8304
|
-
{
|
|
8305
|
-
label: "Host",
|
|
8306
|
-
form: methods,
|
|
8307
|
-
name: "host",
|
|
8308
|
-
type: "text",
|
|
8309
|
-
placeholder: "Unique host name",
|
|
8310
|
-
required: true
|
|
8311
|
-
}
|
|
8312
8288
|
)
|
|
8313
8289
|
] }),
|
|
8314
8290
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -8356,6 +8332,13 @@ var resetPasswordSchema = import_zod4.z.object({
|
|
|
8356
8332
|
token: import_zod4.z.string().min(1, { message: "Token is required" }),
|
|
8357
8333
|
password: import_zod4.z.string().min(6, { message: "Password must be at least 6 characters" })
|
|
8358
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
|
+
});
|
|
8359
8342
|
|
|
8360
8343
|
// src/components/users/linkUser.tsx
|
|
8361
8344
|
var import_react_hook_form9 = require("react-hook-form");
|
|
@@ -8634,7 +8617,8 @@ var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
|
8634
8617
|
function UpdateEmailForm({
|
|
8635
8618
|
data,
|
|
8636
8619
|
close,
|
|
8637
|
-
reload
|
|
8620
|
+
reload,
|
|
8621
|
+
app = ""
|
|
8638
8622
|
}) {
|
|
8639
8623
|
const { put, isLoading } = useApis_default();
|
|
8640
8624
|
const currentEmail = data?.email;
|
|
@@ -8649,7 +8633,7 @@ function UpdateEmailForm({
|
|
|
8649
8633
|
const onSubmit = async (formData) => {
|
|
8650
8634
|
try {
|
|
8651
8635
|
await put({
|
|
8652
|
-
url:
|
|
8636
|
+
url: `${app}/users/change_email/${data._id}`,
|
|
8653
8637
|
body: {
|
|
8654
8638
|
email: formData.newEmail
|
|
8655
8639
|
}
|
|
@@ -8722,7 +8706,8 @@ var { Countdown: Countdown2 } = import_antd11.Statistic;
|
|
|
8722
8706
|
function ResetPasswordForm({
|
|
8723
8707
|
data,
|
|
8724
8708
|
close,
|
|
8725
|
-
reload
|
|
8709
|
+
reload,
|
|
8710
|
+
app = ""
|
|
8726
8711
|
}) {
|
|
8727
8712
|
const { put, isLoading } = useApis_default();
|
|
8728
8713
|
const [datas, setDatas] = (0, import_react37.useState)(data);
|
|
@@ -8731,7 +8716,9 @@ function ResetPasswordForm({
|
|
|
8731
8716
|
);
|
|
8732
8717
|
(0, import_react37.useEffect)(() => {
|
|
8733
8718
|
setDatas(data);
|
|
8734
|
-
setHasPassed(
|
|
8719
|
+
setHasPassed(
|
|
8720
|
+
data?.passwordReset?.passed || !data?.passwordReset?.createdAt
|
|
8721
|
+
);
|
|
8735
8722
|
}, [data]);
|
|
8736
8723
|
const userEmail = data?.email;
|
|
8737
8724
|
const methods = (0, import_react_hook_form12.useForm)({
|
|
@@ -8754,7 +8741,7 @@ function ResetPasswordForm({
|
|
|
8754
8741
|
const resendToken = async () => {
|
|
8755
8742
|
try {
|
|
8756
8743
|
const res = await put({
|
|
8757
|
-
url:
|
|
8744
|
+
url: `${app}/users/reset_password/${data._id}`,
|
|
8758
8745
|
body: {
|
|
8759
8746
|
email: userEmail
|
|
8760
8747
|
}
|
|
@@ -8825,22 +8812,26 @@ var ResetPasswordForm_default = ResetPasswordForm;
|
|
|
8825
8812
|
var import_antd12 = require("antd");
|
|
8826
8813
|
var import_react38 = require("react");
|
|
8827
8814
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8828
|
-
var ActivateUser = ({ data }) => {
|
|
8815
|
+
var ActivateUser = ({ data, app = "" }) => {
|
|
8829
8816
|
const [checked, setChecked] = (0, import_react38.useState)(data?.isActive);
|
|
8830
8817
|
const { put, isLoading } = useApis_default();
|
|
8831
8818
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8832
8819
|
import_antd12.Switch,
|
|
8833
8820
|
{
|
|
8834
8821
|
onChange: async (e) => {
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
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
|
+
}
|
|
8844
8835
|
},
|
|
8845
8836
|
loading: isLoading,
|
|
8846
8837
|
checked,
|
|
@@ -8851,15 +8842,16 @@ var ActivateUser = ({ data }) => {
|
|
|
8851
8842
|
var Activate_default = ActivateUser;
|
|
8852
8843
|
|
|
8853
8844
|
// src/components/users/users.tsx
|
|
8845
|
+
var import_react_router_dom7 = require("react-router-dom");
|
|
8854
8846
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
8855
|
-
function Users() {
|
|
8847
|
+
function Users({ app = "" }) {
|
|
8848
|
+
const navigate = (0, import_react_router_dom7.useNavigate)();
|
|
8856
8849
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
8857
|
-
url:
|
|
8850
|
+
url: `${app}/users/get`,
|
|
8858
8851
|
v: 1,
|
|
8859
8852
|
dateFilter: false
|
|
8860
8853
|
});
|
|
8861
8854
|
const { Modal: Modal2, openState, close } = useModal();
|
|
8862
|
-
const { put, isLoading } = useApis_default();
|
|
8863
8855
|
const items = (data2) => [
|
|
8864
8856
|
{
|
|
8865
8857
|
label: `Reset Password`,
|
|
@@ -8871,6 +8863,7 @@ function Users() {
|
|
|
8871
8863
|
ResetPasswordForm_default,
|
|
8872
8864
|
{
|
|
8873
8865
|
data: data2,
|
|
8866
|
+
app,
|
|
8874
8867
|
close: () => close(),
|
|
8875
8868
|
reload: () => reload()
|
|
8876
8869
|
}
|
|
@@ -8889,7 +8882,8 @@ function Users() {
|
|
|
8889
8882
|
{
|
|
8890
8883
|
data: data2,
|
|
8891
8884
|
close: () => close(),
|
|
8892
|
-
reload: () => reload()
|
|
8885
|
+
reload: () => reload(),
|
|
8886
|
+
app
|
|
8893
8887
|
}
|
|
8894
8888
|
),
|
|
8895
8889
|
width: 600
|
|
@@ -8936,12 +8930,27 @@ function Users() {
|
|
|
8936
8930
|
] });
|
|
8937
8931
|
}
|
|
8938
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
|
+
},
|
|
8939
8948
|
{
|
|
8940
8949
|
accessorKey: "account.name",
|
|
8941
8950
|
header: "Employee Name",
|
|
8942
8951
|
cell: ({ row }) => {
|
|
8943
8952
|
const account = row.original?.account;
|
|
8944
|
-
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" });
|
|
8945
8954
|
}
|
|
8946
8955
|
},
|
|
8947
8956
|
{
|
|
@@ -8949,7 +8958,7 @@ function Users() {
|
|
|
8949
8958
|
header: "Status",
|
|
8950
8959
|
cell: ({ row }) => {
|
|
8951
8960
|
const data2 = row.original;
|
|
8952
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2 });
|
|
8961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2, app });
|
|
8953
8962
|
}
|
|
8954
8963
|
},
|
|
8955
8964
|
{
|
|
@@ -8981,7 +8990,9 @@ function Users() {
|
|
|
8981
8990
|
data: users,
|
|
8982
8991
|
index: true,
|
|
8983
8992
|
title: "User",
|
|
8984
|
-
description: "Manage users"
|
|
8993
|
+
description: "Manage users",
|
|
8994
|
+
createTitle: "Add User",
|
|
8995
|
+
onCreate: () => navigate("/users/create")
|
|
8985
8996
|
}
|
|
8986
8997
|
),
|
|
8987
8998
|
" "
|
|
@@ -8989,15 +9000,97 @@ function Users() {
|
|
|
8989
9000
|
}
|
|
8990
9001
|
var users_default = Users;
|
|
8991
9002
|
|
|
8992
|
-
// src/components/users/
|
|
8993
|
-
var import_react40 = require("react");
|
|
8994
|
-
var import_react_router_dom7 = require("react-router-dom");
|
|
8995
|
-
var import_lucide_react21 = require("lucide-react");
|
|
9003
|
+
// src/components/users/UserForm.tsx
|
|
8996
9004
|
var import_react_hook_form13 = require("react-hook-form");
|
|
8997
9005
|
var import_zod8 = require("@hookform/resolvers/zod");
|
|
8998
|
-
var z4 = __toESM(require("zod"));
|
|
8999
9006
|
var import_antd13 = require("antd");
|
|
9000
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");
|
|
9001
9094
|
var resetPageSchema = z4.object({
|
|
9002
9095
|
password: z4.string().min(6, "Password must be at least 6 characters"),
|
|
9003
9096
|
confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
|
|
@@ -9006,8 +9099,8 @@ var resetPageSchema = z4.object({
|
|
|
9006
9099
|
path: ["confirmPassword"]
|
|
9007
9100
|
});
|
|
9008
9101
|
function ResetPasswordPage() {
|
|
9009
|
-
const [searchParams] = (0,
|
|
9010
|
-
const navigate = (0,
|
|
9102
|
+
const [searchParams] = (0, import_react_router_dom8.useSearchParams)();
|
|
9103
|
+
const navigate = (0, import_react_router_dom8.useNavigate)();
|
|
9011
9104
|
const { put, isLoading } = useApis_default();
|
|
9012
9105
|
const [isVerified, setIsVerified] = (0, import_react40.useState)(false);
|
|
9013
9106
|
const [verifying, setVerifying] = (0, import_react40.useState)(true);
|
|
@@ -9015,8 +9108,8 @@ function ResetPasswordPage() {
|
|
|
9015
9108
|
const token = searchParams.get("token");
|
|
9016
9109
|
const email = searchParams.get("email");
|
|
9017
9110
|
const id = searchParams.get("id");
|
|
9018
|
-
const methods = (0,
|
|
9019
|
-
resolver: (0,
|
|
9111
|
+
const methods = (0, import_react_hook_form14.useForm)({
|
|
9112
|
+
resolver: (0, import_zod9.zodResolver)(resetPageSchema),
|
|
9020
9113
|
defaultValues: {
|
|
9021
9114
|
password: "",
|
|
9022
9115
|
confirmPassword: ""
|
|
@@ -9054,23 +9147,23 @@ function ResetPasswordPage() {
|
|
|
9054
9147
|
password: data.password
|
|
9055
9148
|
}
|
|
9056
9149
|
});
|
|
9057
|
-
|
|
9150
|
+
import_antd14.message.success(
|
|
9058
9151
|
"Password has been reset successfully. You can now login."
|
|
9059
9152
|
);
|
|
9060
9153
|
navigate("/login", { replace: true });
|
|
9061
9154
|
} catch (err) {
|
|
9062
|
-
|
|
9155
|
+
import_antd14.message.error(err?.message || "Failed to reset password.");
|
|
9063
9156
|
}
|
|
9064
9157
|
};
|
|
9065
9158
|
if (verifying) {
|
|
9066
|
-
return /* @__PURE__ */ (0,
|
|
9067
|
-
/* @__PURE__ */ (0,
|
|
9068
|
-
/* @__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..." })
|
|
9069
9162
|
] }) });
|
|
9070
9163
|
}
|
|
9071
|
-
return /* @__PURE__ */ (0,
|
|
9072
|
-
/* @__PURE__ */ (0,
|
|
9073
|
-
/* @__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)(
|
|
9074
9167
|
"div",
|
|
9075
9168
|
{
|
|
9076
9169
|
className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
|
|
@@ -9079,35 +9172,35 @@ function ResetPasswordPage() {
|
|
|
9079
9172
|
}
|
|
9080
9173
|
}
|
|
9081
9174
|
),
|
|
9082
|
-
/* @__PURE__ */ (0,
|
|
9083
|
-
/* @__PURE__ */ (0,
|
|
9084
|
-
/* @__PURE__ */ (0,
|
|
9085
|
-
/* @__PURE__ */ (0,
|
|
9086
|
-
/* @__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" })
|
|
9087
9180
|
] }),
|
|
9088
|
-
/* @__PURE__ */ (0,
|
|
9089
|
-
/* @__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: [
|
|
9090
9183
|
"Secure ",
|
|
9091
|
-
/* @__PURE__ */ (0,
|
|
9184
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-indigo-400", children: "Access" }),
|
|
9092
9185
|
" ",
|
|
9093
|
-
/* @__PURE__ */ (0,
|
|
9186
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("br", {}),
|
|
9094
9187
|
" ",
|
|
9095
9188
|
"Simplified."
|
|
9096
9189
|
] }),
|
|
9097
|
-
/* @__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." })
|
|
9098
9191
|
] }),
|
|
9099
|
-
/* @__PURE__ */ (0,
|
|
9192
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
|
|
9100
9193
|
] })
|
|
9101
9194
|
] }),
|
|
9102
|
-
/* @__PURE__ */ (0,
|
|
9103
|
-
/* @__PURE__ */ (0,
|
|
9104
|
-
/* @__PURE__ */ (0,
|
|
9105
|
-
/* @__PURE__ */ (0,
|
|
9106
|
-
/* @__PURE__ */ (0,
|
|
9107
|
-
/* @__PURE__ */ (0,
|
|
9108
|
-
/* @__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." })
|
|
9109
9202
|
] }),
|
|
9110
|
-
/* @__PURE__ */ (0,
|
|
9203
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9111
9204
|
Button,
|
|
9112
9205
|
{
|
|
9113
9206
|
onClick: () => navigate("/login"),
|
|
@@ -9115,22 +9208,22 @@ function ResetPasswordPage() {
|
|
|
9115
9208
|
children: "Back to Login"
|
|
9116
9209
|
}
|
|
9117
9210
|
)
|
|
9118
|
-
] }) : /* @__PURE__ */ (0,
|
|
9119
|
-
/* @__PURE__ */ (0,
|
|
9120
|
-
/* @__PURE__ */ (0,
|
|
9121
|
-
/* @__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: [
|
|
9122
9215
|
"Set a new, strong password for",
|
|
9123
9216
|
" ",
|
|
9124
|
-
/* @__PURE__ */ (0,
|
|
9217
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-indigo-600 font-medium", children: email })
|
|
9125
9218
|
] })
|
|
9126
9219
|
] }),
|
|
9127
|
-
/* @__PURE__ */ (0,
|
|
9220
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9128
9221
|
"form",
|
|
9129
9222
|
{
|
|
9130
9223
|
onSubmit: methods.handleSubmit(onSubmit),
|
|
9131
9224
|
className: "space-y-6",
|
|
9132
9225
|
children: [
|
|
9133
|
-
/* @__PURE__ */ (0,
|
|
9226
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9134
9227
|
Fields_default.Input,
|
|
9135
9228
|
{
|
|
9136
9229
|
form: methods,
|
|
@@ -9139,11 +9232,11 @@ function ResetPasswordPage() {
|
|
|
9139
9232
|
type: "password",
|
|
9140
9233
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
9141
9234
|
required: true,
|
|
9142
|
-
icon: /* @__PURE__ */ (0,
|
|
9235
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.Lock, { size: 18, className: "text-slate-400" }),
|
|
9143
9236
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
9144
9237
|
}
|
|
9145
9238
|
),
|
|
9146
|
-
/* @__PURE__ */ (0,
|
|
9239
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9147
9240
|
Fields_default.Input,
|
|
9148
9241
|
{
|
|
9149
9242
|
form: methods,
|
|
@@ -9152,11 +9245,11 @@ function ResetPasswordPage() {
|
|
|
9152
9245
|
type: "password",
|
|
9153
9246
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
9154
9247
|
required: true,
|
|
9155
|
-
icon: /* @__PURE__ */ (0,
|
|
9248
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.ShieldCheck, { size: 18, className: "text-slate-400" }),
|
|
9156
9249
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
9157
9250
|
}
|
|
9158
9251
|
),
|
|
9159
|
-
/* @__PURE__ */ (0,
|
|
9252
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
9160
9253
|
Button,
|
|
9161
9254
|
{
|
|
9162
9255
|
type: "submit",
|
|
@@ -9164,7 +9257,7 @@ function ResetPasswordPage() {
|
|
|
9164
9257
|
className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
|
|
9165
9258
|
children: [
|
|
9166
9259
|
"Update Password",
|
|
9167
|
-
!isLoading && /* @__PURE__ */ (0,
|
|
9260
|
+
!isLoading && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react21.ArrowRight, { size: 18 })
|
|
9168
9261
|
]
|
|
9169
9262
|
}
|
|
9170
9263
|
)
|
|
@@ -9179,9 +9272,9 @@ var ResetPasswordPage_default = ResetPasswordPage;
|
|
|
9179
9272
|
|
|
9180
9273
|
// src/components/users/UserProfile.tsx
|
|
9181
9274
|
var import_lucide_react22 = require("lucide-react");
|
|
9182
|
-
var
|
|
9183
|
-
var
|
|
9184
|
-
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");
|
|
9185
9278
|
var UserProfile = ({
|
|
9186
9279
|
items,
|
|
9187
9280
|
name,
|
|
@@ -9192,7 +9285,7 @@ var UserProfile = ({
|
|
|
9192
9285
|
}) => {
|
|
9193
9286
|
const { post } = useApis_default();
|
|
9194
9287
|
const { user, logout: authLogout, account } = useAuth_default();
|
|
9195
|
-
const navigate = (0,
|
|
9288
|
+
const navigate = (0, import_react_router_dom9.useNavigate)();
|
|
9196
9289
|
const logout = async () => {
|
|
9197
9290
|
if (onLogout) {
|
|
9198
9291
|
onLogout();
|
|
@@ -9203,32 +9296,32 @@ var UserProfile = ({
|
|
|
9203
9296
|
url: `/users/logout/${user?._id}`,
|
|
9204
9297
|
v: 1
|
|
9205
9298
|
});
|
|
9206
|
-
|
|
9299
|
+
import_antd15.message.success("Logout successfully");
|
|
9207
9300
|
authLogout();
|
|
9208
9301
|
navigate("/login");
|
|
9209
9302
|
} catch (error) {
|
|
9210
9303
|
console.log(error);
|
|
9211
|
-
|
|
9304
|
+
import_antd15.message.error(error?.message);
|
|
9212
9305
|
}
|
|
9213
9306
|
};
|
|
9214
9307
|
const defaultItems = [
|
|
9215
9308
|
{
|
|
9216
9309
|
label: "My Profile",
|
|
9217
|
-
icon: /* @__PURE__ */ (0,
|
|
9310
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react22.User, { size: 18 }),
|
|
9218
9311
|
onClick: () => navigate("/profile"),
|
|
9219
9312
|
className: "min-w-[150px]"
|
|
9220
9313
|
},
|
|
9221
9314
|
{
|
|
9222
9315
|
label: "Logout",
|
|
9223
|
-
icon: /* @__PURE__ */ (0,
|
|
9316
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react22.LogOut, { size: 18 }),
|
|
9224
9317
|
onClick: logout,
|
|
9225
9318
|
className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
|
|
9226
9319
|
}
|
|
9227
9320
|
];
|
|
9228
|
-
return /* @__PURE__ */ (0,
|
|
9229
|
-
showThemeToggle && /* @__PURE__ */ (0,
|
|
9230
|
-
showThemeToggle && /* @__PURE__ */ (0,
|
|
9231
|
-
/* @__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)(
|
|
9232
9325
|
ProfileDropdown,
|
|
9233
9326
|
{
|
|
9234
9327
|
name: name || account?.name || "User",
|
|
@@ -9244,14 +9337,14 @@ var UserProfile = ({
|
|
|
9244
9337
|
var UserProfile_default = UserProfile;
|
|
9245
9338
|
|
|
9246
9339
|
// src/components/users/ProfilePage.tsx
|
|
9247
|
-
var
|
|
9340
|
+
var import_react_router_dom10 = require("react-router-dom");
|
|
9248
9341
|
var import_lucide_react23 = require("lucide-react");
|
|
9249
|
-
var
|
|
9342
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
9250
9343
|
var ProfilePage = () => {
|
|
9251
|
-
const navigate = (0,
|
|
9344
|
+
const navigate = (0, import_react_router_dom10.useNavigate)();
|
|
9252
9345
|
const { user, account } = useAuth();
|
|
9253
9346
|
if (!user) {
|
|
9254
|
-
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" }) });
|
|
9255
9348
|
}
|
|
9256
9349
|
const extraInfo = [
|
|
9257
9350
|
{
|
|
@@ -9270,19 +9363,19 @@ var ProfilePage = () => {
|
|
|
9270
9363
|
copiable: false
|
|
9271
9364
|
}
|
|
9272
9365
|
];
|
|
9273
|
-
return /* @__PURE__ */ (0,
|
|
9274
|
-
/* @__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)(
|
|
9275
9368
|
Button,
|
|
9276
9369
|
{
|
|
9277
9370
|
variant: "outline",
|
|
9278
9371
|
size: "sm",
|
|
9279
9372
|
onClick: () => navigate(-1),
|
|
9280
|
-
icon: /* @__PURE__ */ (0,
|
|
9373
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react23.ArrowLeft, { size: 16 }),
|
|
9281
9374
|
className: "rounded-full font-bold px-5",
|
|
9282
9375
|
children: "Back"
|
|
9283
9376
|
}
|
|
9284
9377
|
) }),
|
|
9285
|
-
/* @__PURE__ */ (0,
|
|
9378
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9286
9379
|
ProfileView,
|
|
9287
9380
|
{
|
|
9288
9381
|
name: account?.name || "User Account",
|
|
@@ -9352,11 +9445,13 @@ var ProfilePage_default = ProfilePage;
|
|
|
9352
9445
|
ThemeToggle,
|
|
9353
9446
|
ThemedLogin,
|
|
9354
9447
|
UnProtectedRoute,
|
|
9448
|
+
UserForm,
|
|
9355
9449
|
UserProfile,
|
|
9356
9450
|
Users,
|
|
9357
9451
|
Views,
|
|
9358
9452
|
WarqadProvider,
|
|
9359
9453
|
createAccountSchema,
|
|
9454
|
+
createUserSchema,
|
|
9360
9455
|
generatePdf,
|
|
9361
9456
|
linkUserSchema,
|
|
9362
9457
|
resetPasswordSchema,
|