@silexpert/core 1.0.154 → 1.0.155

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 (35) hide show
  1. package/es/types/Enum/PrestationType.d.ts +5 -2626
  2. package/es/types/Enum/PrestationType.d.ts.map +1 -1
  3. package/es/types/Enum/PrestationType.js +1674 -1511
  4. package/es/types/Enum/PrestationType.js.map +1 -1
  5. package/es/types/Interface/models/IExercicePrestation.d.ts +2 -1
  6. package/es/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  7. package/es/types/Interface/models/IExercicePrestation.js.map +1 -1
  8. package/es/types/Interface/models/IPrestation.d.ts +13 -10
  9. package/es/types/Interface/models/IPrestation.d.ts.map +1 -1
  10. package/es/types/Interface/models/IPrestation.js.map +1 -1
  11. package/es/types/Interface/models/IPrestationList.d.ts +3 -2
  12. package/es/types/Interface/models/IPrestationList.d.ts.map +1 -1
  13. package/es/types/Interface/models/IPrestationList.js.map +1 -1
  14. package/es/types/Interface/models/ITerminationList.d.ts +7 -4
  15. package/es/types/Interface/models/ITerminationList.d.ts.map +1 -1
  16. package/es/types/Interface/models/ITerminationList.js.map +1 -1
  17. package/es/utils/prestation.d.ts +4 -1
  18. package/es/utils/prestation.d.ts.map +1 -1
  19. package/es/utils/prestation.js +18 -1
  20. package/es/utils/prestation.js.map +1 -1
  21. package/js/types/Enum/PrestationType.js +1837 -1674
  22. package/js/types/Enum/PrestationType.js.map +1 -1
  23. package/js/types/Interface/models/IExercicePrestation.js.map +1 -1
  24. package/js/types/Interface/models/IPrestation.js.map +1 -1
  25. package/js/types/Interface/models/IPrestationList.js.map +1 -1
  26. package/js/types/Interface/models/ITerminationList.js.map +1 -1
  27. package/js/utils/prestation.js +17 -1
  28. package/js/utils/prestation.js.map +1 -1
  29. package/package.json +1 -1
  30. package/ts/types/Enum/PrestationType.ts +1681 -1512
  31. package/ts/types/Interface/models/IExercicePrestation.ts +2 -1
  32. package/ts/types/Interface/models/IPrestation.ts +13 -10
  33. package/ts/types/Interface/models/IPrestationList.ts +3 -2
  34. package/ts/types/Interface/models/ITerminationList.ts +7 -4
  35. package/ts/utils/prestation.ts +23 -1
@@ -1 +1 @@
1
- {"version":3,"file":"IExercicePrestation.js","names":[],"sources":["../../../../ts/types/Interface/models/IExercicePrestation.ts"],"sourcesContent":["import { IPrestation } from './IPrestation';\nimport { IBalanceSheet } from './IBalanceSheet';\nimport { IExercice } from '../..';\n\n// exercicesPrestations\nexport interface IExercicePrestation {\n id?: number;\n priceHt: number | null;\n totalPrestation: number | null;\n monthNumber: number | null;\n amountSocial: number | null;\n monthOffers: number | null;\n isInCA: boolean;\n idBalanceSheet: number | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n idExercice: number | null;\n idPrestation: number | null;\n\n // Associations\n prestation: IPrestation;\n balanceSheet?: IBalanceSheet;\n exercice?: IExercice;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"IExercicePrestation.js","names":[],"sources":["../../../../ts/types/Interface/models/IExercicePrestation.ts"],"sourcesContent":["import { IPrestation } from './IPrestation';\nimport { IBalanceSheet } from './IBalanceSheet';\nimport { IExercice } from '../..';\n\n// exercicesPrestations\nexport interface IExercicePrestation {\n id?: number;\n priceHt: number | null;\n customerPriceHt: number | null;\n totalPrestation: number | null;\n monthNumber: number | null;\n amountSocial: number | null;\n monthOffers: number | null;\n isInCA: boolean;\n idBalanceSheet: number | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n idExercice: number | null;\n idPrestation: number | null;\n\n // Associations\n prestation?: IPrestation;\n balanceSheet?: IBalanceSheet;\n exercice?: IExercice;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"IPrestation.js","names":[],"sources":["../../../../ts/types/Interface/models/IPrestation.ts"],"sourcesContent":["import { IExercice } from './IExercice';\nimport { IPayment } from './IPayment';\nimport { IPrestationList } from './IPrestationList';\nimport { IPrestationComplementary } from './IPrestationComplementary';\nimport { ISociety } from './ISociety';\nimport { IExercicePrestation } from './IExercicePrestation';\nimport { ICustomerSignature } from './ICustomerSignature';\n\n// prestations\nexport interface IPrestation {\n id?: number;\n numPrestation: string | null;\n statePrevi: number | null;\n archive: boolean;\n withStatuteDrafted: boolean | null;\n withCaptainContrat: boolean | null;\n withStatutesApportNature: boolean | null;\n withStatutesAutorisationTutelle: boolean | null;\n withStatutesFileAccre: boolean | null;\n paid: boolean | null;\n signed: boolean | null;\n toAdministratif: number | null;\n goToAdministratif: Date | null;\n administratifStatus: number;\n toConstitution: number;\n dateValidPrestation: Date | null;\n goToOnboarding: Date | null;\n goToClient: Date | null;\n state: boolean;\n commentPdf: string | null;\n token: string | null;\n size: number | null;\n inProgress: number | null;\n idSociety: number;\n idPrestationList: number;\n idPrestationComplementary: number | null;\n gestionJuridique: boolean;\n idPrestationSocial: number | null;\n idPrestationJuridique: number | null;\n idPrestationCreation: number | null;\n totalAmount?: number;\n discountAmount?: number;\n debitType?: string;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n deletedAt?: Date | null;\n\n // Associations\n exercices: IExercice[];\n prestationsPayments: IPayment[];\n prestationsList: IPrestationList;\n prestationsComplementary: IPrestationComplementary;\n prestationJuridique: IPrestation;\n prestationSocial: IPrestation;\n prestationCreation: IPrestation;\n societiesPrestations: ISociety;\n prestationsDetailsBeforeExercice: IExercicePrestation[];\n customersSignatures: ICustomerSignature[];\n}\n"],"mappings":""}
1
+ {"version":3,"file":"IPrestation.js","names":[],"sources":["../../../../ts/types/Interface/models/IPrestation.ts"],"sourcesContent":["import { IExercice } from './IExercice';\nimport { IPayment } from './IPayment';\nimport { IPrestationList } from './IPrestationList';\nimport { IPrestationComplementary } from './IPrestationComplementary';\nimport { ISociety } from './ISociety';\nimport { IExercicePrestation } from './IExercicePrestation';\nimport { ICustomerSignature } from './ICustomerSignature';\nimport { ITerminationList } from './ITerminationList';\n\n// prestations\nexport interface IPrestation {\n id?: number;\n numPrestation: string | null;\n statePrevi: number | null;\n archive: boolean;\n withStatuteDrafted: boolean | null;\n withCaptainContrat: boolean | null;\n withStatutesApportNature: boolean | null;\n withStatutesAutorisationTutelle: boolean | null;\n withStatutesFileAccre: boolean | null;\n paid: boolean | null;\n signed: boolean | null;\n toAdministratif: number | null;\n goToAdministratif: Date | null;\n administratifStatus: number;\n toConstitution: number;\n dateValidPrestation: Date | null;\n goToOnboarding: Date | null;\n goToClient: Date | null;\n scoring: number | null;\n state: boolean;\n commentPdf: string | null;\n token: string | null;\n size: number | null;\n inProgress: number | null;\n idSociety: number;\n idPrestationList: number;\n idPrestationComplementary: number | null;\n gestionJuridique: boolean;\n idPrestationSocial: number | null;\n idPrestationJuridique: number | null;\n idPrestationCreation: number | null;\n totalAmount?: number;\n discountAmount?: number;\n debitType?: string;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n deletedAt?: Date | null;\n\n // Associations\n exercices?: IExercice[];\n prestationsPayments?: IPayment[];\n prestationsList?: IPrestationList;\n prestationsComplementary?: IPrestationComplementary;\n prestationJuridique?: IPrestation;\n prestationSocial?: IPrestation;\n prestationCreation?: IPrestation;\n societiesPrestations?: ISociety;\n prestationsDetailsBeforeExercice?: IExercicePrestation[];\n customersSignatures?: ICustomerSignature[];\n terminationsList?: ITerminationList;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"IPrestationList.js","names":[],"sources":["../../../../ts/types/Interface/models/IPrestationList.ts"],"sourcesContent":["// prestationsList\nexport interface IPrestationList {\n id?: number;\n name: string;\n isComptable: boolean;\n isJuridique: boolean;\n isSocial: boolean;\n isAttestation: boolean;\n inAverageCart: boolean;\n isBack: boolean;\n price: number | null;\n isCatalog: boolean;\n hidden: boolean;\n isComplementary: boolean;\n signaturePosition: string | null;\n signaturePage: number | null;\n textDefault: string | null;\n color: string | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"IPrestationList.js","names":[],"sources":["../../../../ts/types/Interface/models/IPrestationList.ts"],"sourcesContent":["// prestationsList\nexport interface IPrestationList {\n id?: number;\n name: string;\n isComptable: boolean;\n isJuridique: boolean;\n isSocial: boolean;\n isAttestation: boolean;\n inAverageCart: boolean;\n isBack: boolean;\n price: number | null;\n isCatalog: boolean;\n hidden: boolean;\n isComplementary: boolean;\n signaturePosition: string | null;\n signaturePage: number | null;\n textDefault?: string;\n color?: string;\n point?: number;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ITerminationList.js","names":[],"sources":["../../../../ts/types/Interface/models/ITerminationList.ts"],"sourcesContent":["import { IReasonTermination } from './IReasonTermination';\nimport { ISociety } from './ISociety';\nimport { IExercice } from './IExercice';\nimport { IUser } from './IUser';\n\n// terminitionsList\nexport interface ITerminationList {\n id?: number;\n comment: string | null;\n recalledCustomer: Date | null;\n recalledCustomerBySupervisor: Date | null;\n effectiveDate: Date | null;\n idExercice: number | null;\n endContractDate: Date | null;\n refund: boolean;\n idReasonTermination: number | null;\n idSociety: number | null;\n idCollaborateur: number | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n\n // Associations\n reasonTermination: IReasonTermination;\n societiesTerminations: ISociety;\n exercice: IExercice;\n user: IUser;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"ITerminationList.js","names":[],"sources":["../../../../ts/types/Interface/models/ITerminationList.ts"],"sourcesContent":["import { IReasonTermination } from './IReasonTermination';\nimport { ISociety } from './ISociety';\nimport { IExercice } from './IExercice';\nimport { IUser } from './IUser';\nimport { IPrestation } from './IPrestation';\n\n// terminitionsList\nexport interface ITerminationList {\n id?: number;\n comment: string | null;\n recalledCustomer: Date | null;\n recalledCustomerBySupervisor: Date | null;\n effectiveDate: Date | null;\n idExercice: number | null;\n endContractDate: Date | null;\n refund: boolean;\n idReasonTermination: number | null;\n idSociety: number | null;\n idPrestation: number | null;\n idCollaborateur: number | null;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n\n // Associations\n reasonTermination?: IReasonTermination;\n societiesTerminations?: ISociety;\n exercice?: IExercice;\n user?: IUser;\n prestation?: IPrestation;\n}\n"],"mappings":""}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isExpress = exports.isCreation = exports.isOnlyJuridic = exports.isOnlySocial = exports.isOnlyPrevi = exports.isOtherSocialMission = exports.isAdditionalPresta = exports.isOtherJuridicalMissions = exports.isOtherAccountingMissions = undefined;
6
+ exports.calculateScoringOfPrestation = exports.isExpress = exports.isCreation = exports.isOnlyJuridic = exports.isOnlySocial = exports.isOnlyPrevi = exports.isOtherSocialMission = exports.isAdditionalPresta = exports.isOtherJuridicalMissions = exports.isOtherAccountingMissions = undefined;
7
7
  var _PrestationType = require("../types/Enum/PrestationType");
8
8
  const isOtherAccountingMissions = idPrestationList => [_PrestationType.PrestationType.PREVISIONNEL, _PrestationType.PrestationType.BILAN_INTERMEDIAIRE, _PrestationType.PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE, _PrestationType.PrestationType.AUTRE_MISSION_COMPTABLE, _PrestationType.PrestationType.TVS, _PrestationType.PrestationType.ETUDE_FISCALE, _PrestationType.PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);
9
9
  const isOtherJuridicalMissions = (isJuridique, isCatalog, idPrestationList) => idPrestationList !== _PrestationType.PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;
@@ -18,6 +18,21 @@ const isExpress = idPrestationList => {
18
18
  const prestaList = prestationDetailValues.find(pr => pr.id === idPrestationList);
19
19
  return !!prestaList.isBack;
20
20
  };
21
+ const calculateScoringOfPrestation = (idPrestationType, prestations) => {
22
+ // Get the list of prestations that are half price
23
+ const prestationHalfPriceList = Object.values(_PrestationType.PrestationDetail).filter(p => p.isComptable && !p.isCatalog);
24
+ const prestationHalfPriceIds = prestationHalfPriceList.map(t => t.id);
25
+ // Get the number of points for the prestation
26
+ const prestaDetails = Object.values(_PrestationType.PrestationDetail).find(prestaDetail => prestaDetail.id === idPrestationType);
27
+ const numberPoint = (prestaDetails === null || prestaDetails === void 0 ? void 0 : prestaDetails.point) || 0;
28
+ // Find the prestation with the same idPrestationList and they need to be paid and signed
29
+ const samePrestation = prestations.filter(prestation => prestation.idPrestationList === idPrestationType && prestation.paid === true && prestation.signed === true && prestation.terminationsList === null);
30
+ // If there is no prestation with the same idPrestationList, return 100% of points
31
+ if (samePrestation.length === 0) return numberPoint;
32
+ // If the prestation is in the list of half price prestation, return 50% of points
33
+ if (prestationHalfPriceIds.includes(idPrestationType)) return numberPoint * 0.5;
34
+ return 0;
35
+ };
21
36
  exports.isOtherAccountingMissions = isOtherAccountingMissions;
22
37
  exports.isOtherJuridicalMissions = isOtherJuridicalMissions;
23
38
  exports.isAdditionalPresta = isAdditionalPresta;
@@ -27,4 +42,5 @@ exports.isOnlySocial = isOnlySocial;
27
42
  exports.isOnlyJuridic = isOnlyJuridic;
28
43
  exports.isCreation = isCreation;
29
44
  exports.isExpress = isExpress;
45
+ exports.calculateScoringOfPrestation = calculateScoringOfPrestation;
30
46
  //# sourceMappingURL=prestation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.js","names":["_PrestationType","require","isOtherAccountingMissions","idPrestationList","PrestationType","PREVISIONNEL","BILAN_INTERMEDIAIRE","AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE","AUTRE_MISSION_COMPTABLE","TVS","ETUDE_FISCALE","BILAN_PREVISIONNEL","includes","isOtherJuridicalMissions","isJuridique","isCatalog","GESTION_JURIDIQUE","isOtherSocialMission","AUTRE_MISSION_SOCIALE_HORS_PAIE","isAdditionalPresta","hidden","isOnlyPrevi","filter","idPL","PV_AG","length","isOnlySocial","FRUCTUPAIE","SOCIAL","isOnlyJuridic","isCreation","CREATION_SOCIETE","isExpress","prestationDetailValues","Object","values","PrestationDetail","prestaList","find","pr","id","isBack","exports"],"sources":["../../ts/utils/prestation.ts"],"sourcesContent":["import { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean => [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique:boolean, isCatalog:boolean, idPrestationList: number): boolean => idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean => idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden:boolean, isCatalog:boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL)).length;\n\nconst isOnlySocial = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]):boolean => idPrestationList.includes(PrestationType.CREATION_SOCIETE);\n\nconst isExpress = (idPrestationList: number):boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr:any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress,\n};"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,MAAM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I3B,gBAA0B,IAAaA,gBAAgB,CAACS,QAAQ,CAACR,8BAAc,CAAC2B,gBAAgB,CAAC;AAErH,MAAMC,SAAS,GAAI7B,gBAAwB,IAAY;EACrD,MAAM8B,sBAAsB,GAAGC,MAAM,CAACC,MAAM,CAACC,gCAAgB,CAAQ;EACrE,MAAMC,UAAU,GAAGJ,sBAAsB,CAACK,IAAI,CAAEC,EAAM,IAAKA,EAAE,CAACC,EAAE,KAAKrC,gBAAgB,CAAC;EACtF,OAAO,CAAC,CAACkC,UAAU,CAACI,MAAM;AAC5B,CAAC;AAACC,OAAA,CAGAxC,yBAAyB,GAAzBA,yBAAyB;AAAAwC,OAAA,CAAE7B,wBAAwB,GAAxBA,wBAAwB;AAAA6B,OAAA,CAAEvB,kBAAkB,GAAlBA,kBAAkB;AAAAuB,OAAA,CAAEzB,oBAAoB,GAApBA,oBAAoB;AAAAyB,OAAA,CAAErB,WAAW,GAAXA,WAAW;AAAAqB,OAAA,CAAEhB,YAAY,GAAZA,YAAY;AAAAgB,OAAA,CAAEb,aAAa,GAAbA,aAAa;AAAAa,OAAA,CAAEZ,UAAU,GAAVA,UAAU;AAAAY,OAAA,CAAEV,SAAS,GAATA,SAAS"}
1
+ {"version":3,"file":"prestation.js","names":["_PrestationType","require","isOtherAccountingMissions","idPrestationList","PrestationType","PREVISIONNEL","BILAN_INTERMEDIAIRE","AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE","AUTRE_MISSION_COMPTABLE","TVS","ETUDE_FISCALE","BILAN_PREVISIONNEL","includes","isOtherJuridicalMissions","isJuridique","isCatalog","GESTION_JURIDIQUE","isOtherSocialMission","AUTRE_MISSION_SOCIALE_HORS_PAIE","isAdditionalPresta","hidden","isOnlyPrevi","filter","idPL","PV_AG","length","isOnlySocial","FRUCTUPAIE","SOCIAL","isOnlyJuridic","isCreation","CREATION_SOCIETE","isExpress","prestationDetailValues","Object","values","PrestationDetail","prestaList","find","pr","id","isBack","calculateScoringOfPrestation","idPrestationType","prestations","prestationHalfPriceList","p","isComptable","prestationHalfPriceIds","map","t","prestaDetails","prestaDetail","numberPoint","point","samePrestation","prestation","paid","signed","terminationsList","exports"],"sources":["../../ts/utils/prestation.ts"],"sourcesContent":["import { IPrestation } from '../types';\nimport { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';\n\nconst isOtherAccountingMissions = (idPrestationList: number): boolean => [\n PrestationType.PREVISIONNEL,\n PrestationType.BILAN_INTERMEDIAIRE,\n PrestationType.AVANCE_OU_ABANDON_COMPTE_COURANT_ASSOCIE,\n PrestationType.AUTRE_MISSION_COMPTABLE,\n PrestationType.TVS,\n PrestationType.ETUDE_FISCALE,\n PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList);\n\nconst isOtherJuridicalMissions = (isJuridique:boolean, isCatalog:boolean, idPrestationList: number): boolean => idPrestationList !== PrestationType.GESTION_JURIDIQUE && isCatalog && isJuridique;\n\nconst isOtherSocialMission = (idPrestationList: number): boolean => idPrestationList === PrestationType.AUTRE_MISSION_SOCIALE_HORS_PAIE;\n\nconst isAdditionalPresta = (hidden:boolean, isCatalog:boolean): boolean => !hidden && isCatalog;\n\nconst isOnlyPrevi = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.PREVISIONNEL, PrestationType.BILAN_PREVISIONNEL, PrestationType.PV_AG].includes(idPL)).length;\n\nconst isOnlySocial = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.FRUCTUPAIE, PrestationType.SOCIAL].includes(idPL)).length;\n\nconst isOnlyJuridic = (idPrestationList: number[]):boolean => !idPrestationList.filter((idPL:number) => ![PrestationType.GESTION_JURIDIQUE].includes(idPL)).length;\n\nconst isCreation = (idPrestationList: number[]):boolean => idPrestationList.includes(PrestationType.CREATION_SOCIETE);\n\nconst isExpress = (idPrestationList: number):boolean => {\n const prestationDetailValues = Object.values(PrestationDetail) as any;\n const prestaList = prestationDetailValues.find((pr:any) => pr.id === idPrestationList);\n return !!prestaList.isBack;\n};\n\nconst calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {\n // Get the list of prestations that are half price\n const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);\n const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);\n\n // Get the number of points for the prestation\n const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);\n const numberPoint = prestaDetails?.point || 0;\n\n // Find the prestation with the same idPrestationList and they need to be paid and signed\n const samePrestation = prestations.filter((prestation) => (prestation.idPrestationList === idPrestationType) && (prestation.paid === true && prestation.signed === true && prestation.terminationsList === null));\n\n // If there is no prestation with the same idPrestationList, return 100% of points\n if (samePrestation.length === 0) return numberPoint;\n\n // If the prestation is in the list of half price prestation, return 50% of points\n if (prestationHalfPriceIds.includes(idPrestationType)) return numberPoint * 0.5;\n\n return 0;\n};\n\nexport {\n isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation,\n};"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEA,MAAMC,yBAAyB,GAAIC,gBAAwB,IAAc,CACvEC,8BAAc,CAACC,YAAY,EAC3BD,8BAAc,CAACE,mBAAmB,EAClCF,8BAAc,CAACG,wCAAwC,EACvDH,8BAAc,CAACI,uBAAuB,EACtCJ,8BAAc,CAACK,GAAG,EAClBL,8BAAc,CAACM,aAAa,EAC5BN,8BAAc,CAACO,kBAAkB,CAAC,CAACC,QAAQ,CAACT,gBAAgB,CAAC;AAE/D,MAAMU,wBAAwB,GAAGA,CAACC,WAAmB,EAAEC,SAAiB,EAAEZ,gBAAwB,KAAcA,gBAAgB,KAAKC,8BAAc,CAACY,iBAAiB,IAAID,SAAS,IAAID,WAAW;AAEjM,MAAMG,oBAAoB,GAAId,gBAAwB,IAAcA,gBAAgB,KAAKC,8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8B,OAAA,CAAE5B,SAAS,GAATA,SAAS;AAAA4B,OAAA,CAAElB,4BAA4B,GAA5BA,4BAA4B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.154",
3
+ "version": "1.0.155",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "js/index.js",