asv-hlps 1.2.17 → 1.2.20

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.
Files changed (118) hide show
  1. package/lib/cjs/core/estates/hlpEstate.d.ts +10 -0
  2. package/lib/cjs/core/estates/hlpEstate.js +34 -0
  3. package/lib/cjs/core/estates/index.d.ts +5 -0
  4. package/lib/cjs/core/estates/index.js +27 -0
  5. package/lib/cjs/core/estates/models/Estate.d.ts +24 -0
  6. package/lib/cjs/{models/types/MenuItemType.js → core/estates/models/Estate.js} +0 -0
  7. package/lib/cjs/core/estates/models/EstateAsset.d.ts +7 -0
  8. package/lib/cjs/core/estates/models/EstateAsset.js +2 -0
  9. package/lib/cjs/core/estates/models/EstateCat.d.ts +3 -0
  10. package/lib/cjs/core/estates/models/EstateCat.js +2 -0
  11. package/lib/cjs/core/estates/models/EstateElt.d.ts +3 -0
  12. package/lib/cjs/core/estates/models/EstateElt.js +2 -0
  13. package/lib/cjs/core/estates/models/EstateLevel.d.ts +3 -0
  14. package/lib/cjs/core/estates/models/EstateLevel.js +2 -0
  15. package/lib/cjs/core/estates/models/EstatePor.d.ts +3 -0
  16. package/lib/cjs/core/estates/models/EstatePor.js +2 -0
  17. package/lib/cjs/core/estates/models/Housing.d.ts +17 -0
  18. package/lib/cjs/core/estates/models/Housing.js +2 -0
  19. package/lib/cjs/core/estates/models/HousingRented.d.ts +15 -0
  20. package/lib/cjs/core/estates/models/HousingRented.js +2 -0
  21. package/lib/cjs/core/estates/models/index.d.ts +9 -0
  22. package/lib/cjs/core/estates/models/index.js +2 -0
  23. package/lib/cjs/core/estates/pipes/estate-pipe.d.ts +6 -0
  24. package/lib/cjs/core/estates/pipes/estate-pipe.js +17 -0
  25. package/lib/cjs/core/estates/pipes/list-estate-pipe.d.ts +6 -0
  26. package/lib/cjs/core/estates/pipes/list-estate-pipe.js +17 -0
  27. package/lib/cjs/helpers/pipes/amount-on-bill-pipe.d.ts +1 -1
  28. package/lib/cjs/index.d.ts +1 -4
  29. package/lib/cjs/index.js +3 -5
  30. package/lib/cjs/models/entities/auth/index.d.ts +3 -0
  31. package/lib/cjs/models/entities/auth/index.js +2 -0
  32. package/lib/cjs/models/entities/bills/index.d.ts +8 -0
  33. package/lib/cjs/models/entities/bills/index.js +9 -0
  34. package/lib/cjs/models/entities/buys/index.d.ts +5 -0
  35. package/lib/cjs/models/entities/buys/index.js +5 -0
  36. package/lib/cjs/models/entities/cashs/index.d.ts +7 -0
  37. package/lib/cjs/models/entities/cashs/index.js +2 -0
  38. package/lib/cjs/models/entities/comptas/index.d.ts +9 -0
  39. package/lib/cjs/models/entities/comptas/index.js +2 -0
  40. package/lib/cjs/models/entities/docs/index.d.ts +7 -0
  41. package/lib/cjs/models/entities/docs/index.js +2 -0
  42. package/lib/cjs/models/entities/mails/index.d.ts +5 -0
  43. package/lib/cjs/models/entities/mails/index.js +2 -0
  44. package/lib/cjs/models/entities/products/index.d.ts +26 -0
  45. package/lib/cjs/models/entities/products/index.js +5 -0
  46. package/lib/cjs/models/entities/sales/index.d.ts +13 -0
  47. package/lib/cjs/models/entities/sales/index.js +15 -0
  48. package/lib/cjs/models/entities/users/UserNotatial.d.ts +2 -2
  49. package/lib/cjs/models/entities/users/index.d.ts +2 -1
  50. package/lib/cjs/models/entities/utilities/index.d.ts +4 -0
  51. package/lib/cjs/models/entities/utilities/index.js +7 -0
  52. package/lib/cjs/models/entities/world/index.d.ts +7 -0
  53. package/lib/cjs/models/entities/world/index.js +9 -0
  54. package/lib/cjs/models/index.d.ts +13 -84
  55. package/lib/cjs/models/index.js +27 -33
  56. package/lib/esm/core/estates/hlpEstate.d.ts +10 -0
  57. package/lib/esm/core/estates/hlpEstate.js +32 -0
  58. package/lib/esm/core/estates/index.d.ts +5 -0
  59. package/lib/esm/core/estates/index.js +5 -0
  60. package/lib/esm/core/estates/models/Estate.d.ts +24 -0
  61. package/lib/esm/{models/types/MenuItemType.js → core/estates/models/Estate.js} +0 -0
  62. package/lib/esm/core/estates/models/EstateAsset.d.ts +7 -0
  63. package/lib/esm/core/estates/models/EstateAsset.js +1 -0
  64. package/lib/esm/core/estates/models/EstateCat.d.ts +3 -0
  65. package/lib/esm/core/estates/models/EstateCat.js +1 -0
  66. package/lib/esm/core/estates/models/EstateElt.d.ts +3 -0
  67. package/lib/esm/core/estates/models/EstateElt.js +1 -0
  68. package/lib/esm/core/estates/models/EstateLevel.d.ts +3 -0
  69. package/lib/esm/core/estates/models/EstateLevel.js +1 -0
  70. package/lib/esm/core/estates/models/EstatePor.d.ts +3 -0
  71. package/lib/esm/core/estates/models/EstatePor.js +1 -0
  72. package/lib/esm/core/estates/models/Housing.d.ts +17 -0
  73. package/lib/esm/core/estates/models/Housing.js +1 -0
  74. package/lib/esm/core/estates/models/HousingRented.d.ts +15 -0
  75. package/lib/esm/core/estates/models/HousingRented.js +1 -0
  76. package/lib/esm/core/estates/models/index.d.ts +9 -0
  77. package/lib/esm/core/estates/models/index.js +1 -0
  78. package/lib/esm/core/estates/pipes/estate-pipe.d.ts +6 -0
  79. package/lib/esm/core/estates/pipes/estate-pipe.js +12 -0
  80. package/lib/esm/core/estates/pipes/list-estate-pipe.d.ts +6 -0
  81. package/lib/esm/core/estates/pipes/list-estate-pipe.js +12 -0
  82. package/lib/esm/helpers/pipes/amount-on-bill-pipe.d.ts +1 -1
  83. package/lib/esm/index.d.ts +1 -4
  84. package/lib/esm/index.js +3 -5
  85. package/lib/esm/models/entities/auth/index.d.ts +3 -0
  86. package/lib/esm/models/entities/auth/index.js +1 -0
  87. package/lib/esm/models/entities/bills/index.d.ts +8 -0
  88. package/lib/esm/models/entities/bills/index.js +4 -0
  89. package/lib/esm/models/entities/buys/index.d.ts +5 -0
  90. package/lib/esm/models/entities/buys/index.js +2 -0
  91. package/lib/esm/models/entities/cashs/index.d.ts +7 -0
  92. package/lib/esm/models/entities/cashs/index.js +1 -0
  93. package/lib/esm/models/entities/comptas/index.d.ts +9 -0
  94. package/lib/esm/models/entities/comptas/index.js +1 -0
  95. package/lib/esm/models/entities/docs/index.d.ts +7 -0
  96. package/lib/esm/models/entities/docs/index.js +1 -0
  97. package/lib/esm/models/entities/mails/index.d.ts +5 -0
  98. package/lib/esm/models/entities/mails/index.js +1 -0
  99. package/lib/esm/models/entities/products/index.d.ts +26 -0
  100. package/lib/esm/models/entities/products/index.js +2 -0
  101. package/lib/esm/models/entities/sales/index.d.ts +13 -0
  102. package/lib/esm/models/entities/sales/index.js +7 -0
  103. package/lib/esm/models/entities/users/UserNotatial.d.ts +2 -2
  104. package/lib/esm/models/entities/users/index.d.ts +2 -1
  105. package/lib/esm/models/entities/users/index.js +1 -1
  106. package/lib/esm/models/entities/utilities/index.d.ts +4 -0
  107. package/lib/esm/models/entities/utilities/index.js +3 -0
  108. package/lib/esm/models/entities/world/index.d.ts +7 -0
  109. package/lib/esm/models/entities/world/index.js +4 -0
  110. package/lib/esm/models/index.d.ts +13 -84
  111. package/lib/esm/models/index.js +13 -21
  112. package/package.json +1 -1
  113. package/lib/cjs/helpers/hlpProduct2.d.ts +0 -1
  114. package/lib/cjs/helpers/hlpProduct2.js +0 -130
  115. package/lib/cjs/models/types/MenuItemType.d.ts +0 -14
  116. package/lib/esm/helpers/hlpProduct2.d.ts +0 -1
  117. package/lib/esm/helpers/hlpProduct2.js +0 -126
  118. package/lib/esm/models/types/MenuItemType.d.ts +0 -14
@@ -7,9 +7,10 @@ import { SteGrp } from "./SteGrp";
7
7
  import { User } from "./User";
8
8
  import { UserCredit } from "./UserCredit";
9
9
  import { UserGrp } from "./UserGrp";
10
+ import { UserNotarial } from "./UserNotatial";
10
11
  import { UserNote } from "./UserNote";
11
12
  import { UserOnline } from "./UserOnline";
12
13
  import { UserRole } from "./UserRole";
13
14
  import { UserTitr } from "./UserTitr";
14
15
  import { Zone } from "./Zone";
15
- export { Address, DutyPhcie, Gender, Leave, Ste, SteGrp, User, UserCredit, UserGrp, UserNote, UserOnline, UserRole, UserTitr, Zone };
16
+ export { UserNotarial, Address, DutyPhcie, Gender, Leave, Ste, SteGrp, User, UserCredit, UserGrp, UserNote, UserOnline, UserRole, UserTitr, Zone, };
@@ -1,2 +1,2 @@
1
1
  import { UserCredit } from "./UserCredit";
2
- export { UserCredit };
2
+ export { UserCredit, };
@@ -0,0 +1,4 @@
1
+ import { Todo } from "./Todo";
2
+ import { Vehicle } from "./Vehicle";
3
+ import { Wish } from "./Wish";
4
+ export { Todo, Vehicle, Wish };
@@ -0,0 +1,3 @@
1
+ import { Todo } from "./Todo";
2
+ import { Wish } from "./Wish";
3
+ export { Todo, Wish };
@@ -0,0 +1,7 @@
1
+ import { City } from "./City";
2
+ import { Continent } from "./Continent";
3
+ import { Country } from "./Country";
4
+ import { Department } from "./Department";
5
+ import { Quarter } from "./Quarter";
6
+ import { Region } from "./Region";
7
+ export { City, Continent, Country, Department, Quarter, Region };
@@ -0,0 +1,4 @@
1
+ import { City } from "./City";
2
+ import { Continent } from "./Continent";
3
+ import { Region } from "./Region";
4
+ export { City, Continent, Region };
@@ -1,88 +1,17 @@
1
- import { AuthTag } from "./entities/auth/AuthTag";
2
- import { AuthTagCat } from "./entities/auth/AuthTagCat";
3
- import { Bill } from "./entities/bills/Bill";
4
- import { BillLine } from "./entities/bills/BillLine";
5
- import { BillPayment } from "./entities/bills/BillPayment";
6
- import { BillPaymentMethod } from "./entities/bills/BillPaymentMethod";
7
- import { CBillPeriod } from "./entities/bills/CBillPeriod";
8
- import { EBillPeriod } from "./entities/bills/EBillPeriod";
9
- import { EPayMethod } from "./entities/bills/EPayMethod";
10
- import { Buy } from "./entities/buys/Buy";
11
- import { BuyCart } from "./entities/buys/BuyCart";
12
- import { BuyItem } from "./entities/buys/BuyItem";
13
- import { BuyItems } from "./entities/buys/BuyItems";
14
- import { Account } from "./entities/cashs/Account";
15
- import { Bank } from "./entities/cashs/Bank";
16
- import { Currency } from "./entities/cashs/Currency";
17
- import { Deposit } from "./entities/cashs/Deposit";
18
- import { Feed } from "./entities/cashs/Feed";
19
- import { Spent } from "./entities/cashs/Spent";
20
- import { Entry } from "./entities/comptas/Entry";
21
- import { EntryAccount } from "./entities/comptas/EntryAccount";
22
- import { EntryCat } from "./entities/comptas/EntryCat";
23
- import { EntryLine } from "./entities/comptas/EntryLine";
24
- import { OhadaCat } from "./entities/comptas/OhadaCat";
25
- import { OhadaGrp } from "./entities/comptas/OhadaGrp";
26
- import { OhadaPlan } from "./entities/comptas/OhadaPlan";
27
- import { OhadaSubCat } from "./entities/comptas/OhadaSubCat";
28
- import { Docu } from "./entities/docs/Docu";
29
- import { DocuCat } from "./entities/docs/DocuCat";
30
- import { Faq } from "./entities/docs/Faq";
31
- import { FaqCat } from "./entities/docs/FaqCat";
32
- import { Memo } from "./entities/docs/Memo";
33
- import { MemoCat } from "./entities/docs/MemoCat";
34
- import { Mail } from "./entities/mails/Mail";
35
- import { MailMass } from "./entities/mails/MailMass";
36
- import { MsgAlert } from "./entities/mails/MsgAlert";
37
- import { MsgChat } from "./entities/mails/MsgChat";
38
- import { Product } from "./entities/products/Product";
39
- import { ProductAgcy } from "./entities/products/ProductAgcy";
40
- import { ProductAmm } from "./entities/products/ProductAmm";
41
- import { ProductBuy } from "./entities/products/ProductBuy";
42
- import { ProductCat } from "./entities/products/ProductCat";
43
- import { ProductDci } from "./entities/products/ProductDci";
44
- import { ProductDepot } from "./entities/products/ProductDepot";
45
- import { ProductDos } from "./entities/products/ProductDos";
46
- import { ProductFg } from "./entities/products/ProductFg";
47
- import { ProductIn } from "./entities/products/ProductIn";
48
- import { ProductInOut } from "./entities/products/ProductInOut";
49
- import { ProductInventory } from "./entities/products/ProductInventory";
50
- import { ProductLabo } from "./entities/products/ProductLabo";
51
- import { ProductLoc } from "./entities/products/ProductLoc";
52
- import { ProductMvt } from "./entities/products/ProductMvt";
53
- import { ProductMvtInventory } from "./entities/products/ProductMvtInventory";
54
- import { ProductOutReason } from "./entities/products/ProductOutReason";
55
- import { ProductPromo } from "./entities/products/ProductPromo";
56
- import { ProductPvd } from "./entities/products/ProductPvd";
57
- import { ProductSof } from "./entities/products/ProductSof";
58
- import { ProductStore } from "./entities/products/ProductStore";
59
- import { ProductTcl } from "./entities/products/ProductTcl";
60
- import { ProductTclGrp } from "./entities/products/ProductTclGrp";
61
- import { ProductTransfert } from "./entities/products/ProductTransfert";
62
- import { ProductWanted } from "./entities/products/ProductWanted";
63
- import { CartItem } from "./entities/sales/CartItem";
64
- import { DelideryProcess } from "./entities/sales/DeliveryProcess";
65
- import { SaleTreatStatus } from "./entities/sales/enums/SaleTreatStatus";
66
- import { Sale } from "./entities/sales/Sale";
67
- import { SaleDelivery } from "./entities/sales/SaleDelivery";
68
- import { SaleInfo } from "./entities/sales/SaleInfo";
69
- import { SaleItems } from "./entities/sales/SaleItems";
70
- import { SaleProduct } from "./entities/sales/SaleProduct";
71
- import { SaleProductLot } from "./entities/sales/SaleProductLot";
72
- import { SaleProductQtityIssue } from "./entities/sales/SaleProductQtityIssue";
73
- import { SaleShop } from "./entities/sales/SaleShop";
74
- import { ShopCart } from "./entities/sales/ShopCart";
75
- import { Todo } from "./entities/utilities/Todo";
76
- import { Vehicle } from "./entities/utilities/Vehicle";
77
- import { Wish } from "./entities/utilities/Wish";
78
- import { City } from "./entities/world/City";
79
- import { Continent } from "./entities/world/Continent";
80
- import { Country } from "./entities/world/Country";
81
- import { Department } from "./entities/world/Department";
82
- import { Quarter } from "./entities/world/Quarter";
83
- import { Region } from "./entities/world/Region";
84
1
  import { NaAc } from "./shared/NaAc";
85
2
  import { NaCoAc } from "./shared/NaCoAc";
86
3
  import { NaCoShortAc } from "./shared/NaCoShortAc";
87
4
  import { colNa, colNaCo, colNaCoSh, FormProps, HeaderTableColumnType, IPath, MenuItemType } from "./types/Type";
88
- export { AuthTag, AuthTagCat, Docu, DocuCat, Faq, FaqCat, Memo, MemoCat, NaAc, NaCoAc, NaCoShortAc, Buy, BuyCart, BuyItem, BuyItems, Mail, MailMass, MsgAlert, MsgChat, Account, Bank, Currency, Deposit, Feed, Spent, Entry, EntryAccount, EntryCat, EntryLine, OhadaCat, OhadaGrp, OhadaPlan, OhadaSubCat, CartItem, DelideryProcess, Sale, SaleDelivery, SaleInfo, SaleItems, SaleProduct, SaleProductLot, SaleProductQtityIssue, SaleShop, SaleTreatStatus, ShopCart, Product, ProductAgcy, ProductAmm, ProductBuy, ProductCat, ProductDci, ProductDepot, ProductDos, ProductFg, ProductIn, ProductInOut, ProductInventory, ProductLabo, ProductLoc, ProductMvt, ProductMvtInventory, ProductOutReason, ProductPromo, ProductPvd, ProductSof, ProductStore, ProductTcl, ProductTclGrp, ProductTransfert, ProductWanted, Bill, BillLine, BillPayment, BillPaymentMethod, CBillPeriod, EBillPeriod, EPayMethod, Todo, Vehicle, Wish, City, Continent, Country, Department, Quarter, Region, MenuItemType, HeaderTableColumnType, IPath, colNa, colNaCo, colNaCoSh, FormProps, };
5
+ export * from "./entities/bills/index";
6
+ export * from "./entities/buys/index";
7
+ export * from "./entities/comptas/index";
8
+ export * from "./entities/sales/index";
9
+ export * from "./entities/users/index";
10
+ export * from "./entities/world/index";
11
+ export * from "./entities/cashs/index";
12
+ export * from "./entities/auth/index";
13
+ export * from "./entities/docs/index";
14
+ export * from "./entities/mails/index";
15
+ export * from "./entities/products/index";
16
+ export * from "./entities/utilities/index";
17
+ export { NaAc, NaCoAc, NaCoShortAc, MenuItemType, HeaderTableColumnType, IPath, colNa, colNaCo, colNaCoSh, FormProps };
@@ -1,22 +1,14 @@
1
- import { CBillPeriod } from "./entities/bills/CBillPeriod";
2
- import { EBillPeriod } from "./entities/bills/EBillPeriod";
3
- import { EPayMethod } from "./entities/bills/EPayMethod";
4
- import { BuyItems } from "./entities/buys/BuyItems";
5
- import { ProductPromo } from "./entities/products/ProductPromo";
6
- import { SaleTreatStatus } from "./entities/sales/enums/SaleTreatStatus";
7
- import { SaleItems } from "./entities/sales/SaleItems";
8
- import { SaleProduct } from "./entities/sales/SaleProduct";
9
- import { SaleProductLot } from "./entities/sales/SaleProductLot";
10
- import { SaleShop } from "./entities/sales/SaleShop";
11
- import { ShopCart } from "./entities/sales/ShopCart";
12
- import { Todo } from "./entities/utilities/Todo";
13
- import { Wish } from "./entities/utilities/Wish";
14
- import { City } from "./entities/world/City";
15
- import { Continent } from "./entities/world/Continent";
16
- import { Region } from "./entities/world/Region";
17
1
  import { colNa, colNaCo, colNaCoSh } from "./types/Type";
18
- export { BuyItems, SaleItems, SaleProduct, SaleProductLot, SaleShop, SaleTreatStatus, ShopCart, ProductPromo, CBillPeriod, EBillPeriod, EPayMethod,
19
- // ------ utilities ------
20
- Todo, Wish,
21
- // ------ world ------
22
- City, Continent, Region, colNa, colNaCo, colNaCoSh, };
2
+ export * from "./entities/bills/index";
3
+ export * from "./entities/buys/index";
4
+ export * from "./entities/comptas/index";
5
+ export * from "./entities/sales/index";
6
+ export * from "./entities/users/index";
7
+ export * from "./entities/world/index";
8
+ export * from "./entities/cashs/index";
9
+ export * from "./entities/auth/index";
10
+ export * from "./entities/docs/index";
11
+ export * from "./entities/mails/index";
12
+ export * from "./entities/products/index";
13
+ export * from "./entities/utilities/index";
14
+ export { colNa, colNaCo, colNaCoSh };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.2.17",
3
+ "version": "1.2.20",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -1 +0,0 @@
1
- export declare const HlpProduct: () => void;
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HlpProduct = void 0;
4
- const HlpProduct = () => {
5
- const productCatCode = (product, catCodes) => {
6
- return catCodes.includes(product.cat.code && product.cat.code.toLowerCase());
7
- };
8
- const qtityInAllDepots = (ins) => {
9
- return getQtitiesInDepots(ins);
10
- /* if (!ins.length) {return 0; }
11
-
12
- ins = ins.filter( x => x.depot && x.depot.name.toLocaleLowerCase() !== 'arrivage');
13
- return ins.reduce((prev, curr: ProductIn) => {
14
- return +prev + (+curr.qtity);
15
- }, 0); */
16
- };
17
- const stockValueInDepots = (product, exceptDepots = []) => {
18
- if (!product.ins.length) {
19
- return 0;
20
- }
21
- let ins = product.ins;
22
- ins = ins.filter((x) => x.depot && !["arrivage", ...exceptDepots].includes(x.depot.name.toLocaleLowerCase()));
23
- return ins.reduce((prev, curr) => {
24
- var _a;
25
- // return +prev + (+curr.qtity * (+product.stores?.pghtPrice || 0));
26
- return +prev + +curr.qtity * (+((_a = product.stores[0]) === null || _a === void 0 ? void 0 : _a.pghtPrice) || 0);
27
- }, 0);
28
- // return formatToString(Math.floor(value: string | number));
29
- };
30
- const getQtitiesInDepots = (ins, exceptDepots = []) => {
31
- if (!ins.length) {
32
- return 0;
33
- }
34
- ins = ins.filter((x) => x.depot && x.depot.hasViewStock && !["arrivage", ...exceptDepots].includes(x.depot.name.toLocaleLowerCase()));
35
- // ins = ins.filter(x => x.depot && x.depot.hasViewStock);
36
- return ins.reduce((prev, curr) => {
37
- return +prev + +curr.qtity;
38
- }, 0);
39
- };
40
- const qtityInAllDepotsExeptStore = (ins, stores) => {
41
- return getQtitiesInDepots(ins, stores);
42
- /* if (!ins?.length) {return 0; }
43
-
44
- ins = ins.filter( x => x.depot && x.depot.name.toLocaleLowerCase() !== storeName && x.depot.name.toLocaleLowerCase() !== 'arrivage');
45
- return ins.reduce((prev, curr: ProductIn) => {
46
- return prev + (+curr.qtity);
47
- }, 0); */
48
- };
49
- const getStockSalable = (product) => {
50
- const stockAllSalable = qtityInAllDepots(product.ins) - (+product.stores[0].stockReserved || 0);
51
- const stockStore = getStockStore(product);
52
- let stockSalable = 0;
53
- if (sessionStorage.getItem("isProforma") === "isProforma") {
54
- stockSalable = stockAllSalable;
55
- }
56
- else {
57
- if (stockAllSalable <= stockStore) {
58
- stockSalable = stockAllSalable;
59
- }
60
- if (stockAllSalable > stockStore) {
61
- stockSalable = stockStore;
62
- }
63
- }
64
- return stockSalable || 0;
65
- };
66
- // ------ sort product stock ------
67
- const onSortStock = (sortStock, filteredProducts) => {
68
- // sortStock = !sortStock;
69
- filteredProducts.sort((a, b) => {
70
- // const keyA = a.stock;
71
- const keyA = getStockStore(a);
72
- // const keyB = b.stock;
73
- const keyB = getStockStore(b);
74
- return sortStock ? keyB - keyA : keyA - keyB;
75
- });
76
- };
77
- // product|stock:'store'
78
- // ------ sort cession price ------
79
- const onSortPc = (sortPc, filteredProducts) => {
80
- // sortPc = !sortPc;
81
- filteredProducts.sort((a, b) => {
82
- const keyA = a.stores[0].salePrice;
83
- const keyB = b.stores[0].salePrice;
84
- return sortPc ? keyB - keyA : keyA - keyB;
85
- });
86
- };
87
- const onSortPght = (sortPght, filteredProducts) => {
88
- // this.sortPght = !this.sortPght;
89
- filteredProducts.sort((a, b) => {
90
- const keyA = a.stores[0].pghtPrice;
91
- const keyB = b.stores[0].pghtPrice;
92
- return sortPght ? keyB - keyA : keyA - keyB;
93
- });
94
- };
95
- const sortDesignation = (sortDesignation, filteredProducts) => {
96
- // this.sortDesignation = !this.sortDesignation;
97
- filteredProducts.sort((a, b) => {
98
- return sortDesignation ? b.designation.localeCompare(a.designation) : a.designation.localeCompare(b.designation);
99
- });
100
- };
101
- const getStockStore = (product) => {
102
- let stock = 0;
103
- if (product === null || product === void 0 ? void 0 : product.ins) {
104
- for (const pdtIn of product === null || product === void 0 ? void 0 : product.ins) {
105
- // if(pdtIn.depot.name.toLocaleLowerCase() === environment.host.toLocaleLowerCase()) {
106
- if (pdtIn.depot.main === "master") {
107
- stock += pdtIn.qtity;
108
- }
109
- }
110
- }
111
- // return stock - (+product.stores[0].stockReserved|| 0)
112
- return stock;
113
- // if(!product.ins.length) {return 0}
114
- /* return product.ins.reduce((prev, curr: ProductIn) => {
115
- return prev + +curr.qtity
116
- }, 0) */
117
- };
118
- /* getLotsToString(ins: ProductIn[]) {
119
- let lots: string[] = [];
120
- for (const pdtIn of ins) {
121
- if (pdtIn.lot) {
122
- lots.push(pdtIn.lot + " =>" + moment(pdtIn.expirationDate).format("DD/MM/YYYY"));
123
- }
124
- }
125
- return [...new Set(lots)];
126
- } */
127
- };
128
- exports.HlpProduct = HlpProduct;
129
- // export default new HlpProduct();
130
- // export default { qtityInAllDepots };
@@ -1,14 +0,0 @@
1
- export interface MenuItemType {
2
- key: string;
3
- label: string;
4
- isTitle?: boolean;
5
- icon?: string;
6
- url?: string;
7
- badge?: {
8
- variant: string;
9
- text: string;
10
- };
11
- parentKey?: string;
12
- target?: string;
13
- children?: MenuItemType[];
14
- }
@@ -1 +0,0 @@
1
- export declare const HlpProduct: () => void;
@@ -1,126 +0,0 @@
1
- export const HlpProduct = () => {
2
- const productCatCode = (product, catCodes) => {
3
- return catCodes.includes(product.cat.code && product.cat.code.toLowerCase());
4
- };
5
- const qtityInAllDepots = (ins) => {
6
- return getQtitiesInDepots(ins);
7
- /* if (!ins.length) {return 0; }
8
-
9
- ins = ins.filter( x => x.depot && x.depot.name.toLocaleLowerCase() !== 'arrivage');
10
- return ins.reduce((prev, curr: ProductIn) => {
11
- return +prev + (+curr.qtity);
12
- }, 0); */
13
- };
14
- const stockValueInDepots = (product, exceptDepots = []) => {
15
- if (!product.ins.length) {
16
- return 0;
17
- }
18
- let ins = product.ins;
19
- ins = ins.filter((x) => x.depot && !["arrivage", ...exceptDepots].includes(x.depot.name.toLocaleLowerCase()));
20
- return ins.reduce((prev, curr) => {
21
- var _a;
22
- // return +prev + (+curr.qtity * (+product.stores?.pghtPrice || 0));
23
- return +prev + +curr.qtity * (+((_a = product.stores[0]) === null || _a === void 0 ? void 0 : _a.pghtPrice) || 0);
24
- }, 0);
25
- // return formatToString(Math.floor(value: string | number));
26
- };
27
- const getQtitiesInDepots = (ins, exceptDepots = []) => {
28
- if (!ins.length) {
29
- return 0;
30
- }
31
- ins = ins.filter((x) => x.depot && x.depot.hasViewStock && !["arrivage", ...exceptDepots].includes(x.depot.name.toLocaleLowerCase()));
32
- // ins = ins.filter(x => x.depot && x.depot.hasViewStock);
33
- return ins.reduce((prev, curr) => {
34
- return +prev + +curr.qtity;
35
- }, 0);
36
- };
37
- const qtityInAllDepotsExeptStore = (ins, stores) => {
38
- return getQtitiesInDepots(ins, stores);
39
- /* if (!ins?.length) {return 0; }
40
-
41
- ins = ins.filter( x => x.depot && x.depot.name.toLocaleLowerCase() !== storeName && x.depot.name.toLocaleLowerCase() !== 'arrivage');
42
- return ins.reduce((prev, curr: ProductIn) => {
43
- return prev + (+curr.qtity);
44
- }, 0); */
45
- };
46
- const getStockSalable = (product) => {
47
- const stockAllSalable = qtityInAllDepots(product.ins) - (+product.stores[0].stockReserved || 0);
48
- const stockStore = getStockStore(product);
49
- let stockSalable = 0;
50
- if (sessionStorage.getItem("isProforma") === "isProforma") {
51
- stockSalable = stockAllSalable;
52
- }
53
- else {
54
- if (stockAllSalable <= stockStore) {
55
- stockSalable = stockAllSalable;
56
- }
57
- if (stockAllSalable > stockStore) {
58
- stockSalable = stockStore;
59
- }
60
- }
61
- return stockSalable || 0;
62
- };
63
- // ------ sort product stock ------
64
- const onSortStock = (sortStock, filteredProducts) => {
65
- // sortStock = !sortStock;
66
- filteredProducts.sort((a, b) => {
67
- // const keyA = a.stock;
68
- const keyA = getStockStore(a);
69
- // const keyB = b.stock;
70
- const keyB = getStockStore(b);
71
- return sortStock ? keyB - keyA : keyA - keyB;
72
- });
73
- };
74
- // product|stock:'store'
75
- // ------ sort cession price ------
76
- const onSortPc = (sortPc, filteredProducts) => {
77
- // sortPc = !sortPc;
78
- filteredProducts.sort((a, b) => {
79
- const keyA = a.stores[0].salePrice;
80
- const keyB = b.stores[0].salePrice;
81
- return sortPc ? keyB - keyA : keyA - keyB;
82
- });
83
- };
84
- const onSortPght = (sortPght, filteredProducts) => {
85
- // this.sortPght = !this.sortPght;
86
- filteredProducts.sort((a, b) => {
87
- const keyA = a.stores[0].pghtPrice;
88
- const keyB = b.stores[0].pghtPrice;
89
- return sortPght ? keyB - keyA : keyA - keyB;
90
- });
91
- };
92
- const sortDesignation = (sortDesignation, filteredProducts) => {
93
- // this.sortDesignation = !this.sortDesignation;
94
- filteredProducts.sort((a, b) => {
95
- return sortDesignation ? b.designation.localeCompare(a.designation) : a.designation.localeCompare(b.designation);
96
- });
97
- };
98
- const getStockStore = (product) => {
99
- let stock = 0;
100
- if (product === null || product === void 0 ? void 0 : product.ins) {
101
- for (const pdtIn of product === null || product === void 0 ? void 0 : product.ins) {
102
- // if(pdtIn.depot.name.toLocaleLowerCase() === environment.host.toLocaleLowerCase()) {
103
- if (pdtIn.depot.main === "master") {
104
- stock += pdtIn.qtity;
105
- }
106
- }
107
- }
108
- // return stock - (+product.stores[0].stockReserved|| 0)
109
- return stock;
110
- // if(!product.ins.length) {return 0}
111
- /* return product.ins.reduce((prev, curr: ProductIn) => {
112
- return prev + +curr.qtity
113
- }, 0) */
114
- };
115
- /* getLotsToString(ins: ProductIn[]) {
116
- let lots: string[] = [];
117
- for (const pdtIn of ins) {
118
- if (pdtIn.lot) {
119
- lots.push(pdtIn.lot + " =>" + moment(pdtIn.expirationDate).format("DD/MM/YYYY"));
120
- }
121
- }
122
- return [...new Set(lots)];
123
- } */
124
- };
125
- // export default new HlpProduct();
126
- // export default { qtityInAllDepots };
@@ -1,14 +0,0 @@
1
- export interface MenuItemType {
2
- key: string;
3
- label: string;
4
- isTitle?: boolean;
5
- icon?: string;
6
- url?: string;
7
- badge?: {
8
- variant: string;
9
- text: string;
10
- };
11
- parentKey?: string;
12
- target?: string;
13
- children?: MenuItemType[];
14
- }