warqadui 0.0.93 → 0.0.94
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 +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/index.js +52 -133
- package/dist/index.mjs +50 -131
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1445,13 +1445,10 @@ declare const BrandField: {
|
|
|
1445
1445
|
|
|
1446
1446
|
declare const createBrandSchema: z$1.ZodObject<{
|
|
1447
1447
|
name: z$1.ZodString;
|
|
1448
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1449
1448
|
}, "strip", z$1.ZodTypeAny, {
|
|
1450
1449
|
name: string;
|
|
1451
|
-
branch?: string | undefined;
|
|
1452
1450
|
}, {
|
|
1453
1451
|
name: string;
|
|
1454
|
-
branch?: string | undefined;
|
|
1455
1452
|
}>;
|
|
1456
1453
|
type CreateBrandSchemaType = z$1.infer<typeof createBrandSchema>;
|
|
1457
1454
|
|
|
@@ -1481,13 +1478,10 @@ declare const CategoryField: {
|
|
|
1481
1478
|
|
|
1482
1479
|
declare const createCategorySchema: z$1.ZodObject<{
|
|
1483
1480
|
name: z$1.ZodString;
|
|
1484
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1485
1481
|
}, "strip", z$1.ZodTypeAny, {
|
|
1486
1482
|
name: string;
|
|
1487
|
-
branch?: string | undefined;
|
|
1488
1483
|
}, {
|
|
1489
1484
|
name: string;
|
|
1490
|
-
branch?: string | undefined;
|
|
1491
1485
|
}>;
|
|
1492
1486
|
type CreateCategorySchemaType = z$1.infer<typeof createCategorySchema>;
|
|
1493
1487
|
|
|
@@ -1522,17 +1516,14 @@ declare const createProductSchema: z$1.ZodObject<{
|
|
|
1522
1516
|
category: z$1.ZodOptional<z$1.ZodString>;
|
|
1523
1517
|
brand: z$1.ZodOptional<z$1.ZodString>;
|
|
1524
1518
|
cost: z$1.ZodNumber;
|
|
1525
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1526
1519
|
}, "strip", z$1.ZodTypeAny, {
|
|
1527
1520
|
name: string;
|
|
1528
1521
|
cost: number;
|
|
1529
|
-
branch?: string | undefined;
|
|
1530
1522
|
category?: string | undefined;
|
|
1531
1523
|
brand?: string | undefined;
|
|
1532
1524
|
}, {
|
|
1533
1525
|
name: string;
|
|
1534
1526
|
cost: number;
|
|
1535
|
-
branch?: string | undefined;
|
|
1536
1527
|
category?: string | undefined;
|
|
1537
1528
|
brand?: string | undefined;
|
|
1538
1529
|
}>;
|
|
@@ -1603,7 +1594,6 @@ declare const createPackSchema: z$1.ZodObject<{
|
|
|
1603
1594
|
quantity: number;
|
|
1604
1595
|
productData?: any;
|
|
1605
1596
|
}>, "many">;
|
|
1606
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1607
1597
|
tempProduct: z$1.ZodOptional<z$1.ZodString>;
|
|
1608
1598
|
tempQty: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1609
1599
|
tempCost: z$1.ZodOptional<z$1.ZodNumber>;
|
|
@@ -1618,7 +1608,6 @@ declare const createPackSchema: z$1.ZodObject<{
|
|
|
1618
1608
|
quantity: number;
|
|
1619
1609
|
productData?: any;
|
|
1620
1610
|
}[];
|
|
1621
|
-
branch?: string | undefined;
|
|
1622
1611
|
tempProduct?: string | undefined;
|
|
1623
1612
|
tempQty?: number | undefined;
|
|
1624
1613
|
tempCost?: number | undefined;
|
|
@@ -1633,7 +1622,6 @@ declare const createPackSchema: z$1.ZodObject<{
|
|
|
1633
1622
|
quantity: number;
|
|
1634
1623
|
productData?: any;
|
|
1635
1624
|
}[];
|
|
1636
|
-
branch?: string | undefined;
|
|
1637
1625
|
tempProduct?: string | undefined;
|
|
1638
1626
|
tempQty?: number | undefined;
|
|
1639
1627
|
tempCost?: number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1445,13 +1445,10 @@ declare const BrandField: {
|
|
|
1445
1445
|
|
|
1446
1446
|
declare const createBrandSchema: z$1.ZodObject<{
|
|
1447
1447
|
name: z$1.ZodString;
|
|
1448
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1449
1448
|
}, "strip", z$1.ZodTypeAny, {
|
|
1450
1449
|
name: string;
|
|
1451
|
-
branch?: string | undefined;
|
|
1452
1450
|
}, {
|
|
1453
1451
|
name: string;
|
|
1454
|
-
branch?: string | undefined;
|
|
1455
1452
|
}>;
|
|
1456
1453
|
type CreateBrandSchemaType = z$1.infer<typeof createBrandSchema>;
|
|
1457
1454
|
|
|
@@ -1481,13 +1478,10 @@ declare const CategoryField: {
|
|
|
1481
1478
|
|
|
1482
1479
|
declare const createCategorySchema: z$1.ZodObject<{
|
|
1483
1480
|
name: z$1.ZodString;
|
|
1484
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1485
1481
|
}, "strip", z$1.ZodTypeAny, {
|
|
1486
1482
|
name: string;
|
|
1487
|
-
branch?: string | undefined;
|
|
1488
1483
|
}, {
|
|
1489
1484
|
name: string;
|
|
1490
|
-
branch?: string | undefined;
|
|
1491
1485
|
}>;
|
|
1492
1486
|
type CreateCategorySchemaType = z$1.infer<typeof createCategorySchema>;
|
|
1493
1487
|
|
|
@@ -1522,17 +1516,14 @@ declare const createProductSchema: z$1.ZodObject<{
|
|
|
1522
1516
|
category: z$1.ZodOptional<z$1.ZodString>;
|
|
1523
1517
|
brand: z$1.ZodOptional<z$1.ZodString>;
|
|
1524
1518
|
cost: z$1.ZodNumber;
|
|
1525
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1526
1519
|
}, "strip", z$1.ZodTypeAny, {
|
|
1527
1520
|
name: string;
|
|
1528
1521
|
cost: number;
|
|
1529
|
-
branch?: string | undefined;
|
|
1530
1522
|
category?: string | undefined;
|
|
1531
1523
|
brand?: string | undefined;
|
|
1532
1524
|
}, {
|
|
1533
1525
|
name: string;
|
|
1534
1526
|
cost: number;
|
|
1535
|
-
branch?: string | undefined;
|
|
1536
1527
|
category?: string | undefined;
|
|
1537
1528
|
brand?: string | undefined;
|
|
1538
1529
|
}>;
|
|
@@ -1603,7 +1594,6 @@ declare const createPackSchema: z$1.ZodObject<{
|
|
|
1603
1594
|
quantity: number;
|
|
1604
1595
|
productData?: any;
|
|
1605
1596
|
}>, "many">;
|
|
1606
|
-
branch: z$1.ZodOptional<z$1.ZodString>;
|
|
1607
1597
|
tempProduct: z$1.ZodOptional<z$1.ZodString>;
|
|
1608
1598
|
tempQty: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1609
1599
|
tempCost: z$1.ZodOptional<z$1.ZodNumber>;
|
|
@@ -1618,7 +1608,6 @@ declare const createPackSchema: z$1.ZodObject<{
|
|
|
1618
1608
|
quantity: number;
|
|
1619
1609
|
productData?: any;
|
|
1620
1610
|
}[];
|
|
1621
|
-
branch?: string | undefined;
|
|
1622
1611
|
tempProduct?: string | undefined;
|
|
1623
1612
|
tempQty?: number | undefined;
|
|
1624
1613
|
tempCost?: number | undefined;
|
|
@@ -1633,7 +1622,6 @@ declare const createPackSchema: z$1.ZodObject<{
|
|
|
1633
1622
|
quantity: number;
|
|
1634
1623
|
productData?: any;
|
|
1635
1624
|
}[];
|
|
1636
|
-
branch?: string | undefined;
|
|
1637
1625
|
tempProduct?: string | undefined;
|
|
1638
1626
|
tempQty?: number | undefined;
|
|
1639
1627
|
tempCost?: number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -10155,11 +10155,10 @@ var import_react45 = require("react");
|
|
|
10155
10155
|
var import_antd18 = require("antd");
|
|
10156
10156
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10157
10157
|
function Brands({ v, url }) {
|
|
10158
|
-
const { branchId } = (0, import_react_router_dom17.useParams)();
|
|
10159
10158
|
const [deleteBrand, setDeleteBrand] = (0, import_react45.useState)(null);
|
|
10160
10159
|
const { isLoading, remove } = useApis_default();
|
|
10161
10160
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10162
|
-
url: url || `/brands/get
|
|
10161
|
+
url: url || `/brands/get`,
|
|
10163
10162
|
v,
|
|
10164
10163
|
dateFilter: false
|
|
10165
10164
|
});
|
|
@@ -10251,8 +10250,7 @@ var Brands_default = Brands;
|
|
|
10251
10250
|
// src/components/brands/schema.ts
|
|
10252
10251
|
var import_zod12 = require("zod");
|
|
10253
10252
|
var createBrandSchema = import_zod12.z.object({
|
|
10254
|
-
name: import_zod12.z.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10255
|
-
branch: import_zod12.z.string().optional()
|
|
10253
|
+
name: import_zod12.z.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10256
10254
|
});
|
|
10257
10255
|
|
|
10258
10256
|
// src/components/brands/BrandForm.tsx
|
|
@@ -10260,10 +10258,8 @@ var import_react_hook_form16 = require("react-hook-form");
|
|
|
10260
10258
|
var import_zod13 = require("@hookform/resolvers/zod");
|
|
10261
10259
|
var import_antd19 = require("antd");
|
|
10262
10260
|
var import_react46 = require("react");
|
|
10263
|
-
var import_react_router_dom18 = require("react-router-dom");
|
|
10264
10261
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
10265
10262
|
function BrandForm() {
|
|
10266
|
-
const { branchId } = (0, import_react_router_dom18.useParams)();
|
|
10267
10263
|
const { getQuery, navigate } = useApp_default();
|
|
10268
10264
|
const id = getQuery("id");
|
|
10269
10265
|
const isEdit = !!id;
|
|
@@ -10282,18 +10278,12 @@ function BrandForm() {
|
|
|
10282
10278
|
if (isEdit) {
|
|
10283
10279
|
await put({
|
|
10284
10280
|
url: `/brands/update/${id}`,
|
|
10285
|
-
body:
|
|
10286
|
-
...data,
|
|
10287
|
-
branch: branchId ? branchId : data.branch
|
|
10288
|
-
}
|
|
10281
|
+
body: data
|
|
10289
10282
|
});
|
|
10290
10283
|
} else {
|
|
10291
10284
|
await post({
|
|
10292
10285
|
url: "/brands/create",
|
|
10293
|
-
body:
|
|
10294
|
-
...data,
|
|
10295
|
-
branch: branchId ? branchId : data.branch
|
|
10296
|
-
}
|
|
10286
|
+
body: data
|
|
10297
10287
|
});
|
|
10298
10288
|
}
|
|
10299
10289
|
import_antd19.message.success(`Brand ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -10305,7 +10295,7 @@ function BrandForm() {
|
|
|
10305
10295
|
const fetches = async () => {
|
|
10306
10296
|
try {
|
|
10307
10297
|
const res = await get({
|
|
10308
|
-
url: `/brands/get?id=${id}
|
|
10298
|
+
url: `/brands/get?id=${id}`
|
|
10309
10299
|
});
|
|
10310
10300
|
const data = res.data;
|
|
10311
10301
|
methods.reset(data);
|
|
@@ -10334,29 +10324,17 @@ function BrandForm() {
|
|
|
10334
10324
|
{
|
|
10335
10325
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
10336
10326
|
children: [
|
|
10337
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
),
|
|
10349
|
-
!branchId && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
10350
|
-
Feilds_default.Branches,
|
|
10351
|
-
{
|
|
10352
|
-
label: "Branch",
|
|
10353
|
-
form: methods,
|
|
10354
|
-
name: "branch",
|
|
10355
|
-
placeholder: "Select Branch",
|
|
10356
|
-
api: "/branches/get?noStore=true"
|
|
10357
|
-
}
|
|
10358
|
-
)
|
|
10359
|
-
] }),
|
|
10327
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
10328
|
+
Fields_default.Input,
|
|
10329
|
+
{
|
|
10330
|
+
label: "Name",
|
|
10331
|
+
form: methods,
|
|
10332
|
+
name: "name",
|
|
10333
|
+
type: "text",
|
|
10334
|
+
placeholder: "Enter Brand Name",
|
|
10335
|
+
required: true
|
|
10336
|
+
}
|
|
10337
|
+
) }),
|
|
10360
10338
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
10361
10339
|
Button,
|
|
10362
10340
|
{
|
|
@@ -10378,7 +10356,7 @@ function BrandForm() {
|
|
|
10378
10356
|
var BrandForm_default = BrandForm;
|
|
10379
10357
|
|
|
10380
10358
|
// src/components/brands/Feilds/Brand.tsx
|
|
10381
|
-
var
|
|
10359
|
+
var import_react_router_dom18 = require("react-router-dom");
|
|
10382
10360
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
10383
10361
|
function Brand({
|
|
10384
10362
|
name,
|
|
@@ -10391,7 +10369,7 @@ function Brand({
|
|
|
10391
10369
|
required,
|
|
10392
10370
|
disabled
|
|
10393
10371
|
}) {
|
|
10394
|
-
const { branchId } = (0,
|
|
10372
|
+
const { branchId } = (0, import_react_router_dom18.useParams)();
|
|
10395
10373
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
10396
10374
|
Fields_default.SearchApi,
|
|
10397
10375
|
{
|
|
@@ -10419,22 +10397,21 @@ var BrandField = {
|
|
|
10419
10397
|
var Feilds_default3 = BrandField;
|
|
10420
10398
|
|
|
10421
10399
|
// src/components/categories/Categories.tsx
|
|
10422
|
-
var
|
|
10400
|
+
var import_react_router_dom19 = require("react-router-dom");
|
|
10423
10401
|
var import_lucide_react27 = require("lucide-react");
|
|
10424
10402
|
var import_react47 = require("react");
|
|
10425
10403
|
var import_antd20 = require("antd");
|
|
10426
10404
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
10427
10405
|
function Categories({ v, url }) {
|
|
10428
|
-
const { branchId } = (0, import_react_router_dom20.useParams)();
|
|
10429
10406
|
const [deleteCategory, setDeleteCategory] = (0, import_react47.useState)(null);
|
|
10430
10407
|
const { isLoading, remove } = useApis_default();
|
|
10431
10408
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10432
|
-
url: url || `/categories/get
|
|
10409
|
+
url: url || `/categories/get`,
|
|
10433
10410
|
v,
|
|
10434
10411
|
dateFilter: false
|
|
10435
10412
|
});
|
|
10436
10413
|
const { Modal: Modal2 } = useModal();
|
|
10437
|
-
const navigate = (0,
|
|
10414
|
+
const navigate = (0, import_react_router_dom19.useNavigate)();
|
|
10438
10415
|
const items = (data2) => [
|
|
10439
10416
|
{
|
|
10440
10417
|
label: `Edit Category`,
|
|
@@ -10521,8 +10498,7 @@ var Categories_default = Categories;
|
|
|
10521
10498
|
// src/components/categories/schema.ts
|
|
10522
10499
|
var import_zod14 = require("zod");
|
|
10523
10500
|
var createCategorySchema = import_zod14.z.object({
|
|
10524
|
-
name: import_zod14.z.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10525
|
-
branch: import_zod14.z.string().optional()
|
|
10501
|
+
name: import_zod14.z.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10526
10502
|
});
|
|
10527
10503
|
|
|
10528
10504
|
// src/components/categories/CategoryForm.tsx
|
|
@@ -10530,10 +10506,8 @@ var import_react_hook_form17 = require("react-hook-form");
|
|
|
10530
10506
|
var import_zod15 = require("@hookform/resolvers/zod");
|
|
10531
10507
|
var import_antd21 = require("antd");
|
|
10532
10508
|
var import_react48 = require("react");
|
|
10533
|
-
var import_react_router_dom21 = require("react-router-dom");
|
|
10534
10509
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
10535
10510
|
function CategoryForm() {
|
|
10536
|
-
const { branchId } = (0, import_react_router_dom21.useParams)();
|
|
10537
10511
|
const { getQuery, navigate } = useApp_default();
|
|
10538
10512
|
const id = getQuery("id");
|
|
10539
10513
|
const isEdit = !!id;
|
|
@@ -10552,18 +10526,12 @@ function CategoryForm() {
|
|
|
10552
10526
|
if (isEdit) {
|
|
10553
10527
|
await put({
|
|
10554
10528
|
url: `/categories/update/${id}`,
|
|
10555
|
-
body:
|
|
10556
|
-
...data,
|
|
10557
|
-
branch: branchId ? branchId : data.branch
|
|
10558
|
-
}
|
|
10529
|
+
body: data
|
|
10559
10530
|
});
|
|
10560
10531
|
} else {
|
|
10561
10532
|
await post({
|
|
10562
10533
|
url: "/categories/create",
|
|
10563
|
-
body:
|
|
10564
|
-
...data,
|
|
10565
|
-
branch: branchId ? branchId : data.branch
|
|
10566
|
-
}
|
|
10534
|
+
body: data
|
|
10567
10535
|
});
|
|
10568
10536
|
}
|
|
10569
10537
|
import_antd21.message.success(`Category ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -10575,7 +10543,7 @@ function CategoryForm() {
|
|
|
10575
10543
|
const fetches = async () => {
|
|
10576
10544
|
try {
|
|
10577
10545
|
const res = await get({
|
|
10578
|
-
url: `/categories/get?id=${id}
|
|
10546
|
+
url: `/categories/get?id=${id}`
|
|
10579
10547
|
});
|
|
10580
10548
|
const data = res.data;
|
|
10581
10549
|
methods.reset(data);
|
|
@@ -10604,29 +10572,17 @@ function CategoryForm() {
|
|
|
10604
10572
|
{
|
|
10605
10573
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
10606
10574
|
children: [
|
|
10607
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
),
|
|
10619
|
-
!branchId && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
10620
|
-
Feilds_default.Branches,
|
|
10621
|
-
{
|
|
10622
|
-
label: "Branch",
|
|
10623
|
-
form: methods,
|
|
10624
|
-
name: "branch",
|
|
10625
|
-
placeholder: "Select Branch",
|
|
10626
|
-
api: "/branches/get?noStore=true"
|
|
10627
|
-
}
|
|
10628
|
-
)
|
|
10629
|
-
] }),
|
|
10575
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
10576
|
+
Fields_default.Input,
|
|
10577
|
+
{
|
|
10578
|
+
label: "Name",
|
|
10579
|
+
form: methods,
|
|
10580
|
+
name: "name",
|
|
10581
|
+
type: "text",
|
|
10582
|
+
placeholder: "Enter Category Name",
|
|
10583
|
+
required: true
|
|
10584
|
+
}
|
|
10585
|
+
) }),
|
|
10630
10586
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
10631
10587
|
Button,
|
|
10632
10588
|
{
|
|
@@ -10648,7 +10604,7 @@ function CategoryForm() {
|
|
|
10648
10604
|
var CategoryForm_default = CategoryForm;
|
|
10649
10605
|
|
|
10650
10606
|
// src/components/categories/Feilds/Category.tsx
|
|
10651
|
-
var
|
|
10607
|
+
var import_react_router_dom20 = require("react-router-dom");
|
|
10652
10608
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
10653
10609
|
function Category({
|
|
10654
10610
|
name,
|
|
@@ -10661,7 +10617,7 @@ function Category({
|
|
|
10661
10617
|
required,
|
|
10662
10618
|
disabled
|
|
10663
10619
|
}) {
|
|
10664
|
-
const { branchId } = (0,
|
|
10620
|
+
const { branchId } = (0, import_react_router_dom20.useParams)();
|
|
10665
10621
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10666
10622
|
Fields_default.SearchApi,
|
|
10667
10623
|
{
|
|
@@ -10689,22 +10645,21 @@ var CategoryField = {
|
|
|
10689
10645
|
var Feilds_default4 = CategoryField;
|
|
10690
10646
|
|
|
10691
10647
|
// src/components/products/Products.tsx
|
|
10692
|
-
var
|
|
10648
|
+
var import_react_router_dom21 = require("react-router-dom");
|
|
10693
10649
|
var import_lucide_react28 = require("lucide-react");
|
|
10694
10650
|
var import_react49 = require("react");
|
|
10695
10651
|
var import_antd22 = require("antd");
|
|
10696
10652
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10697
10653
|
function Products({ v, url }) {
|
|
10698
|
-
const { branchId } = (0, import_react_router_dom23.useParams)();
|
|
10699
10654
|
const [deleteProduct, setDeleteProduct] = (0, import_react49.useState)(null);
|
|
10700
10655
|
const { isLoading, remove } = useApis_default();
|
|
10701
10656
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10702
|
-
url: url || `/products/get
|
|
10657
|
+
url: url || `/products/get`,
|
|
10703
10658
|
v,
|
|
10704
10659
|
dateFilter: false
|
|
10705
10660
|
});
|
|
10706
10661
|
const { Modal: Modal2 } = useModal();
|
|
10707
|
-
const navigate = (0,
|
|
10662
|
+
const navigate = (0, import_react_router_dom21.useNavigate)();
|
|
10708
10663
|
const items = (data2) => [
|
|
10709
10664
|
{
|
|
10710
10665
|
label: `Edit Product`,
|
|
@@ -10821,8 +10776,7 @@ var createProductSchema = import_zod16.z.object({
|
|
|
10821
10776
|
name: import_zod16.z.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
10822
10777
|
category: import_zod16.z.string().optional(),
|
|
10823
10778
|
brand: import_zod16.z.string().optional(),
|
|
10824
|
-
cost: import_zod16.z.number({ message: "Cost is required" }).min(0)
|
|
10825
|
-
branch: import_zod16.z.string().optional()
|
|
10779
|
+
cost: import_zod16.z.number({ message: "Cost is required" }).min(0)
|
|
10826
10780
|
});
|
|
10827
10781
|
|
|
10828
10782
|
// src/components/products/ProductForm.tsx
|
|
@@ -10830,10 +10784,8 @@ var import_react_hook_form18 = require("react-hook-form");
|
|
|
10830
10784
|
var import_zod17 = require("@hookform/resolvers/zod");
|
|
10831
10785
|
var import_antd23 = require("antd");
|
|
10832
10786
|
var import_react50 = require("react");
|
|
10833
|
-
var import_react_router_dom24 = require("react-router-dom");
|
|
10834
10787
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10835
10788
|
function ProductForm() {
|
|
10836
|
-
const { branchId } = (0, import_react_router_dom24.useParams)();
|
|
10837
10789
|
const { getQuery, navigate } = useApp_default();
|
|
10838
10790
|
const id = getQuery("id");
|
|
10839
10791
|
const isEdit = !!id;
|
|
@@ -10855,18 +10807,12 @@ function ProductForm() {
|
|
|
10855
10807
|
if (isEdit) {
|
|
10856
10808
|
await put({
|
|
10857
10809
|
url: `/products/update/${id}`,
|
|
10858
|
-
body:
|
|
10859
|
-
...data,
|
|
10860
|
-
branch: branchId ? branchId : data.branch
|
|
10861
|
-
}
|
|
10810
|
+
body: data
|
|
10862
10811
|
});
|
|
10863
10812
|
} else {
|
|
10864
10813
|
await post({
|
|
10865
10814
|
url: "/products/create",
|
|
10866
|
-
body:
|
|
10867
|
-
...data,
|
|
10868
|
-
branch: branchId ? branchId : data.branch
|
|
10869
|
-
}
|
|
10815
|
+
body: data
|
|
10870
10816
|
});
|
|
10871
10817
|
}
|
|
10872
10818
|
import_antd23.message.success(`Product ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -10878,7 +10824,7 @@ function ProductForm() {
|
|
|
10878
10824
|
const fetches = async () => {
|
|
10879
10825
|
try {
|
|
10880
10826
|
const res = await get({
|
|
10881
|
-
url: `/products/get?id=${id}
|
|
10827
|
+
url: `/products/get?id=${id}`
|
|
10882
10828
|
});
|
|
10883
10829
|
const data = res.data;
|
|
10884
10830
|
methods.reset(data);
|
|
@@ -10947,16 +10893,6 @@ function ProductForm() {
|
|
|
10947
10893
|
name: "brand",
|
|
10948
10894
|
api: "/brands/get"
|
|
10949
10895
|
}
|
|
10950
|
-
),
|
|
10951
|
-
!branchId && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
10952
|
-
Feilds_default.Branches,
|
|
10953
|
-
{
|
|
10954
|
-
label: "Branch",
|
|
10955
|
-
form: methods,
|
|
10956
|
-
name: "branch",
|
|
10957
|
-
placeholder: "Select Branch",
|
|
10958
|
-
api: "/branches/get?noStore=true"
|
|
10959
|
-
}
|
|
10960
10896
|
)
|
|
10961
10897
|
] }),
|
|
10962
10898
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
@@ -10980,7 +10916,7 @@ function ProductForm() {
|
|
|
10980
10916
|
var ProductForm_default = ProductForm;
|
|
10981
10917
|
|
|
10982
10918
|
// src/components/products/Feilds/Product.tsx
|
|
10983
|
-
var
|
|
10919
|
+
var import_react_router_dom22 = require("react-router-dom");
|
|
10984
10920
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10985
10921
|
function Product({
|
|
10986
10922
|
name,
|
|
@@ -10995,7 +10931,7 @@ function Product({
|
|
|
10995
10931
|
onChange,
|
|
10996
10932
|
obj
|
|
10997
10933
|
}) {
|
|
10998
|
-
const { branchId } = (0,
|
|
10934
|
+
const { branchId } = (0, import_react_router_dom22.useParams)();
|
|
10999
10935
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
11000
10936
|
Fields_default.SearchApi,
|
|
11001
10937
|
{
|
|
@@ -11025,22 +10961,21 @@ var ProductField = {
|
|
|
11025
10961
|
var Feilds_default5 = ProductField;
|
|
11026
10962
|
|
|
11027
10963
|
// src/components/packs/Packs.tsx
|
|
11028
|
-
var
|
|
10964
|
+
var import_react_router_dom23 = require("react-router-dom");
|
|
11029
10965
|
var import_lucide_react29 = require("lucide-react");
|
|
11030
10966
|
var import_react51 = require("react");
|
|
11031
10967
|
var import_antd24 = require("antd");
|
|
11032
10968
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
11033
10969
|
function Packs({ v, url }) {
|
|
11034
|
-
const { branchId } = (0, import_react_router_dom26.useParams)();
|
|
11035
10970
|
const [deletePack, setDeletePack] = (0, import_react51.useState)(null);
|
|
11036
10971
|
const { isLoading, remove } = useApis_default();
|
|
11037
10972
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
11038
|
-
url: url || `/packs/get
|
|
10973
|
+
url: url || `/packs/get`,
|
|
11039
10974
|
v,
|
|
11040
10975
|
dateFilter: false
|
|
11041
10976
|
});
|
|
11042
10977
|
const { Modal: Modal2 } = useModal();
|
|
11043
|
-
const navigate = (0,
|
|
10978
|
+
const navigate = (0, import_react_router_dom23.useNavigate)();
|
|
11044
10979
|
const items = (data2) => [
|
|
11045
10980
|
{
|
|
11046
10981
|
label: `Edit Pack`,
|
|
@@ -11157,7 +11092,6 @@ var createPackSchema = import_zod18.z.object({
|
|
|
11157
11092
|
type: packTypes,
|
|
11158
11093
|
name: import_zod18.z.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
11159
11094
|
products: import_zod18.z.array(packProductItemSchema).min(1, "At least one product is required"),
|
|
11160
|
-
branch: import_zod18.z.string().optional(),
|
|
11161
11095
|
tempProduct: import_zod18.z.string().optional(),
|
|
11162
11096
|
tempQty: import_zod18.z.number().optional(),
|
|
11163
11097
|
tempCost: import_zod18.z.number().optional(),
|
|
@@ -11169,11 +11103,9 @@ var import_react_hook_form19 = require("react-hook-form");
|
|
|
11169
11103
|
var import_zod19 = require("@hookform/resolvers/zod");
|
|
11170
11104
|
var import_antd25 = require("antd");
|
|
11171
11105
|
var import_react52 = require("react");
|
|
11172
|
-
var import_react_router_dom27 = require("react-router-dom");
|
|
11173
11106
|
var import_lucide_react30 = require("lucide-react");
|
|
11174
11107
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11175
11108
|
function PackForm() {
|
|
11176
|
-
const { branchId } = (0, import_react_router_dom27.useParams)();
|
|
11177
11109
|
const { getQuery, navigate } = useApp_default();
|
|
11178
11110
|
const id = getQuery("id");
|
|
11179
11111
|
const isEdit = !!id;
|
|
@@ -11229,10 +11161,7 @@ function PackForm() {
|
|
|
11229
11161
|
} else {
|
|
11230
11162
|
await post({
|
|
11231
11163
|
url: "/packs/create",
|
|
11232
|
-
body:
|
|
11233
|
-
...formattedData,
|
|
11234
|
-
branch: branchId ? branchId : data.branch
|
|
11235
|
-
}
|
|
11164
|
+
body: formattedData
|
|
11236
11165
|
});
|
|
11237
11166
|
}
|
|
11238
11167
|
import_antd25.message.success(`Pack ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -11244,7 +11173,7 @@ function PackForm() {
|
|
|
11244
11173
|
const fetches = async () => {
|
|
11245
11174
|
try {
|
|
11246
11175
|
const res = await get({
|
|
11247
|
-
url: `/packs/get?id=${id}
|
|
11176
|
+
url: `/packs/get?id=${id}`
|
|
11248
11177
|
});
|
|
11249
11178
|
const data = res.data;
|
|
11250
11179
|
data.products = data.products.map((p, index) => ({
|
|
@@ -11304,16 +11233,6 @@ function PackForm() {
|
|
|
11304
11233
|
enumName: "packTypes",
|
|
11305
11234
|
required: true
|
|
11306
11235
|
}
|
|
11307
|
-
),
|
|
11308
|
-
!branchId && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11309
|
-
Feilds_default.Branches,
|
|
11310
|
-
{
|
|
11311
|
-
label: "Branch",
|
|
11312
|
-
form: methods,
|
|
11313
|
-
name: "branch",
|
|
11314
|
-
placeholder: "Select Branch",
|
|
11315
|
-
api: "/branches/get?noStore=true"
|
|
11316
|
-
}
|
|
11317
11236
|
)
|
|
11318
11237
|
] }),
|
|
11319
11238
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "border rounded-lg p-4 bg-gray-50/50 dark:bg-gray-800/20", children: [
|
package/dist/index.mjs
CHANGED
|
@@ -10092,17 +10092,16 @@ var WalletField = {
|
|
|
10092
10092
|
var Feilds_default2 = WalletField;
|
|
10093
10093
|
|
|
10094
10094
|
// src/components/brands/Brands.tsx
|
|
10095
|
-
import { useNavigate as useNavigate11
|
|
10095
|
+
import { useNavigate as useNavigate11 } from "react-router-dom";
|
|
10096
10096
|
import { EllipsisVertical as EllipsisVertical4, FilePenLine as FilePenLine3, Trash2 as Trash24 } from "lucide-react";
|
|
10097
10097
|
import { useState as useState33 } from "react";
|
|
10098
10098
|
import { message as message16 } from "antd";
|
|
10099
10099
|
import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
10100
10100
|
function Brands({ v, url }) {
|
|
10101
|
-
const { branchId } = useParams9();
|
|
10102
10101
|
const [deleteBrand, setDeleteBrand] = useState33(null);
|
|
10103
10102
|
const { isLoading, remove } = useApis_default();
|
|
10104
10103
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10105
|
-
url: url || `/brands/get
|
|
10104
|
+
url: url || `/brands/get`,
|
|
10106
10105
|
v,
|
|
10107
10106
|
dateFilter: false
|
|
10108
10107
|
});
|
|
@@ -10194,8 +10193,7 @@ var Brands_default = Brands;
|
|
|
10194
10193
|
// src/components/brands/schema.ts
|
|
10195
10194
|
import { z as z6 } from "zod";
|
|
10196
10195
|
var createBrandSchema = z6.object({
|
|
10197
|
-
name: z6.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10198
|
-
branch: z6.string().optional()
|
|
10196
|
+
name: z6.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10199
10197
|
});
|
|
10200
10198
|
|
|
10201
10199
|
// src/components/brands/BrandForm.tsx
|
|
@@ -10203,10 +10201,8 @@ import { useForm as useForm10 } from "react-hook-form";
|
|
|
10203
10201
|
import { zodResolver as zodResolver9 } from "@hookform/resolvers/zod";
|
|
10204
10202
|
import { message as message17 } from "antd";
|
|
10205
10203
|
import { useEffect as useEffect26 } from "react";
|
|
10206
|
-
import { useParams as useParams10 } from "react-router-dom";
|
|
10207
10204
|
import { jsx as jsx64, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
10208
10205
|
function BrandForm() {
|
|
10209
|
-
const { branchId } = useParams10();
|
|
10210
10206
|
const { getQuery, navigate } = useApp_default();
|
|
10211
10207
|
const id = getQuery("id");
|
|
10212
10208
|
const isEdit = !!id;
|
|
@@ -10225,18 +10221,12 @@ function BrandForm() {
|
|
|
10225
10221
|
if (isEdit) {
|
|
10226
10222
|
await put({
|
|
10227
10223
|
url: `/brands/update/${id}`,
|
|
10228
|
-
body:
|
|
10229
|
-
...data,
|
|
10230
|
-
branch: branchId ? branchId : data.branch
|
|
10231
|
-
}
|
|
10224
|
+
body: data
|
|
10232
10225
|
});
|
|
10233
10226
|
} else {
|
|
10234
10227
|
await post({
|
|
10235
10228
|
url: "/brands/create",
|
|
10236
|
-
body:
|
|
10237
|
-
...data,
|
|
10238
|
-
branch: branchId ? branchId : data.branch
|
|
10239
|
-
}
|
|
10229
|
+
body: data
|
|
10240
10230
|
});
|
|
10241
10231
|
}
|
|
10242
10232
|
message17.success(`Brand ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -10248,7 +10238,7 @@ function BrandForm() {
|
|
|
10248
10238
|
const fetches = async () => {
|
|
10249
10239
|
try {
|
|
10250
10240
|
const res = await get({
|
|
10251
|
-
url: `/brands/get?id=${id}
|
|
10241
|
+
url: `/brands/get?id=${id}`
|
|
10252
10242
|
});
|
|
10253
10243
|
const data = res.data;
|
|
10254
10244
|
methods.reset(data);
|
|
@@ -10277,29 +10267,17 @@ function BrandForm() {
|
|
|
10277
10267
|
{
|
|
10278
10268
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
10279
10269
|
children: [
|
|
10280
|
-
/* @__PURE__ */
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
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
|
-
] }),
|
|
10270
|
+
/* @__PURE__ */ jsx64("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ jsx64(
|
|
10271
|
+
Fields_default.Input,
|
|
10272
|
+
{
|
|
10273
|
+
label: "Name",
|
|
10274
|
+
form: methods,
|
|
10275
|
+
name: "name",
|
|
10276
|
+
type: "text",
|
|
10277
|
+
placeholder: "Enter Brand Name",
|
|
10278
|
+
required: true
|
|
10279
|
+
}
|
|
10280
|
+
) }),
|
|
10303
10281
|
/* @__PURE__ */ jsx64("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx64(
|
|
10304
10282
|
Button,
|
|
10305
10283
|
{
|
|
@@ -10321,7 +10299,7 @@ function BrandForm() {
|
|
|
10321
10299
|
var BrandForm_default = BrandForm;
|
|
10322
10300
|
|
|
10323
10301
|
// src/components/brands/Feilds/Brand.tsx
|
|
10324
|
-
import { useParams as
|
|
10302
|
+
import { useParams as useParams10 } from "react-router-dom";
|
|
10325
10303
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
10326
10304
|
function Brand({
|
|
10327
10305
|
name,
|
|
@@ -10334,7 +10312,7 @@ function Brand({
|
|
|
10334
10312
|
required,
|
|
10335
10313
|
disabled
|
|
10336
10314
|
}) {
|
|
10337
|
-
const { branchId } =
|
|
10315
|
+
const { branchId } = useParams10();
|
|
10338
10316
|
return /* @__PURE__ */ jsx65("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx65(
|
|
10339
10317
|
Fields_default.SearchApi,
|
|
10340
10318
|
{
|
|
@@ -10362,17 +10340,16 @@ var BrandField = {
|
|
|
10362
10340
|
var Feilds_default3 = BrandField;
|
|
10363
10341
|
|
|
10364
10342
|
// src/components/categories/Categories.tsx
|
|
10365
|
-
import { useNavigate as useNavigate12
|
|
10343
|
+
import { useNavigate as useNavigate12 } from "react-router-dom";
|
|
10366
10344
|
import { EllipsisVertical as EllipsisVertical5, FilePenLine as FilePenLine4, Trash2 as Trash25 } from "lucide-react";
|
|
10367
10345
|
import { useState as useState34 } from "react";
|
|
10368
10346
|
import { message as message18 } from "antd";
|
|
10369
10347
|
import { Fragment as Fragment15, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
10370
10348
|
function Categories({ v, url }) {
|
|
10371
|
-
const { branchId } = useParams12();
|
|
10372
10349
|
const [deleteCategory, setDeleteCategory] = useState34(null);
|
|
10373
10350
|
const { isLoading, remove } = useApis_default();
|
|
10374
10351
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10375
|
-
url: url || `/categories/get
|
|
10352
|
+
url: url || `/categories/get`,
|
|
10376
10353
|
v,
|
|
10377
10354
|
dateFilter: false
|
|
10378
10355
|
});
|
|
@@ -10464,8 +10441,7 @@ var Categories_default = Categories;
|
|
|
10464
10441
|
// src/components/categories/schema.ts
|
|
10465
10442
|
import { z as z7 } from "zod";
|
|
10466
10443
|
var createCategorySchema = z7.object({
|
|
10467
|
-
name: z7.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10468
|
-
branch: z7.string().optional()
|
|
10444
|
+
name: z7.string().min(2, { message: "Name must be at least 2 characters" })
|
|
10469
10445
|
});
|
|
10470
10446
|
|
|
10471
10447
|
// src/components/categories/CategoryForm.tsx
|
|
@@ -10473,10 +10449,8 @@ import { useForm as useForm11 } from "react-hook-form";
|
|
|
10473
10449
|
import { zodResolver as zodResolver10 } from "@hookform/resolvers/zod";
|
|
10474
10450
|
import { message as message19 } from "antd";
|
|
10475
10451
|
import { useEffect as useEffect27 } from "react";
|
|
10476
|
-
import { useParams as useParams13 } from "react-router-dom";
|
|
10477
10452
|
import { jsx as jsx67, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
10478
10453
|
function CategoryForm() {
|
|
10479
|
-
const { branchId } = useParams13();
|
|
10480
10454
|
const { getQuery, navigate } = useApp_default();
|
|
10481
10455
|
const id = getQuery("id");
|
|
10482
10456
|
const isEdit = !!id;
|
|
@@ -10495,18 +10469,12 @@ function CategoryForm() {
|
|
|
10495
10469
|
if (isEdit) {
|
|
10496
10470
|
await put({
|
|
10497
10471
|
url: `/categories/update/${id}`,
|
|
10498
|
-
body:
|
|
10499
|
-
...data,
|
|
10500
|
-
branch: branchId ? branchId : data.branch
|
|
10501
|
-
}
|
|
10472
|
+
body: data
|
|
10502
10473
|
});
|
|
10503
10474
|
} else {
|
|
10504
10475
|
await post({
|
|
10505
10476
|
url: "/categories/create",
|
|
10506
|
-
body:
|
|
10507
|
-
...data,
|
|
10508
|
-
branch: branchId ? branchId : data.branch
|
|
10509
|
-
}
|
|
10477
|
+
body: data
|
|
10510
10478
|
});
|
|
10511
10479
|
}
|
|
10512
10480
|
message19.success(`Category ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -10518,7 +10486,7 @@ function CategoryForm() {
|
|
|
10518
10486
|
const fetches = async () => {
|
|
10519
10487
|
try {
|
|
10520
10488
|
const res = await get({
|
|
10521
|
-
url: `/categories/get?id=${id}
|
|
10489
|
+
url: `/categories/get?id=${id}`
|
|
10522
10490
|
});
|
|
10523
10491
|
const data = res.data;
|
|
10524
10492
|
methods.reset(data);
|
|
@@ -10547,29 +10515,17 @@ function CategoryForm() {
|
|
|
10547
10515
|
{
|
|
10548
10516
|
onSubmit: handleSubmit(onSubmit, (errors) => console.log(errors)),
|
|
10549
10517
|
children: [
|
|
10550
|
-
/* @__PURE__ */
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
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
|
-
] }),
|
|
10518
|
+
/* @__PURE__ */ jsx67("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: /* @__PURE__ */ jsx67(
|
|
10519
|
+
Fields_default.Input,
|
|
10520
|
+
{
|
|
10521
|
+
label: "Name",
|
|
10522
|
+
form: methods,
|
|
10523
|
+
name: "name",
|
|
10524
|
+
type: "text",
|
|
10525
|
+
placeholder: "Enter Category Name",
|
|
10526
|
+
required: true
|
|
10527
|
+
}
|
|
10528
|
+
) }),
|
|
10573
10529
|
/* @__PURE__ */ jsx67("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx67(
|
|
10574
10530
|
Button,
|
|
10575
10531
|
{
|
|
@@ -10591,7 +10547,7 @@ function CategoryForm() {
|
|
|
10591
10547
|
var CategoryForm_default = CategoryForm;
|
|
10592
10548
|
|
|
10593
10549
|
// src/components/categories/Feilds/Category.tsx
|
|
10594
|
-
import { useParams as
|
|
10550
|
+
import { useParams as useParams12 } from "react-router-dom";
|
|
10595
10551
|
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
10596
10552
|
function Category({
|
|
10597
10553
|
name,
|
|
@@ -10604,7 +10560,7 @@ function Category({
|
|
|
10604
10560
|
required,
|
|
10605
10561
|
disabled
|
|
10606
10562
|
}) {
|
|
10607
|
-
const { branchId } =
|
|
10563
|
+
const { branchId } = useParams12();
|
|
10608
10564
|
return /* @__PURE__ */ jsx68("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx68(
|
|
10609
10565
|
Fields_default.SearchApi,
|
|
10610
10566
|
{
|
|
@@ -10632,17 +10588,16 @@ var CategoryField = {
|
|
|
10632
10588
|
var Feilds_default4 = CategoryField;
|
|
10633
10589
|
|
|
10634
10590
|
// src/components/products/Products.tsx
|
|
10635
|
-
import { useNavigate as useNavigate13
|
|
10591
|
+
import { useNavigate as useNavigate13 } from "react-router-dom";
|
|
10636
10592
|
import { EllipsisVertical as EllipsisVertical6, FilePenLine as FilePenLine5, Trash2 as Trash26 } from "lucide-react";
|
|
10637
10593
|
import { useState as useState35 } from "react";
|
|
10638
10594
|
import { message as message20 } from "antd";
|
|
10639
10595
|
import { Fragment as Fragment16, jsx as jsx69, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
10640
10596
|
function Products({ v, url }) {
|
|
10641
|
-
const { branchId } = useParams15();
|
|
10642
10597
|
const [deleteProduct, setDeleteProduct] = useState35(null);
|
|
10643
10598
|
const { isLoading, remove } = useApis_default();
|
|
10644
10599
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10645
|
-
url: url || `/products/get
|
|
10600
|
+
url: url || `/products/get`,
|
|
10646
10601
|
v,
|
|
10647
10602
|
dateFilter: false
|
|
10648
10603
|
});
|
|
@@ -10764,8 +10719,7 @@ var createProductSchema = z8.object({
|
|
|
10764
10719
|
name: z8.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
10765
10720
|
category: z8.string().optional(),
|
|
10766
10721
|
brand: z8.string().optional(),
|
|
10767
|
-
cost: z8.number({ message: "Cost is required" }).min(0)
|
|
10768
|
-
branch: z8.string().optional()
|
|
10722
|
+
cost: z8.number({ message: "Cost is required" }).min(0)
|
|
10769
10723
|
});
|
|
10770
10724
|
|
|
10771
10725
|
// src/components/products/ProductForm.tsx
|
|
@@ -10773,10 +10727,8 @@ import { useForm as useForm12 } from "react-hook-form";
|
|
|
10773
10727
|
import { zodResolver as zodResolver11 } from "@hookform/resolvers/zod";
|
|
10774
10728
|
import { message as message21 } from "antd";
|
|
10775
10729
|
import { useEffect as useEffect28 } from "react";
|
|
10776
|
-
import { useParams as useParams16 } from "react-router-dom";
|
|
10777
10730
|
import { jsx as jsx70, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
10778
10731
|
function ProductForm() {
|
|
10779
|
-
const { branchId } = useParams16();
|
|
10780
10732
|
const { getQuery, navigate } = useApp_default();
|
|
10781
10733
|
const id = getQuery("id");
|
|
10782
10734
|
const isEdit = !!id;
|
|
@@ -10798,18 +10750,12 @@ function ProductForm() {
|
|
|
10798
10750
|
if (isEdit) {
|
|
10799
10751
|
await put({
|
|
10800
10752
|
url: `/products/update/${id}`,
|
|
10801
|
-
body:
|
|
10802
|
-
...data,
|
|
10803
|
-
branch: branchId ? branchId : data.branch
|
|
10804
|
-
}
|
|
10753
|
+
body: data
|
|
10805
10754
|
});
|
|
10806
10755
|
} else {
|
|
10807
10756
|
await post({
|
|
10808
10757
|
url: "/products/create",
|
|
10809
|
-
body:
|
|
10810
|
-
...data,
|
|
10811
|
-
branch: branchId ? branchId : data.branch
|
|
10812
|
-
}
|
|
10758
|
+
body: data
|
|
10813
10759
|
});
|
|
10814
10760
|
}
|
|
10815
10761
|
message21.success(`Product ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -10821,7 +10767,7 @@ function ProductForm() {
|
|
|
10821
10767
|
const fetches = async () => {
|
|
10822
10768
|
try {
|
|
10823
10769
|
const res = await get({
|
|
10824
|
-
url: `/products/get?id=${id}
|
|
10770
|
+
url: `/products/get?id=${id}`
|
|
10825
10771
|
});
|
|
10826
10772
|
const data = res.data;
|
|
10827
10773
|
methods.reset(data);
|
|
@@ -10890,16 +10836,6 @@ function ProductForm() {
|
|
|
10890
10836
|
name: "brand",
|
|
10891
10837
|
api: "/brands/get"
|
|
10892
10838
|
}
|
|
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
10839
|
)
|
|
10904
10840
|
] }),
|
|
10905
10841
|
/* @__PURE__ */ jsx70("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx70(
|
|
@@ -10923,7 +10859,7 @@ function ProductForm() {
|
|
|
10923
10859
|
var ProductForm_default = ProductForm;
|
|
10924
10860
|
|
|
10925
10861
|
// src/components/products/Feilds/Product.tsx
|
|
10926
|
-
import { useParams as
|
|
10862
|
+
import { useParams as useParams14 } from "react-router-dom";
|
|
10927
10863
|
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
10928
10864
|
function Product({
|
|
10929
10865
|
name,
|
|
@@ -10938,7 +10874,7 @@ function Product({
|
|
|
10938
10874
|
onChange,
|
|
10939
10875
|
obj
|
|
10940
10876
|
}) {
|
|
10941
|
-
const { branchId } =
|
|
10877
|
+
const { branchId } = useParams14();
|
|
10942
10878
|
return /* @__PURE__ */ jsx71("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx71(
|
|
10943
10879
|
Fields_default.SearchApi,
|
|
10944
10880
|
{
|
|
@@ -10968,17 +10904,16 @@ var ProductField = {
|
|
|
10968
10904
|
var Feilds_default5 = ProductField;
|
|
10969
10905
|
|
|
10970
10906
|
// src/components/packs/Packs.tsx
|
|
10971
|
-
import { useNavigate as useNavigate14
|
|
10907
|
+
import { useNavigate as useNavigate14 } from "react-router-dom";
|
|
10972
10908
|
import { EllipsisVertical as EllipsisVertical7, FilePenLine as FilePenLine6, Trash2 as Trash27 } from "lucide-react";
|
|
10973
10909
|
import { useState as useState36 } from "react";
|
|
10974
10910
|
import { message as message22 } from "antd";
|
|
10975
10911
|
import { Fragment as Fragment17, jsx as jsx72, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
10976
10912
|
function Packs({ v, url }) {
|
|
10977
|
-
const { branchId } = useParams18();
|
|
10978
10913
|
const [deletePack, setDeletePack] = useState36(null);
|
|
10979
10914
|
const { isLoading, remove } = useApis_default();
|
|
10980
10915
|
const { data, TransactionViewComponent, reload } = useTransaction_default({
|
|
10981
|
-
url: url || `/packs/get
|
|
10916
|
+
url: url || `/packs/get`,
|
|
10982
10917
|
v,
|
|
10983
10918
|
dateFilter: false
|
|
10984
10919
|
});
|
|
@@ -11100,7 +11035,6 @@ var createPackSchema = z9.object({
|
|
|
11100
11035
|
type: packTypes,
|
|
11101
11036
|
name: z9.string().min(2, { message: "Name must be at least 2 characters" }),
|
|
11102
11037
|
products: z9.array(packProductItemSchema).min(1, "At least one product is required"),
|
|
11103
|
-
branch: z9.string().optional(),
|
|
11104
11038
|
tempProduct: z9.string().optional(),
|
|
11105
11039
|
tempQty: z9.number().optional(),
|
|
11106
11040
|
tempCost: z9.number().optional(),
|
|
@@ -11112,11 +11046,9 @@ import { useForm as useForm13, useFieldArray } from "react-hook-form";
|
|
|
11112
11046
|
import { zodResolver as zodResolver12 } from "@hookform/resolvers/zod";
|
|
11113
11047
|
import { message as message23 } from "antd";
|
|
11114
11048
|
import { useEffect as useEffect29 } from "react";
|
|
11115
|
-
import { useParams as useParams19 } from "react-router-dom";
|
|
11116
11049
|
import { Plus as Plus3, Trash2 as Trash28 } from "lucide-react";
|
|
11117
11050
|
import { jsx as jsx73, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
11118
11051
|
function PackForm() {
|
|
11119
|
-
const { branchId } = useParams19();
|
|
11120
11052
|
const { getQuery, navigate } = useApp_default();
|
|
11121
11053
|
const id = getQuery("id");
|
|
11122
11054
|
const isEdit = !!id;
|
|
@@ -11172,10 +11104,7 @@ function PackForm() {
|
|
|
11172
11104
|
} else {
|
|
11173
11105
|
await post({
|
|
11174
11106
|
url: "/packs/create",
|
|
11175
|
-
body:
|
|
11176
|
-
...formattedData,
|
|
11177
|
-
branch: branchId ? branchId : data.branch
|
|
11178
|
-
}
|
|
11107
|
+
body: formattedData
|
|
11179
11108
|
});
|
|
11180
11109
|
}
|
|
11181
11110
|
message23.success(`Pack ${isEdit ? "updated" : "created"} successfully`);
|
|
@@ -11187,7 +11116,7 @@ function PackForm() {
|
|
|
11187
11116
|
const fetches = async () => {
|
|
11188
11117
|
try {
|
|
11189
11118
|
const res = await get({
|
|
11190
|
-
url: `/packs/get?id=${id}
|
|
11119
|
+
url: `/packs/get?id=${id}`
|
|
11191
11120
|
});
|
|
11192
11121
|
const data = res.data;
|
|
11193
11122
|
data.products = data.products.map((p, index) => ({
|
|
@@ -11247,16 +11176,6 @@ function PackForm() {
|
|
|
11247
11176
|
enumName: "packTypes",
|
|
11248
11177
|
required: true
|
|
11249
11178
|
}
|
|
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
11179
|
)
|
|
11261
11180
|
] }),
|
|
11262
11181
|
/* @__PURE__ */ jsxs56("div", { className: "border rounded-lg p-4 bg-gray-50/50 dark:bg-gray-800/20", children: [
|