warqadui 0.0.88 → 0.0.90

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
@@ -295,6 +295,18 @@ var useTheme = () => {
295
295
  return context;
296
296
  };
297
297
 
298
+ // src/utils/Enums.ts
299
+ var Enums = {
300
+ roles: ["admin", "staff"],
301
+ sex: ["male", "female"],
302
+ accountTypes: ["employee", "supplier", "customer", "amaanah"],
303
+ verificationTypes: ["email_verification", "password_reset"],
304
+ auditActions: ["create", "update", "delete", "login", "logout"],
305
+ walletTypes: ["bank", "cash", "mobile"],
306
+ currencies: ["USD", "TZS", "KES", "CNY"]
307
+ };
308
+ var Enums_default = Enums;
309
+
298
310
  // src/providers/WarqadProvider.tsx
299
311
  import { jsx as jsx5 } from "react/jsx-runtime";
300
312
  var WarqadConfigContext = createContext2(
@@ -330,6 +342,10 @@ var WarqadProvider = ({ children, config }) => {
330
342
  store: {
331
343
  ...DEFAULT_STORE,
332
344
  ...config?.store
345
+ },
346
+ enums: {
347
+ ...Enums_default,
348
+ ...config?.enums
333
349
  }
334
350
  }),
335
351
  [config]
@@ -1803,7 +1819,8 @@ import React8, {
1803
1819
  useState as useState13,
1804
1820
  useRef as useRef3,
1805
1821
  useEffect as useEffect8,
1806
- forwardRef as forwardRef3
1822
+ forwardRef as forwardRef3,
1823
+ useMemo as useMemo4
1807
1824
  } from "react";
1808
1825
  import { createPortal as createPortal2 } from "react-dom";
1809
1826
  import { ChevronDown as ChevronDown2, Check as Check2 } from "lucide-react";
@@ -1817,7 +1834,28 @@ var useSelectContext = () => {
1817
1834
  return context;
1818
1835
  };
1819
1836
  var Select = forwardRef3((props, ref) => {
1820
- const { form, name, onChange, value, children, options = [] } = props;
1837
+ const { enums } = useWarqadConfig();
1838
+ const {
1839
+ form,
1840
+ name,
1841
+ onChange,
1842
+ value,
1843
+ children,
1844
+ options: initialOptions = [],
1845
+ enum: enumData,
1846
+ enumName
1847
+ } = props;
1848
+ const options = useMemo4(() => {
1849
+ if (initialOptions.length > 0) return initialOptions;
1850
+ const targetEnum = enumData || (enumName ? enums[enumName] : void 0);
1851
+ if (targetEnum) {
1852
+ return targetEnum.map((val) => ({
1853
+ value: val,
1854
+ label: String(val).charAt(0).toUpperCase() + String(val).slice(1)
1855
+ }));
1856
+ }
1857
+ return [];
1858
+ }, [initialOptions, enumData, enumName, enums]);
1821
1859
  useEffect8(() => {
1822
1860
  if (form && name && value !== void 0 && value !== null && value !== "") {
1823
1861
  const currentFormValue = form.getValues(name);
@@ -3134,7 +3172,7 @@ var Fields = {
3134
3172
  var Fields_default = Fields;
3135
3173
 
3136
3174
  // src/components/tables/DataTable.tsx
3137
- import React10, { useState as useState17, useMemo as useMemo4, useEffect as useEffect11 } from "react";
3175
+ import React10, { useState as useState17, useMemo as useMemo5, useEffect as useEffect11 } from "react";
3138
3176
  import {
3139
3177
  useReactTable,
3140
3178
  getCoreRowModel,
@@ -3205,7 +3243,7 @@ function DataTable({
3205
3243
  }
3206
3244
  return initialState;
3207
3245
  });
3208
- const columns = useMemo4(() => {
3246
+ const columns = useMemo5(() => {
3209
3247
  let mappedColumns = userColumns.map((col) => ({
3210
3248
  ...col,
3211
3249
  accessorKey: col.key || col.accessorKey,
@@ -3455,7 +3493,7 @@ function DataTable({
3455
3493
  // src/components/tables/PostTable.tsx
3456
3494
  import React11, {
3457
3495
  useState as useState18,
3458
- useMemo as useMemo5,
3496
+ useMemo as useMemo6,
3459
3497
  useEffect as useEffect12,
3460
3498
  useRef as useRef5,
3461
3499
  useCallback as useCallback3
@@ -3791,7 +3829,7 @@ function PostTable({
3791
3829
  },
3792
3830
  [handleCancelEdit]
3793
3831
  );
3794
- const actionColumn = useMemo5(
3832
+ const actionColumn = useMemo6(
3795
3833
  () => ({
3796
3834
  id: "actions",
3797
3835
  header: "Actions",
@@ -3823,7 +3861,7 @@ function PostTable({
3823
3861
  }),
3824
3862
  []
3825
3863
  );
3826
- const columns = useMemo5(() => {
3864
+ const columns = useMemo6(() => {
3827
3865
  const mappedUserColumns = userColumns.map((col) => ({
3828
3866
  ...col,
3829
3867
  accessorKey: col.key || col.accessorKey,
@@ -4161,7 +4199,7 @@ function PostTable({
4161
4199
  }
4162
4200
 
4163
4201
  // src/components/tables/SimpleTable.tsx
4164
- import { useMemo as useMemo6 } from "react";
4202
+ import { useMemo as useMemo7 } from "react";
4165
4203
  import {
4166
4204
  useReactTable as useReactTable3,
4167
4205
  getCoreRowModel as getCoreRowModel3,
@@ -4183,7 +4221,7 @@ function SimpleTable({
4183
4221
  emptyState,
4184
4222
  skeletonCount = 5
4185
4223
  }) {
4186
- const columns = useMemo6(() => {
4224
+ const columns = useMemo7(() => {
4187
4225
  const cols = userColumns.filter((col) => !col.hide).map((col) => ({
4188
4226
  ...col,
4189
4227
  accessorKey: col.key || col.accessorKey,
@@ -4209,7 +4247,7 @@ function SimpleTable({
4209
4247
  columns,
4210
4248
  getCoreRowModel: getCoreRowModel3()
4211
4249
  });
4212
- const hasFooters = useMemo6(() => {
4250
+ const hasFooters = useMemo7(() => {
4213
4251
  return table.getFooterGroups().some(
4214
4252
  (group) => group.headers.some(
4215
4253
  (header) => !header.isPlaceholder && header.column.columnDef.footer
@@ -6086,7 +6124,7 @@ var useA4CategoryView = ({
6086
6124
  var useA4CategoryView_default = useA4CategoryView;
6087
6125
 
6088
6126
  // src/hooks/Fetches/useTransaction.tsx
6089
- import { useEffect as useEffect16, useState as useState24, useMemo as useMemo7, useCallback as useCallback4 } from "react";
6127
+ import { useEffect as useEffect16, useState as useState24, useMemo as useMemo8, useCallback as useCallback4 } from "react";
6090
6128
  import { AlertCircle as AlertCircle4, FileX as FileX3, Plus as Plus2, RefreshCw as RefreshCw3 } from "lucide-react";
6091
6129
  import moment from "moment";
6092
6130
  import { jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
@@ -6117,7 +6155,7 @@ var useTransaction = ({
6117
6155
  useEffect16(() => {
6118
6156
  getData();
6119
6157
  }, [url, v, JSON.stringify(params), delay, date]);
6120
- const TransactionViewComponent = useMemo7(() => {
6158
+ const TransactionViewComponent = useMemo8(() => {
6121
6159
  return ({
6122
6160
  columns = [
6123
6161
  {
@@ -8046,10 +8084,123 @@ import { useNavigate as useNavigate4, useParams } from "react-router-dom";
8046
8084
  import { Cable, EllipsisVertical, FilePenLine, Trash2 as Trash22 } from "lucide-react";
8047
8085
  import { useState as useState26 } from "react";
8048
8086
  import { message as message4 } from "antd";
8049
- import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
8087
+
8088
+ // src/components/ErrorPage/ErrorPage.tsx
8089
+ import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
8090
+ var ErrorPageBase = ({
8091
+ title,
8092
+ message: message16,
8093
+ statusCode,
8094
+ action,
8095
+ className = ""
8096
+ }) => {
8097
+ return /* @__PURE__ */ jsx43(
8098
+ "div",
8099
+ {
8100
+ className: `flex-1 m-auto h-full w-full min-h-[50vh] flex flex-col items-center justify-center p-6 text-zinc-900 dark:text-zinc-100 ${className}`,
8101
+ children: /* @__PURE__ */ jsxs33("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
8102
+ statusCode && /* @__PURE__ */ jsx43("div", { className: "absolute inset-0 flex items-center justify-center z-0 select-none pointer-events-none opacity-[0.03] dark:opacity-5", children: /* @__PURE__ */ jsx43("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
8103
+ /* @__PURE__ */ jsxs33("div", { className: "relative z-10 space-y-6", children: [
8104
+ statusCode && /* @__PURE__ */ jsxs33("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
8105
+ "Error ",
8106
+ statusCode
8107
+ ] }),
8108
+ title && /* @__PURE__ */ jsx43("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
8109
+ message16 && /* @__PURE__ */ jsx43("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message16 }),
8110
+ action && /* @__PURE__ */ jsx43("div", { className: "pt-8", children: /* @__PURE__ */ jsx43(
8111
+ "button",
8112
+ {
8113
+ onClick: action.onClick,
8114
+ className: "px-8 py-3.5 rounded-full text-white font-semibold shadow-[0_4px_14px_0_rgba(0,0,0,0.1)] hover:shadow-[0_6px_20px_rgba(0,0,0,0.15)] transition-all hover:-translate-y-0.5 active:translate-y-0 focus:outline-none focus:ring-2 focus:ring-offset-2",
8115
+ style: { backgroundColor: "var(--primary-color, #3b82f6)" },
8116
+ children: action.label
8117
+ }
8118
+ ) })
8119
+ ] })
8120
+ ] })
8121
+ }
8122
+ );
8123
+ };
8124
+
8125
+ // src/components/ErrorPage/ErrorPage.500.tsx
8126
+ import { jsx as jsx44 } from "react/jsx-runtime";
8127
+ var ErrorPage500 = (props) => {
8128
+ return /* @__PURE__ */ jsx44(
8129
+ ErrorPageBase,
8130
+ {
8131
+ statusCode: 500,
8132
+ title: "Internal Server Error",
8133
+ message: "Oops, something went wrong on our end. Please try again later.",
8134
+ action: { label: "Go Home", onClick: () => window.location.href = "/" },
8135
+ ...props
8136
+ }
8137
+ );
8138
+ };
8139
+
8140
+ // src/components/ErrorPage/ErrorPage.404.tsx
8141
+ import { jsx as jsx45 } from "react/jsx-runtime";
8142
+ var ErrorPage404 = (props) => {
8143
+ return /* @__PURE__ */ jsx45(
8144
+ ErrorPageBase,
8145
+ {
8146
+ statusCode: 404,
8147
+ title: "Page Not Found",
8148
+ message: "The page you are looking for doesn't exist or has been moved.",
8149
+ action: { label: "Go Home", onClick: () => window.location.href = "/" },
8150
+ ...props
8151
+ }
8152
+ );
8153
+ };
8154
+
8155
+ // src/components/ErrorPage/ErrorPage.401.tsx
8156
+ import { jsx as jsx46 } from "react/jsx-runtime";
8157
+ var ErrorPage401 = (props) => {
8158
+ return /* @__PURE__ */ jsx46(
8159
+ ErrorPageBase,
8160
+ {
8161
+ statusCode: 401,
8162
+ title: "Unauthorized",
8163
+ message: "You don't have permission to access this page.",
8164
+ action: { label: "Go Home", onClick: () => window.location.href = "/" },
8165
+ ...props
8166
+ }
8167
+ );
8168
+ };
8169
+
8170
+ // src/components/ErrorPage/ErrorPage.400.tsx
8171
+ import { jsx as jsx47 } from "react/jsx-runtime";
8172
+ var ErrorPage400 = (props) => {
8173
+ return /* @__PURE__ */ jsx47(
8174
+ ErrorPageBase,
8175
+ {
8176
+ statusCode: 400,
8177
+ title: "Bad Request",
8178
+ message: "Your request could not be processed. Please try again.",
8179
+ action: { label: "Go Home", onClick: () => window.location.href = "/" },
8180
+ ...props
8181
+ }
8182
+ );
8183
+ };
8184
+
8185
+ // src/components/ErrorPage/index.ts
8186
+ var ErrorPage = Object.assign(ErrorPageBase, {
8187
+ 500: ErrorPage500,
8188
+ 404: ErrorPage404,
8189
+ 401: ErrorPage401,
8190
+ 400: ErrorPage400
8191
+ });
8192
+
8193
+ // src/components/accounts/Accounts.tsx
8194
+ import { Fragment as Fragment9, jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
8195
+ var ErrorPage5002 = ErrorPage[500];
8050
8196
  function Accounts({ v, url }) {
8197
+ const { enums } = useWarqadConfig();
8051
8198
  const { branchId } = useParams();
8199
+ const navigate = useNavigate4();
8052
8200
  const { type } = useParams();
8201
+ if (!enums.accountTypes.includes(type)) {
8202
+ return /* @__PURE__ */ jsx48(ErrorPage5002, { title: `${type} page not found` });
8203
+ }
8053
8204
  const [deleteAccount, setDeleteAccount] = useState26(null);
8054
8205
  const { isLoading, remove } = useApis_default();
8055
8206
  const isEmployee = type === "employee";
@@ -8059,21 +8210,20 @@ function Accounts({ v, url }) {
8059
8210
  dateFilter: false
8060
8211
  });
8061
8212
  const { Modal: Modal2 } = useModal();
8062
- const navigate = useNavigate4();
8063
8213
  const items = (data2) => [
8064
8214
  {
8065
8215
  label: `Edit ${type}`,
8066
- icon: /* @__PURE__ */ jsx43(FilePenLine, { size: 16 }),
8216
+ icon: /* @__PURE__ */ jsx48(FilePenLine, { size: 16 }),
8067
8217
  onClick: () => navigate(`update?id=${data2?._id}`)
8068
8218
  },
8069
8219
  {
8070
8220
  label: `Delete ${type}`,
8071
- icon: /* @__PURE__ */ jsx43(Trash22, { className: "text-red-500", size: 16 }),
8221
+ icon: /* @__PURE__ */ jsx48(Trash22, { className: "text-red-500", size: 16 }),
8072
8222
  onClick: () => setDeleteAccount(data2)
8073
8223
  },
8074
8224
  isEmployee && !data2?.user && {
8075
8225
  label: `Link User`,
8076
- icon: /* @__PURE__ */ jsx43(Cable, { size: 16 }),
8226
+ icon: /* @__PURE__ */ jsx48(Cable, { size: 16 }),
8077
8227
  onClick: () => navigate(`link-user?id=${data2?._id}`)
8078
8228
  }
8079
8229
  ].filter(Boolean);
@@ -8083,7 +8233,7 @@ function Accounts({ v, url }) {
8083
8233
  header: "Name",
8084
8234
  cell: ({ row }) => {
8085
8235
  const account = row.original;
8086
- return /* @__PURE__ */ jsx43("span", { children: account?.name });
8236
+ return /* @__PURE__ */ jsx48("span", { children: account?.name });
8087
8237
  }
8088
8238
  },
8089
8239
  {
@@ -8091,7 +8241,7 @@ function Accounts({ v, url }) {
8091
8241
  header: "Sex",
8092
8242
  cell: ({ row }) => {
8093
8243
  const account = row.original;
8094
- return /* @__PURE__ */ jsx43("span", { children: account?.sex });
8244
+ return /* @__PURE__ */ jsx48("span", { children: account?.sex });
8095
8245
  }
8096
8246
  },
8097
8247
  {
@@ -8099,7 +8249,7 @@ function Accounts({ v, url }) {
8099
8249
  header: "Email",
8100
8250
  cell: ({ row }) => {
8101
8251
  const account = row.original;
8102
- return /* @__PURE__ */ jsx43("span", { children: account?.email || "N/A" });
8252
+ return /* @__PURE__ */ jsx48("span", { children: account?.email || "N/A" });
8103
8253
  }
8104
8254
  },
8105
8255
  {
@@ -8107,7 +8257,7 @@ function Accounts({ v, url }) {
8107
8257
  header: "Phone",
8108
8258
  cell: ({ row }) => {
8109
8259
  const account = row.original;
8110
- return /* @__PURE__ */ jsx43("span", { children: account?.phoneNumber || "N/A" });
8260
+ return /* @__PURE__ */ jsx48("span", { children: account?.phoneNumber || "N/A" });
8111
8261
  }
8112
8262
  },
8113
8263
  isEmployee && {
@@ -8115,7 +8265,7 @@ function Accounts({ v, url }) {
8115
8265
  header: "User",
8116
8266
  cell: ({ row }) => {
8117
8267
  const account = row.original;
8118
- return /* @__PURE__ */ jsx43(Badge, { variant: account?.user ? "success" : "danger", size: "sm", children: account?.user ? "Linked" : "Not Linked" });
8268
+ return /* @__PURE__ */ jsx48(Badge, { variant: account?.user ? "success" : "danger", size: "sm", children: account?.user ? "Linked" : "Not Linked" });
8119
8269
  }
8120
8270
  },
8121
8271
  {
@@ -8123,13 +8273,13 @@ function Accounts({ v, url }) {
8123
8273
  header: "Actions",
8124
8274
  cell: ({ row }) => {
8125
8275
  const data2 = row.original;
8126
- return /* @__PURE__ */ jsx43(
8276
+ return /* @__PURE__ */ jsx48(
8127
8277
  Dropdown,
8128
8278
  {
8129
8279
  className: "cursor-pointer w-[150px]",
8130
8280
  items: items(data2),
8131
8281
  triggerMode: "hover",
8132
- children: /* @__PURE__ */ jsx43(EllipsisVertical, {})
8282
+ children: /* @__PURE__ */ jsx48(EllipsisVertical, {})
8133
8283
  }
8134
8284
  );
8135
8285
  }
@@ -8147,9 +8297,9 @@ function Accounts({ v, url }) {
8147
8297
  return error;
8148
8298
  }
8149
8299
  };
8150
- return /* @__PURE__ */ jsxs33(Fragment9, { children: [
8151
- /* @__PURE__ */ jsx43(Modal2, {}),
8152
- /* @__PURE__ */ jsx43(
8300
+ return /* @__PURE__ */ jsxs34(Fragment9, { children: [
8301
+ /* @__PURE__ */ jsx48(Modal2, {}),
8302
+ /* @__PURE__ */ jsx48(
8153
8303
  ConfirmModal,
8154
8304
  {
8155
8305
  isOpen: !!deleteAccount,
@@ -8162,7 +8312,7 @@ function Accounts({ v, url }) {
8162
8312
  children: null
8163
8313
  }
8164
8314
  ),
8165
- /* @__PURE__ */ jsx43(
8315
+ /* @__PURE__ */ jsx48(
8166
8316
  TransactionViewComponent,
8167
8317
  {
8168
8318
  columns,
@@ -8202,18 +8352,6 @@ var useApp = () => {
8202
8352
  };
8203
8353
  var useApp_default = useApp;
8204
8354
 
8205
- // src/utils/Enums.ts
8206
- var Enums = {
8207
- roles: ["admin", "staff"],
8208
- sex: ["male", "female"],
8209
- accountTypes: ["employee", "supplier", "customer", "investor"],
8210
- verificationTypes: ["email_verification", "password_reset"],
8211
- auditActions: ["create", "update", "delete", "login", "logout"],
8212
- walletTypes: ["bank", "cash", "mobile"],
8213
- currencies: ["USD", "TZS", "KES", "CNY"]
8214
- };
8215
- var Enums_default = Enums;
8216
-
8217
8355
  // src/components/accounts/schema.tsx
8218
8356
  import { z as z2 } from "zod";
8219
8357
  var createAccountSchema = z2.object({
@@ -8267,7 +8405,7 @@ var Formats_default = Formats;
8267
8405
 
8268
8406
  // src/hooks/useAccountBalance.tsx
8269
8407
  import { useEffect as useEffect19, useState as useState27 } from "react";
8270
- import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
8408
+ import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
8271
8409
  var useAccountbalance = ({
8272
8410
  url,
8273
8411
  showBalance,
@@ -8301,15 +8439,15 @@ var useAccountbalance = ({
8301
8439
  return null;
8302
8440
  }
8303
8441
  if (isLoading) {
8304
- return /* @__PURE__ */ jsx44("h2", { className: "text-gray-500", children: "Getting Balance..." });
8442
+ return /* @__PURE__ */ jsx49("h2", { className: "text-gray-500", children: "Getting Balance..." });
8305
8443
  }
8306
8444
  if (error) {
8307
- return /* @__PURE__ */ jsxs34("h2", { className: "text-red-500", children: [
8445
+ return /* @__PURE__ */ jsxs35("h2", { className: "text-red-500", children: [
8308
8446
  "Error: ",
8309
8447
  error
8310
8448
  ] });
8311
8449
  }
8312
- return /* @__PURE__ */ jsxs34(
8450
+ return /* @__PURE__ */ jsxs35(
8313
8451
  "h2",
8314
8452
  {
8315
8453
  className: `${balance.startsWith("-") ? "text-red-500" : "text-green-500"}`,
@@ -8326,7 +8464,7 @@ var useAccountBalance_default = useAccountbalance;
8326
8464
 
8327
8465
  // src/components/accounts/Feilds/Account.tsx
8328
8466
  import { useParams as useParams3 } from "react-router-dom";
8329
- import { jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
8467
+ import { jsx as jsx50, jsxs as jsxs36 } from "react/jsx-runtime";
8330
8468
  function Account({
8331
8469
  name,
8332
8470
  label,
@@ -8346,8 +8484,8 @@ function Account({
8346
8484
  showBalance,
8347
8485
  accountId
8348
8486
  });
8349
- return /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-2", children: [
8350
- /* @__PURE__ */ jsx45(
8487
+ return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-2", children: [
8488
+ /* @__PURE__ */ jsx50(
8351
8489
  Fields_default.SearchApi,
8352
8490
  {
8353
8491
  name,
@@ -8364,13 +8502,13 @@ function Account({
8364
8502
  disabled
8365
8503
  }
8366
8504
  ),
8367
- /* @__PURE__ */ jsx45(BalanceView, {})
8505
+ /* @__PURE__ */ jsx50(BalanceView, {})
8368
8506
  ] });
8369
8507
  }
8370
8508
  var Account_default = Account;
8371
8509
 
8372
8510
  // src/components/accounts/Feilds/Customers.tsx
8373
- import { jsx as jsx46 } from "react/jsx-runtime";
8511
+ import { jsx as jsx51 } from "react/jsx-runtime";
8374
8512
  function Customer({
8375
8513
  name = "customer",
8376
8514
  label = "Customer",
@@ -8383,7 +8521,7 @@ function Customer({
8383
8521
  disabled,
8384
8522
  v
8385
8523
  }) {
8386
- return /* @__PURE__ */ jsx46(
8524
+ return /* @__PURE__ */ jsx51(
8387
8525
  Account_default,
8388
8526
  {
8389
8527
  name,
@@ -8402,7 +8540,7 @@ function Customer({
8402
8540
  var Customers_default = Customer;
8403
8541
 
8404
8542
  // src/components/accounts/Feilds/Employee.tsx
8405
- import { jsx as jsx47 } from "react/jsx-runtime";
8543
+ import { jsx as jsx52 } from "react/jsx-runtime";
8406
8544
  function Employee({
8407
8545
  name = "employee",
8408
8546
  label = "Employee",
@@ -8415,7 +8553,7 @@ function Employee({
8415
8553
  disabled,
8416
8554
  v
8417
8555
  }) {
8418
- return /* @__PURE__ */ jsx47(
8556
+ return /* @__PURE__ */ jsx52(
8419
8557
  Account_default,
8420
8558
  {
8421
8559
  name,
@@ -8434,7 +8572,7 @@ function Employee({
8434
8572
  var Employee_default = Employee;
8435
8573
 
8436
8574
  // src/components/accounts/Feilds/Branches.tsx
8437
- import { jsx as jsx48 } from "react/jsx-runtime";
8575
+ import { jsx as jsx53 } from "react/jsx-runtime";
8438
8576
  function Branches({
8439
8577
  name = "branch",
8440
8578
  label = "Branch",
@@ -8447,7 +8585,7 @@ function Branches({
8447
8585
  v,
8448
8586
  disabled
8449
8587
  }) {
8450
- return /* @__PURE__ */ jsx48(
8588
+ return /* @__PURE__ */ jsx53(
8451
8589
  Account_default,
8452
8590
  {
8453
8591
  name,
@@ -8476,13 +8614,18 @@ var Feilds_default = AccountFields;
8476
8614
 
8477
8615
  // src/components/accounts/AccountForm.tsx
8478
8616
  import { useParams as useParams4 } from "react-router-dom";
8479
- import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
8617
+ import { jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
8618
+ var ErrorPage5003 = ErrorPage[500];
8480
8619
  function AccountForm() {
8620
+ const { enums } = useWarqadConfig();
8481
8621
  const { branchId } = useParams4();
8482
8622
  const { getQuery, getParams, navigate } = useApp_default();
8483
8623
  const id = getQuery("id");
8484
8624
  const type = getParams("type");
8485
8625
  const isEdit = !!id;
8626
+ if (!enums.accountTypes.includes(type)) {
8627
+ return /* @__PURE__ */ jsx54(ErrorPage5003, { title: `${type} page not found` });
8628
+ }
8486
8629
  const { post, put, isLoading } = useApis_default();
8487
8630
  const { isLoading: isLoadingGet, get } = useApis_default();
8488
8631
  const methods = useForm2({
@@ -8523,7 +8666,7 @@ function AccountForm() {
8523
8666
  const fetches = async () => {
8524
8667
  try {
8525
8668
  const res = await get({
8526
- url: `/accounts/get/${type}?id=${id}`
8669
+ url: `/accounts/get/${type}?id=${id}${branchId ? `&branch=${branchId}` : ""}`
8527
8670
  });
8528
8671
  const data = res.data;
8529
8672
  methods.reset(data);
@@ -8536,24 +8679,24 @@ function AccountForm() {
8536
8679
  fetches();
8537
8680
  }
8538
8681
  }, [id]);
8539
- return /* @__PURE__ */ jsxs36(
8682
+ return /* @__PURE__ */ jsxs37(
8540
8683
  Card,
8541
8684
  {
8542
8685
  className: "max-w-4xl mx-auto mt-10 relative",
8543
8686
  isLoading: isLoadingGet,
8544
8687
  loadingText: "Processing...",
8545
8688
  children: [
8546
- /* @__PURE__ */ jsxs36(Card.Header, { children: [
8547
- /* @__PURE__ */ jsx49(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
8548
- /* @__PURE__ */ jsx49(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
8689
+ /* @__PURE__ */ jsxs37(Card.Header, { children: [
8690
+ /* @__PURE__ */ jsx54(Card.Title, { children: `${isEdit ? "Edit" : "Add"} ${type}` }),
8691
+ /* @__PURE__ */ jsx54(Card.Description, { children: isEdit ? `Update the details for this ${type}` : `Create a new ${type} and add it to your list` })
8549
8692
  ] }),
8550
- /* @__PURE__ */ jsx49(Card.Content, { children: /* @__PURE__ */ jsxs36(
8693
+ /* @__PURE__ */ jsx54(Card.Content, { children: /* @__PURE__ */ jsxs37(
8551
8694
  "form",
8552
8695
  {
8553
8696
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
8554
8697
  children: [
8555
- /* @__PURE__ */ jsxs36("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8556
- /* @__PURE__ */ jsx49(
8698
+ /* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8699
+ /* @__PURE__ */ jsx54(
8557
8700
  Fields_default.Input,
8558
8701
  {
8559
8702
  label: "Name",
@@ -8564,19 +8707,16 @@ function AccountForm() {
8564
8707
  required: true
8565
8708
  }
8566
8709
  ),
8567
- /* @__PURE__ */ jsx49(
8710
+ /* @__PURE__ */ jsx54(
8568
8711
  Fields_default.Select,
8569
8712
  {
8570
8713
  label: "Sex",
8571
8714
  form: methods,
8572
8715
  name: "sex",
8573
- options: Enums_default.sex.map((sex) => ({
8574
- value: sex,
8575
- label: sex
8576
- }))
8716
+ enumName: "sex"
8577
8717
  }
8578
8718
  ),
8579
- /* @__PURE__ */ jsx49(
8719
+ /* @__PURE__ */ jsx54(
8580
8720
  Fields_default.Input,
8581
8721
  {
8582
8722
  label: "Email",
@@ -8586,7 +8726,7 @@ function AccountForm() {
8586
8726
  placeholder: "e.g maoo@exapmle.com"
8587
8727
  }
8588
8728
  ),
8589
- /* @__PURE__ */ jsx49(
8729
+ /* @__PURE__ */ jsx54(
8590
8730
  Fields_default.PhoneInput,
8591
8731
  {
8592
8732
  label: "Phone Number",
@@ -8595,7 +8735,7 @@ function AccountForm() {
8595
8735
  placeholder: "Enter phone number"
8596
8736
  }
8597
8737
  ),
8598
- !branchId && /* @__PURE__ */ jsx49(
8738
+ !branchId && /* @__PURE__ */ jsx54(
8599
8739
  Feilds_default.Branches,
8600
8740
  {
8601
8741
  label: "Branch",
@@ -8606,7 +8746,7 @@ function AccountForm() {
8606
8746
  }
8607
8747
  )
8608
8748
  ] }),
8609
- /* @__PURE__ */ jsx49("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx49(
8749
+ /* @__PURE__ */ jsx54("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx54(
8610
8750
  Button,
8611
8751
  {
8612
8752
  isLoading,
@@ -8665,7 +8805,7 @@ import { useForm as useForm3 } from "react-hook-form";
8665
8805
  import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
8666
8806
  import { message as message6 } from "antd";
8667
8807
  import { useEffect as useEffect21 } from "react";
8668
- import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
8808
+ import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
8669
8809
  function LinkUser({ type: initialType = "employee" }) {
8670
8810
  const { getQuery, navigate, getParams } = useApp_default();
8671
8811
  const id = getQuery("id");
@@ -8721,26 +8861,26 @@ function LinkUser({ type: initialType = "employee" }) {
8721
8861
  navigate(-1);
8722
8862
  }
8723
8863
  }, [id]);
8724
- return /* @__PURE__ */ jsxs37(
8864
+ return /* @__PURE__ */ jsxs38(
8725
8865
  Card,
8726
8866
  {
8727
8867
  className: "max-w-4xl mx-auto mt-10 relative",
8728
8868
  isLoading: isLoadingGet,
8729
8869
  loadingText: "Processing...",
8730
8870
  children: [
8731
- /* @__PURE__ */ jsxs37(Card.Header, { children: [
8732
- /* @__PURE__ */ jsx50(Card.Title, { children: `Link User ` }),
8733
- /* @__PURE__ */ jsx50(Card.Description, { children: "Link User Employee and add it to your list" })
8871
+ /* @__PURE__ */ jsxs38(Card.Header, { children: [
8872
+ /* @__PURE__ */ jsx55(Card.Title, { children: `Link User ` }),
8873
+ /* @__PURE__ */ jsx55(Card.Description, { children: "Link User Employee and add it to your list" })
8734
8874
  ] }),
8735
- /* @__PURE__ */ jsx50(Card.Content, { children: /* @__PURE__ */ jsxs37(
8875
+ /* @__PURE__ */ jsx55(Card.Content, { children: /* @__PURE__ */ jsxs38(
8736
8876
  "form",
8737
8877
  {
8738
8878
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
8739
8879
  className: "space-y-4",
8740
8880
  children: [
8741
- /* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8881
+ /* @__PURE__ */ jsxs38("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
8742
8882
  " ",
8743
- /* @__PURE__ */ jsx50(
8883
+ /* @__PURE__ */ jsx55(
8744
8884
  Fields_default.Input,
8745
8885
  {
8746
8886
  label: "Name",
@@ -8751,7 +8891,7 @@ function LinkUser({ type: initialType = "employee" }) {
8751
8891
  disabled: true
8752
8892
  }
8753
8893
  ),
8754
- /* @__PURE__ */ jsx50(
8894
+ /* @__PURE__ */ jsx55(
8755
8895
  Fields_default.Input,
8756
8896
  {
8757
8897
  label: "Email",
@@ -8762,7 +8902,7 @@ function LinkUser({ type: initialType = "employee" }) {
8762
8902
  required: true
8763
8903
  }
8764
8904
  ),
8765
- /* @__PURE__ */ jsx50(
8905
+ /* @__PURE__ */ jsx55(
8766
8906
  Fields_default.Select,
8767
8907
  {
8768
8908
  label: "Role",
@@ -8773,7 +8913,7 @@ function LinkUser({ type: initialType = "employee" }) {
8773
8913
  }
8774
8914
  )
8775
8915
  ] }),
8776
- /* @__PURE__ */ jsx50("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx50(
8916
+ /* @__PURE__ */ jsx55("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx55(
8777
8917
  Button,
8778
8918
  {
8779
8919
  isLoading,
@@ -8794,7 +8934,7 @@ function LinkUser({ type: initialType = "employee" }) {
8794
8934
  var linkUser_default = LinkUser;
8795
8935
 
8796
8936
  // src/components/users/users.tsx
8797
- import { useMemo as useMemo8 } from "react";
8937
+ import { useMemo as useMemo9 } from "react";
8798
8938
  import { EllipsisVertical as EllipsisVertical2, Info, Mail as Mail2, ShieldCheck, Key } from "lucide-react";
8799
8939
 
8800
8940
  // src/components/users/VerifyEmailForm.tsx
@@ -8802,7 +8942,7 @@ import { useForm as useForm4 } from "react-hook-form";
8802
8942
  import { zodResolver as zodResolver4 } from "@hookform/resolvers/zod";
8803
8943
  import { message as message7, Statistic } from "antd";
8804
8944
  import { useState as useState28, useEffect as useEffect22 } from "react";
8805
- import { jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
8945
+ import { jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
8806
8946
  var { Countdown } = Statistic;
8807
8947
  function VerifyEmailForm({
8808
8948
  data,
@@ -8870,9 +9010,9 @@ function VerifyEmailForm({
8870
9010
  message7.error(error?.message || "Something went wrong");
8871
9011
  }
8872
9012
  };
8873
- return /* @__PURE__ */ jsxs38("form", { onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)), children: [
8874
- /* @__PURE__ */ jsxs38("div", { className: "space-y-2", children: [
8875
- oldEmail && /* @__PURE__ */ jsx51("div", { className: "border-b-2 pb-2", children: /* @__PURE__ */ jsx51(
9013
+ return /* @__PURE__ */ jsxs39("form", { onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)), children: [
9014
+ /* @__PURE__ */ jsxs39("div", { className: "space-y-2", children: [
9015
+ oldEmail && /* @__PURE__ */ jsx56("div", { className: "border-b-2 pb-2", children: /* @__PURE__ */ jsx56(
8876
9016
  Fields_default.Input,
8877
9017
  {
8878
9018
  label: "Current Email",
@@ -8882,7 +9022,7 @@ function VerifyEmailForm({
8882
9022
  disabled: true
8883
9023
  }
8884
9024
  ) }),
8885
- /* @__PURE__ */ jsx51(
9025
+ /* @__PURE__ */ jsx56(
8886
9026
  Fields_default.Input,
8887
9027
  {
8888
9028
  label: "New Email",
@@ -8893,7 +9033,7 @@ function VerifyEmailForm({
8893
9033
  disabled: true
8894
9034
  }
8895
9035
  ),
8896
- /* @__PURE__ */ jsx51(
9036
+ /* @__PURE__ */ jsx56(
8897
9037
  Fields_default.Input,
8898
9038
  {
8899
9039
  label: "Token",
@@ -8904,19 +9044,19 @@ function VerifyEmailForm({
8904
9044
  }
8905
9045
  )
8906
9046
  ] }),
8907
- /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2 mt-2", children: [
8908
- /* @__PURE__ */ jsxs38("h1", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
9047
+ /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2 mt-2", children: [
9048
+ /* @__PURE__ */ jsxs39("h1", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
8909
9049
  "Didn't receive a verification token or expired?",
8910
9050
  " "
8911
9051
  ] }),
8912
- hasPassed || !threeMinutesLater ? /* @__PURE__ */ jsx51(
9052
+ hasPassed || !threeMinutesLater ? /* @__PURE__ */ jsx56(
8913
9053
  "span",
8914
9054
  {
8915
9055
  onClick: resend,
8916
9056
  className: "text-blue-600 cursor-pointer underline text-sm",
8917
9057
  children: "Resend"
8918
9058
  }
8919
- ) : /* @__PURE__ */ jsx51("span", { className: "text-blue-600 cursor-pointer underline text-sm", children: /* @__PURE__ */ jsx51(
9059
+ ) : /* @__PURE__ */ jsx56("span", { className: "text-blue-600 cursor-pointer underline text-sm", children: /* @__PURE__ */ jsx56(
8920
9060
  Countdown,
8921
9061
  {
8922
9062
  styles: { content: { fontSize: 14, color: "#3b82f6" } },
@@ -8926,7 +9066,7 @@ function VerifyEmailForm({
8926
9066
  threeMinutesLater
8927
9067
  ) })
8928
9068
  ] }),
8929
- /* @__PURE__ */ jsx51("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx51(
9069
+ /* @__PURE__ */ jsx56("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx56(
8930
9070
  Button,
8931
9071
  {
8932
9072
  isLoading,
@@ -8944,7 +9084,7 @@ var VerifyEmailForm_default = VerifyEmailForm;
8944
9084
  import { useForm as useForm5 } from "react-hook-form";
8945
9085
  import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
8946
9086
  import { message as message8 } from "antd";
8947
- import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
9087
+ import { jsx as jsx57, jsxs as jsxs40 } from "react/jsx-runtime";
8948
9088
  function UpdateEmailForm({
8949
9089
  data,
8950
9090
  close,
@@ -8977,9 +9117,9 @@ function UpdateEmailForm({
8977
9117
  message8.error(error?.message || "Something went wrong");
8978
9118
  }
8979
9119
  };
8980
- return /* @__PURE__ */ jsxs39("form", { onSubmit: handleSubmit(onSubmit), children: [
8981
- /* @__PURE__ */ jsxs39("div", { className: "space-y-4", children: [
8982
- /* @__PURE__ */ jsx52(
9120
+ return /* @__PURE__ */ jsxs40("form", { onSubmit: handleSubmit(onSubmit), children: [
9121
+ /* @__PURE__ */ jsxs40("div", { className: "space-y-4", children: [
9122
+ /* @__PURE__ */ jsx57(
8983
9123
  Fields_default.Input,
8984
9124
  {
8985
9125
  label: "Current Email",
@@ -8988,7 +9128,7 @@ function UpdateEmailForm({
8988
9128
  disabled: true
8989
9129
  }
8990
9130
  ),
8991
- /* @__PURE__ */ jsx52(
9131
+ /* @__PURE__ */ jsx57(
8992
9132
  Fields_default.Input,
8993
9133
  {
8994
9134
  label: "New Email Address",
@@ -8999,10 +9139,10 @@ function UpdateEmailForm({
8999
9139
  required: true
9000
9140
  }
9001
9141
  ),
9002
- /* @__PURE__ */ jsx52("div", { className: "bg-blue-50 dark:bg-blue-900/10 border-l-4 border-blue-400 p-3 rounded", children: /* @__PURE__ */ jsx52("p", { className: "text-xs text-blue-700 dark:text-blue-400", children: "Note: You will need to verify the new email address before it becomes primary." }) })
9142
+ /* @__PURE__ */ jsx57("div", { className: "bg-blue-50 dark:bg-blue-900/10 border-l-4 border-blue-400 p-3 rounded", children: /* @__PURE__ */ jsx57("p", { className: "text-xs text-blue-700 dark:text-blue-400", children: "Note: You will need to verify the new email address before it becomes primary." }) })
9003
9143
  ] }),
9004
- /* @__PURE__ */ jsxs39("footer", { className: "flex justify-end mt-6 gap-3", children: [
9005
- /* @__PURE__ */ jsx52(
9144
+ /* @__PURE__ */ jsxs40("footer", { className: "flex justify-end mt-6 gap-3", children: [
9145
+ /* @__PURE__ */ jsx57(
9006
9146
  Button,
9007
9147
  {
9008
9148
  type: "button",
@@ -9012,7 +9152,7 @@ function UpdateEmailForm({
9012
9152
  children: "Cancel"
9013
9153
  }
9014
9154
  ),
9015
- /* @__PURE__ */ jsx52(
9155
+ /* @__PURE__ */ jsx57(
9016
9156
  Button,
9017
9157
  {
9018
9158
  isLoading,
@@ -9031,7 +9171,7 @@ var UpdateEmailForm_default = UpdateEmailForm;
9031
9171
  import { useForm as useForm6 } from "react-hook-form";
9032
9172
  import { message as message9, Statistic as Statistic2 } from "antd";
9033
9173
  import { useState as useState29, useEffect as useEffect23 } from "react";
9034
- import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
9174
+ import { jsx as jsx58, jsxs as jsxs41 } from "react/jsx-runtime";
9035
9175
  var { Countdown: Countdown2 } = Statistic2;
9036
9176
  function ResetPasswordForm({
9037
9177
  data,
@@ -9086,9 +9226,9 @@ function ResetPasswordForm({
9086
9226
  message9.error(error?.message || "Something went wrong");
9087
9227
  }
9088
9228
  };
9089
- return /* @__PURE__ */ jsxs40("form", { onSubmit: handleSubmit(onSubmit), children: [
9090
- /* @__PURE__ */ jsxs40("div", { className: "space-y-4", children: [
9091
- /* @__PURE__ */ jsx53("div", { className: "border-b-2 pb-4 dark:border-zinc-800", children: /* @__PURE__ */ jsx53(
9229
+ return /* @__PURE__ */ jsxs41("form", { onSubmit: handleSubmit(onSubmit), children: [
9230
+ /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
9231
+ /* @__PURE__ */ jsx58("div", { className: "border-b-2 pb-4 dark:border-zinc-800", children: /* @__PURE__ */ jsx58(
9092
9232
  Fields_default.Input,
9093
9233
  {
9094
9234
  label: "Target Email",
@@ -9097,10 +9237,10 @@ function ResetPasswordForm({
9097
9237
  disabled: true
9098
9238
  }
9099
9239
  ) }),
9100
- /* @__PURE__ */ jsx53("div", { className: "bg-orange-50 dark:bg-orange-900/10 border-l-4 border-orange-400 p-4 rounded-xl", children: /* @__PURE__ */ jsx53("p", { className: "text-sm text-orange-700 dark:text-orange-300", children: "Click context below to send a secure password reset link to this user." }) }),
9101
- !hasPassed && threeMinutesLater && /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2 mt-2 bg-blue-50 dark:bg-blue-900/10 p-2 rounded-lg", children: [
9102
- /* @__PURE__ */ jsx53("p", { className: "text-xs text-blue-600 dark:text-blue-400 font-medium", children: "You can request another link in:" }),
9103
- /* @__PURE__ */ jsx53("span", { className: "text-blue-600 font-bold text-xs", children: /* @__PURE__ */ jsx53(
9240
+ /* @__PURE__ */ jsx58("div", { className: "bg-orange-50 dark:bg-orange-900/10 border-l-4 border-orange-400 p-4 rounded-xl", children: /* @__PURE__ */ jsx58("p", { className: "text-sm text-orange-700 dark:text-orange-300", children: "Click context below to send a secure password reset link to this user." }) }),
9241
+ !hasPassed && threeMinutesLater && /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2 mt-2 bg-blue-50 dark:bg-blue-900/10 p-2 rounded-lg", children: [
9242
+ /* @__PURE__ */ jsx58("p", { className: "text-xs text-blue-600 dark:text-blue-400 font-medium", children: "You can request another link in:" }),
9243
+ /* @__PURE__ */ jsx58("span", { className: "text-blue-600 font-bold text-xs", children: /* @__PURE__ */ jsx58(
9104
9244
  Countdown2,
9105
9245
  {
9106
9246
  styles: { content: { fontSize: 12, color: "#3b82f6" } },
@@ -9111,8 +9251,8 @@ function ResetPasswordForm({
9111
9251
  ) })
9112
9252
  ] })
9113
9253
  ] }),
9114
- /* @__PURE__ */ jsxs40("footer", { className: "flex justify-end mt-8 gap-3", children: [
9115
- /* @__PURE__ */ jsx53(
9254
+ /* @__PURE__ */ jsxs41("footer", { className: "flex justify-end mt-8 gap-3", children: [
9255
+ /* @__PURE__ */ jsx58(
9116
9256
  Button,
9117
9257
  {
9118
9258
  type: "button",
@@ -9122,7 +9262,7 @@ function ResetPasswordForm({
9122
9262
  children: "Cancel"
9123
9263
  }
9124
9264
  ),
9125
- /* @__PURE__ */ jsx53(
9265
+ /* @__PURE__ */ jsx58(
9126
9266
  Button,
9127
9267
  {
9128
9268
  isLoading,
@@ -9140,11 +9280,11 @@ var ResetPasswordForm_default = ResetPasswordForm;
9140
9280
  // src/components/users/Activate.tsx
9141
9281
  import { message as message10, Switch } from "antd";
9142
9282
  import { useState as useState30 } from "react";
9143
- import { Fragment as Fragment10, jsx as jsx54 } from "react/jsx-runtime";
9283
+ import { Fragment as Fragment10, jsx as jsx59 } from "react/jsx-runtime";
9144
9284
  var ActivateUser = ({ data }) => {
9145
9285
  const [checked, setChecked] = useState30(data?.isActive);
9146
9286
  const { put, isLoading } = useApis_default();
9147
- return /* @__PURE__ */ jsx54(Fragment10, { children: /* @__PURE__ */ jsx54(
9287
+ return /* @__PURE__ */ jsx59(Fragment10, { children: /* @__PURE__ */ jsx59(
9148
9288
  Switch,
9149
9289
  {
9150
9290
  onChange: async (e) => {
@@ -9172,7 +9312,7 @@ var Activate_default = ActivateUser;
9172
9312
 
9173
9313
  // src/components/users/users.tsx
9174
9314
  import { useNavigate as useNavigate6 } from "react-router-dom";
9175
- import { Fragment as Fragment11, jsx as jsx55, jsxs as jsxs41 } from "react/jsx-runtime";
9315
+ import { Fragment as Fragment11, jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
9176
9316
  function Users() {
9177
9317
  const navigate = useNavigate6();
9178
9318
  const { data, TransactionViewComponent, reload } = useTransaction_default({
@@ -9184,11 +9324,11 @@ function Users() {
9184
9324
  const items = (data2) => [
9185
9325
  {
9186
9326
  label: `Reset Password`,
9187
- icon: /* @__PURE__ */ jsx55(Key, { size: 16 }),
9327
+ icon: /* @__PURE__ */ jsx60(Key, { size: 16 }),
9188
9328
  onClick: () => openState({
9189
9329
  title: "Request Password Reset",
9190
9330
  type: "form",
9191
- content: /* @__PURE__ */ jsx55(
9331
+ content: /* @__PURE__ */ jsx60(
9192
9332
  ResetPasswordForm_default,
9193
9333
  {
9194
9334
  data: data2,
@@ -9201,11 +9341,11 @@ function Users() {
9201
9341
  },
9202
9342
  {
9203
9343
  label: `Update Email`,
9204
- icon: /* @__PURE__ */ jsx55(Mail2, { size: 16 }),
9344
+ icon: /* @__PURE__ */ jsx60(Mail2, { size: 16 }),
9205
9345
  onClick: () => openState({
9206
9346
  title: "Update Email Address",
9207
9347
  type: "form",
9208
- content: /* @__PURE__ */ jsx55(
9348
+ content: /* @__PURE__ */ jsx60(
9209
9349
  UpdateEmailForm_default,
9210
9350
  {
9211
9351
  data: data2,
@@ -9218,11 +9358,11 @@ function Users() {
9218
9358
  },
9219
9359
  data2?.emailVerification && {
9220
9360
  label: `Verify Email`,
9221
- icon: /* @__PURE__ */ jsx55(ShieldCheck, {}),
9361
+ icon: /* @__PURE__ */ jsx60(ShieldCheck, {}),
9222
9362
  onClick: () => openState({
9223
9363
  title: "Verify Email",
9224
9364
  type: "form",
9225
- content: /* @__PURE__ */ jsx55(
9365
+ content: /* @__PURE__ */ jsx60(
9226
9366
  VerifyEmailForm_default,
9227
9367
  {
9228
9368
  data: data2,
@@ -9234,7 +9374,7 @@ function Users() {
9234
9374
  })
9235
9375
  }
9236
9376
  ].filter(Boolean);
9237
- const columns = useMemo8(
9377
+ const columns = useMemo9(
9238
9378
  () => [
9239
9379
  {
9240
9380
  accessorKey: "email",
@@ -9243,16 +9383,16 @@ function Users() {
9243
9383
  const data2 = row.original;
9244
9384
  const emailVerification = data2?.emailVerification;
9245
9385
  const newEmail = emailVerification?.email !== data2?.email ? emailVerification?.email : null;
9246
- return /* @__PURE__ */ jsxs41("div", { className: "space-y-1", children: [
9247
- /* @__PURE__ */ jsxs41("section", { className: "flex items-center gap-2", children: [
9386
+ return /* @__PURE__ */ jsxs42("div", { className: "space-y-1", children: [
9387
+ /* @__PURE__ */ jsxs42("section", { className: "flex items-center gap-2", children: [
9248
9388
  " ",
9249
- /* @__PURE__ */ jsx55("p", { children: data2?.email }),
9250
- data2?.isEmailVerified && /* @__PURE__ */ jsx55(Badge, { variant: "success", size: "sm", children: "Verified" }),
9251
- !data2?.isEmailVerified && /* @__PURE__ */ jsx55(Badge, { variant: "warning", size: "sm", children: "Not Verified" })
9389
+ /* @__PURE__ */ jsx60("p", { children: data2?.email }),
9390
+ data2?.isEmailVerified && /* @__PURE__ */ jsx60(Badge, { variant: "success", size: "sm", children: "Verified" }),
9391
+ !data2?.isEmailVerified && /* @__PURE__ */ jsx60(Badge, { variant: "warning", size: "sm", children: "Not Verified" })
9252
9392
  ] }),
9253
- newEmail && /* @__PURE__ */ jsxs41("section", { className: "flex items-center gap-2", children: [
9254
- /* @__PURE__ */ jsx55(Info, { size: 16, className: "text-orange-600" }),
9255
- /* @__PURE__ */ jsx55("p", { children: newEmail })
9393
+ newEmail && /* @__PURE__ */ jsxs42("section", { className: "flex items-center gap-2", children: [
9394
+ /* @__PURE__ */ jsx60(Info, { size: 16, className: "text-orange-600" }),
9395
+ /* @__PURE__ */ jsx60("p", { children: newEmail })
9256
9396
  ] })
9257
9397
  ] });
9258
9398
  }
@@ -9262,7 +9402,7 @@ function Users() {
9262
9402
  header: "Role",
9263
9403
  cell: ({ row }) => {
9264
9404
  const data2 = row.original;
9265
- return /* @__PURE__ */ jsx55(
9405
+ return /* @__PURE__ */ jsx60(
9266
9406
  Badge,
9267
9407
  {
9268
9408
  variant: data2?.role === "admin" ? "primary" : "warning",
@@ -9277,7 +9417,7 @@ function Users() {
9277
9417
  header: "Employee Name",
9278
9418
  cell: ({ row }) => {
9279
9419
  const account = row.original?.account;
9280
- return /* @__PURE__ */ jsx55("span", { children: account?.name || "N/A" });
9420
+ return /* @__PURE__ */ jsx60("span", { children: account?.name || "N/A" });
9281
9421
  }
9282
9422
  },
9283
9423
  {
@@ -9285,7 +9425,7 @@ function Users() {
9285
9425
  header: "Status",
9286
9426
  cell: ({ row }) => {
9287
9427
  const data2 = row.original;
9288
- return /* @__PURE__ */ jsx55(Activate_default, { data: data2 });
9428
+ return /* @__PURE__ */ jsx60(Activate_default, { data: data2 });
9289
9429
  }
9290
9430
  },
9291
9431
  {
@@ -9293,13 +9433,13 @@ function Users() {
9293
9433
  header: "Actions",
9294
9434
  cell: ({ row }) => {
9295
9435
  const data2 = row.original;
9296
- return /* @__PURE__ */ jsx55(
9436
+ return /* @__PURE__ */ jsx60(
9297
9437
  Dropdown,
9298
9438
  {
9299
9439
  className: "w-fit! cursor-pointer",
9300
9440
  items: items(data2),
9301
9441
  triggerMode: "hover",
9302
- children: /* @__PURE__ */ jsx55(EllipsisVertical2, {})
9442
+ children: /* @__PURE__ */ jsx60(EllipsisVertical2, {})
9303
9443
  }
9304
9444
  );
9305
9445
  }
@@ -9308,9 +9448,9 @@ function Users() {
9308
9448
  [items]
9309
9449
  );
9310
9450
  const users = data?.data || [];
9311
- return /* @__PURE__ */ jsxs41(Fragment11, { children: [
9312
- /* @__PURE__ */ jsx55(Modal2, {}),
9313
- /* @__PURE__ */ jsx55(
9451
+ return /* @__PURE__ */ jsxs42(Fragment11, { children: [
9452
+ /* @__PURE__ */ jsx60(Modal2, {}),
9453
+ /* @__PURE__ */ jsx60(
9314
9454
  TransactionViewComponent,
9315
9455
  {
9316
9456
  columns,
@@ -9331,7 +9471,7 @@ var users_default = Users;
9331
9471
  import { useForm as useForm7 } from "react-hook-form";
9332
9472
  import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
9333
9473
  import { message as message11 } from "antd";
9334
- import { jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
9474
+ import { jsx as jsx61, jsxs as jsxs43 } from "react/jsx-runtime";
9335
9475
  function UserForm() {
9336
9476
  const { navigate } = useApp_default();
9337
9477
  const { post, isLoading } = useApis_default();
@@ -9356,14 +9496,14 @@ function UserForm() {
9356
9496
  message11.error(error?.message || "Something went wrong");
9357
9497
  }
9358
9498
  };
9359
- return /* @__PURE__ */ jsxs42(Card, { className: "max-w-xl mx-auto mt-10 relative", children: [
9360
- /* @__PURE__ */ jsxs42(Card.Header, { children: [
9361
- /* @__PURE__ */ jsx56(Card.Title, { children: "Add User" }),
9362
- /* @__PURE__ */ jsx56(Card.Description, { children: "Create a new user by providing their email and phone number." })
9499
+ return /* @__PURE__ */ jsxs43(Card, { className: "max-w-xl mx-auto mt-10 relative", children: [
9500
+ /* @__PURE__ */ jsxs43(Card.Header, { children: [
9501
+ /* @__PURE__ */ jsx61(Card.Title, { children: "Add User" }),
9502
+ /* @__PURE__ */ jsx61(Card.Description, { children: "Create a new user by providing their email and phone number." })
9363
9503
  ] }),
9364
- /* @__PURE__ */ jsx56(Card.Content, { children: /* @__PURE__ */ jsxs42("form", { onSubmit: handleSubmit(onSubmit), children: [
9365
- /* @__PURE__ */ jsxs42("div", { className: "space-y-4", children: [
9366
- /* @__PURE__ */ jsx56(
9504
+ /* @__PURE__ */ jsx61(Card.Content, { children: /* @__PURE__ */ jsxs43("form", { onSubmit: handleSubmit(onSubmit), children: [
9505
+ /* @__PURE__ */ jsxs43("div", { className: "space-y-4", children: [
9506
+ /* @__PURE__ */ jsx61(
9367
9507
  Fields_default.Input,
9368
9508
  {
9369
9509
  label: "Email",
@@ -9374,7 +9514,7 @@ function UserForm() {
9374
9514
  required: true
9375
9515
  }
9376
9516
  ),
9377
- /* @__PURE__ */ jsx56(
9517
+ /* @__PURE__ */ jsx61(
9378
9518
  Fields_default.PhoneInput,
9379
9519
  {
9380
9520
  label: "Phone Number",
@@ -9383,7 +9523,7 @@ function UserForm() {
9383
9523
  placeholder: "Enter phone number"
9384
9524
  }
9385
9525
  ),
9386
- /* @__PURE__ */ jsx56(
9526
+ /* @__PURE__ */ jsx61(
9387
9527
  Fields_default.Select,
9388
9528
  {
9389
9529
  label: "Role",
@@ -9394,7 +9534,7 @@ function UserForm() {
9394
9534
  }
9395
9535
  )
9396
9536
  ] }),
9397
- /* @__PURE__ */ jsx56("footer", { className: "flex justify-end mt-6", children: /* @__PURE__ */ jsx56(
9537
+ /* @__PURE__ */ jsx61("footer", { className: "flex justify-end mt-6", children: /* @__PURE__ */ jsx61(
9398
9538
  Button,
9399
9539
  {
9400
9540
  isLoading,
@@ -9417,7 +9557,7 @@ import { useForm as useForm8 } from "react-hook-form";
9417
9557
  import { zodResolver as zodResolver7 } from "@hookform/resolvers/zod";
9418
9558
  import * as z4 from "zod";
9419
9559
  import { message as message12, Spin } from "antd";
9420
- import { Fragment as Fragment12, jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
9560
+ import { Fragment as Fragment12, jsx as jsx62, jsxs as jsxs44 } from "react/jsx-runtime";
9421
9561
  var resetPageSchema = z4.object({
9422
9562
  password: z4.string().min(6, "Password must be at least 6 characters"),
9423
9563
  confirmPassword: z4.string().min(6, "Password must be at least 6 characters")
@@ -9483,14 +9623,14 @@ function ResetPasswordPage() {
9483
9623
  }
9484
9624
  };
9485
9625
  if (verifying) {
9486
- return /* @__PURE__ */ jsx57("div", { className: "h-screen w-full flex items-center justify-center bg-slate-50 dark:bg-[#0A0B10]", children: /* @__PURE__ */ jsxs43("div", { className: "text-center space-y-4", children: [
9487
- /* @__PURE__ */ jsx57(Spin, { size: "large" }),
9488
- /* @__PURE__ */ jsx57("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
9626
+ return /* @__PURE__ */ jsx62("div", { className: "h-screen w-full flex items-center justify-center bg-slate-50 dark:bg-[#0A0B10]", children: /* @__PURE__ */ jsxs44("div", { className: "text-center space-y-4", children: [
9627
+ /* @__PURE__ */ jsx62(Spin, { size: "large" }),
9628
+ /* @__PURE__ */ jsx62("p", { className: "text-slate-500 animate-pulse", children: "Verifying reset link..." })
9489
9629
  ] }) });
9490
9630
  }
9491
- return /* @__PURE__ */ jsxs43("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
9492
- /* @__PURE__ */ jsxs43("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
9493
- /* @__PURE__ */ jsx57(
9631
+ return /* @__PURE__ */ jsxs44("div", { className: "flex h-screen w-full overflow-hidden bg-white dark:bg-[#0A0B10]", children: [
9632
+ /* @__PURE__ */ jsxs44("div", { className: "hidden lg:flex lg:w-1/2 relative overflow-hidden bg-slate-900 border-r border-slate-800", children: [
9633
+ /* @__PURE__ */ jsx62(
9494
9634
  "div",
9495
9635
  {
9496
9636
  className: "absolute inset-0 z-0 opacity-40 bg-cover bg-center",
@@ -9499,35 +9639,35 @@ function ResetPasswordPage() {
9499
9639
  }
9500
9640
  }
9501
9641
  ),
9502
- /* @__PURE__ */ jsx57("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
9503
- /* @__PURE__ */ jsxs43("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
9504
- /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-3", children: [
9505
- /* @__PURE__ */ jsx57("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-indigo-500/20 shadow-xl", children: /* @__PURE__ */ jsx57(Terminal2, { className: "text-white w-6 h-6" }) }),
9506
- /* @__PURE__ */ jsx57("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
9642
+ /* @__PURE__ */ jsx62("div", { className: "absolute inset-0 bg-linear-to-tr from-[#0A0B10] via-transparent to-indigo-500/10 z-10" }),
9643
+ /* @__PURE__ */ jsxs44("div", { className: "relative z-20 p-12 flex flex-col justify-between w-full h-full", children: [
9644
+ /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-3", children: [
9645
+ /* @__PURE__ */ jsx62("div", { className: "h-10 w-10 bg-indigo-600 rounded-lg flex items-center justify-center shadow-indigo-500/20 shadow-xl", children: /* @__PURE__ */ jsx62(Terminal2, { className: "text-white w-6 h-6" }) }),
9646
+ /* @__PURE__ */ jsx62("span", { className: "text-2xl font-bold text-white tracking-widest uppercase", children: "Warqad UI" })
9507
9647
  ] }),
9508
- /* @__PURE__ */ jsxs43("div", { className: "max-w-md", children: [
9509
- /* @__PURE__ */ jsxs43("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
9648
+ /* @__PURE__ */ jsxs44("div", { className: "max-w-md", children: [
9649
+ /* @__PURE__ */ jsxs44("h1", { className: "text-5xl font-extrabold text-white mb-6 leading-tight", children: [
9510
9650
  "Secure ",
9511
- /* @__PURE__ */ jsx57("span", { className: "text-indigo-400", children: "Access" }),
9651
+ /* @__PURE__ */ jsx62("span", { className: "text-indigo-400", children: "Access" }),
9512
9652
  " ",
9513
- /* @__PURE__ */ jsx57("br", {}),
9653
+ /* @__PURE__ */ jsx62("br", {}),
9514
9654
  " ",
9515
9655
  "Simplified."
9516
9656
  ] }),
9517
- /* @__PURE__ */ jsx57("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
9657
+ /* @__PURE__ */ jsx62("p", { className: "text-slate-400 text-lg leading-relaxed", children: "Reset your credentials securely and regain access to your dashboard in minutes." })
9518
9658
  ] }),
9519
- /* @__PURE__ */ jsx57("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
9659
+ /* @__PURE__ */ jsx62("div", { className: "text-slate-500 text-sm italic", children: "Trusted by developers worldwide." })
9520
9660
  ] })
9521
9661
  ] }),
9522
- /* @__PURE__ */ jsxs43("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: [
9523
- /* @__PURE__ */ jsx57("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx57(ThemeToggle, {}) }),
9524
- /* @__PURE__ */ jsx57("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ jsxs43("div", { className: "text-center space-y-6", children: [
9525
- /* @__PURE__ */ jsx57("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__ */ jsx57(ShieldCheck2, { className: "text-red-600 dark:text-red-400 w-8 h-8" }) }),
9526
- /* @__PURE__ */ jsxs43("div", { children: [
9527
- /* @__PURE__ */ jsx57("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
9528
- /* @__PURE__ */ jsx57("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
9662
+ /* @__PURE__ */ jsxs44("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: [
9663
+ /* @__PURE__ */ jsx62("div", { className: "absolute top-4 right-4 z-50", children: /* @__PURE__ */ jsx62(ThemeToggle, {}) }),
9664
+ /* @__PURE__ */ jsx62("div", { className: "max-w-md w-full mx-auto", children: !isVerified || error ? /* @__PURE__ */ jsxs44("div", { className: "text-center space-y-6", children: [
9665
+ /* @__PURE__ */ jsx62("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__ */ jsx62(ShieldCheck2, { className: "text-red-600 dark:text-red-400 w-8 h-8" }) }),
9666
+ /* @__PURE__ */ jsxs44("div", { children: [
9667
+ /* @__PURE__ */ jsx62("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-2", children: "Link Invalid" }),
9668
+ /* @__PURE__ */ jsx62("p", { className: "text-slate-500 dark:text-slate-400", children: error || "The reset link is invalid or has already been used." })
9529
9669
  ] }),
9530
- /* @__PURE__ */ jsx57(
9670
+ /* @__PURE__ */ jsx62(
9531
9671
  Button,
9532
9672
  {
9533
9673
  onClick: () => navigate("/login"),
@@ -9535,22 +9675,22 @@ function ResetPasswordPage() {
9535
9675
  children: "Back to Login"
9536
9676
  }
9537
9677
  )
9538
- ] }) : /* @__PURE__ */ jsxs43(Fragment12, { children: [
9539
- /* @__PURE__ */ jsxs43("div", { className: "mb-10", children: [
9540
- /* @__PURE__ */ jsx57("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
9541
- /* @__PURE__ */ jsxs43("p", { className: "text-slate-500 dark:text-slate-400", children: [
9678
+ ] }) : /* @__PURE__ */ jsxs44(Fragment12, { children: [
9679
+ /* @__PURE__ */ jsxs44("div", { className: "mb-10", children: [
9680
+ /* @__PURE__ */ jsx62("h2", { className: "text-3xl font-bold text-slate-900 dark:text-white mb-3 tracking-tight", children: "Reset Password" }),
9681
+ /* @__PURE__ */ jsxs44("p", { className: "text-slate-500 dark:text-slate-400", children: [
9542
9682
  "Set a new, strong password for",
9543
9683
  " ",
9544
- /* @__PURE__ */ jsx57("span", { className: "text-indigo-600 font-medium", children: email })
9684
+ /* @__PURE__ */ jsx62("span", { className: "text-indigo-600 font-medium", children: email })
9545
9685
  ] })
9546
9686
  ] }),
9547
- /* @__PURE__ */ jsxs43(
9687
+ /* @__PURE__ */ jsxs44(
9548
9688
  "form",
9549
9689
  {
9550
9690
  onSubmit: methods.handleSubmit(onSubmit),
9551
9691
  className: "space-y-6",
9552
9692
  children: [
9553
- /* @__PURE__ */ jsx57(
9693
+ /* @__PURE__ */ jsx62(
9554
9694
  Fields_default.Input,
9555
9695
  {
9556
9696
  form: methods,
@@ -9559,11 +9699,11 @@ function ResetPasswordPage() {
9559
9699
  type: "password",
9560
9700
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
9561
9701
  required: true,
9562
- icon: /* @__PURE__ */ jsx57(Lock2, { size: 18, className: "text-slate-400" }),
9702
+ icon: /* @__PURE__ */ jsx62(Lock2, { size: 18, className: "text-slate-400" }),
9563
9703
  className: "bg-slate-50 dark:bg-slate-900/50 h-12"
9564
9704
  }
9565
9705
  ),
9566
- /* @__PURE__ */ jsx57(
9706
+ /* @__PURE__ */ jsx62(
9567
9707
  Fields_default.Input,
9568
9708
  {
9569
9709
  form: methods,
@@ -9572,11 +9712,11 @@ function ResetPasswordPage() {
9572
9712
  type: "password",
9573
9713
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
9574
9714
  required: true,
9575
- icon: /* @__PURE__ */ jsx57(ShieldCheck2, { size: 18, className: "text-slate-400" }),
9715
+ icon: /* @__PURE__ */ jsx62(ShieldCheck2, { size: 18, className: "text-slate-400" }),
9576
9716
  className: "bg-slate-50 dark:bg-slate-900/50 h-12"
9577
9717
  }
9578
9718
  ),
9579
- /* @__PURE__ */ jsxs43(
9719
+ /* @__PURE__ */ jsxs44(
9580
9720
  Button,
9581
9721
  {
9582
9722
  type: "submit",
@@ -9584,7 +9724,7 @@ function ResetPasswordPage() {
9584
9724
  className: "w-full h-12 bg-indigo-600 hover:bg-indigo-500 text-white font-semibold flex items-center justify-center gap-2",
9585
9725
  children: [
9586
9726
  "Update Password",
9587
- !isLoading && /* @__PURE__ */ jsx57(ArrowRight2, { size: 18 })
9727
+ !isLoading && /* @__PURE__ */ jsx62(ArrowRight2, { size: 18 })
9588
9728
  ]
9589
9729
  }
9590
9730
  )
@@ -9601,7 +9741,7 @@ var ResetPasswordPage_default = ResetPasswordPage;
9601
9741
  import { LogOut, User as User2 } from "lucide-react";
9602
9742
  import { useNavigate as useNavigate8 } from "react-router-dom";
9603
9743
  import { message as message13 } from "antd";
9604
- import { jsx as jsx58, jsxs as jsxs44 } from "react/jsx-runtime";
9744
+ import { jsx as jsx63, jsxs as jsxs45 } from "react/jsx-runtime";
9605
9745
  var UserProfile = ({
9606
9746
  items,
9607
9747
  name,
@@ -9634,21 +9774,21 @@ var UserProfile = ({
9634
9774
  const defaultItems = [
9635
9775
  {
9636
9776
  label: "My Profile",
9637
- icon: /* @__PURE__ */ jsx58(User2, { size: 18 }),
9777
+ icon: /* @__PURE__ */ jsx63(User2, { size: 18 }),
9638
9778
  onClick: () => navigate("profile"),
9639
9779
  className: "min-w-[150px]"
9640
9780
  },
9641
9781
  {
9642
9782
  label: "Logout",
9643
- icon: /* @__PURE__ */ jsx58(LogOut, { size: 18 }),
9783
+ icon: /* @__PURE__ */ jsx63(LogOut, { size: 18 }),
9644
9784
  onClick: logout,
9645
9785
  className: "text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20"
9646
9786
  }
9647
9787
  ];
9648
- return /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-3", children: [
9649
- showThemeToggle && /* @__PURE__ */ jsx58(ThemeToggle, {}),
9650
- showThemeToggle && /* @__PURE__ */ jsx58("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
9651
- /* @__PURE__ */ jsx58(
9788
+ return /* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-3", children: [
9789
+ showThemeToggle && /* @__PURE__ */ jsx63(ThemeToggle, {}),
9790
+ showThemeToggle && /* @__PURE__ */ jsx63("div", { className: "w-px h-6 mx-2 bg-gray-200 dark:bg-gray-800" }),
9791
+ /* @__PURE__ */ jsx63(
9652
9792
  ProfileDropdown,
9653
9793
  {
9654
9794
  name: name || account?.name || "User",
@@ -9666,12 +9806,12 @@ var UserProfile_default = UserProfile;
9666
9806
  // src/components/users/ProfilePage.tsx
9667
9807
  import { useNavigate as useNavigate9 } from "react-router-dom";
9668
9808
  import { ArrowLeft as ArrowLeft3 } from "lucide-react";
9669
- import { jsx as jsx59, jsxs as jsxs45 } from "react/jsx-runtime";
9809
+ import { jsx as jsx64, jsxs as jsxs46 } from "react/jsx-runtime";
9670
9810
  var ProfilePage = () => {
9671
9811
  const navigate = useNavigate9();
9672
9812
  const { user, account } = useAuth();
9673
9813
  if (!user) {
9674
- return /* @__PURE__ */ jsx59("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx59("h1", { children: "Please login to view your profile" }) });
9814
+ return /* @__PURE__ */ jsx64("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx64("h1", { children: "Please login to view your profile" }) });
9675
9815
  }
9676
9816
  const extraInfo = [
9677
9817
  {
@@ -9690,19 +9830,19 @@ var ProfilePage = () => {
9690
9830
  copiable: false
9691
9831
  }
9692
9832
  ];
9693
- return /* @__PURE__ */ jsxs45("div", { className: "p-4 sm:p-8 space-y-6", children: [
9694
- /* @__PURE__ */ jsx59("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ jsx59(
9833
+ return /* @__PURE__ */ jsxs46("div", { className: "p-4 sm:p-8 space-y-6", children: [
9834
+ /* @__PURE__ */ jsx64("div", { className: "max-w-5xl mx-auto", children: /* @__PURE__ */ jsx64(
9695
9835
  Button,
9696
9836
  {
9697
9837
  variant: "outline",
9698
9838
  size: "sm",
9699
9839
  onClick: () => navigate(-1),
9700
- icon: /* @__PURE__ */ jsx59(ArrowLeft3, { size: 16 }),
9840
+ icon: /* @__PURE__ */ jsx64(ArrowLeft3, { size: 16 }),
9701
9841
  className: "rounded-full font-bold px-5",
9702
9842
  children: "Back"
9703
9843
  }
9704
9844
  ) }),
9705
- /* @__PURE__ */ jsx59(
9845
+ /* @__PURE__ */ jsx64(
9706
9846
  ProfileView,
9707
9847
  {
9708
9848
  name: account?.name || "User Account",
@@ -9722,7 +9862,7 @@ import { useNavigate as useNavigate10, useParams as useParams6 } from "react-rou
9722
9862
  import { EllipsisVertical as EllipsisVertical3, FilePenLine as FilePenLine2, Trash2 as Trash23 } from "lucide-react";
9723
9863
  import { useState as useState32 } from "react";
9724
9864
  import { message as message14 } from "antd";
9725
- import { Fragment as Fragment13, jsx as jsx60, jsxs as jsxs46 } from "react/jsx-runtime";
9865
+ import { Fragment as Fragment13, jsx as jsx65, jsxs as jsxs47 } from "react/jsx-runtime";
9726
9866
  function Wallets({ v, url }) {
9727
9867
  const { branchId } = useParams6();
9728
9868
  const [deleteWallet, setDeleteWallet] = useState32(null);
@@ -9737,12 +9877,12 @@ function Wallets({ v, url }) {
9737
9877
  const items = (data2) => [
9738
9878
  {
9739
9879
  label: `Edit Wallet`,
9740
- icon: /* @__PURE__ */ jsx60(FilePenLine2, { size: 16 }),
9880
+ icon: /* @__PURE__ */ jsx65(FilePenLine2, { size: 16 }),
9741
9881
  onClick: () => navigate(`update?id=${data2?._id}`)
9742
9882
  },
9743
9883
  {
9744
9884
  label: `Delete Wallet`,
9745
- icon: /* @__PURE__ */ jsx60(Trash23, { className: "text-red-500", size: 16 }),
9885
+ icon: /* @__PURE__ */ jsx65(Trash23, { className: "text-red-500", size: 16 }),
9746
9886
  onClick: () => setDeleteWallet(data2)
9747
9887
  }
9748
9888
  ].filter(Boolean);
@@ -9752,7 +9892,7 @@ function Wallets({ v, url }) {
9752
9892
  header: "Name",
9753
9893
  cell: ({ row }) => {
9754
9894
  const wallet = row.original;
9755
- return /* @__PURE__ */ jsx60("span", { children: wallet?.name });
9895
+ return /* @__PURE__ */ jsx65("span", { children: wallet?.name });
9756
9896
  }
9757
9897
  },
9758
9898
  {
@@ -9760,7 +9900,7 @@ function Wallets({ v, url }) {
9760
9900
  header: "Type",
9761
9901
  cell: ({ row }) => {
9762
9902
  const wallet = row.original;
9763
- return /* @__PURE__ */ jsx60("span", { className: "capitalize", children: wallet?.type });
9903
+ return /* @__PURE__ */ jsx65("span", { className: "capitalize", children: wallet?.type });
9764
9904
  }
9765
9905
  },
9766
9906
  {
@@ -9768,7 +9908,7 @@ function Wallets({ v, url }) {
9768
9908
  header: "Currency",
9769
9909
  cell: ({ row }) => {
9770
9910
  const wallet = row.original;
9771
- return /* @__PURE__ */ jsx60("span", { children: wallet?.currency });
9911
+ return /* @__PURE__ */ jsx65("span", { children: wallet?.currency });
9772
9912
  }
9773
9913
  },
9774
9914
  {
@@ -9776,7 +9916,7 @@ function Wallets({ v, url }) {
9776
9916
  header: "Account No",
9777
9917
  cell: ({ row }) => {
9778
9918
  const wallet = row.original;
9779
- return /* @__PURE__ */ jsx60("span", { children: wallet?.accountNo || "N/A" });
9919
+ return /* @__PURE__ */ jsx65("span", { children: wallet?.accountNo || "N/A" });
9780
9920
  }
9781
9921
  },
9782
9922
  {
@@ -9784,13 +9924,13 @@ function Wallets({ v, url }) {
9784
9924
  header: "Actions",
9785
9925
  cell: ({ row }) => {
9786
9926
  const data2 = row.original;
9787
- return /* @__PURE__ */ jsx60(
9927
+ return /* @__PURE__ */ jsx65(
9788
9928
  Dropdown,
9789
9929
  {
9790
9930
  className: "cursor-pointer w-[150px]",
9791
9931
  items: items(data2),
9792
9932
  triggerMode: "hover",
9793
- children: /* @__PURE__ */ jsx60(EllipsisVertical3, {})
9933
+ children: /* @__PURE__ */ jsx65(EllipsisVertical3, {})
9794
9934
  }
9795
9935
  );
9796
9936
  }
@@ -9808,9 +9948,9 @@ function Wallets({ v, url }) {
9808
9948
  return error;
9809
9949
  }
9810
9950
  };
9811
- return /* @__PURE__ */ jsxs46(Fragment13, { children: [
9812
- /* @__PURE__ */ jsx60(Modal2, {}),
9813
- /* @__PURE__ */ jsx60(
9951
+ return /* @__PURE__ */ jsxs47(Fragment13, { children: [
9952
+ /* @__PURE__ */ jsx65(Modal2, {}),
9953
+ /* @__PURE__ */ jsx65(
9814
9954
  ConfirmModal,
9815
9955
  {
9816
9956
  isOpen: !!deleteWallet,
@@ -9823,7 +9963,7 @@ function Wallets({ v, url }) {
9823
9963
  children: null
9824
9964
  }
9825
9965
  ),
9826
- /* @__PURE__ */ jsx60(
9966
+ /* @__PURE__ */ jsx65(
9827
9967
  TransactionViewComponent,
9828
9968
  {
9829
9969
  columns,
@@ -9857,8 +9997,9 @@ import { zodResolver as zodResolver8 } from "@hookform/resolvers/zod";
9857
9997
  import { message as message15 } from "antd";
9858
9998
  import { useEffect as useEffect25 } from "react";
9859
9999
  import { useParams as useParams7 } from "react-router-dom";
9860
- import { jsx as jsx61, jsxs as jsxs47 } from "react/jsx-runtime";
10000
+ import { jsx as jsx66, jsxs as jsxs48 } from "react/jsx-runtime";
9861
10001
  function WalletForm() {
10002
+ const { enums } = useWarqadConfig();
9862
10003
  const { branchId } = useParams7();
9863
10004
  const { getQuery, navigate } = useApp_default();
9864
10005
  const id = getQuery("id");
@@ -9890,7 +10031,10 @@ function WalletForm() {
9890
10031
  } else {
9891
10032
  await post({
9892
10033
  url: "/wallets/create",
9893
- body: data
10034
+ body: {
10035
+ ...data,
10036
+ branch: branchId ? branchId : data.branch
10037
+ }
9894
10038
  });
9895
10039
  }
9896
10040
  message15.success(`Wallet ${isEdit ? "updated" : "created"} successfully`);
@@ -9902,7 +10046,7 @@ function WalletForm() {
9902
10046
  const fetches = async () => {
9903
10047
  try {
9904
10048
  const res = await get({
9905
- url: `/wallets/get?id=${id}`
10049
+ url: `/wallets/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
9906
10050
  });
9907
10051
  const data = res.data;
9908
10052
  methods.reset(data);
@@ -9915,24 +10059,24 @@ function WalletForm() {
9915
10059
  fetches();
9916
10060
  }
9917
10061
  }, [id]);
9918
- return /* @__PURE__ */ jsxs47(
10062
+ return /* @__PURE__ */ jsxs48(
9919
10063
  Card,
9920
10064
  {
9921
10065
  className: "max-w-4xl mx-auto mt-10 relative",
9922
10066
  isLoading: isLoadingGet,
9923
10067
  loadingText: "Processing...",
9924
10068
  children: [
9925
- /* @__PURE__ */ jsxs47(Card.Header, { children: [
9926
- /* @__PURE__ */ jsx61(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Wallet` }),
9927
- /* @__PURE__ */ jsx61(Card.Description, { children: isEdit ? `Update the details for this wallet` : `Create a new wallet and add it to your list` })
10069
+ /* @__PURE__ */ jsxs48(Card.Header, { children: [
10070
+ /* @__PURE__ */ jsx66(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Wallet` }),
10071
+ /* @__PURE__ */ jsx66(Card.Description, { children: isEdit ? `Update the details for this wallet` : `Create a new wallet and add it to your list` })
9928
10072
  ] }),
9929
- /* @__PURE__ */ jsx61(Card.Content, { children: /* @__PURE__ */ jsxs47(
10073
+ /* @__PURE__ */ jsx66(Card.Content, { children: /* @__PURE__ */ jsxs48(
9930
10074
  "form",
9931
10075
  {
9932
10076
  onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
9933
10077
  children: [
9934
- /* @__PURE__ */ jsxs47("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
9935
- /* @__PURE__ */ jsx61(
10078
+ /* @__PURE__ */ jsxs48("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10079
+ /* @__PURE__ */ jsx66(
9936
10080
  Fields_default.Input,
9937
10081
  {
9938
10082
  label: "Name",
@@ -9943,33 +10087,27 @@ function WalletForm() {
9943
10087
  required: true
9944
10088
  }
9945
10089
  ),
9946
- /* @__PURE__ */ jsx61(
10090
+ /* @__PURE__ */ jsx66(
9947
10091
  Fields_default.Select,
9948
10092
  {
9949
10093
  label: "Wallet Type",
9950
10094
  form: methods,
9951
10095
  required: true,
9952
10096
  name: "type",
9953
- options: Enums_default.walletTypes.map((type) => ({
9954
- value: type,
9955
- label: type
9956
- }))
10097
+ enumName: "walletTypes"
9957
10098
  }
9958
10099
  ),
9959
- /* @__PURE__ */ jsx61(
10100
+ /* @__PURE__ */ jsx66(
9960
10101
  Fields_default.Select,
9961
10102
  {
9962
10103
  label: "Currency",
9963
10104
  form: methods,
9964
10105
  name: "currency",
9965
10106
  required: true,
9966
- options: Enums_default.currencies.map((currency) => ({
9967
- value: currency,
9968
- label: currency
9969
- }))
10107
+ enumName: "currencies"
9970
10108
  }
9971
10109
  ),
9972
- /* @__PURE__ */ jsx61(
10110
+ /* @__PURE__ */ jsx66(
9973
10111
  Fields_default.Input,
9974
10112
  {
9975
10113
  label: "Account Number",
@@ -9979,7 +10117,7 @@ function WalletForm() {
9979
10117
  placeholder: "Enter account number (optional)"
9980
10118
  }
9981
10119
  ),
9982
- !branchId && /* @__PURE__ */ jsx61(
10120
+ !branchId && /* @__PURE__ */ jsx66(
9983
10121
  Feilds_default.Branches,
9984
10122
  {
9985
10123
  label: "Branch",
@@ -9990,7 +10128,7 @@ function WalletForm() {
9990
10128
  }
9991
10129
  )
9992
10130
  ] }),
9993
- /* @__PURE__ */ jsx61("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx61(
10131
+ /* @__PURE__ */ jsx66("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx66(
9994
10132
  Button,
9995
10133
  {
9996
10134
  isLoading,
@@ -10012,7 +10150,7 @@ var WalletForm_default = WalletForm;
10012
10150
 
10013
10151
  // src/components/wallets/Feilds/Wallet.tsx
10014
10152
  import { useParams as useParams8 } from "react-router-dom";
10015
- import { jsx as jsx62, jsxs as jsxs48 } from "react/jsx-runtime";
10153
+ import { jsx as jsx67, jsxs as jsxs49 } from "react/jsx-runtime";
10016
10154
  function Wallet({
10017
10155
  name,
10018
10156
  label,
@@ -10032,8 +10170,8 @@ function Wallet({
10032
10170
  showBalance,
10033
10171
  accountId: walletId
10034
10172
  });
10035
- return /* @__PURE__ */ jsxs48("div", { className: "flex flex-col gap-2", children: [
10036
- /* @__PURE__ */ jsx62(
10173
+ return /* @__PURE__ */ jsxs49("div", { className: "flex flex-col gap-2", children: [
10174
+ /* @__PURE__ */ jsx67(
10037
10175
  Fields_default.SearchApi,
10038
10176
  {
10039
10177
  name,
@@ -10050,7 +10188,7 @@ function Wallet({
10050
10188
  disabled
10051
10189
  }
10052
10190
  ),
10053
- /* @__PURE__ */ jsx62(BalanceView, {})
10191
+ /* @__PURE__ */ jsx67(BalanceView, {})
10054
10192
  ] });
10055
10193
  }
10056
10194
  var Wallet_default = Wallet;
@@ -10060,111 +10198,6 @@ var WalletField = {
10060
10198
  Wallet: Wallet_default
10061
10199
  };
10062
10200
  var Feilds_default2 = WalletField;
10063
-
10064
- // src/components/ErrorPage/ErrorPage.tsx
10065
- import { jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
10066
- var ErrorPageBase = ({
10067
- title,
10068
- message: message16,
10069
- statusCode,
10070
- action,
10071
- className = ""
10072
- }) => {
10073
- return /* @__PURE__ */ jsx63(
10074
- "div",
10075
- {
10076
- className: `flex-1 m-auto h-full w-full min-h-[50vh] flex flex-col items-center justify-center p-6 text-zinc-900 dark:text-zinc-100 ${className}`,
10077
- children: /* @__PURE__ */ jsxs49("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
10078
- statusCode && /* @__PURE__ */ jsx63("div", { className: "absolute inset-0 flex items-center justify-center z-0 select-none pointer-events-none opacity-[0.03] dark:opacity-5", children: /* @__PURE__ */ jsx63("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
10079
- /* @__PURE__ */ jsxs49("div", { className: "relative z-10 space-y-6", children: [
10080
- statusCode && /* @__PURE__ */ jsxs49("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
10081
- "Error ",
10082
- statusCode
10083
- ] }),
10084
- title && /* @__PURE__ */ jsx63("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
10085
- message16 && /* @__PURE__ */ jsx63("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message16 }),
10086
- action && /* @__PURE__ */ jsx63("div", { className: "pt-8", children: /* @__PURE__ */ jsx63(
10087
- "button",
10088
- {
10089
- onClick: action.onClick,
10090
- className: "px-8 py-3.5 rounded-full text-white font-semibold shadow-[0_4px_14px_0_rgba(0,0,0,0.1)] hover:shadow-[0_6px_20px_rgba(0,0,0,0.15)] transition-all hover:-translate-y-0.5 active:translate-y-0 focus:outline-none focus:ring-2 focus:ring-offset-2",
10091
- style: { backgroundColor: "var(--primary-color, #3b82f6)" },
10092
- children: action.label
10093
- }
10094
- ) })
10095
- ] })
10096
- ] })
10097
- }
10098
- );
10099
- };
10100
-
10101
- // src/components/ErrorPage/ErrorPage.500.tsx
10102
- import { jsx as jsx64 } from "react/jsx-runtime";
10103
- var ErrorPage500 = (props) => {
10104
- return /* @__PURE__ */ jsx64(
10105
- ErrorPageBase,
10106
- {
10107
- statusCode: 500,
10108
- title: "Internal Server Error",
10109
- message: "Oops, something went wrong on our end. Please try again later.",
10110
- action: { label: "Go Home", onClick: () => window.location.href = "/" },
10111
- ...props
10112
- }
10113
- );
10114
- };
10115
-
10116
- // src/components/ErrorPage/ErrorPage.404.tsx
10117
- import { jsx as jsx65 } from "react/jsx-runtime";
10118
- var ErrorPage404 = (props) => {
10119
- return /* @__PURE__ */ jsx65(
10120
- ErrorPageBase,
10121
- {
10122
- statusCode: 404,
10123
- title: "Page Not Found",
10124
- message: "The page you are looking for doesn't exist or has been moved.",
10125
- action: { label: "Go Home", onClick: () => window.location.href = "/" },
10126
- ...props
10127
- }
10128
- );
10129
- };
10130
-
10131
- // src/components/ErrorPage/ErrorPage.401.tsx
10132
- import { jsx as jsx66 } from "react/jsx-runtime";
10133
- var ErrorPage401 = (props) => {
10134
- return /* @__PURE__ */ jsx66(
10135
- ErrorPageBase,
10136
- {
10137
- statusCode: 401,
10138
- title: "Unauthorized",
10139
- message: "You don't have permission to access this page.",
10140
- action: { label: "Go Home", onClick: () => window.location.href = "/" },
10141
- ...props
10142
- }
10143
- );
10144
- };
10145
-
10146
- // src/components/ErrorPage/ErrorPage.400.tsx
10147
- import { jsx as jsx67 } from "react/jsx-runtime";
10148
- var ErrorPage400 = (props) => {
10149
- return /* @__PURE__ */ jsx67(
10150
- ErrorPageBase,
10151
- {
10152
- statusCode: 400,
10153
- title: "Bad Request",
10154
- message: "Your request could not be processed. Please try again.",
10155
- action: { label: "Go Home", onClick: () => window.location.href = "/" },
10156
- ...props
10157
- }
10158
- );
10159
- };
10160
-
10161
- // src/components/ErrorPage/index.ts
10162
- var ErrorPage = Object.assign(ErrorPageBase, {
10163
- 500: ErrorPage500,
10164
- 404: ErrorPage404,
10165
- 401: ErrorPage401,
10166
- 400: ErrorPage400
10167
- });
10168
10201
  export {
10169
10202
  Feilds_default as AccountFields,
10170
10203
  AccountForm_default as AccountForm,