warqadui 0.0.91 → 0.0.93

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
@@ -303,7 +303,8 @@ var Enums = {
303
303
  verificationTypes: ["email_verification", "password_reset"],
304
304
  auditActions: ["create", "update", "delete", "login", "logout"],
305
305
  walletTypes: ["bank", "cash", "mobile"],
306
- currencies: ["USD", "TZS", "KES", "CNY"]
306
+ currencies: ["USD", "TZS", "KES", "CNY"],
307
+ packTypes: ["pressure", "bag", "boxes"]
307
308
  };
308
309
  var Enums_default = Enums;
309
310
 
@@ -1330,13 +1331,13 @@ var Input = forwardRef(
1330
1331
  }
1331
1332
  }
1332
1333
  }, [props.value, name, form]);
1333
- let message16 = error;
1334
+ let message24 = error;
1334
1335
  if (form && name) {
1335
1336
  const {
1336
1337
  formState: { errors }
1337
1338
  } = form;
1338
1339
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
1339
- message16 = errorObj?.message;
1340
+ message24 = errorObj?.message;
1340
1341
  }
1341
1342
  const watchedValue = form?.watch(name);
1342
1343
  useEffect7(() => {
@@ -1405,7 +1406,7 @@ var Input = forwardRef(
1405
1406
  }
1406
1407
  )
1407
1408
  ] }),
1408
- message16 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-red-600 dark:text-red-400", children: message16 })
1409
+ message24 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
1409
1410
  ]
1410
1411
  }
1411
1412
  );
@@ -1730,7 +1731,7 @@ var PhoneInput = forwardRef2(
1730
1731
  const [isFocused, setIsFocused] = useState12(false);
1731
1732
  const { theme } = useWarqadConfig();
1732
1733
  const primaryColor = theme?.primaryColor;
1733
- let message16 = error;
1734
+ let message24 = error;
1734
1735
  if (form && name) {
1735
1736
  const {
1736
1737
  formState: { errors }
@@ -1740,7 +1741,7 @@ var PhoneInput = forwardRef2(
1740
1741
  for (const part of nameParts) {
1741
1742
  currentError = currentError?.[part];
1742
1743
  }
1743
- message16 = currentError?.message || message16;
1744
+ message24 = currentError?.message || message24;
1744
1745
  }
1745
1746
  const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ jsxs15("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
1746
1747
  /* @__PURE__ */ jsxs15(
@@ -1791,7 +1792,7 @@ var PhoneInput = forwardRef2(
1791
1792
  }
1792
1793
  )
1793
1794
  ] }),
1794
- message16 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message16 })
1795
+ message24 && /* @__PURE__ */ jsx20("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
1795
1796
  ] });
1796
1797
  if (form && name) {
1797
1798
  return /* @__PURE__ */ jsx20(
@@ -1969,7 +1970,7 @@ var SelectRoot = ({
1969
1970
  document.addEventListener("mousedown", handleClickOutside);
1970
1971
  return () => document.removeEventListener("mousedown", handleClickOutside);
1971
1972
  }, [fieldInternalProps]);
1972
- let message16 = error;
1973
+ let message24 = error;
1973
1974
  if (form && name) {
1974
1975
  const {
1975
1976
  formState: { errors }
@@ -1979,7 +1980,7 @@ var SelectRoot = ({
1979
1980
  for (const part of nameParts) {
1980
1981
  currentError = currentError?.[part];
1981
1982
  }
1982
- message16 = currentError?.message || message16;
1983
+ message24 = currentError?.message || message24;
1983
1984
  }
1984
1985
  const allOptions = initialOptions?.length ? initialOptions : registeredOptions;
1985
1986
  const valueCtx = {
@@ -2040,7 +2041,7 @@ var SelectRoot = ({
2040
2041
  String(opt.value) || index
2041
2042
  )) })
2042
2043
  ] }),
2043
- message16 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message16 })
2044
+ message24 && /* @__PURE__ */ jsx21("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
2044
2045
  ]
2045
2046
  }
2046
2047
  ) });
@@ -2278,13 +2279,13 @@ var Textarea = forwardRef4(
2278
2279
  const [isFocused, setIsFocused] = useState14(false);
2279
2280
  const { theme } = useWarqadConfig();
2280
2281
  const primaryColor = theme?.primaryColor;
2281
- let message16 = error;
2282
+ let message24 = error;
2282
2283
  if (form && name) {
2283
2284
  const {
2284
2285
  formState: { errors }
2285
2286
  } = form;
2286
2287
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
2287
- message16 = errorObj?.message;
2288
+ message24 = errorObj?.message;
2288
2289
  }
2289
2290
  const renderInput = (inputProps, ref2) => /* @__PURE__ */ jsxs17("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
2290
2291
  /* @__PURE__ */ jsxs17(
@@ -2322,7 +2323,7 @@ var Textarea = forwardRef4(
2322
2323
  }
2323
2324
  }
2324
2325
  ) }),
2325
- message16 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message16 })
2326
+ message24 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
2326
2327
  ] });
2327
2328
  useEffect9(() => {
2328
2329
  if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
@@ -2648,7 +2649,7 @@ var SearchApiRoot = ({
2648
2649
  const filteredOptions = options.filter(
2649
2650
  (option) => !filter.includes(getOptionValue(option))
2650
2651
  );
2651
- let message16 = error || errorMessage;
2652
+ let message24 = error || errorMessage;
2652
2653
  if (form && name) {
2653
2654
  const {
2654
2655
  formState: { errors }
@@ -2658,7 +2659,7 @@ var SearchApiRoot = ({
2658
2659
  for (const part of nameParts) {
2659
2660
  currentError = currentError?.[part];
2660
2661
  }
2661
- message16 = currentError?.message || message16;
2662
+ message24 = currentError?.message || message24;
2662
2663
  }
2663
2664
  const valueCtx = {
2664
2665
  isOpen,
@@ -2692,7 +2693,7 @@ var SearchApiRoot = ({
2692
2693
  form,
2693
2694
  name,
2694
2695
  obj,
2695
- error: message16,
2696
+ error: message24,
2696
2697
  onSelect,
2697
2698
  onClear
2698
2699
  };
@@ -3061,19 +3062,19 @@ var DateInput = forwardRef6(
3061
3062
  const { theme } = useWarqadConfig();
3062
3063
  const primaryColor = theme?.primaryColor;
3063
3064
  const [isFocused, setIsFocused] = useState16(false);
3064
- let message16 = error;
3065
+ let message24 = error;
3065
3066
  if (form && name) {
3066
3067
  const {
3067
3068
  formState: { errors }
3068
3069
  } = form;
3069
3070
  const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
3070
- message16 = errorObj?.message;
3071
+ message24 = errorObj?.message;
3071
3072
  }
3072
3073
  const inputStyles = `w-full px-2.5 py-1 rounded-md border! shadow-none transition-all! duration-200! outline-none!
3073
3074
  bg-white! dark:bg-zinc-900!
3074
3075
  text-gray-900! dark:text-zinc-100!
3075
3076
  hover:bg-white! dark:hover:bg-zinc-900!
3076
- ${message16 ? "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"}
3077
+ ${message24 ? "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"}
3077
3078
  [&.ant-picker-focused]:bg-white dark:[&.ant-picker-focused]:bg-zinc-900
3078
3079
  ${className}`;
3079
3080
  const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
@@ -3096,8 +3097,8 @@ var DateInput = forwardRef6(
3096
3097
  needConfirm: false,
3097
3098
  style: {
3098
3099
  height: "var(--input-height, 40px)",
3099
- borderColor: isFocused && !message16 ? primaryColor : void 0,
3100
- boxShadow: isFocused && !message16 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3100
+ borderColor: isFocused && !message24 ? primaryColor : void 0,
3101
+ boxShadow: isFocused && !message24 ? `${primaryColor}33 0px 0px 0px 2px` : void 0
3101
3102
  },
3102
3103
  classNames: { popup: { root: "z-50" } },
3103
3104
  suffixIcon: /* @__PURE__ */ jsx24(
@@ -3127,7 +3128,7 @@ var DateInput = forwardRef6(
3127
3128
  {
3128
3129
  className: "block text-xs font-medium transition-colors duration-200",
3129
3130
  style: {
3130
- color: message16 ? "#ef4444" : isFocused ? primaryColor : void 0
3131
+ color: message24 ? "#ef4444" : isFocused ? primaryColor : void 0
3131
3132
  },
3132
3133
  children: [
3133
3134
  label,
@@ -3148,7 +3149,7 @@ var DateInput = forwardRef6(
3148
3149
  )
3149
3150
  }
3150
3151
  ) : renderDatePicker(value, onChange, onBlur, ref),
3151
- message16 && /* @__PURE__ */ jsx24("p", { className: "text-sm text-red-600 dark:text-red-400", children: message16 })
3152
+ message24 && /* @__PURE__ */ jsx24("p", { className: "text-sm text-red-600 dark:text-red-400", children: message24 })
3152
3153
  ] });
3153
3154
  }
3154
3155
  );
@@ -7473,17 +7474,17 @@ var preWarningFns = [];
7473
7474
  var preMessage = (fn) => {
7474
7475
  preWarningFns.push(fn);
7475
7476
  };
7476
- function warning(valid, message16) {
7477
+ function warning(valid, message24) {
7477
7478
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
7478
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message16);
7479
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message24);
7479
7480
  if (finalMessage) {
7480
7481
  console.error(`Warning: ${finalMessage}`);
7481
7482
  }
7482
7483
  }
7483
7484
  }
7484
- function note(valid, message16) {
7485
+ function note(valid, message24) {
7485
7486
  if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
7486
- const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message16);
7487
+ const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message24);
7487
7488
  if (finalMessage) {
7488
7489
  console.warn(`Note: ${finalMessage}`);
7489
7490
  }
@@ -7492,17 +7493,17 @@ function note(valid, message16) {
7492
7493
  function resetWarned() {
7493
7494
  warned = {};
7494
7495
  }
7495
- function call(method, valid, message16) {
7496
- if (!valid && !warned[message16]) {
7497
- method(false, message16);
7498
- warned[message16] = true;
7496
+ function call(method, valid, message24) {
7497
+ if (!valid && !warned[message24]) {
7498
+ method(false, message24);
7499
+ warned[message24] = true;
7499
7500
  }
7500
7501
  }
7501
- function warningOnce(valid, message16) {
7502
- call(warning, valid, message16);
7502
+ function warningOnce(valid, message24) {
7503
+ call(warning, valid, message24);
7503
7504
  }
7504
- function noteOnce(valid, message16) {
7505
- call(note, valid, message16);
7505
+ function noteOnce(valid, message24) {
7506
+ call(note, valid, message24);
7506
7507
  }
7507
7508
  warningOnce.preMessage = preMessage;
7508
7509
  warningOnce.resetWarned = resetWarned;
@@ -7513,8 +7514,8 @@ import React19, { useContext as useContext5, useEffect as useEffect17 } from "re
7513
7514
  function camelCase(input) {
7514
7515
  return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
7515
7516
  }
7516
- function warning2(valid, message16) {
7517
- warningOnce(valid, `[@ant-design/icons] ${message16}`);
7517
+ function warning2(valid, message24) {
7518
+ warningOnce(valid, `[@ant-design/icons] ${message24}`);
7518
7519
  }
7519
7520
  function isIconDefinition(target) {
7520
7521
  return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
@@ -8080,7 +8081,7 @@ var AdminProtectedRoute = () => {
8080
8081
  };
8081
8082
 
8082
8083
  // src/components/accounts/Accounts.tsx
8083
- import { Navigate as Navigate2, useNavigate as useNavigate4, useParams } from "react-router-dom";
8084
+ import { useNavigate as useNavigate4, useParams } from "react-router-dom";
8084
8085
  import { Cable, EllipsisVertical, FilePenLine, Trash2 as Trash22 } from "lucide-react";
8085
8086
  import { useState as useState26 } from "react";
8086
8087
  import { message as message4 } from "antd";
@@ -8091,8 +8092,7 @@ function Accounts({ v, url }) {
8091
8092
  const navigate = useNavigate4();
8092
8093
  const { type } = useParams();
8093
8094
  if (!enums.accountTypes.includes(type)) {
8094
- message4.error("Invalid account type");
8095
- return /* @__PURE__ */ jsx43(Navigate2, { to: "/accounts", replace: true });
8095
+ navigate(-1);
8096
8096
  }
8097
8097
  const [deleteAccount, setDeleteAccount] = useState26(null);
8098
8098
  const { isLoading, remove } = useApis_default();
@@ -8506,7 +8506,7 @@ var AccountFields = {
8506
8506
  var Feilds_default = AccountFields;
8507
8507
 
8508
8508
  // src/components/accounts/AccountForm.tsx
8509
- import { Navigate as Navigate3, useParams as useParams4 } from "react-router-dom";
8509
+ import { useParams as useParams4 } from "react-router-dom";
8510
8510
  import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
8511
8511
  function AccountForm() {
8512
8512
  const { enums } = useWarqadConfig();
@@ -8516,8 +8516,7 @@ function AccountForm() {
8516
8516
  const type = getParams("type");
8517
8517
  const isEdit = !!id;
8518
8518
  if (!enums.accountTypes.includes(type)) {
8519
- message5.error("Invalid account type");
8520
- return /* @__PURE__ */ jsx49(Navigate3, { to: "/accounts", replace: true });
8519
+ navigate(-1);
8521
8520
  }
8522
8521
  const { post, put, isLoading } = useApis_default();
8523
8522
  const { isLoading: isLoadingGet, get } = useApis_default();
@@ -10092,29 +10091,1381 @@ var WalletField = {
10092
10091
  };
10093
10092
  var Feilds_default2 = WalletField;
10094
10093
 
10094
+ // src/components/brands/Brands.tsx
10095
+ import { useNavigate as useNavigate11, useParams as useParams9 } from "react-router-dom";
10096
+ import { EllipsisVertical as EllipsisVertical4, FilePenLine as FilePenLine3, Trash2 as Trash24 } from "lucide-react";
10097
+ import { useState as useState33 } from "react";
10098
+ import { message as message16 } from "antd";
10099
+ import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
10100
+ function Brands({ v, url }) {
10101
+ const { branchId } = useParams9();
10102
+ const [deleteBrand, setDeleteBrand] = useState33(null);
10103
+ const { isLoading, remove } = useApis_default();
10104
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
10105
+ url: url || `/brands/get${branchId ? `?branch=${branchId}` : ""}`,
10106
+ v,
10107
+ dateFilter: false
10108
+ });
10109
+ const { Modal: Modal2 } = useModal();
10110
+ const navigate = useNavigate11();
10111
+ const items = (data2) => [
10112
+ {
10113
+ label: `Edit Brand`,
10114
+ icon: /* @__PURE__ */ jsx63(FilePenLine3, { size: 16 }),
10115
+ onClick: () => navigate(`update?id=${data2?._id}`)
10116
+ },
10117
+ {
10118
+ label: `Delete Brand`,
10119
+ icon: /* @__PURE__ */ jsx63(Trash24, { className: "text-red-500", size: 16 }),
10120
+ onClick: () => setDeleteBrand(data2)
10121
+ }
10122
+ ].filter(Boolean);
10123
+ const columns = [
10124
+ {
10125
+ accessorKey: "name",
10126
+ header: "Name",
10127
+ cell: ({ row }) => {
10128
+ const brand = row.original;
10129
+ return /* @__PURE__ */ jsx63("span", { children: brand?.name });
10130
+ }
10131
+ },
10132
+ {
10133
+ accessorKey: "actions",
10134
+ header: "Actions",
10135
+ cell: ({ row }) => {
10136
+ const data2 = row.original;
10137
+ return /* @__PURE__ */ jsx63(
10138
+ Dropdown,
10139
+ {
10140
+ className: "cursor-pointer w-[150px]",
10141
+ items: items(data2),
10142
+ triggerMode: "hover",
10143
+ children: /* @__PURE__ */ jsx63(EllipsisVertical4, {})
10144
+ }
10145
+ );
10146
+ }
10147
+ }
10148
+ ].filter(Boolean);
10149
+ const brands = data?.data || [];
10150
+ const onDelete = async (id) => {
10151
+ try {
10152
+ await remove({ url: `/brands/delete/${id}` });
10153
+ message16.success("Brand deleted successfully");
10154
+ reload();
10155
+ setDeleteBrand(null);
10156
+ } catch (error) {
10157
+ message16.error(error.message || "Something went wrong");
10158
+ return error;
10159
+ }
10160
+ };
10161
+ return /* @__PURE__ */ jsxs49(Fragment14, { children: [
10162
+ /* @__PURE__ */ jsx63(Modal2, {}),
10163
+ /* @__PURE__ */ jsx63(
10164
+ ConfirmModal,
10165
+ {
10166
+ isOpen: !!deleteBrand,
10167
+ isLoading,
10168
+ onClose: () => setDeleteBrand(null),
10169
+ title: `Delete Brand`,
10170
+ description: `Are you sure you want to delete "${deleteBrand?.name}"? This action cannot be undone. and Please type "delete" to confirm.`,
10171
+ confirmationWord: "delete",
10172
+ onSubmit: () => onDelete(deleteBrand?._id),
10173
+ children: null
10174
+ }
10175
+ ),
10176
+ /* @__PURE__ */ jsx63(
10177
+ TransactionViewComponent,
10178
+ {
10179
+ columns,
10180
+ data: brands,
10181
+ title: `Brands`,
10182
+ description: `Add or update brands`,
10183
+ index: true,
10184
+ createTitle: `Add Brand`,
10185
+ onCreate: () => {
10186
+ navigate("create");
10187
+ }
10188
+ }
10189
+ )
10190
+ ] });
10191
+ }
10192
+ var Brands_default = Brands;
10193
+
10194
+ // src/components/brands/schema.ts
10195
+ import { z as z6 } from "zod";
10196
+ var createBrandSchema = z6.object({
10197
+ name: z6.string().min(2, { message: "Name must be at least 2 characters" }),
10198
+ branch: z6.string().optional()
10199
+ });
10200
+
10201
+ // src/components/brands/BrandForm.tsx
10202
+ import { useForm as useForm10 } from "react-hook-form";
10203
+ import { zodResolver as zodResolver9 } from "@hookform/resolvers/zod";
10204
+ import { message as message17 } from "antd";
10205
+ import { useEffect as useEffect26 } from "react";
10206
+ import { useParams as useParams10 } from "react-router-dom";
10207
+ import { jsx as jsx64, jsxs as jsxs50 } from "react/jsx-runtime";
10208
+ function BrandForm() {
10209
+ const { branchId } = useParams10();
10210
+ const { getQuery, navigate } = useApp_default();
10211
+ const id = getQuery("id");
10212
+ const isEdit = !!id;
10213
+ const { post, put, isLoading } = useApis_default();
10214
+ const { isLoading: isLoadingGet, get } = useApis_default();
10215
+ const methods = useForm10({
10216
+ resolver: zodResolver9(createBrandSchema),
10217
+ defaultValues: {
10218
+ name: ""
10219
+ },
10220
+ shouldUnregister: false
10221
+ });
10222
+ const { handleSubmit } = methods;
10223
+ const onSubmit = async (data) => {
10224
+ try {
10225
+ if (isEdit) {
10226
+ await put({
10227
+ url: `/brands/update/${id}`,
10228
+ body: {
10229
+ ...data,
10230
+ branch: branchId ? branchId : data.branch
10231
+ }
10232
+ });
10233
+ } else {
10234
+ await post({
10235
+ url: "/brands/create",
10236
+ body: {
10237
+ ...data,
10238
+ branch: branchId ? branchId : data.branch
10239
+ }
10240
+ });
10241
+ }
10242
+ message17.success(`Brand ${isEdit ? "updated" : "created"} successfully`);
10243
+ navigate(-1);
10244
+ } catch (error) {
10245
+ message17.error(error?.message || "Something went wrong");
10246
+ }
10247
+ };
10248
+ const fetches = async () => {
10249
+ try {
10250
+ const res = await get({
10251
+ url: `/brands/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10252
+ });
10253
+ const data = res.data;
10254
+ methods.reset(data);
10255
+ } catch (error) {
10256
+ message17.error(error?.message || "Something went wrong");
10257
+ }
10258
+ };
10259
+ useEffect26(() => {
10260
+ if (isEdit) {
10261
+ fetches();
10262
+ }
10263
+ }, [id]);
10264
+ return /* @__PURE__ */ jsxs50(
10265
+ Card,
10266
+ {
10267
+ className: "max-w-4xl mx-auto mt-10 relative",
10268
+ isLoading: isLoadingGet,
10269
+ loadingText: "Processing...",
10270
+ children: [
10271
+ /* @__PURE__ */ jsxs50(Card.Header, { children: [
10272
+ /* @__PURE__ */ jsx64(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Brand` }),
10273
+ /* @__PURE__ */ jsx64(Card.Description, { children: isEdit ? `Update the details for this brand` : `Create a new brand and add it to your list` })
10274
+ ] }),
10275
+ /* @__PURE__ */ jsx64(Card.Content, { children: /* @__PURE__ */ jsxs50(
10276
+ "form",
10277
+ {
10278
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10279
+ children: [
10280
+ /* @__PURE__ */ jsxs50("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10281
+ /* @__PURE__ */ jsx64(
10282
+ Fields_default.Input,
10283
+ {
10284
+ label: "Name",
10285
+ form: methods,
10286
+ name: "name",
10287
+ type: "text",
10288
+ placeholder: "Enter Brand Name",
10289
+ required: true
10290
+ }
10291
+ ),
10292
+ !branchId && /* @__PURE__ */ jsx64(
10293
+ Feilds_default.Branches,
10294
+ {
10295
+ label: "Branch",
10296
+ form: methods,
10297
+ name: "branch",
10298
+ placeholder: "Select Branch",
10299
+ api: "/branches/get?noStore=true"
10300
+ }
10301
+ )
10302
+ ] }),
10303
+ /* @__PURE__ */ jsx64("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx64(
10304
+ Button,
10305
+ {
10306
+ isLoading,
10307
+ disabled: isLoading,
10308
+ type: "submit",
10309
+ className: "min-w-[100px]",
10310
+ variant: !isEdit ? "primary" : "warning",
10311
+ children: isEdit ? "Update" : "Add"
10312
+ }
10313
+ ) })
10314
+ ]
10315
+ }
10316
+ ) })
10317
+ ]
10318
+ }
10319
+ );
10320
+ }
10321
+ var BrandForm_default = BrandForm;
10322
+
10323
+ // src/components/brands/Feilds/Brand.tsx
10324
+ import { useParams as useParams11 } from "react-router-dom";
10325
+ import { jsx as jsx65 } from "react/jsx-runtime";
10326
+ function Brand({
10327
+ name,
10328
+ label,
10329
+ placeholder,
10330
+ api,
10331
+ form,
10332
+ filter,
10333
+ v = 1,
10334
+ required,
10335
+ disabled
10336
+ }) {
10337
+ const { branchId } = useParams11();
10338
+ return /* @__PURE__ */ jsx65("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx65(
10339
+ Fields_default.SearchApi,
10340
+ {
10341
+ name,
10342
+ form,
10343
+ label,
10344
+ placeholder: placeholder || `Select ${name}`,
10345
+ api: `${api}${branchId ? `?branch=${branchId}` : ""}`,
10346
+ queryKey: "search",
10347
+ filter,
10348
+ v,
10349
+ labelKey: "name",
10350
+ valueKey: "_id",
10351
+ required,
10352
+ disabled
10353
+ }
10354
+ ) });
10355
+ }
10356
+ var Brand_default = Brand;
10357
+
10358
+ // src/components/brands/Feilds/index.tsx
10359
+ var BrandField = {
10360
+ Brand: Brand_default
10361
+ };
10362
+ var Feilds_default3 = BrandField;
10363
+
10364
+ // src/components/categories/Categories.tsx
10365
+ import { useNavigate as useNavigate12, useParams as useParams12 } from "react-router-dom";
10366
+ import { EllipsisVertical as EllipsisVertical5, FilePenLine as FilePenLine4, Trash2 as Trash25 } from "lucide-react";
10367
+ import { useState as useState34 } from "react";
10368
+ import { message as message18 } from "antd";
10369
+ import { Fragment as Fragment15, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
10370
+ function Categories({ v, url }) {
10371
+ const { branchId } = useParams12();
10372
+ const [deleteCategory, setDeleteCategory] = useState34(null);
10373
+ const { isLoading, remove } = useApis_default();
10374
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
10375
+ url: url || `/categories/get${branchId ? `?branch=${branchId}` : ""}`,
10376
+ v,
10377
+ dateFilter: false
10378
+ });
10379
+ const { Modal: Modal2 } = useModal();
10380
+ const navigate = useNavigate12();
10381
+ const items = (data2) => [
10382
+ {
10383
+ label: `Edit Category`,
10384
+ icon: /* @__PURE__ */ jsx66(FilePenLine4, { size: 16 }),
10385
+ onClick: () => navigate(`update?id=${data2?._id}`)
10386
+ },
10387
+ {
10388
+ label: `Delete Category`,
10389
+ icon: /* @__PURE__ */ jsx66(Trash25, { className: "text-red-500", size: 16 }),
10390
+ onClick: () => setDeleteCategory(data2)
10391
+ }
10392
+ ].filter(Boolean);
10393
+ const columns = [
10394
+ {
10395
+ accessorKey: "name",
10396
+ header: "Name",
10397
+ cell: ({ row }) => {
10398
+ const category = row.original;
10399
+ return /* @__PURE__ */ jsx66("span", { children: category?.name });
10400
+ }
10401
+ },
10402
+ {
10403
+ accessorKey: "actions",
10404
+ header: "Actions",
10405
+ cell: ({ row }) => {
10406
+ const data2 = row.original;
10407
+ return /* @__PURE__ */ jsx66(
10408
+ Dropdown,
10409
+ {
10410
+ className: "cursor-pointer w-[150px]",
10411
+ items: items(data2),
10412
+ triggerMode: "hover",
10413
+ children: /* @__PURE__ */ jsx66(EllipsisVertical5, {})
10414
+ }
10415
+ );
10416
+ }
10417
+ }
10418
+ ].filter(Boolean);
10419
+ const categories = data?.data || [];
10420
+ const onDelete = async (id) => {
10421
+ try {
10422
+ await remove({ url: `/categories/delete/${id}` });
10423
+ message18.success("Category deleted successfully");
10424
+ reload();
10425
+ setDeleteCategory(null);
10426
+ } catch (error) {
10427
+ message18.error(error.message || "Something went wrong");
10428
+ return error;
10429
+ }
10430
+ };
10431
+ return /* @__PURE__ */ jsxs51(Fragment15, { children: [
10432
+ /* @__PURE__ */ jsx66(Modal2, {}),
10433
+ /* @__PURE__ */ jsx66(
10434
+ ConfirmModal,
10435
+ {
10436
+ isOpen: !!deleteCategory,
10437
+ isLoading,
10438
+ onClose: () => setDeleteCategory(null),
10439
+ title: `Delete Category`,
10440
+ description: `Are you sure you want to delete "${deleteCategory?.name}"? This action cannot be undone. and Please type "delete" to confirm.`,
10441
+ confirmationWord: "delete",
10442
+ onSubmit: () => onDelete(deleteCategory?._id),
10443
+ children: null
10444
+ }
10445
+ ),
10446
+ /* @__PURE__ */ jsx66(
10447
+ TransactionViewComponent,
10448
+ {
10449
+ columns,
10450
+ data: categories,
10451
+ title: `Categories`,
10452
+ description: `Add or update categories`,
10453
+ index: true,
10454
+ createTitle: `Add Category`,
10455
+ onCreate: () => {
10456
+ navigate("create");
10457
+ }
10458
+ }
10459
+ )
10460
+ ] });
10461
+ }
10462
+ var Categories_default = Categories;
10463
+
10464
+ // src/components/categories/schema.ts
10465
+ import { z as z7 } from "zod";
10466
+ var createCategorySchema = z7.object({
10467
+ name: z7.string().min(2, { message: "Name must be at least 2 characters" }),
10468
+ branch: z7.string().optional()
10469
+ });
10470
+
10471
+ // src/components/categories/CategoryForm.tsx
10472
+ import { useForm as useForm11 } from "react-hook-form";
10473
+ import { zodResolver as zodResolver10 } from "@hookform/resolvers/zod";
10474
+ import { message as message19 } from "antd";
10475
+ import { useEffect as useEffect27 } from "react";
10476
+ import { useParams as useParams13 } from "react-router-dom";
10477
+ import { jsx as jsx67, jsxs as jsxs52 } from "react/jsx-runtime";
10478
+ function CategoryForm() {
10479
+ const { branchId } = useParams13();
10480
+ const { getQuery, navigate } = useApp_default();
10481
+ const id = getQuery("id");
10482
+ const isEdit = !!id;
10483
+ const { post, put, isLoading } = useApis_default();
10484
+ const { isLoading: isLoadingGet, get } = useApis_default();
10485
+ const methods = useForm11({
10486
+ resolver: zodResolver10(createCategorySchema),
10487
+ defaultValues: {
10488
+ name: ""
10489
+ },
10490
+ shouldUnregister: false
10491
+ });
10492
+ const { handleSubmit } = methods;
10493
+ const onSubmit = async (data) => {
10494
+ try {
10495
+ if (isEdit) {
10496
+ await put({
10497
+ url: `/categories/update/${id}`,
10498
+ body: {
10499
+ ...data,
10500
+ branch: branchId ? branchId : data.branch
10501
+ }
10502
+ });
10503
+ } else {
10504
+ await post({
10505
+ url: "/categories/create",
10506
+ body: {
10507
+ ...data,
10508
+ branch: branchId ? branchId : data.branch
10509
+ }
10510
+ });
10511
+ }
10512
+ message19.success(`Category ${isEdit ? "updated" : "created"} successfully`);
10513
+ navigate(-1);
10514
+ } catch (error) {
10515
+ message19.error(error?.message || "Something went wrong");
10516
+ }
10517
+ };
10518
+ const fetches = async () => {
10519
+ try {
10520
+ const res = await get({
10521
+ url: `/categories/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10522
+ });
10523
+ const data = res.data;
10524
+ methods.reset(data);
10525
+ } catch (error) {
10526
+ message19.error(error?.message || "Something went wrong");
10527
+ }
10528
+ };
10529
+ useEffect27(() => {
10530
+ if (isEdit) {
10531
+ fetches();
10532
+ }
10533
+ }, [id]);
10534
+ return /* @__PURE__ */ jsxs52(
10535
+ Card,
10536
+ {
10537
+ className: "max-w-4xl mx-auto mt-10 relative",
10538
+ isLoading: isLoadingGet,
10539
+ loadingText: "Processing...",
10540
+ children: [
10541
+ /* @__PURE__ */ jsxs52(Card.Header, { children: [
10542
+ /* @__PURE__ */ jsx67(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Category` }),
10543
+ /* @__PURE__ */ jsx67(Card.Description, { children: isEdit ? `Update the details for this category` : `Create a new category and add it to your list` })
10544
+ ] }),
10545
+ /* @__PURE__ */ jsx67(Card.Content, { children: /* @__PURE__ */ jsxs52(
10546
+ "form",
10547
+ {
10548
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10549
+ children: [
10550
+ /* @__PURE__ */ jsxs52("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10551
+ /* @__PURE__ */ jsx67(
10552
+ Fields_default.Input,
10553
+ {
10554
+ label: "Name",
10555
+ form: methods,
10556
+ name: "name",
10557
+ type: "text",
10558
+ placeholder: "Enter Category Name",
10559
+ required: true
10560
+ }
10561
+ ),
10562
+ !branchId && /* @__PURE__ */ jsx67(
10563
+ Feilds_default.Branches,
10564
+ {
10565
+ label: "Branch",
10566
+ form: methods,
10567
+ name: "branch",
10568
+ placeholder: "Select Branch",
10569
+ api: "/branches/get?noStore=true"
10570
+ }
10571
+ )
10572
+ ] }),
10573
+ /* @__PURE__ */ jsx67("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx67(
10574
+ Button,
10575
+ {
10576
+ isLoading,
10577
+ disabled: isLoading,
10578
+ type: "submit",
10579
+ className: "min-w-[100px]",
10580
+ variant: !isEdit ? "primary" : "warning",
10581
+ children: isEdit ? "Update" : "Add"
10582
+ }
10583
+ ) })
10584
+ ]
10585
+ }
10586
+ ) })
10587
+ ]
10588
+ }
10589
+ );
10590
+ }
10591
+ var CategoryForm_default = CategoryForm;
10592
+
10593
+ // src/components/categories/Feilds/Category.tsx
10594
+ import { useParams as useParams14 } from "react-router-dom";
10595
+ import { jsx as jsx68 } from "react/jsx-runtime";
10596
+ function Category({
10597
+ name,
10598
+ label,
10599
+ placeholder,
10600
+ api,
10601
+ form,
10602
+ filter,
10603
+ v = 1,
10604
+ required,
10605
+ disabled
10606
+ }) {
10607
+ const { branchId } = useParams14();
10608
+ return /* @__PURE__ */ jsx68("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx68(
10609
+ Fields_default.SearchApi,
10610
+ {
10611
+ name,
10612
+ form,
10613
+ label,
10614
+ placeholder: placeholder || `Select ${name}`,
10615
+ api: `${api}${branchId ? `?branch=${branchId}` : ""}`,
10616
+ queryKey: "search",
10617
+ filter,
10618
+ v,
10619
+ labelKey: "name",
10620
+ valueKey: "_id",
10621
+ required,
10622
+ disabled
10623
+ }
10624
+ ) });
10625
+ }
10626
+ var Category_default = Category;
10627
+
10628
+ // src/components/categories/Feilds/index.tsx
10629
+ var CategoryField = {
10630
+ Category: Category_default
10631
+ };
10632
+ var Feilds_default4 = CategoryField;
10633
+
10634
+ // src/components/products/Products.tsx
10635
+ import { useNavigate as useNavigate13, useParams as useParams15 } from "react-router-dom";
10636
+ import { EllipsisVertical as EllipsisVertical6, FilePenLine as FilePenLine5, Trash2 as Trash26 } from "lucide-react";
10637
+ import { useState as useState35 } from "react";
10638
+ import { message as message20 } from "antd";
10639
+ import { Fragment as Fragment16, jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
10640
+ function Products({ v, url }) {
10641
+ const { branchId } = useParams15();
10642
+ const [deleteProduct, setDeleteProduct] = useState35(null);
10643
+ const { isLoading, remove } = useApis_default();
10644
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
10645
+ url: url || `/products/get${branchId ? `?branch=${branchId}` : ""}`,
10646
+ v,
10647
+ dateFilter: false
10648
+ });
10649
+ const { Modal: Modal2 } = useModal();
10650
+ const navigate = useNavigate13();
10651
+ const items = (data2) => [
10652
+ {
10653
+ label: `Edit Product`,
10654
+ icon: /* @__PURE__ */ jsx69(FilePenLine5, { size: 16 }),
10655
+ onClick: () => navigate(`update?id=${data2?._id}`)
10656
+ },
10657
+ {
10658
+ label: `Delete Product`,
10659
+ icon: /* @__PURE__ */ jsx69(Trash26, { className: "text-red-500", size: 16 }),
10660
+ onClick: () => setDeleteProduct(data2)
10661
+ }
10662
+ ].filter(Boolean);
10663
+ const columns = [
10664
+ {
10665
+ accessorKey: "name",
10666
+ header: "Name",
10667
+ cell: ({ row }) => {
10668
+ const product = row.original;
10669
+ return /* @__PURE__ */ jsx69("span", { children: product?.name });
10670
+ }
10671
+ },
10672
+ {
10673
+ accessorKey: "category",
10674
+ header: "Category",
10675
+ cell: ({ row }) => {
10676
+ const product = row.original;
10677
+ return /* @__PURE__ */ jsx69("span", { children: product?.categoryData?.name || "N/A" });
10678
+ }
10679
+ },
10680
+ {
10681
+ accessorKey: "brand",
10682
+ header: "Brand",
10683
+ cell: ({ row }) => {
10684
+ const product = row.original;
10685
+ return /* @__PURE__ */ jsx69("span", { children: product?.brandData?.name || "N/A" });
10686
+ }
10687
+ },
10688
+ {
10689
+ accessorKey: "cost",
10690
+ header: "Cost",
10691
+ cell: ({ row }) => {
10692
+ const product = row.original;
10693
+ return /* @__PURE__ */ jsxs53("span", { children: [
10694
+ " ",
10695
+ product?.cost?.toLocaleString()
10696
+ ] });
10697
+ }
10698
+ },
10699
+ {
10700
+ accessorKey: "actions",
10701
+ header: "Actions",
10702
+ cell: ({ row }) => {
10703
+ const data2 = row.original;
10704
+ return /* @__PURE__ */ jsx69(
10705
+ Dropdown,
10706
+ {
10707
+ className: "cursor-pointer w-[150px]",
10708
+ items: items(data2),
10709
+ triggerMode: "hover",
10710
+ children: /* @__PURE__ */ jsx69(EllipsisVertical6, {})
10711
+ }
10712
+ );
10713
+ }
10714
+ }
10715
+ ].filter(Boolean);
10716
+ const products = data?.data || [];
10717
+ const onDelete = async (id) => {
10718
+ try {
10719
+ await remove({ url: `/products/delete/${id}` });
10720
+ message20.success("Product deleted successfully");
10721
+ reload();
10722
+ setDeleteProduct(null);
10723
+ } catch (error) {
10724
+ message20.error(error.message || "Something went wrong");
10725
+ return error;
10726
+ }
10727
+ };
10728
+ return /* @__PURE__ */ jsxs53(Fragment16, { children: [
10729
+ /* @__PURE__ */ jsx69(Modal2, {}),
10730
+ /* @__PURE__ */ jsx69(
10731
+ ConfirmModal,
10732
+ {
10733
+ isOpen: !!deleteProduct,
10734
+ isLoading,
10735
+ onClose: () => setDeleteProduct(null),
10736
+ title: `Delete Product`,
10737
+ description: `Are you sure you want to delete "${deleteProduct?.name}"? This action cannot be undone. and Please type "delete" to confirm.`,
10738
+ confirmationWord: "delete",
10739
+ onSubmit: () => onDelete(deleteProduct?._id),
10740
+ children: null
10741
+ }
10742
+ ),
10743
+ /* @__PURE__ */ jsx69(
10744
+ TransactionViewComponent,
10745
+ {
10746
+ columns,
10747
+ data: products,
10748
+ title: `Products`,
10749
+ description: `Add or update products`,
10750
+ index: true,
10751
+ createTitle: `Add Product`,
10752
+ onCreate: () => {
10753
+ navigate("create");
10754
+ }
10755
+ }
10756
+ )
10757
+ ] });
10758
+ }
10759
+ var Products_default = Products;
10760
+
10761
+ // src/components/products/schema.ts
10762
+ import { z as z8 } from "zod";
10763
+ var createProductSchema = z8.object({
10764
+ name: z8.string().min(2, { message: "Name must be at least 2 characters" }),
10765
+ category: z8.string().optional(),
10766
+ brand: z8.string().optional(),
10767
+ cost: z8.number({ message: "Cost is required" }).min(0),
10768
+ branch: z8.string().optional()
10769
+ });
10770
+
10771
+ // src/components/products/ProductForm.tsx
10772
+ import { useForm as useForm12 } from "react-hook-form";
10773
+ import { zodResolver as zodResolver11 } from "@hookform/resolvers/zod";
10774
+ import { message as message21 } from "antd";
10775
+ import { useEffect as useEffect28 } from "react";
10776
+ import { useParams as useParams16 } from "react-router-dom";
10777
+ import { jsx as jsx70, jsxs as jsxs54 } from "react/jsx-runtime";
10778
+ function ProductForm() {
10779
+ const { branchId } = useParams16();
10780
+ const { getQuery, navigate } = useApp_default();
10781
+ const id = getQuery("id");
10782
+ const isEdit = !!id;
10783
+ const { post, put, isLoading } = useApis_default();
10784
+ const { isLoading: isLoadingGet, get } = useApis_default();
10785
+ const methods = useForm12({
10786
+ resolver: zodResolver11(createProductSchema),
10787
+ defaultValues: {
10788
+ name: "",
10789
+ category: void 0,
10790
+ brand: void 0,
10791
+ cost: 0
10792
+ },
10793
+ shouldUnregister: false
10794
+ });
10795
+ const { handleSubmit } = methods;
10796
+ const onSubmit = async (data) => {
10797
+ try {
10798
+ if (isEdit) {
10799
+ await put({
10800
+ url: `/products/update/${id}`,
10801
+ body: {
10802
+ ...data,
10803
+ branch: branchId ? branchId : data.branch
10804
+ }
10805
+ });
10806
+ } else {
10807
+ await post({
10808
+ url: "/products/create",
10809
+ body: {
10810
+ ...data,
10811
+ branch: branchId ? branchId : data.branch
10812
+ }
10813
+ });
10814
+ }
10815
+ message21.success(`Product ${isEdit ? "updated" : "created"} successfully`);
10816
+ navigate(-1);
10817
+ } catch (error) {
10818
+ message21.error(error?.message || "Something went wrong");
10819
+ }
10820
+ };
10821
+ const fetches = async () => {
10822
+ try {
10823
+ const res = await get({
10824
+ url: `/products/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
10825
+ });
10826
+ const data = res.data;
10827
+ methods.reset(data);
10828
+ } catch (error) {
10829
+ message21.error(error?.message || "Something went wrong");
10830
+ }
10831
+ };
10832
+ useEffect28(() => {
10833
+ if (isEdit) {
10834
+ fetches();
10835
+ }
10836
+ }, [id]);
10837
+ return /* @__PURE__ */ jsxs54(
10838
+ Card,
10839
+ {
10840
+ className: "max-w-4xl mx-auto mt-10 relative",
10841
+ isLoading: isLoadingGet,
10842
+ loadingText: "Processing...",
10843
+ children: [
10844
+ /* @__PURE__ */ jsxs54(Card.Header, { children: [
10845
+ /* @__PURE__ */ jsx70(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Product` }),
10846
+ /* @__PURE__ */ jsx70(Card.Description, { children: isEdit ? `Update the details for this product` : `Create a new product and add it to your list` })
10847
+ ] }),
10848
+ /* @__PURE__ */ jsx70(Card.Content, { children: /* @__PURE__ */ jsxs54(
10849
+ "form",
10850
+ {
10851
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
10852
+ children: [
10853
+ /* @__PURE__ */ jsxs54("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
10854
+ /* @__PURE__ */ jsx70(
10855
+ Fields_default.Input,
10856
+ {
10857
+ label: "Name",
10858
+ form: methods,
10859
+ name: "name",
10860
+ type: "text",
10861
+ placeholder: "Enter Product Name",
10862
+ required: true
10863
+ }
10864
+ ),
10865
+ /* @__PURE__ */ jsx70(
10866
+ Fields_default.Input,
10867
+ {
10868
+ label: "Cost",
10869
+ form: methods,
10870
+ name: "cost",
10871
+ type: "number",
10872
+ placeholder: "0.00",
10873
+ required: true
10874
+ }
10875
+ ),
10876
+ /* @__PURE__ */ jsx70(
10877
+ Feilds_default4.Category,
10878
+ {
10879
+ label: "Category",
10880
+ form: methods,
10881
+ name: "category",
10882
+ api: "/categories/get"
10883
+ }
10884
+ ),
10885
+ /* @__PURE__ */ jsx70(
10886
+ Feilds_default3.Brand,
10887
+ {
10888
+ label: "Brand",
10889
+ form: methods,
10890
+ name: "brand",
10891
+ api: "/brands/get"
10892
+ }
10893
+ ),
10894
+ !branchId && /* @__PURE__ */ jsx70(
10895
+ Feilds_default.Branches,
10896
+ {
10897
+ label: "Branch",
10898
+ form: methods,
10899
+ name: "branch",
10900
+ placeholder: "Select Branch",
10901
+ api: "/branches/get?noStore=true"
10902
+ }
10903
+ )
10904
+ ] }),
10905
+ /* @__PURE__ */ jsx70("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx70(
10906
+ Button,
10907
+ {
10908
+ isLoading,
10909
+ disabled: isLoading,
10910
+ type: "submit",
10911
+ className: "min-w-[100px]",
10912
+ variant: !isEdit ? "primary" : "warning",
10913
+ children: isEdit ? "Update" : "Add"
10914
+ }
10915
+ ) })
10916
+ ]
10917
+ }
10918
+ ) })
10919
+ ]
10920
+ }
10921
+ );
10922
+ }
10923
+ var ProductForm_default = ProductForm;
10924
+
10925
+ // src/components/products/Feilds/Product.tsx
10926
+ import { useParams as useParams17 } from "react-router-dom";
10927
+ import { jsx as jsx71 } from "react/jsx-runtime";
10928
+ function Product({
10929
+ name,
10930
+ label,
10931
+ placeholder,
10932
+ api,
10933
+ form,
10934
+ filter,
10935
+ v = 1,
10936
+ required,
10937
+ disabled,
10938
+ onChange,
10939
+ obj
10940
+ }) {
10941
+ const { branchId } = useParams17();
10942
+ return /* @__PURE__ */ jsx71("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx71(
10943
+ Fields_default.SearchApi,
10944
+ {
10945
+ name,
10946
+ form,
10947
+ label,
10948
+ onChange,
10949
+ placeholder: placeholder || `Select ${name}`,
10950
+ api: `${api}${branchId ? `?branch=${branchId}` : ""}`,
10951
+ queryKey: "search",
10952
+ filter,
10953
+ v,
10954
+ labelKey: "name",
10955
+ valueKey: "_id",
10956
+ required,
10957
+ disabled,
10958
+ obj
10959
+ }
10960
+ ) });
10961
+ }
10962
+ var Product_default = Product;
10963
+
10964
+ // src/components/products/Feilds/index.tsx
10965
+ var ProductField = {
10966
+ Product: Product_default
10967
+ };
10968
+ var Feilds_default5 = ProductField;
10969
+
10970
+ // src/components/packs/Packs.tsx
10971
+ import { useNavigate as useNavigate14, useParams as useParams18 } from "react-router-dom";
10972
+ import { EllipsisVertical as EllipsisVertical7, FilePenLine as FilePenLine6, Trash2 as Trash27 } from "lucide-react";
10973
+ import { useState as useState36 } from "react";
10974
+ import { message as message22 } from "antd";
10975
+ import { Fragment as Fragment17, jsx as jsx72, jsxs as jsxs55 } from "react/jsx-runtime";
10976
+ function Packs({ v, url }) {
10977
+ const { branchId } = useParams18();
10978
+ const [deletePack, setDeletePack] = useState36(null);
10979
+ const { isLoading, remove } = useApis_default();
10980
+ const { data, TransactionViewComponent, reload } = useTransaction_default({
10981
+ url: url || `/packs/get${branchId ? `?branch=${branchId}` : ""}`,
10982
+ v,
10983
+ dateFilter: false
10984
+ });
10985
+ const { Modal: Modal2 } = useModal();
10986
+ const navigate = useNavigate14();
10987
+ const items = (data2) => [
10988
+ {
10989
+ label: `Edit Pack`,
10990
+ icon: /* @__PURE__ */ jsx72(FilePenLine6, { size: 16 }),
10991
+ onClick: () => navigate(`update?id=${data2?._id}`)
10992
+ },
10993
+ {
10994
+ label: `Delete Pack`,
10995
+ icon: /* @__PURE__ */ jsx72(Trash27, { className: "text-red-500", size: 16 }),
10996
+ onClick: () => setDeletePack(data2)
10997
+ }
10998
+ ].filter(Boolean);
10999
+ const columns = [
11000
+ {
11001
+ accessorKey: "name",
11002
+ header: "Name",
11003
+ cell: ({ row }) => {
11004
+ const pack = row.original;
11005
+ return /* @__PURE__ */ jsx72("span", { children: pack?.name });
11006
+ }
11007
+ },
11008
+ {
11009
+ accessorKey: "type",
11010
+ header: "Type",
11011
+ cell: ({ row }) => {
11012
+ const pack = row.original;
11013
+ return /* @__PURE__ */ jsx72("span", { className: "capitalize", children: pack?.type });
11014
+ }
11015
+ },
11016
+ {
11017
+ accessorKey: "products",
11018
+ header: "Products Count",
11019
+ cell: ({ row }) => {
11020
+ const pack = row.original;
11021
+ return /* @__PURE__ */ jsxs55("span", { children: [
11022
+ pack?.products?.length || 0,
11023
+ " Products"
11024
+ ] });
11025
+ }
11026
+ },
11027
+ {
11028
+ accessorKey: "actions",
11029
+ header: "Actions",
11030
+ cell: ({ row }) => {
11031
+ const data2 = row.original;
11032
+ return /* @__PURE__ */ jsx72(
11033
+ Dropdown,
11034
+ {
11035
+ className: "cursor-pointer w-[150px]",
11036
+ items: items(data2),
11037
+ triggerMode: "hover",
11038
+ children: /* @__PURE__ */ jsx72(EllipsisVertical7, {})
11039
+ }
11040
+ );
11041
+ }
11042
+ }
11043
+ ].filter(Boolean);
11044
+ const packs = data?.data || [];
11045
+ const onDelete = async (id) => {
11046
+ try {
11047
+ await remove({ url: `/packs/delete/${id}` });
11048
+ message22.success("Pack deleted successfully");
11049
+ reload();
11050
+ setDeletePack(null);
11051
+ } catch (error) {
11052
+ message22.error(error.message || "Something went wrong");
11053
+ return error;
11054
+ }
11055
+ };
11056
+ return /* @__PURE__ */ jsxs55(Fragment17, { children: [
11057
+ /* @__PURE__ */ jsx72(Modal2, {}),
11058
+ /* @__PURE__ */ jsx72(
11059
+ ConfirmModal,
11060
+ {
11061
+ isOpen: !!deletePack,
11062
+ isLoading,
11063
+ onClose: () => setDeletePack(null),
11064
+ title: `Delete Pack`,
11065
+ description: `Are you sure you want to delete "${deletePack?.name}"? This action cannot be undone. and Please type "delete" to confirm.`,
11066
+ confirmationWord: "delete",
11067
+ onSubmit: () => onDelete(deletePack?._id),
11068
+ children: null
11069
+ }
11070
+ ),
11071
+ /* @__PURE__ */ jsx72(
11072
+ TransactionViewComponent,
11073
+ {
11074
+ columns,
11075
+ data: packs,
11076
+ title: `Packs`,
11077
+ description: `Add or update product packs`,
11078
+ index: true,
11079
+ createTitle: `Add Pack`,
11080
+ onCreate: () => {
11081
+ navigate("create");
11082
+ }
11083
+ }
11084
+ )
11085
+ ] });
11086
+ }
11087
+ var Packs_default = Packs;
11088
+
11089
+ // src/components/packs/schema.ts
11090
+ import { z as z9 } from "zod";
11091
+ var packProductItemSchema = z9.object({
11092
+ product: z9.string({ message: "Product ID is required" }),
11093
+ cost: z9.number().min(0, "Cost must be a positive number"),
11094
+ quantity: z9.number().min(1, "Quantity must be at least 1"),
11095
+ index: z9.number({ message: "Index is required" }),
11096
+ productData: z9.any().optional()
11097
+ });
11098
+ var packTypes = z9.enum(Enums_default.packTypes);
11099
+ var createPackSchema = z9.object({
11100
+ type: packTypes,
11101
+ name: z9.string().min(2, { message: "Name must be at least 2 characters" }),
11102
+ products: z9.array(packProductItemSchema).min(1, "At least one product is required"),
11103
+ branch: z9.string().optional(),
11104
+ tempProduct: z9.string().optional(),
11105
+ tempQty: z9.number().optional(),
11106
+ tempCost: z9.number().optional(),
11107
+ tempData: z9.record(z9.string(), z9.any()).optional()
11108
+ });
11109
+
11110
+ // src/components/packs/PackForm.tsx
11111
+ import { useForm as useForm13, useFieldArray } from "react-hook-form";
11112
+ import { zodResolver as zodResolver12 } from "@hookform/resolvers/zod";
11113
+ import { message as message23 } from "antd";
11114
+ import { useEffect as useEffect29 } from "react";
11115
+ import { useParams as useParams19 } from "react-router-dom";
11116
+ import { Plus as Plus3, Trash2 as Trash28 } from "lucide-react";
11117
+ import { jsx as jsx73, jsxs as jsxs56 } from "react/jsx-runtime";
11118
+ function PackForm() {
11119
+ const { branchId } = useParams19();
11120
+ const { getQuery, navigate } = useApp_default();
11121
+ const id = getQuery("id");
11122
+ const isEdit = !!id;
11123
+ const { post, put, isLoading } = useApis_default();
11124
+ const { isLoading: isLoadingGet, get } = useApis_default();
11125
+ const methods = useForm13({
11126
+ resolver: zodResolver12(createPackSchema),
11127
+ defaultValues: {
11128
+ name: "",
11129
+ type: "boxes",
11130
+ products: [],
11131
+ tempQty: 1,
11132
+ tempCost: 0
11133
+ },
11134
+ shouldUnregister: false
11135
+ });
11136
+ const currentProduct = methods.watch("tempData");
11137
+ const { handleSubmit, control, watch, setValue, getValues } = methods;
11138
+ const { fields, append, remove } = useFieldArray({
11139
+ control,
11140
+ name: "products"
11141
+ });
11142
+ const onAddProduct = () => {
11143
+ const val = getValues("tempProduct");
11144
+ const qty = getValues("tempQty") || 1;
11145
+ const cost = getValues("tempCost") || 0;
11146
+ if (val && currentProduct) {
11147
+ append({
11148
+ product: val,
11149
+ cost: Number(cost),
11150
+ quantity: Number(qty),
11151
+ index: fields.length,
11152
+ productData: currentProduct
11153
+ });
11154
+ setValue("tempProduct", "");
11155
+ setValue("tempQty", 1);
11156
+ setValue("tempCost", 0);
11157
+ } else {
11158
+ message23.warning("Please select a product first");
11159
+ }
11160
+ };
11161
+ const onSubmit = async (data) => {
11162
+ try {
11163
+ const formattedData = {
11164
+ ...data,
11165
+ products: data.products.map((p, i) => ({ ...p, index: i }))
11166
+ };
11167
+ if (isEdit) {
11168
+ await put({
11169
+ url: `/packs/update/${id}`,
11170
+ body: formattedData
11171
+ });
11172
+ } else {
11173
+ await post({
11174
+ url: "/packs/create",
11175
+ body: {
11176
+ ...formattedData,
11177
+ branch: branchId ? branchId : data.branch
11178
+ }
11179
+ });
11180
+ }
11181
+ message23.success(`Pack ${isEdit ? "updated" : "created"} successfully`);
11182
+ navigate(-1);
11183
+ } catch (error) {
11184
+ message23.error(error?.message || "Something went wrong");
11185
+ }
11186
+ };
11187
+ const fetches = async () => {
11188
+ try {
11189
+ const res = await get({
11190
+ url: `/packs/get?id=${id}${branchId ? `&branch=${branchId}` : ""}`
11191
+ });
11192
+ const data = res.data;
11193
+ data.products = data.products.map((p, index) => ({
11194
+ ...p,
11195
+ tempData: p?.productData,
11196
+ index
11197
+ }));
11198
+ methods.reset(data);
11199
+ } catch (error) {
11200
+ message23.error(error?.message || "Something went wrong");
11201
+ }
11202
+ };
11203
+ useEffect29(() => {
11204
+ if (isEdit) {
11205
+ fetches();
11206
+ }
11207
+ }, [id]);
11208
+ useEffect29(() => {
11209
+ if (currentProduct) {
11210
+ setValue("tempCost", currentProduct.cost || 0);
11211
+ }
11212
+ }, [currentProduct]);
11213
+ return /* @__PURE__ */ jsxs56(
11214
+ Card,
11215
+ {
11216
+ className: "max-w-5xl mx-auto mt-10 relative",
11217
+ isLoading: isLoadingGet,
11218
+ loadingText: "Processing...",
11219
+ children: [
11220
+ /* @__PURE__ */ jsxs56(Card.Header, { children: [
11221
+ /* @__PURE__ */ jsx73(Card.Title, { children: `${isEdit ? "Edit" : "Add"} Pack` }),
11222
+ /* @__PURE__ */ jsx73(Card.Description, { children: isEdit ? `Update the details for this product pack` : `Create a new product pack and define its components` })
11223
+ ] }),
11224
+ /* @__PURE__ */ jsx73(Card.Content, { children: /* @__PURE__ */ jsxs56(
11225
+ "form",
11226
+ {
11227
+ onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
11228
+ children: [
11229
+ /* @__PURE__ */ jsxs56("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 mb-8", children: [
11230
+ /* @__PURE__ */ jsx73(
11231
+ Fields_default.Input,
11232
+ {
11233
+ label: "Pack Name",
11234
+ form: methods,
11235
+ name: "name",
11236
+ type: "text",
11237
+ placeholder: "e.g. Family Box A",
11238
+ required: true
11239
+ }
11240
+ ),
11241
+ /* @__PURE__ */ jsx73(
11242
+ Fields_default.Select,
11243
+ {
11244
+ label: "Pack Type",
11245
+ form: methods,
11246
+ name: "type",
11247
+ enumName: "packTypes",
11248
+ required: true
11249
+ }
11250
+ ),
11251
+ !branchId && /* @__PURE__ */ jsx73(
11252
+ Feilds_default.Branches,
11253
+ {
11254
+ label: "Branch",
11255
+ form: methods,
11256
+ name: "branch",
11257
+ placeholder: "Select Branch",
11258
+ api: "/branches/get?noStore=true"
11259
+ }
11260
+ )
11261
+ ] }),
11262
+ /* @__PURE__ */ jsxs56("div", { className: "border rounded-lg p-4 bg-gray-50/50 dark:bg-gray-800/20", children: [
11263
+ /* @__PURE__ */ jsx73("h3", { className: "text-lg font-semibold mb-4", children: "Products in Pack" }),
11264
+ /* @__PURE__ */ jsx73("div", { className: "mb-6 bg-white dark:bg-gray-900 p-4 rounded-lg border shadow-sm", children: /* @__PURE__ */ jsxs56("div", { className: "grid grid-cols-12 gap-3 items-end", children: [
11265
+ /* @__PURE__ */ jsx73("div", { className: "col-span-12 sm:col-span-5", children: /* @__PURE__ */ jsx73(
11266
+ Feilds_default5.Product,
11267
+ {
11268
+ label: "Find Product",
11269
+ form: methods,
11270
+ name: "tempProduct",
11271
+ api: "/products/get",
11272
+ obj: "tempData"
11273
+ }
11274
+ ) }),
11275
+ /* @__PURE__ */ jsx73("div", { className: "col-span-4 sm:col-span-2", children: /* @__PURE__ */ jsx73(
11276
+ Fields_default.Input,
11277
+ {
11278
+ label: "Qty",
11279
+ form: methods,
11280
+ name: "tempQty",
11281
+ type: "number",
11282
+ placeholder: "1"
11283
+ }
11284
+ ) }),
11285
+ /* @__PURE__ */ jsx73("div", { className: "col-span-5 sm:col-span-3", children: /* @__PURE__ */ jsx73(
11286
+ Fields_default.Input,
11287
+ {
11288
+ label: "Cost",
11289
+ form: methods,
11290
+ name: "tempCost",
11291
+ type: "number",
11292
+ placeholder: "0.00"
11293
+ }
11294
+ ) }),
11295
+ /* @__PURE__ */ jsx73("div", { className: "col-span-3 sm:col-span-2", children: /* @__PURE__ */ jsx73(
11296
+ Button,
11297
+ {
11298
+ type: "button",
11299
+ onClick: onAddProduct,
11300
+ className: "w-full h-[40px]",
11301
+ icon: /* @__PURE__ */ jsx73(Plus3, { size: 16 }),
11302
+ children: "Add"
11303
+ }
11304
+ ) })
11305
+ ] }) }),
11306
+ /* @__PURE__ */ jsx73("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs56("table", { className: "w-full text-left border-collapse", children: [
11307
+ /* @__PURE__ */ jsx73("thead", { className: "bg-gray-100 dark:bg-gray-800/50", children: /* @__PURE__ */ jsxs56("tr", { children: [
11308
+ /* @__PURE__ */ jsx73("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500", children: "Product" }),
11309
+ /* @__PURE__ */ jsx73("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-24", children: "Qty" }),
11310
+ /* @__PURE__ */ jsx73("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-32", children: "Cost" }),
11311
+ /* @__PURE__ */ jsx73("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-32", children: "Line Total" }),
11312
+ /* @__PURE__ */ jsx73("th", { className: "px-3 py-2 text-xs font-bold uppercase text-gray-500 w-16 text-center", children: "Action" })
11313
+ ] }) }),
11314
+ /* @__PURE__ */ jsxs56("tbody", { className: "divide-y divide-gray-100 dark:divide-gray-800 bg-white dark:bg-gray-900", children: [
11315
+ fields.map((field, index) => /* @__PURE__ */ jsxs56(
11316
+ "tr",
11317
+ {
11318
+ className: "hover:bg-gray-50/50 dark:hover:bg-gray-800/50 transition-colors",
11319
+ children: [
11320
+ /* @__PURE__ */ jsxs56("td", { className: "px-3 py-2", children: [
11321
+ /* @__PURE__ */ jsx73("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: field.productData?.name || "Product" }),
11322
+ field.productData?.sku && /* @__PURE__ */ jsxs56("p", { className: "text-[10px] text-gray-500", children: [
11323
+ "SKU: ",
11324
+ field.productData?.sku
11325
+ ] })
11326
+ ] }),
11327
+ /* @__PURE__ */ jsx73("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx73(
11328
+ Fields_default.Input,
11329
+ {
11330
+ form: methods,
11331
+ name: `products.${index}.quantity`,
11332
+ type: "number",
11333
+ placeholder: "1",
11334
+ required: true,
11335
+ className: "h-8 py-1!"
11336
+ }
11337
+ ) }),
11338
+ /* @__PURE__ */ jsx73("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx73(
11339
+ Fields_default.Input,
11340
+ {
11341
+ form: methods,
11342
+ name: `products.${index}.cost`,
11343
+ type: "number",
11344
+ placeholder: "0.00",
11345
+ required: true,
11346
+ className: "h-8 py-1!"
11347
+ }
11348
+ ) }),
11349
+ /* @__PURE__ */ jsx73("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx73("span", { className: "text-sm font-semibold", children: ((Number(watch(`products.${index}.quantity`)) || 0) * (Number(watch(`products.${index}.cost`)) || 0)).toLocaleString() }) }),
11350
+ /* @__PURE__ */ jsx73("td", { className: "px-3 py-2 text-center", children: /* @__PURE__ */ jsx73(
11351
+ Button,
11352
+ {
11353
+ type: "button",
11354
+ variant: "ghost",
11355
+ size: "sm",
11356
+ className: "text-red-500 hover:text-red-700 hover:bg-red-50 p-1 h-8 w-8",
11357
+ onClick: () => remove(index),
11358
+ children: /* @__PURE__ */ jsx73(Trash28, { size: 16 })
11359
+ }
11360
+ ) })
11361
+ ]
11362
+ },
11363
+ field.id
11364
+ )),
11365
+ fields.length === 0 && /* @__PURE__ */ jsx73("tr", { children: /* @__PURE__ */ jsx73("td", { colSpan: 5, className: "text-center py-10", children: /* @__PURE__ */ jsx73("p", { className: "text-sm text-gray-500", children: "No products added yet. Use the search above to add products." }) }) })
11366
+ ] })
11367
+ ] }) }),
11368
+ /* @__PURE__ */ jsxs56("div", { className: "mt-6 pt-6 border-t grid grid-cols-1 sm:grid-cols-3 gap-3", children: [
11369
+ /* @__PURE__ */ jsxs56("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
11370
+ /* @__PURE__ */ jsx73("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Lines" }),
11371
+ /* @__PURE__ */ jsx73("p", { className: "text-lg font-bold text-blue-600", children: watch("products")?.length || 0 })
11372
+ ] }),
11373
+ /* @__PURE__ */ jsxs56("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
11374
+ /* @__PURE__ */ jsx73("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Quantity" }),
11375
+ /* @__PURE__ */ jsx73("p", { className: "text-lg font-bold text-indigo-600", children: watch("products")?.reduce(
11376
+ (acc, curr) => acc + (Number(curr.quantity) || 0),
11377
+ 0
11378
+ ) })
11379
+ ] }),
11380
+ /* @__PURE__ */ jsxs56("div", { className: "bg-white dark:bg-gray-900 p-3 rounded-lg border shadow-sm", children: [
11381
+ /* @__PURE__ */ jsx73("p", { className: "text-[10px] text-gray-500 uppercase font-bold mb-0.5", children: "Total Cost" }),
11382
+ /* @__PURE__ */ jsxs56("p", { className: "text-lg font-bold text-emerald-600", children: [
11383
+ watch("products")?.reduce(
11384
+ (acc, curr) => acc + (Number(curr.quantity) || 0) * (Number(curr.cost) || 0),
11385
+ 0
11386
+ ).toLocaleString(),
11387
+ " ",
11388
+ /* @__PURE__ */ jsx73("span", { className: "text-[10px] font-normal text-gray-400", children: "USD" })
11389
+ ] })
11390
+ ] })
11391
+ ] })
11392
+ ] }),
11393
+ /* @__PURE__ */ jsx73("footer", { className: "flex justify-end mt-8", children: /* @__PURE__ */ jsx73(
11394
+ Button,
11395
+ {
11396
+ isLoading,
11397
+ disabled: isLoading,
11398
+ type: "submit",
11399
+ className: "min-w-[120px]",
11400
+ variant: !isEdit ? "primary" : "warning",
11401
+ children: isEdit ? "Update Pack" : "Create Pack"
11402
+ }
11403
+ ) })
11404
+ ]
11405
+ }
11406
+ ) })
11407
+ ]
11408
+ }
11409
+ );
11410
+ }
11411
+ var PackForm_default = PackForm;
11412
+
11413
+ // src/components/packs/Feilds/Pack.tsx
11414
+ import { jsx as jsx74 } from "react/jsx-runtime";
11415
+ function Pack({
11416
+ name,
11417
+ label,
11418
+ placeholder = "Select Pack",
11419
+ api,
11420
+ form,
11421
+ filter,
11422
+ v,
11423
+ required,
11424
+ disabled
11425
+ }) {
11426
+ return /* @__PURE__ */ jsx74(
11427
+ Fields_default.SearchApi,
11428
+ {
11429
+ label,
11430
+ form,
11431
+ name,
11432
+ api,
11433
+ placeholder,
11434
+ queryKey: "name",
11435
+ labelKey: "name",
11436
+ valueKey: "_id",
11437
+ filter,
11438
+ v,
11439
+ required,
11440
+ disabled
11441
+ }
11442
+ );
11443
+ }
11444
+ var Pack_default = { Pack };
11445
+
10095
11446
  // src/components/ErrorPage/ErrorPage.tsx
10096
- import { jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
11447
+ import { jsx as jsx75, jsxs as jsxs57 } from "react/jsx-runtime";
10097
11448
  var ErrorPageBase = ({
10098
11449
  title,
10099
- message: message16,
11450
+ message: message24,
10100
11451
  statusCode,
10101
11452
  action,
10102
11453
  className = ""
10103
11454
  }) => {
10104
- return /* @__PURE__ */ jsx63(
11455
+ return /* @__PURE__ */ jsx75(
10105
11456
  "div",
10106
11457
  {
10107
11458
  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}`,
10108
- children: /* @__PURE__ */ jsxs49("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
10109
- 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 }) }),
10110
- /* @__PURE__ */ jsxs49("div", { className: "relative z-10 space-y-6", children: [
10111
- statusCode && /* @__PURE__ */ jsxs49("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
11459
+ children: /* @__PURE__ */ jsxs57("div", { className: "relative flex flex-col items-center justify-center w-full max-w-2xl text-center", children: [
11460
+ statusCode && /* @__PURE__ */ jsx75("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__ */ jsx75("span", { className: "text-[12rem] sm:text-[16rem] md:text-[20rem] font-bold leading-none tracking-tighter", children: statusCode }) }),
11461
+ /* @__PURE__ */ jsxs57("div", { className: "relative z-10 space-y-6", children: [
11462
+ statusCode && /* @__PURE__ */ jsxs57("h2", { className: "text-xl md:text-2xl font-semibold text-zinc-500 dark:text-zinc-400", children: [
10112
11463
  "Error ",
10113
11464
  statusCode
10114
11465
  ] }),
10115
- title && /* @__PURE__ */ jsx63("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
10116
- message16 && /* @__PURE__ */ jsx63("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message16 }),
10117
- action && /* @__PURE__ */ jsx63("div", { className: "pt-8", children: /* @__PURE__ */ jsx63(
11466
+ title && /* @__PURE__ */ jsx75("h1", { className: "text-4xl md:text-5xl font-extrabold tracking-tight drop-shadow-sm", children: title }),
11467
+ message24 && /* @__PURE__ */ jsx75("p", { className: "text-lg md:text-xl text-zinc-600 dark:text-zinc-400 max-w-md mx-auto", children: message24 }),
11468
+ action && /* @__PURE__ */ jsx75("div", { className: "pt-8", children: /* @__PURE__ */ jsx75(
10118
11469
  "button",
10119
11470
  {
10120
11471
  onClick: action.onClick,
@@ -10130,9 +11481,9 @@ var ErrorPageBase = ({
10130
11481
  };
10131
11482
 
10132
11483
  // src/components/ErrorPage/ErrorPage.500.tsx
10133
- import { jsx as jsx64 } from "react/jsx-runtime";
11484
+ import { jsx as jsx76 } from "react/jsx-runtime";
10134
11485
  var ErrorPage500 = (props) => {
10135
- return /* @__PURE__ */ jsx64(
11486
+ return /* @__PURE__ */ jsx76(
10136
11487
  ErrorPageBase,
10137
11488
  {
10138
11489
  statusCode: 500,
@@ -10145,9 +11496,9 @@ var ErrorPage500 = (props) => {
10145
11496
  };
10146
11497
 
10147
11498
  // src/components/ErrorPage/ErrorPage.404.tsx
10148
- import { jsx as jsx65 } from "react/jsx-runtime";
11499
+ import { jsx as jsx77 } from "react/jsx-runtime";
10149
11500
  var ErrorPage404 = (props) => {
10150
- return /* @__PURE__ */ jsx65(
11501
+ return /* @__PURE__ */ jsx77(
10151
11502
  ErrorPageBase,
10152
11503
  {
10153
11504
  statusCode: 404,
@@ -10160,9 +11511,9 @@ var ErrorPage404 = (props) => {
10160
11511
  };
10161
11512
 
10162
11513
  // src/components/ErrorPage/ErrorPage.401.tsx
10163
- import { jsx as jsx66 } from "react/jsx-runtime";
11514
+ import { jsx as jsx78 } from "react/jsx-runtime";
10164
11515
  var ErrorPage401 = (props) => {
10165
- return /* @__PURE__ */ jsx66(
11516
+ return /* @__PURE__ */ jsx78(
10166
11517
  ErrorPageBase,
10167
11518
  {
10168
11519
  statusCode: 401,
@@ -10175,9 +11526,9 @@ var ErrorPage401 = (props) => {
10175
11526
  };
10176
11527
 
10177
11528
  // src/components/ErrorPage/ErrorPage.400.tsx
10178
- import { jsx as jsx67 } from "react/jsx-runtime";
11529
+ import { jsx as jsx79 } from "react/jsx-runtime";
10179
11530
  var ErrorPage400 = (props) => {
10180
- return /* @__PURE__ */ jsx67(
11531
+ return /* @__PURE__ */ jsx79(
10181
11532
  ErrorPageBase,
10182
11533
  {
10183
11534
  statusCode: 400,
@@ -10202,7 +11553,10 @@ export {
10202
11553
  Accounts_default as Accounts,
10203
11554
  AdminProtectedRoute,
10204
11555
  Badge,
11556
+ Feilds_default3 as BrandField,
11557
+ BrandForm_default as BrandForm,
10205
11558
  Branding,
11559
+ Brands_default as Brands,
10206
11560
  Breadcrumbs,
10207
11561
  Button,
10208
11562
  Card,
@@ -10211,7 +11565,10 @@ export {
10211
11565
  CardFooter,
10212
11566
  CardHeader,
10213
11567
  CardTitle,
11568
+ Categories_default as Categories,
10214
11569
  CategoryCard,
11570
+ Feilds_default4 as CategoryField,
11571
+ CategoryForm_default as CategoryForm,
10215
11572
  ClassicSpin,
10216
11573
  CodeBlock,
10217
11574
  ConfirmModal,
@@ -10229,10 +11586,16 @@ export {
10229
11586
  LoadingSpin,
10230
11587
  Modal,
10231
11588
  OverlaySpin,
11589
+ Pack_default as PackField,
11590
+ PackForm_default as PackForm,
11591
+ Packs_default as Packs,
10232
11592
  PageA4,
10233
11593
  PageHeader,
10234
11594
  PhoneInput,
10235
11595
  PostTable,
11596
+ Feilds_default5 as ProductField,
11597
+ ProductForm_default as ProductForm,
11598
+ Products_default as Products,
10236
11599
  ProfileCard,
10237
11600
  ProfileDropdown,
10238
11601
  ProfilePage_default as ProfilePage,
@@ -10263,10 +11626,16 @@ export {
10263
11626
  Wallets_default as Wallets,
10264
11627
  WarqadProvider,
10265
11628
  createAccountSchema,
11629
+ createBrandSchema,
11630
+ createCategorySchema,
11631
+ createPackSchema,
11632
+ createProductSchema,
10266
11633
  createUserSchema,
10267
11634
  createWalletSchema,
10268
11635
  generatePdf,
10269
11636
  linkUserSchema,
11637
+ packProductItemSchema,
11638
+ packTypes,
10270
11639
  resetPasswordSchema,
10271
11640
  storage,
10272
11641
  updateUserEmailSchema,