warqadui 0.0.295 → 0.0.297

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2607,11 +2607,17 @@ declare function ProductList$1({ v, url, deleteUrl, updateImageUrl, updateGaller
2607
2607
  deleteImageUrl?: string;
2608
2608
  }): react_jsx_runtime.JSX.Element;
2609
2609
 
2610
- declare function ProductForm({ v, getUrl, createUrl, updateUrl, }: {
2610
+ declare function ProductForm({ v, getUrl, createUrl, updateUrl, categoryApi, categoryUrl, subCategoryApi, subCategoryUrl, brandApi, brandUrl, }: {
2611
2611
  v?: 1 | 2 | 3;
2612
2612
  getUrl?: string;
2613
2613
  createUrl?: string;
2614
2614
  updateUrl?: string;
2615
+ categoryApi?: string;
2616
+ categoryUrl?: string;
2617
+ subCategoryApi?: string;
2618
+ subCategoryUrl?: string;
2619
+ brandApi?: string;
2620
+ brandUrl?: string;
2615
2621
  }): react_jsx_runtime.JSX.Element;
2616
2622
 
2617
2623
  declare function CategoryList({ v, url }: {
package/dist/index.d.ts CHANGED
@@ -2607,11 +2607,17 @@ declare function ProductList$1({ v, url, deleteUrl, updateImageUrl, updateGaller
2607
2607
  deleteImageUrl?: string;
2608
2608
  }): react_jsx_runtime.JSX.Element;
2609
2609
 
2610
- declare function ProductForm({ v, getUrl, createUrl, updateUrl, }: {
2610
+ declare function ProductForm({ v, getUrl, createUrl, updateUrl, categoryApi, categoryUrl, subCategoryApi, subCategoryUrl, brandApi, brandUrl, }: {
2611
2611
  v?: 1 | 2 | 3;
2612
2612
  getUrl?: string;
2613
2613
  createUrl?: string;
2614
2614
  updateUrl?: string;
2615
+ categoryApi?: string;
2616
+ categoryUrl?: string;
2617
+ subCategoryApi?: string;
2618
+ subCategoryUrl?: string;
2619
+ brandApi?: string;
2620
+ brandUrl?: string;
2615
2621
  }): react_jsx_runtime.JSX.Element;
2616
2622
 
2617
2623
  declare function CategoryList({ v, url }: {
package/dist/index.js CHANGED
@@ -20172,7 +20172,7 @@ function Products({ v, url }) {
20172
20172
  const columns = [
20173
20173
  {
20174
20174
  id: "name",
20175
- accessorFn: (row) => row.name || `${row.code || ""} ${row.desc || ""}`,
20175
+ accessorFn: (row) => row.name || "N/A",
20176
20176
  header: "Name",
20177
20177
  cell: ({ row }) => {
20178
20178
  const product = row.original;
@@ -41191,7 +41191,7 @@ function ProductList({
41191
41191
  const columns = [
41192
41192
  {
41193
41193
  id: "name",
41194
- accessorFn: (row) => row.name || `${row.code || ""} ${row.desc || ""}`,
41194
+ accessorFn: (row) => row.name || "N/A",
41195
41195
  header: "Name",
41196
41196
  cell: ({ row }) => {
41197
41197
  const product = row.original;
@@ -41290,7 +41290,7 @@ function ProductList({
41290
41290
  isLoading,
41291
41291
  onClose: () => setDeleteProduct(null),
41292
41292
  title: `Delete Product`,
41293
- description: `Are you sure you want to delete "${deleteProduct?.name || `${deleteProduct?.code} ${deleteProduct?.desc}`}"? This action cannot be undone. and Please type "delete" to confirm.`,
41293
+ description: `Are you sure you want to delete "${deleteProduct?.name || "this product"}"? This action cannot be undone. and Please type "delete" to confirm.`,
41294
41294
  confirmationWord: "delete",
41295
41295
  onSubmit: () => onDelete(deleteProduct?._id),
41296
41296
  children: null
@@ -41326,8 +41326,6 @@ var import_lucide_react113 = require("lucide-react");
41326
41326
  // src/dgl/products/schema.ts
41327
41327
  var import_zod95 = require("zod");
41328
41328
  var createProductSchema2 = import_zod95.z.object({
41329
- code: import_zod95.z.string().min(1, "Code is required").trim().toLowerCase(),
41330
- desc: import_zod95.z.string().min(1, "Description is required").trim(),
41331
41329
  cost: import_zod95.z.coerce.number().min(0.01, "Cost must be greater than 0"),
41332
41330
  wholeSale: import_zod95.z.coerce.number().min(0, "Wholesale price must be positive").optional().nullable(),
41333
41331
  name: import_zod95.z.string().min(1, "Name is required").trim().toLowerCase(),
@@ -41364,9 +41362,18 @@ function ProductForm2({
41364
41362
  v,
41365
41363
  getUrl,
41366
41364
  createUrl,
41367
- updateUrl
41365
+ updateUrl,
41366
+ categoryApi,
41367
+ categoryUrl,
41368
+ subCategoryApi,
41369
+ subCategoryUrl,
41370
+ brandApi,
41371
+ brandUrl
41368
41372
  }) {
41369
41373
  const { getQuery, navigate } = useApp_default();
41374
+ const catApi = categoryApi || categoryUrl || "/inventory/categories/get";
41375
+ const subCatBaseApi = subCategoryApi || subCategoryUrl || "/inventory/sub-categories/get";
41376
+ const bApi = brandApi || brandUrl || "/inventory/brands/get";
41370
41377
  const id = getQuery("id");
41371
41378
  const isEdit = !!id;
41372
41379
  const {
@@ -41381,8 +41388,6 @@ function ProductForm2({
41381
41388
  const methods = (0, import_react_hook_form58.useForm)({
41382
41389
  resolver: (0, import_zod96.zodResolver)(createProductSchema2),
41383
41390
  defaultValues: {
41384
- code: "",
41385
- desc: "",
41386
41391
  cost: 0,
41387
41392
  wholeSale: null,
41388
41393
  name: "",
@@ -41550,28 +41555,6 @@ function ProductForm2({
41550
41555
  /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "space-y-4", children: [
41551
41556
  /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("h3", { className: "text-base font-semibold text-gray-800 dark:text-zinc-200 border-b border-gray-150 dark:border-zinc-800 pb-2", children: "Basic Information" }),
41552
41557
  /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
41553
- /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
41554
- Fields_default.Input,
41555
- {
41556
- label: "Code",
41557
- form: methods,
41558
- name: "code",
41559
- type: "text",
41560
- placeholder: "Enter product code",
41561
- required: true
41562
- }
41563
- ),
41564
- /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
41565
- Fields_default.Input,
41566
- {
41567
- label: "Description (Short)",
41568
- form: methods,
41569
- name: "desc",
41570
- type: "text",
41571
- placeholder: "Enter short description",
41572
- required: true
41573
- }
41574
- ),
41575
41558
  /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
41576
41559
  Fields_default.Input,
41577
41560
  {
@@ -41636,8 +41619,8 @@ function ProductForm2({
41636
41619
  form: methods,
41637
41620
  name: "category",
41638
41621
  obj: "categoryData",
41639
- api: "/inventory/categories/get",
41640
- v: 3,
41622
+ api: catApi,
41623
+ v,
41641
41624
  label: "Category",
41642
41625
  placeholder: "Select Category"
41643
41626
  }
@@ -41648,21 +41631,21 @@ function ProductForm2({
41648
41631
  form: methods,
41649
41632
  name: "subCategory",
41650
41633
  obj: "subCategoryData",
41651
- api: selectedCategory ? `/inventory/sub-categories/get?category=${selectedCategory}` : "/inventory/sub-categories/get",
41652
- v: 3,
41634
+ api: selectedCategory ? `${subCatBaseApi}${subCatBaseApi.includes("?") ? "&" : "?"}category=${selectedCategory}` : subCatBaseApi,
41635
+ v,
41653
41636
  label: "SubCategory",
41654
41637
  placeholder: "Select SubCategory",
41655
41638
  disabled: !selectedCategory
41656
41639
  }
41657
41640
  ),
41658
- /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
41641
+ brandApi && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
41659
41642
  Fields_default.SearchApi,
41660
41643
  {
41661
41644
  form: methods,
41662
41645
  name: "brand",
41663
41646
  obj: "brandData",
41664
- api: "/inventory/brands/get",
41665
- v: 3,
41647
+ api: bApi,
41648
+ v,
41666
41649
  label: "Brand",
41667
41650
  placeholder: "Select Brand"
41668
41651
  }
@@ -41707,10 +41690,10 @@ function ProductForm2({
41707
41690
  /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { className: "py-2", children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
41708
41691
  Fields_default.Textarea,
41709
41692
  {
41710
- label: "Description (Long)",
41693
+ label: "Description",
41711
41694
  form: methods,
41712
41695
  name: "description",
41713
- placeholder: "Enter long description",
41696
+ placeholder: "Enter description",
41714
41697
  rows: 3
41715
41698
  }
41716
41699
  ) })
package/dist/index.mjs CHANGED
@@ -20258,7 +20258,7 @@ function Products({ v, url }) {
20258
20258
  const columns = [
20259
20259
  {
20260
20260
  id: "name",
20261
- accessorFn: (row) => row.name || `${row.code || ""} ${row.desc || ""}`,
20261
+ accessorFn: (row) => row.name || "N/A",
20262
20262
  header: "Name",
20263
20263
  cell: ({ row }) => {
20264
20264
  const product = row.original;
@@ -41387,7 +41387,7 @@ function ProductList({
41387
41387
  const columns = [
41388
41388
  {
41389
41389
  id: "name",
41390
- accessorFn: (row) => row.name || `${row.code || ""} ${row.desc || ""}`,
41390
+ accessorFn: (row) => row.name || "N/A",
41391
41391
  header: "Name",
41392
41392
  cell: ({ row }) => {
41393
41393
  const product = row.original;
@@ -41486,7 +41486,7 @@ function ProductList({
41486
41486
  isLoading,
41487
41487
  onClose: () => setDeleteProduct(null),
41488
41488
  title: `Delete Product`,
41489
- description: `Are you sure you want to delete "${deleteProduct?.name || `${deleteProduct?.code} ${deleteProduct?.desc}`}"? This action cannot be undone. and Please type "delete" to confirm.`,
41489
+ description: `Are you sure you want to delete "${deleteProduct?.name || "this product"}"? This action cannot be undone. and Please type "delete" to confirm.`,
41490
41490
  confirmationWord: "delete",
41491
41491
  onSubmit: () => onDelete(deleteProduct?._id),
41492
41492
  children: null
@@ -41522,8 +41522,6 @@ import { UploadCloud as UploadCloud3, X as X9 } from "lucide-react";
41522
41522
  // src/dgl/products/schema.ts
41523
41523
  import { z as z38 } from "zod";
41524
41524
  var createProductSchema2 = z38.object({
41525
- code: z38.string().min(1, "Code is required").trim().toLowerCase(),
41526
- desc: z38.string().min(1, "Description is required").trim(),
41527
41525
  cost: z38.coerce.number().min(0.01, "Cost must be greater than 0"),
41528
41526
  wholeSale: z38.coerce.number().min(0, "Wholesale price must be positive").optional().nullable(),
41529
41527
  name: z38.string().min(1, "Name is required").trim().toLowerCase(),
@@ -41560,9 +41558,18 @@ function ProductForm2({
41560
41558
  v,
41561
41559
  getUrl,
41562
41560
  createUrl,
41563
- updateUrl
41561
+ updateUrl,
41562
+ categoryApi,
41563
+ categoryUrl,
41564
+ subCategoryApi,
41565
+ subCategoryUrl,
41566
+ brandApi,
41567
+ brandUrl
41564
41568
  }) {
41565
41569
  const { getQuery, navigate } = useApp_default();
41570
+ const catApi = categoryApi || categoryUrl || "/inventory/categories/get";
41571
+ const subCatBaseApi = subCategoryApi || subCategoryUrl || "/inventory/sub-categories/get";
41572
+ const bApi = brandApi || brandUrl || "/inventory/brands/get";
41566
41573
  const id = getQuery("id");
41567
41574
  const isEdit = !!id;
41568
41575
  const {
@@ -41577,8 +41584,6 @@ function ProductForm2({
41577
41584
  const methods = useForm45({
41578
41585
  resolver: zodResolver44(createProductSchema2),
41579
41586
  defaultValues: {
41580
- code: "",
41581
- desc: "",
41582
41587
  cost: 0,
41583
41588
  wholeSale: null,
41584
41589
  name: "",
@@ -41746,28 +41751,6 @@ function ProductForm2({
41746
41751
  /* @__PURE__ */ jsxs202("div", { className: "space-y-4", children: [
41747
41752
  /* @__PURE__ */ jsx233("h3", { className: "text-base font-semibold text-gray-800 dark:text-zinc-200 border-b border-gray-150 dark:border-zinc-800 pb-2", children: "Basic Information" }),
41748
41753
  /* @__PURE__ */ jsxs202("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
41749
- /* @__PURE__ */ jsx233(
41750
- Fields_default.Input,
41751
- {
41752
- label: "Code",
41753
- form: methods,
41754
- name: "code",
41755
- type: "text",
41756
- placeholder: "Enter product code",
41757
- required: true
41758
- }
41759
- ),
41760
- /* @__PURE__ */ jsx233(
41761
- Fields_default.Input,
41762
- {
41763
- label: "Description (Short)",
41764
- form: methods,
41765
- name: "desc",
41766
- type: "text",
41767
- placeholder: "Enter short description",
41768
- required: true
41769
- }
41770
- ),
41771
41754
  /* @__PURE__ */ jsx233(
41772
41755
  Fields_default.Input,
41773
41756
  {
@@ -41832,8 +41815,8 @@ function ProductForm2({
41832
41815
  form: methods,
41833
41816
  name: "category",
41834
41817
  obj: "categoryData",
41835
- api: "/inventory/categories/get",
41836
- v: 3,
41818
+ api: catApi,
41819
+ v,
41837
41820
  label: "Category",
41838
41821
  placeholder: "Select Category"
41839
41822
  }
@@ -41844,21 +41827,21 @@ function ProductForm2({
41844
41827
  form: methods,
41845
41828
  name: "subCategory",
41846
41829
  obj: "subCategoryData",
41847
- api: selectedCategory ? `/inventory/sub-categories/get?category=${selectedCategory}` : "/inventory/sub-categories/get",
41848
- v: 3,
41830
+ api: selectedCategory ? `${subCatBaseApi}${subCatBaseApi.includes("?") ? "&" : "?"}category=${selectedCategory}` : subCatBaseApi,
41831
+ v,
41849
41832
  label: "SubCategory",
41850
41833
  placeholder: "Select SubCategory",
41851
41834
  disabled: !selectedCategory
41852
41835
  }
41853
41836
  ),
41854
- /* @__PURE__ */ jsx233(
41837
+ brandApi && /* @__PURE__ */ jsx233(
41855
41838
  Fields_default.SearchApi,
41856
41839
  {
41857
41840
  form: methods,
41858
41841
  name: "brand",
41859
41842
  obj: "brandData",
41860
- api: "/inventory/brands/get",
41861
- v: 3,
41843
+ api: bApi,
41844
+ v,
41862
41845
  label: "Brand",
41863
41846
  placeholder: "Select Brand"
41864
41847
  }
@@ -41903,10 +41886,10 @@ function ProductForm2({
41903
41886
  /* @__PURE__ */ jsx233("div", { className: "py-2", children: /* @__PURE__ */ jsx233(
41904
41887
  Fields_default.Textarea,
41905
41888
  {
41906
- label: "Description (Long)",
41889
+ label: "Description",
41907
41890
  form: methods,
41908
41891
  name: "description",
41909
- placeholder: "Enter long description",
41892
+ placeholder: "Enter description",
41910
41893
  rows: 3
41911
41894
  }
41912
41895
  ) })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.295",
3
+ "version": "0.0.297",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",