warqadui 0.0.71 → 0.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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,16 @@ var ActivateUser = ({ data }) => {
8800
8809
  var Activate_default = ActivateUser;
8801
8810
 
8802
8811
  // src/components/users/users.tsx
8812
+ import { useNavigate as useNavigate6 } from "react-router-dom";
8803
8813
  import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
8804
- function Users() {
8814
+ function Users({ app = "" }) {
8815
+ const navigate = useNavigate6();
8805
8816
  const { data, TransactionViewComponent, reload } = useTransaction_default({
8806
- url: "/users/get",
8817
+ url: `${app}/users/get`,
8807
8818
  v: 1,
8808
8819
  dateFilter: false
8809
8820
  });
8810
8821
  const { Modal: Modal2, openState, close } = useModal();
8811
- const { put, isLoading } = useApis_default();
8812
8822
  const items = (data2) => [
8813
8823
  {
8814
8824
  label: `Reset Password`,
@@ -8820,6 +8830,7 @@ function Users() {
8820
8830
  ResetPasswordForm_default,
8821
8831
  {
8822
8832
  data: data2,
8833
+ app,
8823
8834
  close: () => close(),
8824
8835
  reload: () => reload()
8825
8836
  }
@@ -8838,7 +8849,8 @@ function Users() {
8838
8849
  {
8839
8850
  data: data2,
8840
8851
  close: () => close(),
8841
- reload: () => reload()
8852
+ reload: () => reload(),
8853
+ app
8842
8854
  }
8843
8855
  ),
8844
8856
  width: 600
@@ -8885,12 +8897,27 @@ function Users() {
8885
8897
  ] });
8886
8898
  }
8887
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
+ },
8888
8915
  {
8889
8916
  accessorKey: "account.name",
8890
8917
  header: "Employee Name",
8891
8918
  cell: ({ row }) => {
8892
8919
  const account = row.original?.account;
8893
- return /* @__PURE__ */ jsx49("span", { children: account?.name });
8920
+ return /* @__PURE__ */ jsx49("span", { children: account?.name || "N/A" });
8894
8921
  }
8895
8922
  },
8896
8923
  {
@@ -8898,7 +8925,7 @@ function Users() {
8898
8925
  header: "Status",
8899
8926
  cell: ({ row }) => {
8900
8927
  const data2 = row.original;
8901
- return /* @__PURE__ */ jsx49(Activate_default, { data: data2 });
8928
+ return /* @__PURE__ */ jsx49(Activate_default, { data: data2, app });
8902
8929
  }
8903
8930
  },
8904
8931
  {
@@ -8930,7 +8957,9 @@ function Users() {
8930
8957
  data: users,
8931
8958
  index: true,
8932
8959
  title: "User",
8933
- description: "Manage users"
8960
+ description: "Manage users",
8961
+ createTitle: "Add User",
8962
+ onCreate: () => navigate("/users/create")
8934
8963
  }
8935
8964
  ),
8936
8965
  " "
@@ -8938,15 +8967,97 @@ function Users() {
8938
8967
  }
8939
8968
  var users_default = Users;
8940
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
+
8941
9052
  // src/components/users/ResetPasswordPage.tsx
8942
9053
  import { useEffect as useEffect22, useState as useState29 } from "react";
8943
- import { useSearchParams as useSearchParams2, useNavigate as useNavigate6 } from "react-router-dom";
9054
+ import { useSearchParams as useSearchParams2, useNavigate as useNavigate7 } from "react-router-dom";
8944
9055
  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";
9056
+ import { useForm as useForm8 } from "react-hook-form";
9057
+ import { zodResolver as zodResolver7 } from "@hookform/resolvers/zod";
8947
9058
  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";
9059
+ import { message as message12, Spin } from "antd";
9060
+ import { Fragment as Fragment12, jsx as jsx51, jsxs as jsxs40 } from "react/jsx-runtime";
8950
9061
  var resetPageSchema = z4.object({
8951
9062
  password: z4.string().min(6, "Password must be at least 6 characters"),
8952
9063
  confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
@@ -8956,7 +9067,7 @@ var resetPageSchema = z4.object({
8956
9067
  });
8957
9068
  function ResetPasswordPage() {
8958
9069
  const [searchParams] = useSearchParams2();
8959
- const navigate = useNavigate6();
9070
+ const navigate = useNavigate7();
8960
9071
  const { put, isLoading } = useApis_default();
8961
9072
  const [isVerified, setIsVerified] = useState29(false);
8962
9073
  const [verifying, setVerifying] = useState29(true);
@@ -8964,8 +9075,8 @@ function ResetPasswordPage() {
8964
9075
  const token = searchParams.get("token");
8965
9076
  const email = searchParams.get("email");
8966
9077
  const id = searchParams.get("id");
8967
- const methods = useForm7({
8968
- resolver: zodResolver6(resetPageSchema),
9078
+ const methods = useForm8({
9079
+ resolver: zodResolver7(resetPageSchema),
8969
9080
  defaultValues: {
8970
9081
  password: "",
8971
9082
  confirmPassword: ""
@@ -9003,23 +9114,23 @@ function ResetPasswordPage() {
9003
9114
  password: data.password
9004
9115
  }
9005
9116
  });
9006
- message11.success(
9117
+ message12.success(
9007
9118
  "Password has been reset successfully. You can now login."
9008
9119
  );
9009
9120
  navigate("/login", { replace: true });
9010
9121
  } catch (err) {
9011
- message11.error(err?.message || "Failed to reset password.");
9122
+ message12.error(err?.message || "Failed to reset password.");
9012
9123
  }
9013
9124
  };
9014
9125
  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..." })
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..." })
9018
9129
  ] }) });
9019
9130
  }
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(
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(
9023
9134
  "div",
9024
9135
  {
9025
9136
  className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
@@ -9028,35 +9139,35 @@ function ResetPasswordPage() {
9028
9139
  }
9029
9140
  }
9030
9141
  ),
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" })
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" })
9036
9147
  ] }),
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: [
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: [
9039
9150
  "Secure ",
9040
- /* @__PURE__ */ jsx50("span", { className: "text-indigo-400", children: "Access" }),
9151
+ /* @__PURE__ */ jsx51("span", { className: "text-indigo-400", children: "Access" }),
9041
9152
  " ",
9042
- /* @__PURE__ */ jsx50("br", {}),
9153
+ /* @__PURE__ */ jsx51("br", {}),
9043
9154
  " ",
9044
9155
  "Simplified."
9045
9156
  ] }),
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." })
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." })
9047
9158
  ] }),
9048
- /* @__PURE__ */ jsx50("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
9159
+ /* @__PURE__ */ jsx51("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
9049
9160
  ] })
9050
9161
  ] }),
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." })
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." })
9058
9169
  ] }),
9059
- /* @__PURE__ */ jsx50(
9170
+ /* @__PURE__ */ jsx51(
9060
9171
  Button,
9061
9172
  {
9062
9173
  onClick: () => navigate("/login"),
@@ -9064,22 +9175,22 @@ function ResetPasswordPage() {
9064
9175
  children: "Back to Login"
9065
9176
  }
9066
9177
  )
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: [
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: [
9071
9182
  "Set a new, strong password for",
9072
9183
  " ",
9073
- /* @__PURE__ */ jsx50("span", { className: "text-indigo-600 font-medium", children: email })
9184
+ /* @__PURE__ */ jsx51("span", { className: "text-indigo-600 font-medium", children: email })
9074
9185
  ] })
9075
9186
  ] }),
9076
- /* @__PURE__ */ jsxs39(
9187
+ /* @__PURE__ */ jsxs40(
9077
9188
  "form",
9078
9189
  {
9079
9190
  onSubmit: methods.handleSubmit(onSubmit),
9080
9191
  className: "space-y-6",
9081
9192
  children: [
9082
- /* @__PURE__ */ jsx50(
9193
+ /* @__PURE__ */ jsx51(
9083
9194
  Fields_default.Input,
9084
9195
  {
9085
9196
  form: methods,
@@ -9088,11 +9199,11 @@ function ResetPasswordPage() {
9088
9199
  type: "password",
9089
9200
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
9090
9201
  required: true,
9091
- icon: /* @__PURE__ */ jsx50(Lock2, { size: 18, className: "text-slate-400" }),
9202
+ icon: /* @__PURE__ */ jsx51(Lock2, { size: 18, className: "text-slate-400" }),
9092
9203
  className: "bg-slate-50 dark:bg-slate-900/50 h-12"
9093
9204
  }
9094
9205
  ),
9095
- /* @__PURE__ */ jsx50(
9206
+ /* @__PURE__ */ jsx51(
9096
9207
  Fields_default.Input,
9097
9208
  {
9098
9209
  form: methods,
@@ -9101,11 +9212,11 @@ function ResetPasswordPage() {
9101
9212
  type: "password",
9102
9213
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
9103
9214
  required: true,
9104
- icon: /* @__PURE__ */ jsx50(ShieldCheck2, { size: 18, className: "text-slate-400" }),
9215
+ icon: /* @__PURE__ */ jsx51(ShieldCheck2, { size: 18, className: "text-slate-400" }),
9105
9216
  className: "bg-slate-50 dark:bg-slate-900/50 h-12"
9106
9217
  }
9107
9218
  ),
9108
- /* @__PURE__ */ jsxs39(
9219
+ /* @__PURE__ */ jsxs40(
9109
9220
  Button,
9110
9221
  {
9111
9222
  type: "submit",
@@ -9113,7 +9224,7 @@ function ResetPasswordPage() {
9113
9224
  className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
9114
9225
  children: [
9115
9226
  "Update Password",
9116
- !isLoading && /* @__PURE__ */ jsx50(ArrowRight2, { size: 18 })
9227
+ !isLoading && /* @__PURE__ */ jsx51(ArrowRight2, { size: 18 })
9117
9228
  ]
9118
9229
  }
9119
9230
  )
@@ -9128,9 +9239,9 @@ var ResetPasswordPage_default = ResetPasswordPage;
9128
9239
 
9129
9240
  // src/components/users/UserProfile.tsx
9130
9241
  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";
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";
9134
9245
  var UserProfile = ({
9135
9246
  items,
9136
9247
  name,
@@ -9141,7 +9252,7 @@ var UserProfile = ({
9141
9252
  }) => {
9142
9253
  const { post } = useApis_default();
9143
9254
  const { user, logout: authLogout, account } = useAuth_default();
9144
- const navigate = useNavigate7();
9255
+ const navigate = useNavigate8();
9145
9256
  const logout = async () => {
9146
9257
  if (onLogout) {
9147
9258
  onLogout();
@@ -9152,32 +9263,32 @@ var UserProfile = ({
9152
9263
  url: `/users/logout/${user?._id}`,
9153
9264
  v: 1
9154
9265
  });
9155
- message12.success("Logout successfully");
9266
+ message13.success("Logout successfully");
9156
9267
  authLogout();
9157
9268
  navigate("/login");
9158
9269
  } catch (error) {
9159
9270
  console.log(error);
9160
- message12.error(error?.message);
9271
+ message13.error(error?.message);
9161
9272
  }
9162
9273
  };
9163
9274
  const defaultItems = [
9164
9275
  {
9165
9276
  label: "My Profile",
9166
- icon: /* @__PURE__ */ jsx51(User2, { size: 18 }),
9277
+ icon: /* @__PURE__ */ jsx52(User2, { size: 18 }),
9167
9278
  onClick: () => navigate("/profile"),
9168
9279
  className: "min-w-[150px]"
9169
9280
  },
9170
9281
  {
9171
9282
  label: "Logout",
9172
- icon: /* @__PURE__ */ jsx51(LogOut, { size: 18 }),
9283
+ icon: /* @__PURE__ */ jsx52(LogOut, { size: 18 }),
9173
9284
  onClick: logout,
9174
9285
  className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
9175
9286
  }
9176
9287
  ];
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(
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(
9181
9292
  ProfileDropdown,
9182
9293
  {
9183
9294
  name: name || account?.name || "User",
@@ -9193,14 +9304,14 @@ var UserProfile = ({
9193
9304
  var UserProfile_default = UserProfile;
9194
9305
 
9195
9306
  // src/components/users/ProfilePage.tsx
9196
- import { useNavigate as useNavigate8 } from "react-router-dom";
9307
+ import { useNavigate as useNavigate9 } from "react-router-dom";
9197
9308
  import { ArrowLeft as ArrowLeft3 } from "lucide-react";
9198
- import { jsx as jsx52, jsxs as jsxs41 } from "react/jsx-runtime";
9309
+ import { jsx as jsx53, jsxs as jsxs42 } from "react/jsx-runtime";
9199
9310
  var ProfilePage = () => {
9200
- const navigate = useNavigate8();
9311
+ const navigate = useNavigate9();
9201
9312
  const { user, account } = useAuth();
9202
9313
  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" }) });
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" }) });
9204
9315
  }
9205
9316
  const extraInfo = [
9206
9317
  {
@@ -9219,19 +9330,19 @@ var ProfilePage = () => {
9219
9330
  copiable: false
9220
9331
  }
9221
9332
  ];
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(
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(
9224
9335
  Button,
9225
9336
  {
9226
9337
  variant: "outline",
9227
9338
  size: "sm",
9228
9339
  onClick: () => navigate(-1),
9229
- icon: /* @__PURE__ */ jsx52(ArrowLeft3, { size: 16 }),
9340
+ icon: /* @__PURE__ */ jsx53(ArrowLeft3, { size: 16 }),
9230
9341
  className: "rounded-full font-bold px-5",
9231
9342
  children: "Back"
9232
9343
  }
9233
9344
  ) }),
9234
- /* @__PURE__ */ jsx52(
9345
+ /* @__PURE__ */ jsx53(
9235
9346
  ProfileView,
9236
9347
  {
9237
9348
  name: account?.name || "User Account",
@@ -9300,11 +9411,13 @@ export {
9300
9411
  ThemeToggle,
9301
9412
  ThemedLogin,
9302
9413
  UnProtectedRoute,
9414
+ UserForm_default as UserForm,
9303
9415
  UserProfile_default as UserProfile,
9304
9416
  users_default as Users,
9305
9417
  Views_default as Views,
9306
9418
  WarqadProvider,
9307
9419
  createAccountSchema,
9420
+ createUserSchema,
9308
9421
  generatePdf,
9309
9422
  linkUserSchema,
9310
9423
  resetPasswordSchema,