warqadui 0.0.71 → 0.0.73

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.mjs CHANGED
@@ -933,7 +933,7 @@ var CardTitle = ({
933
933
  "h3",
934
934
  {
935
935
  className: cn(
936
- "text-lg font-semibold leading-none tracking-tight text-gray-900 dark:text-gray-100",
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 message13 = error;
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
- message13 = errorObj?.message;
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
- message13 && /* @__PURE__ */ jsx15("p", { className: "text-sm text-red-600 dark:text-red-400", children: message13 })
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 message13 = error;
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
- message13 = currentError?.message || message13;
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
- message13 && /* @__PURE__ */ jsx19("p", { className: "text-sm text-red-600 dark:text-red-400", children: message13 })
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 message13 = error;
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
- message13 = currentError?.message || message13;
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
- message13 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message13 })
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 message13 = error;
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
- message13 = errorObj?.message;
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
- message13 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message13 })
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 message13 = error || errorMessage;
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
- message13 = currentError?.message || message13;
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: message13,
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 message13 = error;
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
- message13 = errorObj?.message;
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
- ${message13 ? "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"}
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 && !message13 ? primaryColor : void 0,
2979
- boxShadow: isFocused && !message13 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
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: message13 ? "#ef4444" : isFocused ? primaryColor : void 0
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
- message13 && /* @__PURE__ */ jsx23("p", { className: "text-sm text-red-600 dark:text-red-400", children: message13 })
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, message13) {
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"), message13);
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, message13) {
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"), message13);
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, message13) {
7375
- if (!valid && !warned[message13]) {
7376
- method(false, message13);
7377
- warned[message13] = true;
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, message13) {
7381
- call(warning, valid, message13);
7380
+ function warningOnce(valid, message14) {
7381
+ call(warning, valid, message14);
7382
7382
  }
7383
- function noteOnce(valid, message13) {
7384
- call(note, valid, message13);
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, message13) {
7396
- warningOnce(valid, `[@ant-design/icons] ${message13}`);
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");
@@ -8299,6 +8299,13 @@ var resetPasswordSchema = z3.object({
8299
8299
  token: z3.string().min(1, { message: "Token is required" }),
8300
8300
  password: z3.string().min(6, { message: "Password must be at least 6 characters" })
8301
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
+ });
8302
8309
 
8303
8310
  // src/components/users/linkUser.tsx
8304
8311
  import { useForm as useForm3 } from "react-hook-form";
@@ -8424,13 +8431,7 @@ var linkUser_default = LinkUser;
8424
8431
 
8425
8432
  // src/components/users/users.tsx
8426
8433
  import { useMemo as useMemo8 } from "react";
8427
- import {
8428
- EllipsisVertical as EllipsisVertical2,
8429
- Info,
8430
- Mail as Mail2,
8431
- ShieldCheck,
8432
- Key
8433
- } from "lucide-react";
8434
+ import { EllipsisVertical as EllipsisVertical2, Info, Mail as Mail2, ShieldCheck, Key } from "lucide-react";
8434
8435
 
8435
8436
  // src/components/users/VerifyEmailForm.tsx
8436
8437
  import { useForm as useForm4 } from "react-hook-form";
@@ -8583,7 +8584,8 @@ import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
8583
8584
  function UpdateEmailForm({
8584
8585
  data,
8585
8586
  close,
8586
- reload
8587
+ reload,
8588
+ app = ""
8587
8589
  }) {
8588
8590
  const { put, isLoading } = useApis_default();
8589
8591
  const currentEmail = data?.email;
@@ -8598,7 +8600,7 @@ function UpdateEmailForm({
8598
8600
  const onSubmit = async (formData) => {
8599
8601
  try {
8600
8602
  await put({
8601
- url: `/users/change_email/${data._id}`,
8603
+ url: `${app}/users/change_email/${data._id}`,
8602
8604
  body: {
8603
8605
  email: formData.newEmail
8604
8606
  }
@@ -8671,7 +8673,8 @@ var { Countdown: Countdown2 } = Statistic2;
8671
8673
  function ResetPasswordForm({
8672
8674
  data,
8673
8675
  close,
8674
- reload
8676
+ reload,
8677
+ app = ""
8675
8678
  }) {
8676
8679
  const { put, isLoading } = useApis_default();
8677
8680
  const [datas, setDatas] = useState27(data);
@@ -8680,7 +8683,9 @@ function ResetPasswordForm({
8680
8683
  );
8681
8684
  useEffect21(() => {
8682
8685
  setDatas(data);
8683
- setHasPassed(data?.passwordReset?.passed || !data?.passwordReset?.createdAt);
8686
+ setHasPassed(
8687
+ data?.passwordReset?.passed || !data?.passwordReset?.createdAt
8688
+ );
8684
8689
  }, [data]);
8685
8690
  const userEmail = data?.email;
8686
8691
  const methods = useForm6({
@@ -8703,7 +8708,7 @@ function ResetPasswordForm({
8703
8708
  const resendToken = async () => {
8704
8709
  try {
8705
8710
  const res = await put({
8706
- url: `/users/reset_password/${data._id}`,
8711
+ url: `${app}/users/reset_password/${data._id}`,
8707
8712
  body: {
8708
8713
  email: userEmail
8709
8714
  }
@@ -8774,22 +8779,26 @@ var ResetPasswordForm_default = ResetPasswordForm;
8774
8779
  import { message as message10, Switch } from "antd";
8775
8780
  import { useState as useState28 } from "react";
8776
8781
  import { Fragment as Fragment10, jsx as jsx48 } from "react/jsx-runtime";
8777
- var ActivateUser = ({ data }) => {
8782
+ var ActivateUser = ({ data, app = "" }) => {
8778
8783
  const [checked, setChecked] = useState28(data?.isActive);
8779
8784
  const { put, isLoading } = useApis_default();
8780
8785
  return /* @__PURE__ */ jsx48(Fragment10, { children: /* @__PURE__ */ jsx48(
8781
8786
  Switch,
8782
8787
  {
8783
8788
  onChange: async (e) => {
8784
- const res = await put({
8785
- url: `/users/activate/${data?._id}`,
8786
- v: 1,
8787
- body: { isActive: e }
8788
- });
8789
- message10.success(
8790
- res?.data?.isActive ? "User Activated" : "User Deactivated"
8791
- );
8792
- setChecked(res?.data?.isActive);
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
+ }
8793
8802
  },
8794
8803
  loading: isLoading,
8795
8804
  checked,
@@ -8800,15 +8809,17 @@ var ActivateUser = ({ data }) => {
8800
8809
  var Activate_default = ActivateUser;
8801
8810
 
8802
8811
  // src/components/users/users.tsx
8812
+ import { useNavigate as useNavigate6, useParams as useParams3 } from "react-router-dom";
8803
8813
  import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
8804
8814
  function Users() {
8815
+ const { appId: app = "" } = useParams3();
8816
+ const navigate = useNavigate6();
8805
8817
  const { data, TransactionViewComponent, reload } = useTransaction_default({
8806
- url: "/users/get",
8818
+ url: `${app}/users/get`,
8807
8819
  v: 1,
8808
8820
  dateFilter: false
8809
8821
  });
8810
8822
  const { Modal: Modal2, openState, close } = useModal();
8811
- const { put, isLoading } = useApis_default();
8812
8823
  const items = (data2) => [
8813
8824
  {
8814
8825
  label: `Reset Password`,
@@ -8820,6 +8831,7 @@ function Users() {
8820
8831
  ResetPasswordForm_default,
8821
8832
  {
8822
8833
  data: data2,
8834
+ app,
8823
8835
  close: () => close(),
8824
8836
  reload: () => reload()
8825
8837
  }
@@ -8838,7 +8850,8 @@ function Users() {
8838
8850
  {
8839
8851
  data: data2,
8840
8852
  close: () => close(),
8841
- reload: () => reload()
8853
+ reload: () => reload(),
8854
+ app
8842
8855
  }
8843
8856
  ),
8844
8857
  width: 600
@@ -8885,12 +8898,27 @@ function Users() {
8885
8898
  ] });
8886
8899
  }
8887
8900
  },
8901
+ {
8902
+ accessorKey: "role",
8903
+ header: "Role",
8904
+ cell: ({ row }) => {
8905
+ const data2 = row.original;
8906
+ return /* @__PURE__ */ jsx49(
8907
+ Badge,
8908
+ {
8909
+ variant: data2?.role === "admin" ? "primary" : "warning",
8910
+ size: "sm",
8911
+ children: data2?.role || "N/A"
8912
+ }
8913
+ );
8914
+ }
8915
+ },
8888
8916
  {
8889
8917
  accessorKey: "account.name",
8890
8918
  header: "Employee Name",
8891
8919
  cell: ({ row }) => {
8892
8920
  const account = row.original?.account;
8893
- return /* @__PURE__ */ jsx49("span", { children: account?.name });
8921
+ return /* @__PURE__ */ jsx49("span", { children: account?.name || "N/A" });
8894
8922
  }
8895
8923
  },
8896
8924
  {
@@ -8898,7 +8926,7 @@ function Users() {
8898
8926
  header: "Status",
8899
8927
  cell: ({ row }) => {
8900
8928
  const data2 = row.original;
8901
- return /* @__PURE__ */ jsx49(Activate_default, { data: data2 });
8929
+ return /* @__PURE__ */ jsx49(Activate_default, { data: data2, app });
8902
8930
  }
8903
8931
  },
8904
8932
  {
@@ -8930,7 +8958,9 @@ function Users() {
8930
8958
  data: users,
8931
8959
  index: true,
8932
8960
  title: "User",
8933
- description: "Manage users"
8961
+ description: "Manage users",
8962
+ createTitle: "Add User",
8963
+ onCreate: () => navigate("/users/create")
8934
8964
  }
8935
8965
  ),
8936
8966
  " "
@@ -8938,15 +8968,99 @@ function Users() {
8938
8968
  }
8939
8969
  var users_default = Users;
8940
8970
 
8971
+ // src/components/users/UserForm.tsx
8972
+ import { useForm as useForm7 } from "react-hook-form";
8973
+ import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
8974
+ import { message as message11 } from "antd";
8975
+ import { useParams as useParams4 } from "react-router-dom";
8976
+ import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
8977
+ function UserForm() {
8978
+ const { appId: app = "" } = useParams4();
8979
+ const { navigate } = useApp_default();
8980
+ const { post, isLoading } = useApis_default();
8981
+ const methods = useForm7({
8982
+ resolver: zodResolver6(createUserSchema),
8983
+ defaultValues: {
8984
+ email: "",
8985
+ phoneNumber: "",
8986
+ role: "admin"
8987
+ }
8988
+ });
8989
+ const { handleSubmit } = methods;
8990
+ const onSubmit = async (data) => {
8991
+ try {
8992
+ await post({
8993
+ url: `${app}/users/create`,
8994
+ body: data
8995
+ });
8996
+ message11.success("User created successfully");
8997
+ navigate(-1);
8998
+ } catch (error) {
8999
+ message11.error(error?.message || "Something went wrong");
9000
+ }
9001
+ };
9002
+ return /* @__PURE__ */ jsxs39(Card, { className: "max-w-xl mx-auto mt-10 relative", children: [
9003
+ /* @__PURE__ */ jsxs39(Card.Header, { children: [
9004
+ /* @__PURE__ */ jsx50(Card.Title, { children: "Add User" }),
9005
+ /* @__PURE__ */ jsx50(Card.Description, { children: "Create a new user by providing their email and phone number." })
9006
+ ] }),
9007
+ /* @__PURE__ */ jsx50(Card.Content, { children: /* @__PURE__ */ jsxs39("form", { onSubmit: handleSubmit(onSubmit), children: [
9008
+ /* @__PURE__ */ jsxs39("div", { className: "space-y-4", children: [
9009
+ /* @__PURE__ */ jsx50(
9010
+ Fields_default.Input,
9011
+ {
9012
+ label: "Email",
9013
+ form: methods,
9014
+ name: "email",
9015
+ type: "email",
9016
+ placeholder: "e.g. user@example.com",
9017
+ required: true
9018
+ }
9019
+ ),
9020
+ /* @__PURE__ */ jsx50(
9021
+ Fields_default.PhoneInput,
9022
+ {
9023
+ label: "Phone Number",
9024
+ form: methods,
9025
+ name: "phoneNumber",
9026
+ placeholder: "Enter phone number"
9027
+ }
9028
+ ),
9029
+ /* @__PURE__ */ jsx50(
9030
+ Fields_default.Select,
9031
+ {
9032
+ label: "Role",
9033
+ form: methods,
9034
+ name: "role",
9035
+ options: [{ label: "Admin", value: "admin" }],
9036
+ required: true
9037
+ }
9038
+ )
9039
+ ] }),
9040
+ /* @__PURE__ */ jsx50("footer", { className: "flex justify-end mt-6", children: /* @__PURE__ */ jsx50(
9041
+ Button,
9042
+ {
9043
+ isLoading,
9044
+ disabled: isLoading,
9045
+ type: "submit",
9046
+ className: "min-w-[100px]",
9047
+ children: "Add User"
9048
+ }
9049
+ ) })
9050
+ ] }) })
9051
+ ] });
9052
+ }
9053
+ var UserForm_default = UserForm;
9054
+
8941
9055
  // src/components/users/ResetPasswordPage.tsx
8942
9056
  import { useEffect as useEffect22, useState as useState29 } from "react";
8943
- import { useSearchParams as useSearchParams2, useNavigate as useNavigate6 } from "react-router-dom";
9057
+ import { useSearchParams as useSearchParams2, useNavigate as useNavigate7 } from "react-router-dom";
8944
9058
  import { Lock as Lock2, ShieldCheck as ShieldCheck2, ArrowRight as ArrowRight2, Terminal as Terminal2 } from "lucide-react";
8945
- import { useForm as useForm7 } from "react-hook-form";
8946
- import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
9059
+ import { useForm as useForm8 } from "react-hook-form";
9060
+ import { zodResolver as zodResolver7 } from "@hookform/resolvers/zod";
8947
9061
  import * as z4 from "zod";
8948
- import { message as message11, Spin } from "antd";
8949
- import { Fragment as Fragment12, jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
9062
+ import { message as message12, Spin } from "antd";
9063
+ import { Fragment as Fragment12, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
8950
9064
  var resetPageSchema = z4.object({
8951
9065
  password: z4.string().min(6, "Password must be at least 6 characters"),
8952
9066
  confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
@@ -8956,7 +9070,7 @@ var resetPageSchema = z4.object({
8956
9070
  });
8957
9071
  function ResetPasswordPage() {
8958
9072
  const [searchParams] = useSearchParams2();
8959
- const navigate = useNavigate6();
9073
+ const navigate = useNavigate7();
8960
9074
  const { put, isLoading } = useApis_default();
8961
9075
  const [isVerified, setIsVerified] = useState29(false);
8962
9076
  const [verifying, setVerifying] = useState29(true);
@@ -8964,8 +9078,8 @@ function ResetPasswordPage() {
8964
9078
  const token = searchParams.get("token");
8965
9079
  const email = searchParams.get("email");
8966
9080
  const id = searchParams.get("id");
8967
- const methods = useForm7({
8968
- resolver: zodResolver6(resetPageSchema),
9081
+ const methods = useForm8({
9082
+ resolver: zodResolver7(resetPageSchema),
8969
9083
  defaultValues: {
8970
9084
  password: "",
8971
9085
  confirmPassword: ""
@@ -9003,23 +9117,23 @@ function ResetPasswordPage() {
9003
9117
  password: data.password
9004
9118
  }
9005
9119
  });
9006
- message11.success(
9120
+ message12.success(
9007
9121
  "Password has been reset successfully. You can now login."
9008
9122
  );
9009
9123
  navigate("/login", { replace: true });
9010
9124
  } catch (err) {
9011
- message11.error(err?.message || "Failed to reset password.");
9125
+ message12.error(err?.message || "Failed to reset password.");
9012
9126
  }
9013
9127
  };
9014
9128
  if (verifying) {
9015
- return /* @__PURE__ */ jsx50("div", { className: "h-screen w-full flex items-center justify-center bg-slate-50 dark:bg-[#0A0B10]", children: /* @__PURE__ */ jsxs39("div", { className: "text-center space-y-4", children: [
9016
- /* @__PURE__ */ jsx50(Spin, { size: "large" }),
9017
- /* @__PURE__ */ jsx50("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
9129
+ 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: [
9130
+ /* @__PURE__ */ jsx51(Spin, { size: "large" }),
9131
+ /* @__PURE__ */ jsx51("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
9018
9132
  ] }) });
9019
9133
  }
9020
- return /* @__PURE__ */ jsxs39("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
9021
- /* @__PURE__ */ jsxs39("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
9022
- /* @__PURE__ */ jsx50(
9134
+ return /* @__PURE__ */ jsxs40("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
9135
+ /* @__PURE__ */ jsxs40("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
9136
+ /* @__PURE__ */ jsx51(
9023
9137
  "div",
9024
9138
  {
9025
9139
  className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
@@ -9028,35 +9142,35 @@ function ResetPasswordPage() {
9028
9142
  }
9029
9143
  }
9030
9144
  ),
9031
- /* @__PURE__ */ jsx50("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
9032
- /* @__PURE__ */ jsxs39("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
9033
- /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-3", children: [
9034
- /* @__PURE__ */ jsx50("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-indigo-500/20 shadow-xl", children: /* @__PURE__ */ jsx50(Terminal2, { className: "text-white w-6 h-6" }) }),
9035
- /* @__PURE__ */ jsx50("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
9145
+ /* @__PURE__ */ jsx51("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
9146
+ /* @__PURE__ */ jsxs40("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
9147
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-3", children: [
9148
+ /* @__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" }) }),
9149
+ /* @__PURE__ */ jsx51("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
9036
9150
  ] }),
9037
- /* @__PURE__ */ jsxs39("div", { className: "max-w-md", children: [
9038
- /* @__PURE__ */ jsxs39("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
9151
+ /* @__PURE__ */ jsxs40("div", { className: "max-w-md", children: [
9152
+ /* @__PURE__ */ jsxs40("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
9039
9153
  "Secure ",
9040
- /* @__PURE__ */ jsx50("span", { className: "text-indigo-400", children: "Access" }),
9154
+ /* @__PURE__ */ jsx51("span", { className: "text-indigo-400", children: "Access" }),
9041
9155
  " ",
9042
- /* @__PURE__ */ jsx50("br", {}),
9156
+ /* @__PURE__ */ jsx51("br", {}),
9043
9157
  " ",
9044
9158
  "Simplified."
9045
9159
  ] }),
9046
- /* @__PURE__ */ jsx50("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
9160
+ /* @__PURE__ */ jsx51("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
9047
9161
  ] }),
9048
- /* @__PURE__ */ jsx50("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
9162
+ /* @__PURE__ */ jsx51("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
9049
9163
  ] })
9050
9164
  ] }),
9051
- /* @__PURE__ */ jsxs39("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: [
9052
- /* @__PURE__ */ jsx50("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx50(ThemeToggle, {}) }),
9053
- /* @__PURE__ */ jsx50("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ jsxs39("div", { className: "text-center space-y-6", children: [
9054
- /* @__PURE__ */ jsx50("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__ */ jsx50(ShieldCheck2, { className: "text-red-600 dark:text-red-400 w-8 h-8" }) }),
9055
- /* @__PURE__ */ jsxs39("div", { children: [
9056
- /* @__PURE__ */ jsx50("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
9057
- /* @__PURE__ */ jsx50("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
9165
+ /* @__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: [
9166
+ /* @__PURE__ */ jsx51("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx51(ThemeToggle, {}) }),
9167
+ /* @__PURE__ */ jsx51("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ jsxs40("div", { className: "text-center space-y-6", children: [
9168
+ /* @__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" }) }),
9169
+ /* @__PURE__ */ jsxs40("div", { children: [
9170
+ /* @__PURE__ */ jsx51("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
9171
+ /* @__PURE__ */ jsx51("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
9058
9172
  ] }),
9059
- /* @__PURE__ */ jsx50(
9173
+ /* @__PURE__ */ jsx51(
9060
9174
  Button,
9061
9175
  {
9062
9176
  onClick: () => navigate("/login"),
@@ -9064,22 +9178,22 @@ function ResetPasswordPage() {
9064
9178
  children: "Back to Login"
9065
9179
  }
9066
9180
  )
9067
- ] }) : /* @__PURE__ */ jsxs39(Fragment12, { children: [
9068
- /* @__PURE__ */ jsxs39("div", { className: "mb-10", children: [
9069
- /* @__PURE__ */ jsx50("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
9070
- /* @__PURE__ */ jsxs39("p", { className: "text-slate-500 dark:text-slate-400", children: [
9181
+ ] }) : /* @__PURE__ */ jsxs40(Fragment12, { children: [
9182
+ /* @__PURE__ */ jsxs40("div", { className: "mb-10", children: [
9183
+ /* @__PURE__ */ jsx51("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
9184
+ /* @__PURE__ */ jsxs40("p", { className: "text-slate-500 dark:text-slate-400", children: [
9071
9185
  "Set a new, strong password for",
9072
9186
  " ",
9073
- /* @__PURE__ */ jsx50("span", { className: "text-indigo-600 font-medium", children: email })
9187
+ /* @__PURE__ */ jsx51("span", { className: "text-indigo-600 font-medium", children: email })
9074
9188
  ] })
9075
9189
  ] }),
9076
- /* @__PURE__ */ jsxs39(
9190
+ /* @__PURE__ */ jsxs40(
9077
9191
  "form",
9078
9192
  {
9079
9193
  onSubmit: methods.handleSubmit(onSubmit),
9080
9194
  className: "space-y-6",
9081
9195
  children: [
9082
- /* @__PURE__ */ jsx50(
9196
+ /* @__PURE__ */ jsx51(
9083
9197
  Fields_default.Input,
9084
9198
  {
9085
9199
  form: methods,
@@ -9088,11 +9202,11 @@ function ResetPasswordPage() {
9088
9202
  type: "password",
9089
9203
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
9090
9204
  required: true,
9091
- icon: /* @__PURE__ */ jsx50(Lock2, { size: 18, className: "text-slate-400" }),
9205
+ icon: /* @__PURE__ */ jsx51(Lock2, { size: 18, className: "text-slate-400" }),
9092
9206
  className: "bg-slate-50 dark:bg-slate-900/50 h-12"
9093
9207
  }
9094
9208
  ),
9095
- /* @__PURE__ */ jsx50(
9209
+ /* @__PURE__ */ jsx51(
9096
9210
  Fields_default.Input,
9097
9211
  {
9098
9212
  form: methods,
@@ -9101,11 +9215,11 @@ function ResetPasswordPage() {
9101
9215
  type: "password",
9102
9216
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
9103
9217
  required: true,
9104
- icon: /* @__PURE__ */ jsx50(ShieldCheck2, { size: 18, className: "text-slate-400" }),
9218
+ icon: /* @__PURE__ */ jsx51(ShieldCheck2, { size: 18, className: "text-slate-400" }),
9105
9219
  className: "bg-slate-50 dark:bg-slate-900/50 h-12"
9106
9220
  }
9107
9221
  ),
9108
- /* @__PURE__ */ jsxs39(
9222
+ /* @__PURE__ */ jsxs40(
9109
9223
  Button,
9110
9224
  {
9111
9225
  type: "submit",
@@ -9113,7 +9227,7 @@ function ResetPasswordPage() {
9113
9227
  className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
9114
9228
  children: [
9115
9229
  "Update Password",
9116
- !isLoading && /* @__PURE__ */ jsx50(ArrowRight2, { size: 18 })
9230
+ !isLoading && /* @__PURE__ */ jsx51(ArrowRight2, { size: 18 })
9117
9231
  ]
9118
9232
  }
9119
9233
  )
@@ -9128,9 +9242,9 @@ var ResetPasswordPage_default = ResetPasswordPage;
9128
9242
 
9129
9243
  // src/components/users/UserProfile.tsx
9130
9244
  import { LogOut, User as User2 } from "lucide-react";
9131
- import { useNavigate as useNavigate7 } from "react-router-dom";
9132
- import { message as message12 } from "antd";
9133
- import { jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
9245
+ import { useNavigate as useNavigate8 } from "react-router-dom";
9246
+ import { message as message13 } from "antd";
9247
+ import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
9134
9248
  var UserProfile = ({
9135
9249
  items,
9136
9250
  name,
@@ -9141,7 +9255,7 @@ var UserProfile = ({
9141
9255
  }) => {
9142
9256
  const { post } = useApis_default();
9143
9257
  const { user, logout: authLogout, account } = useAuth_default();
9144
- const navigate = useNavigate7();
9258
+ const navigate = useNavigate8();
9145
9259
  const logout = async () => {
9146
9260
  if (onLogout) {
9147
9261
  onLogout();
@@ -9152,32 +9266,32 @@ var UserProfile = ({
9152
9266
  url: `/users/logout/${user?._id}`,
9153
9267
  v: 1
9154
9268
  });
9155
- message12.success("Logout successfully");
9269
+ message13.success("Logout successfully");
9156
9270
  authLogout();
9157
9271
  navigate("/login");
9158
9272
  } catch (error) {
9159
9273
  console.log(error);
9160
- message12.error(error?.message);
9274
+ message13.error(error?.message);
9161
9275
  }
9162
9276
  };
9163
9277
  const defaultItems = [
9164
9278
  {
9165
9279
  label: "My Profile",
9166
- icon: /* @__PURE__ */ jsx51(User2, { size: 18 }),
9280
+ icon: /* @__PURE__ */ jsx52(User2, { size: 18 }),
9167
9281
  onClick: () => navigate("/profile"),
9168
9282
  className: "min-w-[150px]"
9169
9283
  },
9170
9284
  {
9171
9285
  label: "Logout",
9172
- icon: /* @__PURE__ */ jsx51(LogOut, { size: 18 }),
9286
+ icon: /* @__PURE__ */ jsx52(LogOut, { size: 18 }),
9173
9287
  onClick: logout,
9174
9288
  className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
9175
9289
  }
9176
9290
  ];
9177
- return /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-3", children: [
9178
- showThemeToggle && /* @__PURE__ */ jsx51(ThemeToggle, {}),
9179
- showThemeToggle && /* @__PURE__ */ jsx51("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
9180
- /* @__PURE__ */ jsx51(
9291
+ return /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-3", children: [
9292
+ showThemeToggle && /* @__PURE__ */ jsx52(ThemeToggle, {}),
9293
+ showThemeToggle && /* @__PURE__ */ jsx52("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
9294
+ /* @__PURE__ */ jsx52(
9181
9295
  ProfileDropdown,
9182
9296
  {
9183
9297
  name: name || account?.name || "User",
@@ -9193,14 +9307,14 @@ var UserProfile = ({
9193
9307
  var UserProfile_default = UserProfile;
9194
9308
 
9195
9309
  // src/components/users/ProfilePage.tsx
9196
- import { useNavigate as useNavigate8 } from "react-router-dom";
9310
+ import { useNavigate as useNavigate9 } from "react-router-dom";
9197
9311
  import { ArrowLeft as ArrowLeft3 } from "lucide-react";
9198
- import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
9312
+ import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
9199
9313
  var ProfilePage = () => {
9200
- const navigate = useNavigate8();
9314
+ const navigate = useNavigate9();
9201
9315
  const { user, account } = useAuth();
9202
9316
  if (!user) {
9203
- return /* @__PURE__ */ jsx52("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx52("h1", { children: "Please login to view your profile" }) });
9317
+ return /* @__PURE__ */ jsx53("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx53("h1", { children: "Please login to view your profile" }) });
9204
9318
  }
9205
9319
  const extraInfo = [
9206
9320
  {
@@ -9219,19 +9333,19 @@ var ProfilePage = () => {
9219
9333
  copiable: false
9220
9334
  }
9221
9335
  ];
9222
- return /* @__PURE__ */ jsxs41("div", { className: "p-4 sm:p-8 space-y-6", children: [
9223
- /* @__PURE__ */ jsx52("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ jsx52(
9336
+ return /* @__PURE__ */ jsxs42("div", { className: "p-4 sm:p-8 space-y-6", children: [
9337
+ /* @__PURE__ */ jsx53("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ jsx53(
9224
9338
  Button,
9225
9339
  {
9226
9340
  variant: "outline",
9227
9341
  size: "sm",
9228
9342
  onClick: () => navigate(-1),
9229
- icon: /* @__PURE__ */ jsx52(ArrowLeft3, { size: 16 }),
9343
+ icon: /* @__PURE__ */ jsx53(ArrowLeft3, { size: 16 }),
9230
9344
  className: "rounded-full font-bold px-5",
9231
9345
  children: "Back"
9232
9346
  }
9233
9347
  ) }),
9234
- /* @__PURE__ */ jsx52(
9348
+ /* @__PURE__ */ jsx53(
9235
9349
  ProfileView,
9236
9350
  {
9237
9351
  name: account?.name || "User Account",
@@ -9300,11 +9414,13 @@ export {
9300
9414
  ThemeToggle,
9301
9415
  ThemedLogin,
9302
9416
  UnProtectedRoute,
9417
+ UserForm_default as UserForm,
9303
9418
  UserProfile_default as UserProfile,
9304
9419
  users_default as Users,
9305
9420
  Views_default as Views,
9306
9421
  WarqadProvider,
9307
9422
  createAccountSchema,
9423
+ createUserSchema,
9308
9424
  generatePdf,
9309
9425
  linkUserSchema,
9310
9426
  resetPasswordSchema,