asv-hlps 1.4.63 → 1.4.64

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.
@@ -2,6 +2,7 @@ import Currency from "../../cashs/models/Currency";
2
2
  import EInOutMotive from "../../shared/models/EInOutMotive";
3
3
  import Ste from "../../users/models/Ste";
4
4
  import User from "../../users/models/User";
5
+ import ProductDepot from "./ProductDepot";
5
6
  export default interface ProductMvt {
6
7
  id?: number;
7
8
  createdAt?: Date;
@@ -21,4 +22,6 @@ export default interface ProductMvt {
21
22
  isDone?: boolean;
22
23
  tsfMan?: User;
23
24
  validedMan?: User;
25
+ depot?: ProductDepot;
26
+ depotId?: number;
24
27
  }
@@ -10,10 +10,10 @@ const getNbProductsOnSale = (sale) => {
10
10
  exports.getNbProductsOnSale = getNbProductsOnSale;
11
11
  const getTotalTvaOnSale = (sale, dlvr = false) => {
12
12
  return sale.saleProducts.reduce((prev, curr) => {
13
- if (curr.unitPrice === 0) {
13
+ if ((curr === null || curr === void 0 ? void 0 : curr.unitPrice) === 0) {
14
14
  return 0;
15
15
  }
16
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice);
16
+ const unitPrice = (curr === null || curr === void 0 ? void 0 : curr.unitPrice) > 0 ? curr.unitPrice : (0, product_1.unitPriceByClientCat)(curr.product, sale.client, curr.speUnitPrice) || 0;
17
17
  return !dlvr
18
18
  ? Math.ceil(prev + unitPrice * (+curr.tva / 100) * +curr.qtityOdr)
19
19
  : // ? Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityOdr)
@@ -123,3 +123,6 @@ export declare const checkObjInArray: (objs: any[], checkProp: string | number,
123
123
  export declare const pathName: (location: any) => any;
124
124
  export declare const nthIndexOf: (str: string, charToFind: string, nthPosition?: number) => number;
125
125
  export declare const partOfStringBetweenTwoSpeChar: (str: string, position1: number, position2: number, char?: string) => string;
126
+ export declare const groupedByProp: (tobs: object[], prop: string, groupKey?: string, groupArrayKey?: string) => {
127
+ [x: string]: unknown;
128
+ }[];
package/lib/cjs/utils.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.dateNth = exports.dateNthMonth = exports.dateNthDay = exports.dateNthWeek = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.reformatDates = exports.firstDayOfDate = exports.dateToString = exports.dateDiff = exports.dateFormatter = exports.replaceSpacesWith = exports.replaceAllIn = exports.toPlural = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeSpecialCharsAndSpaces = exports.refGenerator = exports.removeAMPM = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.removeAccent = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.currencyFormatter = exports.checkAuth = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjectsGrouped = exports.duplicateObjects = exports.removeDuplicateValues = exports.removeDuplicateObjects = exports.getRandomColor = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.formatDateFirstDayFr = exports.isEmpty = void 0;
7
- exports.partOfStringBetweenTwoSpeChar = exports.nthIndexOf = exports.pathName = exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = void 0;
7
+ exports.groupedByProp = exports.partOfStringBetweenTwoSpeChar = exports.nthIndexOf = exports.pathName = exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = void 0;
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  const dayOfYear_1 = __importDefault(require("dayjs/plugin/dayOfYear"));
10
10
  const isSameOrBefore_1 = __importDefault(require("dayjs/plugin/isSameOrBefore"));
@@ -870,3 +870,14 @@ const partOfStringBetweenTwoSpeChar = (str, position1, position2, char = "/") =>
870
870
  return str.substring(firstSlashPosition + 1, secondSlashPosition);
871
871
  };
872
872
  exports.partOfStringBetweenTwoSpeChar = partOfStringBetweenTwoSpeChar;
873
+ const groupedByProp = (tobs, prop, groupKey = "tob", groupArrayKey = "arr") => {
874
+ const groupedObj = tobs.reduce((prev, curr) => {
875
+ prev[curr[prop]] = [...(prev[curr[prop]] || []), curr];
876
+ return prev;
877
+ }, {});
878
+ return Object.entries(groupedObj).map(([key, arr]) => ({
879
+ [groupKey]: key,
880
+ [groupArrayKey]: arr,
881
+ }));
882
+ };
883
+ exports.groupedByProp = groupedByProp;
@@ -2,6 +2,7 @@ import Currency from "../../cashs/models/Currency";
2
2
  import EInOutMotive from "../../shared/models/EInOutMotive";
3
3
  import Ste from "../../users/models/Ste";
4
4
  import User from "../../users/models/User";
5
+ import ProductDepot from "./ProductDepot";
5
6
  export default interface ProductMvt {
6
7
  id?: number;
7
8
  createdAt?: Date;
@@ -21,4 +22,6 @@ export default interface ProductMvt {
21
22
  isDone?: boolean;
22
23
  tsfMan?: User;
23
24
  validedMan?: User;
25
+ depot?: ProductDepot;
26
+ depotId?: number;
24
27
  }
@@ -6,10 +6,10 @@ export const getNbProductsOnSale = (sale) => {
6
6
  };
7
7
  export const getTotalTvaOnSale = (sale, dlvr = false) => {
8
8
  return sale.saleProducts.reduce((prev, curr) => {
9
- if (curr.unitPrice === 0) {
9
+ if ((curr === null || curr === void 0 ? void 0 : curr.unitPrice) === 0) {
10
10
  return 0;
11
11
  }
12
- const unitPrice = curr.unitPrice > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice);
12
+ const unitPrice = (curr === null || curr === void 0 ? void 0 : curr.unitPrice) > 0 ? curr.unitPrice : unitPriceByClientCat(curr.product, sale.client, curr.speUnitPrice) || 0;
13
13
  return !dlvr
14
14
  ? Math.ceil(prev + unitPrice * (+curr.tva / 100) * +curr.qtityOdr)
15
15
  : // ? Math.ceil(prev + unitPrice * (+curr.product.tva / 100) * +curr.qtityOdr)
@@ -123,3 +123,6 @@ export declare const checkObjInArray: (objs: any[], checkProp: string | number,
123
123
  export declare const pathName: (location: any) => any;
124
124
  export declare const nthIndexOf: (str: string, charToFind: string, nthPosition?: number) => number;
125
125
  export declare const partOfStringBetweenTwoSpeChar: (str: string, position1: number, position2: number, char?: string) => string;
126
+ export declare const groupedByProp: (tobs: object[], prop: string, groupKey?: string, groupArrayKey?: string) => {
127
+ [x: string]: unknown;
128
+ }[];
package/lib/esm/utils.js CHANGED
@@ -770,3 +770,13 @@ export const partOfStringBetweenTwoSpeChar = (str, position1, position2, char =
770
770
  const secondSlashPosition = nthIndexOf(str, char, position2);
771
771
  return str.substring(firstSlashPosition + 1, secondSlashPosition);
772
772
  };
773
+ export const groupedByProp = (tobs, prop, groupKey = "tob", groupArrayKey = "arr") => {
774
+ const groupedObj = tobs.reduce((prev, curr) => {
775
+ prev[curr[prop]] = [...(prev[curr[prop]] || []), curr];
776
+ return prev;
777
+ }, {});
778
+ return Object.entries(groupedObj).map(([key, arr]) => ({
779
+ [groupKey]: key,
780
+ [groupArrayKey]: arr,
781
+ }));
782
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.63",
3
+ "version": "1.4.64",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -18,28 +18,28 @@
18
18
  "devDependencies": {
19
19
  "@types/express": "^5.0.3",
20
20
  "@types/jwt-decode": "^3.1.0",
21
- "@types/lodash": "^4.17.19",
21
+ "@types/lodash": "^4.17.20",
22
22
  "@types/pdfmake": "^0.2.11",
23
23
  "@types/randomatic": "^3.1.5",
24
- "@types/react": "^19.1.8"
24
+ "@types/react": "^19.1.17"
25
25
  },
26
26
  "dependencies": {
27
- "@tanstack/react-query": "^5.81.5",
28
- "axios": "^1.10.0",
27
+ "@tanstack/react-query": "^5.90.2",
28
+ "axios": "^1.12.2",
29
29
  "class-validator": "^0.14.2",
30
30
  "classnames": "^2.5.1",
31
- "dayjs": "^1.11.13",
31
+ "dayjs": "^1.11.18",
32
32
  "express": "^4.21.2",
33
33
  "i": "^0.3.7",
34
34
  "jwt-decode": "^4.0.0",
35
35
  "lodash": "^4.17.21",
36
- "npm": "^11.4.2",
36
+ "npm": "^11.6.1",
37
37
  "pdfmake": "^0.2.20",
38
38
  "randomatic": "^3.1.1",
39
39
  "remove-accents": "^0.5.0",
40
- "typeorm": "^0.3.25",
41
- "typescript": "^5.8.3",
42
- "yup": "^1.6.1",
43
- "zustand": "^5.0.6"
40
+ "typeorm": "^0.3.27",
41
+ "typescript": "^5.9.3",
42
+ "yup": "^1.7.1",
43
+ "zustand": "^5.0.8"
44
44
  }
45
45
  }