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.mjs
CHANGED
|
@@ -933,7 +933,7 @@ var CardTitle = ({
|
|
|
933
933
|
"h3",
|
|
934
934
|
{
|
|
935
935
|
className: cn(
|
|
936
|
-
"text-
|
|
936
|
+
"text-xl capitalize font-bold leading-none tracking-tight text-gray-900 dark:text-gray-100 ",
|
|
937
937
|
className
|
|
938
938
|
),
|
|
939
939
|
children
|
|
@@ -1064,13 +1064,13 @@ var Input = forwardRef(
|
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
}, [props.value, name, form]);
|
|
1067
|
-
let
|
|
1067
|
+
let message14 = error;
|
|
1068
1068
|
if (form && name) {
|
|
1069
1069
|
const {
|
|
1070
1070
|
formState: { errors }
|
|
1071
1071
|
} = form;
|
|
1072
1072
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1073
|
-
|
|
1073
|
+
message14 = errorObj?.message;
|
|
1074
1074
|
}
|
|
1075
1075
|
const watchedValue = form?.watch(name);
|
|
1076
1076
|
useEffect6(() => {
|
|
@@ -1139,7 +1139,7 @@ var Input = forwardRef(
|
|
|
1139
1139
|
}
|
|
1140
1140
|
)
|
|
1141
1141
|
] }),
|
|
1142
|
-
|
|
1142
|
+
message14 && /* @__PURE__ */ jsx15("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
1143
1143
|
]
|
|
1144
1144
|
}
|
|
1145
1145
|
);
|
|
@@ -1464,7 +1464,7 @@ var PhoneInput = forwardRef2(
|
|
|
1464
1464
|
const [isFocused, setIsFocused] = useState10(false);
|
|
1465
1465
|
const { theme } = useWarqadConfig();
|
|
1466
1466
|
const primaryColor = theme?.primaryColor;
|
|
1467
|
-
let
|
|
1467
|
+
let message14 = error;
|
|
1468
1468
|
if (form && name) {
|
|
1469
1469
|
const {
|
|
1470
1470
|
formState: { errors }
|
|
@@ -1474,7 +1474,7 @@ var PhoneInput = forwardRef2(
|
|
|
1474
1474
|
for (const part of nameParts) {
|
|
1475
1475
|
currentError = currentError?.[part];
|
|
1476
1476
|
}
|
|
1477
|
-
|
|
1477
|
+
message14 = currentError?.message || message14;
|
|
1478
1478
|
}
|
|
1479
1479
|
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs14("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1480
1480
|
/* @__PURE__ */ jsxs14(
|
|
@@ -1525,7 +1525,7 @@ var PhoneInput = forwardRef2(
|
|
|
1525
1525
|
}
|
|
1526
1526
|
)
|
|
1527
1527
|
] }),
|
|
1528
|
-
|
|
1528
|
+
message14 && /* @__PURE__ */ jsx19("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
1529
1529
|
] });
|
|
1530
1530
|
if (form && name) {
|
|
1531
1531
|
return /* @__PURE__ */ jsx19(
|
|
@@ -1681,7 +1681,7 @@ var SelectRoot = ({
|
|
|
1681
1681
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1682
1682
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1683
1683
|
}, [fieldInternalProps]);
|
|
1684
|
-
let
|
|
1684
|
+
let message14 = error;
|
|
1685
1685
|
if (form && name) {
|
|
1686
1686
|
const {
|
|
1687
1687
|
formState: { errors }
|
|
@@ -1691,7 +1691,7 @@ var SelectRoot = ({
|
|
|
1691
1691
|
for (const part of nameParts) {
|
|
1692
1692
|
currentError = currentError?.[part];
|
|
1693
1693
|
}
|
|
1694
|
-
|
|
1694
|
+
message14 = currentError?.message || message14;
|
|
1695
1695
|
}
|
|
1696
1696
|
const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
|
|
1697
1697
|
const valueCtx = {
|
|
@@ -1752,7 +1752,7 @@ var SelectRoot = ({
|
|
|
1752
1752
|
String(opt.value) || index
|
|
1753
1753
|
)) })
|
|
1754
1754
|
] }),
|
|
1755
|
-
|
|
1755
|
+
message14 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
1756
1756
|
]
|
|
1757
1757
|
}
|
|
1758
1758
|
) });
|
|
@@ -1990,13 +1990,13 @@ var Textarea = forwardRef4(
|
|
|
1990
1990
|
const [isFocused, setIsFocused] = useState12(false);
|
|
1991
1991
|
const { theme } = useWarqadConfig();
|
|
1992
1992
|
const primaryColor = theme?.primaryColor;
|
|
1993
|
-
let
|
|
1993
|
+
let message14 = error;
|
|
1994
1994
|
if (form && name) {
|
|
1995
1995
|
const {
|
|
1996
1996
|
formState: { errors }
|
|
1997
1997
|
} = form;
|
|
1998
1998
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1999
|
-
|
|
1999
|
+
message14 = errorObj?.message;
|
|
2000
2000
|
}
|
|
2001
2001
|
const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs16("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
2002
2002
|
/* @__PURE__ */ jsxs16(
|
|
@@ -2034,7 +2034,7 @@ var Textarea = forwardRef4(
|
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
2036
|
) }),
|
|
2037
|
-
|
|
2037
|
+
message14 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
2038
2038
|
] });
|
|
2039
2039
|
useEffect8(() => {
|
|
2040
2040
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
@@ -2527,7 +2527,7 @@ var SearchApiRoot = ({
|
|
|
2527
2527
|
const filteredOptions = options.filter(
|
|
2528
2528
|
(option) => !filter.includes(getOptionValue(option))
|
|
2529
2529
|
);
|
|
2530
|
-
let
|
|
2530
|
+
let message14 = error || errorMessage;
|
|
2531
2531
|
if (form && name) {
|
|
2532
2532
|
const {
|
|
2533
2533
|
formState: { errors }
|
|
@@ -2537,7 +2537,7 @@ var SearchApiRoot = ({
|
|
|
2537
2537
|
for (const part of nameParts) {
|
|
2538
2538
|
currentError = currentError?.[part];
|
|
2539
2539
|
}
|
|
2540
|
-
|
|
2540
|
+
message14 = currentError?.message || message14;
|
|
2541
2541
|
}
|
|
2542
2542
|
const valueCtx = {
|
|
2543
2543
|
isOpen,
|
|
@@ -2571,7 +2571,7 @@ var SearchApiRoot = ({
|
|
|
2571
2571
|
form,
|
|
2572
2572
|
name,
|
|
2573
2573
|
obj,
|
|
2574
|
-
error:
|
|
2574
|
+
error: message14,
|
|
2575
2575
|
onSelect,
|
|
2576
2576
|
onClear
|
|
2577
2577
|
};
|
|
@@ -2940,19 +2940,19 @@ var DateInput = forwardRef6(
|
|
|
2940
2940
|
const { theme } = useWarqadConfig();
|
|
2941
2941
|
const primaryColor = theme?.primaryColor;
|
|
2942
2942
|
const [isFocused, setIsFocused] = useState15(false);
|
|
2943
|
-
let
|
|
2943
|
+
let message14 = error;
|
|
2944
2944
|
if (form && name) {
|
|
2945
2945
|
const {
|
|
2946
2946
|
formState: { errors }
|
|
2947
2947
|
} = form;
|
|
2948
2948
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
2949
|
-
|
|
2949
|
+
message14 = errorObj?.message;
|
|
2950
2950
|
}
|
|
2951
2951
|
const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
|
|
2952
2952
|
bg-white! dark:bg-zinc-900!
|
|
2953
2953
|
text-gray-900! dark:text-zinc-100!
|
|
2954
2954
|
hover:bg-white! dark:hover:bg-zinc-900!
|
|
2955
|
-
${
|
|
2955
|
+
${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"}
|
|
2956
2956
|
[&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
|
|
2957
2957
|
${className}`;
|
|
2958
2958
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
@@ -2975,8 +2975,8 @@ var DateInput = forwardRef6(
|
|
|
2975
2975
|
needConfirm: false,
|
|
2976
2976
|
style: {
|
|
2977
2977
|
height: "var(--input-height, 40px)",
|
|
2978
|
-
borderColor: isFocused && !
|
|
2979
|
-
boxShadow: isFocused && !
|
|
2978
|
+
borderColor: isFocused && !message14 ? primaryColor : void 0,
|
|
2979
|
+
boxShadow: isFocused && !message14 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
2980
2980
|
},
|
|
2981
2981
|
classNames: { popup: { root: "z-50" } },
|
|
2982
2982
|
suffixIcon: /* @__PURE__ */ jsx23(
|
|
@@ -3006,7 +3006,7 @@ var DateInput = forwardRef6(
|
|
|
3006
3006
|
{
|
|
3007
3007
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
3008
3008
|
style: {
|
|
3009
|
-
color:
|
|
3009
|
+
color: message14 ? "#ef4444" : isFocused ? primaryColor : void 0
|
|
3010
3010
|
},
|
|
3011
3011
|
children: [
|
|
3012
3012
|
label,
|
|
@@ -3027,7 +3027,7 @@ var DateInput = forwardRef6(
|
|
|
3027
3027
|
)
|
|
3028
3028
|
}
|
|
3029
3029
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
3030
|
-
|
|
3030
|
+
message14 && /* @__PURE__ */ jsx23("p", { className: "text-sm text-red-600 dark:text-red-400", children: message14 })
|
|
3031
3031
|
] });
|
|
3032
3032
|
}
|
|
3033
3033
|
);
|
|
@@ -7352,17 +7352,17 @@ var preWarningFns = [];
|
|
|
7352
7352
|
var preMessage = (fn) => {
|
|
7353
7353
|
preWarningFns.push(fn);
|
|
7354
7354
|
};
|
|
7355
|
-
function warning(valid,
|
|
7355
|
+
function warning(valid, message14) {
|
|
7356
7356
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
7357
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"),
|
|
7357
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message14);
|
|
7358
7358
|
if (finalMessage) {
|
|
7359
7359
|
console.error(`Warning: ${finalMessage}`);
|
|
7360
7360
|
}
|
|
7361
7361
|
}
|
|
7362
7362
|
}
|
|
7363
|
-
function note(valid,
|
|
7363
|
+
function note(valid, message14) {
|
|
7364
7364
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
7365
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"),
|
|
7365
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message14);
|
|
7366
7366
|
if (finalMessage) {
|
|
7367
7367
|
console.warn(`Note: ${finalMessage}`);
|
|
7368
7368
|
}
|
|
@@ -7371,17 +7371,17 @@ function note(valid, message13) {
|
|
|
7371
7371
|
function resetWarned() {
|
|
7372
7372
|
warned = {};
|
|
7373
7373
|
}
|
|
7374
|
-
function call(method, valid,
|
|
7375
|
-
if (!valid && !warned[
|
|
7376
|
-
method(false,
|
|
7377
|
-
warned[
|
|
7374
|
+
function call(method, valid, message14) {
|
|
7375
|
+
if (!valid && !warned[message14]) {
|
|
7376
|
+
method(false, message14);
|
|
7377
|
+
warned[message14] = true;
|
|
7378
7378
|
}
|
|
7379
7379
|
}
|
|
7380
|
-
function warningOnce(valid,
|
|
7381
|
-
call(warning, valid,
|
|
7380
|
+
function warningOnce(valid, message14) {
|
|
7381
|
+
call(warning, valid, message14);
|
|
7382
7382
|
}
|
|
7383
|
-
function noteOnce(valid,
|
|
7384
|
-
call(note, valid,
|
|
7383
|
+
function noteOnce(valid, message14) {
|
|
7384
|
+
call(note, valid, message14);
|
|
7385
7385
|
}
|
|
7386
7386
|
warningOnce.preMessage = preMessage;
|
|
7387
7387
|
warningOnce.resetWarned = resetWarned;
|
|
@@ -7392,8 +7392,8 @@ import React19, { useContext as useContext5, useEffect as useEffect16 } from "re
|
|
|
7392
7392
|
function camelCase(input) {
|
|
7393
7393
|
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
7394
7394
|
}
|
|
7395
|
-
function warning2(valid,
|
|
7396
|
-
warningOnce(valid, `[@ant-design/icons] ${
|
|
7395
|
+
function warning2(valid, message14) {
|
|
7396
|
+
warningOnce(valid, `[@ant-design/icons] ${message14}`);
|
|
7397
7397
|
}
|
|
7398
7398
|
function isIconDefinition(target) {
|
|
7399
7399
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -8128,9 +8128,7 @@ var createAccountSchema = z2.object({
|
|
|
8128
8128
|
message: "Please enter a valid email address"
|
|
8129
8129
|
}).transform((val) => val?.toLowerCase()),
|
|
8130
8130
|
phoneNumber: z2.string().optional(),
|
|
8131
|
-
sex: z2.enum(Enums_default.sex)
|
|
8132
|
-
owner: z2.string().min(1, { message: "Owner is required" }),
|
|
8133
|
-
host: z2.string().min(1, { message: "Host is required" })
|
|
8131
|
+
sex: z2.enum(Enums_default.sex)
|
|
8134
8132
|
});
|
|
8135
8133
|
|
|
8136
8134
|
// src/components/accounts/AccountForm.tsx
|
|
@@ -8152,9 +8150,7 @@ function AccountForm() {
|
|
|
8152
8150
|
name: "",
|
|
8153
8151
|
email: "",
|
|
8154
8152
|
phoneNumber: "",
|
|
8155
|
-
sex: "male"
|
|
8156
|
-
owner: "",
|
|
8157
|
-
host: ""
|
|
8153
|
+
sex: "male"
|
|
8158
8154
|
},
|
|
8159
8155
|
shouldUnregister: false
|
|
8160
8156
|
});
|
|
@@ -8256,28 +8252,6 @@ function AccountForm() {
|
|
|
8256
8252
|
name: "phoneNumber",
|
|
8257
8253
|
placeholder: "Enter phone number"
|
|
8258
8254
|
}
|
|
8259
|
-
),
|
|
8260
|
-
/* @__PURE__ */ jsx43(
|
|
8261
|
-
Fields_default.SearchApi,
|
|
8262
|
-
{
|
|
8263
|
-
label: "Owner",
|
|
8264
|
-
form: methods,
|
|
8265
|
-
name: "owner",
|
|
8266
|
-
api: "/accounts/get/customer",
|
|
8267
|
-
placeholder: "Search for account owner...",
|
|
8268
|
-
required: true
|
|
8269
|
-
}
|
|
8270
|
-
),
|
|
8271
|
-
/* @__PURE__ */ jsx43(
|
|
8272
|
-
Fields_default.Input,
|
|
8273
|
-
{
|
|
8274
|
-
label: "Host",
|
|
8275
|
-
form: methods,
|
|
8276
|
-
name: "host",
|
|
8277
|
-
type: "text",
|
|
8278
|
-
placeholder: "Unique host name",
|
|
8279
|
-
required: true
|
|
8280
|
-
}
|
|
8281
8255
|
)
|
|
8282
8256
|
] }),
|
|
8283
8257
|
/* @__PURE__ */ jsx43("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx43(
|
|
@@ -8325,6 +8299,13 @@ var resetPasswordSchema = z3.object({
|
|
|
8325
8299
|
token: z3.string().min(1, { message: "Token is required" }),
|
|
8326
8300
|
password: z3.string().min(6, { message: "Password must be at least 6 characters" })
|
|
8327
8301
|
});
|
|
8302
|
+
var createUserSchema = z3.object({
|
|
8303
|
+
email: z3.string().refine((val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
|
|
8304
|
+
message: "Please enter a valid email address"
|
|
8305
|
+
}).transform((val) => val?.toLowerCase()),
|
|
8306
|
+
phoneNumber: z3.string().optional(),
|
|
8307
|
+
role: z3.enum(["admin"])
|
|
8308
|
+
});
|
|
8328
8309
|
|
|
8329
8310
|
// src/components/users/linkUser.tsx
|
|
8330
8311
|
import { useForm as useForm3 } from "react-hook-form";
|
|
@@ -8450,13 +8431,7 @@ var linkUser_default = LinkUser;
|
|
|
8450
8431
|
|
|
8451
8432
|
// src/components/users/users.tsx
|
|
8452
8433
|
import { useMemo as useMemo8 } from "react";
|
|
8453
|
-
import {
|
|
8454
|
-
EllipsisVertical as EllipsisVertical2,
|
|
8455
|
-
Info,
|
|
8456
|
-
Mail as Mail2,
|
|
8457
|
-
ShieldCheck,
|
|
8458
|
-
Key
|
|
8459
|
-
} from "lucide-react";
|
|
8434
|
+
import { EllipsisVertical as EllipsisVertical2, Info, Mail as Mail2, ShieldCheck, Key } from "lucide-react";
|
|
8460
8435
|
|
|
8461
8436
|
// src/components/users/VerifyEmailForm.tsx
|
|
8462
8437
|
import { useForm as useForm4 } from "react-hook-form";
|
|
@@ -8609,7 +8584,8 @@ import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
|
8609
8584
|
function UpdateEmailForm({
|
|
8610
8585
|
data,
|
|
8611
8586
|
close,
|
|
8612
|
-
reload
|
|
8587
|
+
reload,
|
|
8588
|
+
app = ""
|
|
8613
8589
|
}) {
|
|
8614
8590
|
const { put, isLoading } = useApis_default();
|
|
8615
8591
|
const currentEmail = data?.email;
|
|
@@ -8624,7 +8600,7 @@ function UpdateEmailForm({
|
|
|
8624
8600
|
const onSubmit = async (formData) => {
|
|
8625
8601
|
try {
|
|
8626
8602
|
await put({
|
|
8627
|
-
url:
|
|
8603
|
+
url: `${app}/users/change_email/${data._id}`,
|
|
8628
8604
|
body: {
|
|
8629
8605
|
email: formData.newEmail
|
|
8630
8606
|
}
|
|
@@ -8697,7 +8673,8 @@ var { Countdown: Countdown2 } = Statistic2;
|
|
|
8697
8673
|
function ResetPasswordForm({
|
|
8698
8674
|
data,
|
|
8699
8675
|
close,
|
|
8700
|
-
reload
|
|
8676
|
+
reload,
|
|
8677
|
+
app = ""
|
|
8701
8678
|
}) {
|
|
8702
8679
|
const { put, isLoading } = useApis_default();
|
|
8703
8680
|
const [datas, setDatas] = useState27(data);
|
|
@@ -8706,7 +8683,9 @@ function ResetPasswordForm({
|
|
|
8706
8683
|
);
|
|
8707
8684
|
useEffect21(() => {
|
|
8708
8685
|
setDatas(data);
|
|
8709
|
-
setHasPassed(
|
|
8686
|
+
setHasPassed(
|
|
8687
|
+
data?.passwordReset?.passed || !data?.passwordReset?.createdAt
|
|
8688
|
+
);
|
|
8710
8689
|
}, [data]);
|
|
8711
8690
|
const userEmail = data?.email;
|
|
8712
8691
|
const methods = useForm6({
|
|
@@ -8729,7 +8708,7 @@ function ResetPasswordForm({
|
|
|
8729
8708
|
const resendToken = async () => {
|
|
8730
8709
|
try {
|
|
8731
8710
|
const res = await put({
|
|
8732
|
-
url:
|
|
8711
|
+
url: `${app}/users/reset_password/${data._id}`,
|
|
8733
8712
|
body: {
|
|
8734
8713
|
email: userEmail
|
|
8735
8714
|
}
|
|
@@ -8800,22 +8779,26 @@ var ResetPasswordForm_default = ResetPasswordForm;
|
|
|
8800
8779
|
import { message as message10, Switch } from "antd";
|
|
8801
8780
|
import { useState as useState28 } from "react";
|
|
8802
8781
|
import { Fragment as Fragment10, jsx as jsx48 } from "react/jsx-runtime";
|
|
8803
|
-
var ActivateUser = ({ data }) => {
|
|
8782
|
+
var ActivateUser = ({ data, app = "" }) => {
|
|
8804
8783
|
const [checked, setChecked] = useState28(data?.isActive);
|
|
8805
8784
|
const { put, isLoading } = useApis_default();
|
|
8806
8785
|
return /* @__PURE__ */ jsx48(Fragment10, { children: /* @__PURE__ */ jsx48(
|
|
8807
8786
|
Switch,
|
|
8808
8787
|
{
|
|
8809
8788
|
onChange: async (e) => {
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8789
|
+
try {
|
|
8790
|
+
const res = await put({
|
|
8791
|
+
url: `${app}/users/activate/${data?._id}`,
|
|
8792
|
+
v: 1,
|
|
8793
|
+
body: { isActive: e }
|
|
8794
|
+
});
|
|
8795
|
+
message10.success(
|
|
8796
|
+
res?.data?.isActive ? "User Activated" : "User Deactivated"
|
|
8797
|
+
);
|
|
8798
|
+
setChecked(res?.data?.isActive);
|
|
8799
|
+
} catch (error) {
|
|
8800
|
+
message10.error(error?.message || "Failed to update user status");
|
|
8801
|
+
}
|
|
8819
8802
|
},
|
|
8820
8803
|
loading: isLoading,
|
|
8821
8804
|
checked,
|
|
@@ -8826,15 +8809,16 @@ var ActivateUser = ({ data }) => {
|
|
|
8826
8809
|
var Activate_default = ActivateUser;
|
|
8827
8810
|
|
|
8828
8811
|
// src/components/users/users.tsx
|
|
8812
|
+
import { useNavigate as useNavigate6 } from "react-router-dom";
|
|
8829
8813
|
import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
8830
|
-
function Users() {
|
|
8814
|
+
function Users({ app = "" }) {
|
|
8815
|
+
const navigate = useNavigate6();
|
|
8831
8816
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
8832
|
-
url:
|
|
8817
|
+
url: `${app}/users/get`,
|
|
8833
8818
|
v: 1,
|
|
8834
8819
|
dateFilter: false
|
|
8835
8820
|
});
|
|
8836
8821
|
const { Modal: Modal2, openState, close } = useModal();
|
|
8837
|
-
const { put, isLoading } = useApis_default();
|
|
8838
8822
|
const items = (data2) => [
|
|
8839
8823
|
{
|
|
8840
8824
|
label: `Reset Password`,
|
|
@@ -8846,6 +8830,7 @@ function Users() {
|
|
|
8846
8830
|
ResetPasswordForm_default,
|
|
8847
8831
|
{
|
|
8848
8832
|
data: data2,
|
|
8833
|
+
app,
|
|
8849
8834
|
close: () => close(),
|
|
8850
8835
|
reload: () => reload()
|
|
8851
8836
|
}
|
|
@@ -8864,7 +8849,8 @@ function Users() {
|
|
|
8864
8849
|
{
|
|
8865
8850
|
data: data2,
|
|
8866
8851
|
close: () => close(),
|
|
8867
|
-
reload: () => reload()
|
|
8852
|
+
reload: () => reload(),
|
|
8853
|
+
app
|
|
8868
8854
|
}
|
|
8869
8855
|
),
|
|
8870
8856
|
width: 600
|
|
@@ -8911,12 +8897,27 @@ function Users() {
|
|
|
8911
8897
|
] });
|
|
8912
8898
|
}
|
|
8913
8899
|
},
|
|
8900
|
+
{
|
|
8901
|
+
accessorKey: "role",
|
|
8902
|
+
header: "Role",
|
|
8903
|
+
cell: ({ row }) => {
|
|
8904
|
+
const data2 = row.original;
|
|
8905
|
+
return /* @__PURE__ */ jsx49(
|
|
8906
|
+
Badge,
|
|
8907
|
+
{
|
|
8908
|
+
variant: data2?.role === "admin" ? "primary" : "warning",
|
|
8909
|
+
size: "sm",
|
|
8910
|
+
children: data2?.role || "N/A"
|
|
8911
|
+
}
|
|
8912
|
+
);
|
|
8913
|
+
}
|
|
8914
|
+
},
|
|
8914
8915
|
{
|
|
8915
8916
|
accessorKey: "account.name",
|
|
8916
8917
|
header: "Employee Name",
|
|
8917
8918
|
cell: ({ row }) => {
|
|
8918
8919
|
const account = row.original?.account;
|
|
8919
|
-
return /* @__PURE__ */ jsx49("span", { children: account?.name });
|
|
8920
|
+
return /* @__PURE__ */ jsx49("span", { children: account?.name || "N/A" });
|
|
8920
8921
|
}
|
|
8921
8922
|
},
|
|
8922
8923
|
{
|
|
@@ -8924,7 +8925,7 @@ function Users() {
|
|
|
8924
8925
|
header: "Status",
|
|
8925
8926
|
cell: ({ row }) => {
|
|
8926
8927
|
const data2 = row.original;
|
|
8927
|
-
return /* @__PURE__ */ jsx49(Activate_default, { data: data2 });
|
|
8928
|
+
return /* @__PURE__ */ jsx49(Activate_default, { data: data2, app });
|
|
8928
8929
|
}
|
|
8929
8930
|
},
|
|
8930
8931
|
{
|
|
@@ -8956,7 +8957,9 @@ function Users() {
|
|
|
8956
8957
|
data: users,
|
|
8957
8958
|
index: true,
|
|
8958
8959
|
title: "User",
|
|
8959
|
-
description: "Manage users"
|
|
8960
|
+
description: "Manage users",
|
|
8961
|
+
createTitle: "Add User",
|
|
8962
|
+
onCreate: () => navigate("/users/create")
|
|
8960
8963
|
}
|
|
8961
8964
|
),
|
|
8962
8965
|
" "
|
|
@@ -8964,15 +8967,97 @@ function Users() {
|
|
|
8964
8967
|
}
|
|
8965
8968
|
var users_default = Users;
|
|
8966
8969
|
|
|
8970
|
+
// src/components/users/UserForm.tsx
|
|
8971
|
+
import { useForm as useForm7 } from "react-hook-form";
|
|
8972
|
+
import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
|
|
8973
|
+
import { message as message11 } from "antd";
|
|
8974
|
+
import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8975
|
+
function UserForm({ app = "" }) {
|
|
8976
|
+
const { navigate } = useApp_default();
|
|
8977
|
+
const { post, isLoading } = useApis_default();
|
|
8978
|
+
const methods = useForm7({
|
|
8979
|
+
resolver: zodResolver6(createUserSchema),
|
|
8980
|
+
defaultValues: {
|
|
8981
|
+
email: "",
|
|
8982
|
+
phoneNumber: "",
|
|
8983
|
+
role: "admin"
|
|
8984
|
+
}
|
|
8985
|
+
});
|
|
8986
|
+
const { handleSubmit } = methods;
|
|
8987
|
+
const onSubmit = async (data) => {
|
|
8988
|
+
try {
|
|
8989
|
+
await post({
|
|
8990
|
+
url: `${app}/users/create`,
|
|
8991
|
+
body: data
|
|
8992
|
+
});
|
|
8993
|
+
message11.success("User created successfully");
|
|
8994
|
+
navigate(-1);
|
|
8995
|
+
} catch (error) {
|
|
8996
|
+
message11.error(error?.message || "Something went wrong");
|
|
8997
|
+
}
|
|
8998
|
+
};
|
|
8999
|
+
return /* @__PURE__ */ jsxs39(Card, { className: "max-w-xl mx-auto mt-10 relative", children: [
|
|
9000
|
+
/* @__PURE__ */ jsxs39(Card.Header, { children: [
|
|
9001
|
+
/* @__PURE__ */ jsx50(Card.Title, { children: "Add User" }),
|
|
9002
|
+
/* @__PURE__ */ jsx50(Card.Description, { children: "Create a new user by providing their email and phone number." })
|
|
9003
|
+
] }),
|
|
9004
|
+
/* @__PURE__ */ jsx50(Card.Content, { children: /* @__PURE__ */ jsxs39("form", { onSubmit: handleSubmit(onSubmit), children: [
|
|
9005
|
+
/* @__PURE__ */ jsxs39("div", { className: "space-y-4", children: [
|
|
9006
|
+
/* @__PURE__ */ jsx50(
|
|
9007
|
+
Fields_default.Input,
|
|
9008
|
+
{
|
|
9009
|
+
label: "Email",
|
|
9010
|
+
form: methods,
|
|
9011
|
+
name: "email",
|
|
9012
|
+
type: "email",
|
|
9013
|
+
placeholder: "e.g. user@example.com",
|
|
9014
|
+
required: true
|
|
9015
|
+
}
|
|
9016
|
+
),
|
|
9017
|
+
/* @__PURE__ */ jsx50(
|
|
9018
|
+
Fields_default.PhoneInput,
|
|
9019
|
+
{
|
|
9020
|
+
label: "Phone Number",
|
|
9021
|
+
form: methods,
|
|
9022
|
+
name: "phoneNumber",
|
|
9023
|
+
placeholder: "Enter phone number"
|
|
9024
|
+
}
|
|
9025
|
+
),
|
|
9026
|
+
/* @__PURE__ */ jsx50(
|
|
9027
|
+
Fields_default.Select,
|
|
9028
|
+
{
|
|
9029
|
+
label: "Role",
|
|
9030
|
+
form: methods,
|
|
9031
|
+
name: "role",
|
|
9032
|
+
options: [{ label: "Admin", value: "admin" }],
|
|
9033
|
+
required: true
|
|
9034
|
+
}
|
|
9035
|
+
)
|
|
9036
|
+
] }),
|
|
9037
|
+
/* @__PURE__ */ jsx50("footer", { className: "flex justify-end mt-6", children: /* @__PURE__ */ jsx50(
|
|
9038
|
+
Button,
|
|
9039
|
+
{
|
|
9040
|
+
isLoading,
|
|
9041
|
+
disabled: isLoading,
|
|
9042
|
+
type: "submit",
|
|
9043
|
+
className: "min-w-[100px]",
|
|
9044
|
+
children: "Add User"
|
|
9045
|
+
}
|
|
9046
|
+
) })
|
|
9047
|
+
] }) })
|
|
9048
|
+
] });
|
|
9049
|
+
}
|
|
9050
|
+
var UserForm_default = UserForm;
|
|
9051
|
+
|
|
8967
9052
|
// src/components/users/ResetPasswordPage.tsx
|
|
8968
9053
|
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
8969
|
-
import { useSearchParams as useSearchParams2, useNavigate as
|
|
9054
|
+
import { useSearchParams as useSearchParams2, useNavigate as useNavigate7 } from "react-router-dom";
|
|
8970
9055
|
import { Lock as Lock2, ShieldCheck as ShieldCheck2, ArrowRight as ArrowRight2, Terminal as Terminal2 } from "lucide-react";
|
|
8971
|
-
import { useForm as
|
|
8972
|
-
import { zodResolver as
|
|
9056
|
+
import { useForm as useForm8 } from "react-hook-form";
|
|
9057
|
+
import { zodResolver as zodResolver7 } from "@hookform/resolvers/zod";
|
|
8973
9058
|
import * as z4 from "zod";
|
|
8974
|
-
import { message as
|
|
8975
|
-
import { Fragment as Fragment12, jsx as
|
|
9059
|
+
import { message as message12, Spin } from "antd";
|
|
9060
|
+
import { Fragment as Fragment12, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
8976
9061
|
var resetPageSchema = z4.object({
|
|
8977
9062
|
password: z4.string().min(6, "Password must be at least 6 characters"),
|
|
8978
9063
|
confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
|
|
@@ -8982,7 +9067,7 @@ var resetPageSchema = z4.object({
|
|
|
8982
9067
|
});
|
|
8983
9068
|
function ResetPasswordPage() {
|
|
8984
9069
|
const [searchParams] = useSearchParams2();
|
|
8985
|
-
const navigate =
|
|
9070
|
+
const navigate = useNavigate7();
|
|
8986
9071
|
const { put, isLoading } = useApis_default();
|
|
8987
9072
|
const [isVerified, setIsVerified] = useState29(false);
|
|
8988
9073
|
const [verifying, setVerifying] = useState29(true);
|
|
@@ -8990,8 +9075,8 @@ function ResetPasswordPage() {
|
|
|
8990
9075
|
const token = searchParams.get("token");
|
|
8991
9076
|
const email = searchParams.get("email");
|
|
8992
9077
|
const id = searchParams.get("id");
|
|
8993
|
-
const methods =
|
|
8994
|
-
resolver:
|
|
9078
|
+
const methods = useForm8({
|
|
9079
|
+
resolver: zodResolver7(resetPageSchema),
|
|
8995
9080
|
defaultValues: {
|
|
8996
9081
|
password: "",
|
|
8997
9082
|
confirmPassword: ""
|
|
@@ -9029,23 +9114,23 @@ function ResetPasswordPage() {
|
|
|
9029
9114
|
password: data.password
|
|
9030
9115
|
}
|
|
9031
9116
|
});
|
|
9032
|
-
|
|
9117
|
+
message12.success(
|
|
9033
9118
|
"Password has been reset successfully. You can now login."
|
|
9034
9119
|
);
|
|
9035
9120
|
navigate("/login", { replace: true });
|
|
9036
9121
|
} catch (err) {
|
|
9037
|
-
|
|
9122
|
+
message12.error(err?.message || "Failed to reset password.");
|
|
9038
9123
|
}
|
|
9039
9124
|
};
|
|
9040
9125
|
if (verifying) {
|
|
9041
|
-
return /* @__PURE__ */
|
|
9042
|
-
/* @__PURE__ */
|
|
9043
|
-
/* @__PURE__ */
|
|
9126
|
+
return /* @__PURE__ */ jsx51("div", { className: "h-screen w-full flex items-center justify-center bg-slate-50 dark:bg-[#0A0B10]", children: /* @__PURE__ */ jsxs40("div", { className: "text-center space-y-4", children: [
|
|
9127
|
+
/* @__PURE__ */ jsx51(Spin, { size: "large" }),
|
|
9128
|
+
/* @__PURE__ */ jsx51("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
|
|
9044
9129
|
] }) });
|
|
9045
9130
|
}
|
|
9046
|
-
return /* @__PURE__ */
|
|
9047
|
-
/* @__PURE__ */
|
|
9048
|
-
/* @__PURE__ */
|
|
9131
|
+
return /* @__PURE__ */ jsxs40("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
|
|
9132
|
+
/* @__PURE__ */ jsxs40("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
|
|
9133
|
+
/* @__PURE__ */ jsx51(
|
|
9049
9134
|
"div",
|
|
9050
9135
|
{
|
|
9051
9136
|
className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
|
|
@@ -9054,35 +9139,35 @@ function ResetPasswordPage() {
|
|
|
9054
9139
|
}
|
|
9055
9140
|
}
|
|
9056
9141
|
),
|
|
9057
|
-
/* @__PURE__ */
|
|
9058
|
-
/* @__PURE__ */
|
|
9059
|
-
/* @__PURE__ */
|
|
9060
|
-
/* @__PURE__ */
|
|
9061
|
-
/* @__PURE__ */
|
|
9142
|
+
/* @__PURE__ */ jsx51("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
|
|
9143
|
+
/* @__PURE__ */ jsxs40("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
|
|
9144
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-3", children: [
|
|
9145
|
+
/* @__PURE__ */ jsx51("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-indigo-500/20 shadow-xl", children: /* @__PURE__ */ jsx51(Terminal2, { className: "text-white w-6 h-6" }) }),
|
|
9146
|
+
/* @__PURE__ */ jsx51("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
|
|
9062
9147
|
] }),
|
|
9063
|
-
/* @__PURE__ */
|
|
9064
|
-
/* @__PURE__ */
|
|
9148
|
+
/* @__PURE__ */ jsxs40("div", { className: "max-w-md", children: [
|
|
9149
|
+
/* @__PURE__ */ jsxs40("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
|
|
9065
9150
|
"Secure ",
|
|
9066
|
-
/* @__PURE__ */
|
|
9151
|
+
/* @__PURE__ */ jsx51("span", { className: "text-indigo-400", children: "Access" }),
|
|
9067
9152
|
" ",
|
|
9068
|
-
/* @__PURE__ */
|
|
9153
|
+
/* @__PURE__ */ jsx51("br", {}),
|
|
9069
9154
|
" ",
|
|
9070
9155
|
"Simplified."
|
|
9071
9156
|
] }),
|
|
9072
|
-
/* @__PURE__ */
|
|
9157
|
+
/* @__PURE__ */ jsx51("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
|
|
9073
9158
|
] }),
|
|
9074
|
-
/* @__PURE__ */
|
|
9159
|
+
/* @__PURE__ */ jsx51("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
|
|
9075
9160
|
] })
|
|
9076
9161
|
] }),
|
|
9077
|
-
/* @__PURE__ */
|
|
9078
|
-
/* @__PURE__ */
|
|
9079
|
-
/* @__PURE__ */
|
|
9080
|
-
/* @__PURE__ */
|
|
9081
|
-
/* @__PURE__ */
|
|
9082
|
-
/* @__PURE__ */
|
|
9083
|
-
/* @__PURE__ */
|
|
9162
|
+
/* @__PURE__ */ jsxs40("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: [
|
|
9163
|
+
/* @__PURE__ */ jsx51("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx51(ThemeToggle, {}) }),
|
|
9164
|
+
/* @__PURE__ */ jsx51("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ jsxs40("div", { className: "text-center space-y-6", children: [
|
|
9165
|
+
/* @__PURE__ */ jsx51("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__ */ jsx51(ShieldCheck2, { className: "text-red-600 dark:text-red-400 w-8 h-8" }) }),
|
|
9166
|
+
/* @__PURE__ */ jsxs40("div", { children: [
|
|
9167
|
+
/* @__PURE__ */ jsx51("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
|
|
9168
|
+
/* @__PURE__ */ jsx51("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
|
|
9084
9169
|
] }),
|
|
9085
|
-
/* @__PURE__ */
|
|
9170
|
+
/* @__PURE__ */ jsx51(
|
|
9086
9171
|
Button,
|
|
9087
9172
|
{
|
|
9088
9173
|
onClick: () => navigate("/login"),
|
|
@@ -9090,22 +9175,22 @@ function ResetPasswordPage() {
|
|
|
9090
9175
|
children: "Back to Login"
|
|
9091
9176
|
}
|
|
9092
9177
|
)
|
|
9093
|
-
] }) : /* @__PURE__ */
|
|
9094
|
-
/* @__PURE__ */
|
|
9095
|
-
/* @__PURE__ */
|
|
9096
|
-
/* @__PURE__ */
|
|
9178
|
+
] }) : /* @__PURE__ */ jsxs40(Fragment12, { children: [
|
|
9179
|
+
/* @__PURE__ */ jsxs40("div", { className: "mb-10", children: [
|
|
9180
|
+
/* @__PURE__ */ jsx51("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
|
|
9181
|
+
/* @__PURE__ */ jsxs40("p", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
9097
9182
|
"Set a new, strong password for",
|
|
9098
9183
|
" ",
|
|
9099
|
-
/* @__PURE__ */
|
|
9184
|
+
/* @__PURE__ */ jsx51("span", { className: "text-indigo-600 font-medium", children: email })
|
|
9100
9185
|
] })
|
|
9101
9186
|
] }),
|
|
9102
|
-
/* @__PURE__ */
|
|
9187
|
+
/* @__PURE__ */ jsxs40(
|
|
9103
9188
|
"form",
|
|
9104
9189
|
{
|
|
9105
9190
|
onSubmit: methods.handleSubmit(onSubmit),
|
|
9106
9191
|
className: "space-y-6",
|
|
9107
9192
|
children: [
|
|
9108
|
-
/* @__PURE__ */
|
|
9193
|
+
/* @__PURE__ */ jsx51(
|
|
9109
9194
|
Fields_default.Input,
|
|
9110
9195
|
{
|
|
9111
9196
|
form: methods,
|
|
@@ -9114,11 +9199,11 @@ function ResetPasswordPage() {
|
|
|
9114
9199
|
type: "password",
|
|
9115
9200
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
9116
9201
|
required: true,
|
|
9117
|
-
icon: /* @__PURE__ */
|
|
9202
|
+
icon: /* @__PURE__ */ jsx51(Lock2, { size: 18, className: "text-slate-400" }),
|
|
9118
9203
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
9119
9204
|
}
|
|
9120
9205
|
),
|
|
9121
|
-
/* @__PURE__ */
|
|
9206
|
+
/* @__PURE__ */ jsx51(
|
|
9122
9207
|
Fields_default.Input,
|
|
9123
9208
|
{
|
|
9124
9209
|
form: methods,
|
|
@@ -9127,11 +9212,11 @@ function ResetPasswordPage() {
|
|
|
9127
9212
|
type: "password",
|
|
9128
9213
|
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
9129
9214
|
required: true,
|
|
9130
|
-
icon: /* @__PURE__ */
|
|
9215
|
+
icon: /* @__PURE__ */ jsx51(ShieldCheck2, { size: 18, className: "text-slate-400" }),
|
|
9131
9216
|
className: "bg-slate-50 dark:bg-slate-900/50 h-12"
|
|
9132
9217
|
}
|
|
9133
9218
|
),
|
|
9134
|
-
/* @__PURE__ */
|
|
9219
|
+
/* @__PURE__ */ jsxs40(
|
|
9135
9220
|
Button,
|
|
9136
9221
|
{
|
|
9137
9222
|
type: "submit",
|
|
@@ -9139,7 +9224,7 @@ function ResetPasswordPage() {
|
|
|
9139
9224
|
className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
|
|
9140
9225
|
children: [
|
|
9141
9226
|
"Update Password",
|
|
9142
|
-
!isLoading && /* @__PURE__ */
|
|
9227
|
+
!isLoading && /* @__PURE__ */ jsx51(ArrowRight2, { size: 18 })
|
|
9143
9228
|
]
|
|
9144
9229
|
}
|
|
9145
9230
|
)
|
|
@@ -9154,9 +9239,9 @@ var ResetPasswordPage_default = ResetPasswordPage;
|
|
|
9154
9239
|
|
|
9155
9240
|
// src/components/users/UserProfile.tsx
|
|
9156
9241
|
import { LogOut, User as User2 } from "lucide-react";
|
|
9157
|
-
import { useNavigate as
|
|
9158
|
-
import { message as
|
|
9159
|
-
import { jsx as
|
|
9242
|
+
import { useNavigate as useNavigate8 } from "react-router-dom";
|
|
9243
|
+
import { message as message13 } from "antd";
|
|
9244
|
+
import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9160
9245
|
var UserProfile = ({
|
|
9161
9246
|
items,
|
|
9162
9247
|
name,
|
|
@@ -9167,7 +9252,7 @@ var UserProfile = ({
|
|
|
9167
9252
|
}) => {
|
|
9168
9253
|
const { post } = useApis_default();
|
|
9169
9254
|
const { user, logout: authLogout, account } = useAuth_default();
|
|
9170
|
-
const navigate =
|
|
9255
|
+
const navigate = useNavigate8();
|
|
9171
9256
|
const logout = async () => {
|
|
9172
9257
|
if (onLogout) {
|
|
9173
9258
|
onLogout();
|
|
@@ -9178,32 +9263,32 @@ var UserProfile = ({
|
|
|
9178
9263
|
url: `/users/logout/${user?._id}`,
|
|
9179
9264
|
v: 1
|
|
9180
9265
|
});
|
|
9181
|
-
|
|
9266
|
+
message13.success("Logout successfully");
|
|
9182
9267
|
authLogout();
|
|
9183
9268
|
navigate("/login");
|
|
9184
9269
|
} catch (error) {
|
|
9185
9270
|
console.log(error);
|
|
9186
|
-
|
|
9271
|
+
message13.error(error?.message);
|
|
9187
9272
|
}
|
|
9188
9273
|
};
|
|
9189
9274
|
const defaultItems = [
|
|
9190
9275
|
{
|
|
9191
9276
|
label: "My Profile",
|
|
9192
|
-
icon: /* @__PURE__ */
|
|
9277
|
+
icon: /* @__PURE__ */ jsx52(User2, { size: 18 }),
|
|
9193
9278
|
onClick: () => navigate("/profile"),
|
|
9194
9279
|
className: "min-w-[150px]"
|
|
9195
9280
|
},
|
|
9196
9281
|
{
|
|
9197
9282
|
label: "Logout",
|
|
9198
|
-
icon: /* @__PURE__ */
|
|
9283
|
+
icon: /* @__PURE__ */ jsx52(LogOut, { size: 18 }),
|
|
9199
9284
|
onClick: logout,
|
|
9200
9285
|
className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
|
|
9201
9286
|
}
|
|
9202
9287
|
];
|
|
9203
|
-
return /* @__PURE__ */
|
|
9204
|
-
showThemeToggle && /* @__PURE__ */
|
|
9205
|
-
showThemeToggle && /* @__PURE__ */
|
|
9206
|
-
/* @__PURE__ */
|
|
9288
|
+
return /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-3", children: [
|
|
9289
|
+
showThemeToggle && /* @__PURE__ */ jsx52(ThemeToggle, {}),
|
|
9290
|
+
showThemeToggle && /* @__PURE__ */ jsx52("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
|
|
9291
|
+
/* @__PURE__ */ jsx52(
|
|
9207
9292
|
ProfileDropdown,
|
|
9208
9293
|
{
|
|
9209
9294
|
name: name || account?.name || "User",
|
|
@@ -9219,14 +9304,14 @@ var UserProfile = ({
|
|
|
9219
9304
|
var UserProfile_default = UserProfile;
|
|
9220
9305
|
|
|
9221
9306
|
// src/components/users/ProfilePage.tsx
|
|
9222
|
-
import { useNavigate as
|
|
9307
|
+
import { useNavigate as useNavigate9 } from "react-router-dom";
|
|
9223
9308
|
import { ArrowLeft as ArrowLeft3 } from "lucide-react";
|
|
9224
|
-
import { jsx as
|
|
9309
|
+
import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9225
9310
|
var ProfilePage = () => {
|
|
9226
|
-
const navigate =
|
|
9311
|
+
const navigate = useNavigate9();
|
|
9227
9312
|
const { user, account } = useAuth();
|
|
9228
9313
|
if (!user) {
|
|
9229
|
-
return /* @__PURE__ */
|
|
9314
|
+
return /* @__PURE__ */ jsx53("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx53("h1", { children: "Please login to view your profile" }) });
|
|
9230
9315
|
}
|
|
9231
9316
|
const extraInfo = [
|
|
9232
9317
|
{
|
|
@@ -9245,19 +9330,19 @@ var ProfilePage = () => {
|
|
|
9245
9330
|
copiable: false
|
|
9246
9331
|
}
|
|
9247
9332
|
];
|
|
9248
|
-
return /* @__PURE__ */
|
|
9249
|
-
/* @__PURE__ */
|
|
9333
|
+
return /* @__PURE__ */ jsxs42("div", { className: "p-4 sm:p-8 space-y-6", children: [
|
|
9334
|
+
/* @__PURE__ */ jsx53("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ jsx53(
|
|
9250
9335
|
Button,
|
|
9251
9336
|
{
|
|
9252
9337
|
variant: "outline",
|
|
9253
9338
|
size: "sm",
|
|
9254
9339
|
onClick: () => navigate(-1),
|
|
9255
|
-
icon: /* @__PURE__ */
|
|
9340
|
+
icon: /* @__PURE__ */ jsx53(ArrowLeft3, { size: 16 }),
|
|
9256
9341
|
className: "rounded-full font-bold px-5",
|
|
9257
9342
|
children: "Back"
|
|
9258
9343
|
}
|
|
9259
9344
|
) }),
|
|
9260
|
-
/* @__PURE__ */
|
|
9345
|
+
/* @__PURE__ */ jsx53(
|
|
9261
9346
|
ProfileView,
|
|
9262
9347
|
{
|
|
9263
9348
|
name: account?.name || "User Account",
|
|
@@ -9326,11 +9411,13 @@ export {
|
|
|
9326
9411
|
ThemeToggle,
|
|
9327
9412
|
ThemedLogin,
|
|
9328
9413
|
UnProtectedRoute,
|
|
9414
|
+
UserForm_default as UserForm,
|
|
9329
9415
|
UserProfile_default as UserProfile,
|
|
9330
9416
|
users_default as Users,
|
|
9331
9417
|
Views_default as Views,
|
|
9332
9418
|
WarqadProvider,
|
|
9333
9419
|
createAccountSchema,
|
|
9420
|
+
createUserSchema,
|
|
9334
9421
|
generatePdf,
|
|
9335
9422
|
linkUserSchema,
|
|
9336
9423
|
resetPasswordSchema,
|