@silexpert/core 1.0.158 → 1.0.161

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 (36) hide show
  1. package/es/types/Enum/GeneralThirdParty.d.ts.map +1 -1
  2. package/es/types/Enum/GeneralThirdParty.js +611 -234
  3. package/es/types/Enum/GeneralThirdParty.js.map +1 -1
  4. package/es/types/Enum/Holidays.d.ts +2 -0
  5. package/es/types/Enum/Holidays.d.ts.map +1 -0
  6. package/es/types/Enum/Holidays.js +2 -0
  7. package/es/types/Enum/Holidays.js.map +1 -0
  8. package/es/types/Enum/PrestationType.js +1 -1
  9. package/es/types/Enum/PrestationType.js.map +1 -1
  10. package/es/types/Interface/models/IPrestation.d.ts +1 -1
  11. package/es/types/Interface/models/IPrestation.d.ts.map +1 -1
  12. package/es/types/Interface/models/IPrestation.js.map +1 -1
  13. package/es/types/index.d.ts +1 -0
  14. package/es/types/index.d.ts.map +1 -1
  15. package/es/types/index.js +1 -0
  16. package/es/types/index.js.map +1 -1
  17. package/es/utils/prestation.js +9 -10
  18. package/es/utils/prestation.js.map +1 -1
  19. package/js/types/Enum/GeneralThirdParty.js +1567 -436
  20. package/js/types/Enum/GeneralThirdParty.js.map +1 -1
  21. package/js/types/Enum/Holidays.js +7 -0
  22. package/js/types/Enum/Holidays.js.map +1 -0
  23. package/js/types/Enum/PrestationType.js +1 -1
  24. package/js/types/Enum/PrestationType.js.map +1 -1
  25. package/js/types/Interface/models/IPrestation.js.map +1 -1
  26. package/js/types/index.js +10 -0
  27. package/js/types/index.js.map +1 -1
  28. package/js/utils/prestation.js +8 -8
  29. package/js/utils/prestation.js.map +1 -1
  30. package/package.json +1 -1
  31. package/ts/types/Enum/GeneralThirdParty.ts +611 -234
  32. package/ts/types/Enum/Holidays.ts +1 -0
  33. package/ts/types/Enum/PrestationType.ts +1 -1
  34. package/ts/types/Interface/models/IPrestation.ts +1 -1
  35. package/ts/types/index.ts +1 -0
  36. package/ts/utils/prestation.ts +9 -9
@@ -0,0 +1 @@
1
+ export const DateHolidays = ['2028-01-01', '2028-04-17', '2028-05-01', '2028-05-08', '2028-05-25', '2028-06-05', '2028-07-14', '2028-08-15', '2028-11-01', '2028-11-11', '2028-12-25', '2027-01-01', '2027-03-29', '2027-05-01', '2027-05-06', '2027-05-08', '2027-05-17', '2027-07-14', '2027-08-15', '2027-11-01', '2027-11-11', '2027-12-25', '2026-01-01', '2026-04-06', '2026-05-01', '2026-05-08', '2026-05-14', '2026-05-25', '2026-07-14', '2026-08-15', '2026-11-01', '2026-11-11', '2026-12-25', '2025-01-01', '2025-04-21', '2025-05-01', '2025-05-08', '2025-05-29', '2025-06-09', '2025-07-14', '2025-08-15', '2025-11-01', '2025-11-11', '2025-12-25', '2024-01-01', '2024-04-01', '2024-05-01', '2024-05-08', '2024-05-09', '2024-05-20', '2024-07-14', '2024-08-15', '2024-11-01', '2024-11-11', '2024-12-25', '2023-01-01', '2023-04-10', '2023-05-01', '2023-05-08', '2023-05-18', '2023-05-29', '2023-07-14', '2023-08-15', '2023-11-01', '2023-11-11', '2023-12-25'];
@@ -255,7 +255,7 @@ export const PrestationDetail: PrestationDetailEnum = {
255
255
  isComplementary: false,
256
256
  signaturePosition: '400,54,569,90',
257
257
  signaturePage: 5,
258
- point: 0,
258
+ point: 125,
259
259
  },
260
260
  PREVISIONNEL: {
261
261
  id: 6,
@@ -58,5 +58,5 @@ export interface IPrestation {
58
58
  societiesPrestations?: ISociety;
59
59
  prestationsDetailsBeforeExercice?: IExercicePrestation[];
60
60
  customersSignatures?: ICustomerSignature[];
61
- terminationsList?: ITerminationList;
61
+ terminationList?: ITerminationList;
62
62
  }
package/ts/types/index.ts CHANGED
@@ -476,6 +476,7 @@ export * from './Enum/GeneralThirdParty';
476
476
  export * from './Enum/MailDomainType';
477
477
  export * from './Enum/TextMessageType';
478
478
  export * from './Enum/JobTitle';
479
+ export * from './Enum/Holidays';
479
480
 
480
481
  // Interfaces API
481
482
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
@@ -31,24 +31,24 @@ const isExpress = (idPrestationList: number):boolean => {
31
31
  };
32
32
 
33
33
  const calculateScoringOfPrestation = (idPrestationType: PrestationType, prestations: IPrestation[]): number => {
34
+ const prestationsSignedPaid = prestations.filter((prestation) => prestation.paid && prestation.signed && prestation.terminationList === null);
35
+
34
36
  // Get the list of prestations that are half price
35
37
  const prestationHalfPriceList = Object.values(PrestationDetail).filter((p) => p.isComptable && !p.isCatalog);
36
38
  const prestationHalfPriceIds = prestationHalfPriceList.map((t) => t.id);
37
39
 
38
- // Get the number of points for the prestation
40
+ // Get the number of points for the new prestation
39
41
  const prestaDetails = Object.values(PrestationDetail).find((prestaDetail) => prestaDetail.id === idPrestationType);
40
42
  const numberPoint = prestaDetails?.point || 0;
41
43
 
42
- // Find the prestation with the same idPrestationList and they need to be paid and signed
43
- const samePrestation = prestations.filter((prestation) => (prestation.idPrestationList === idPrestationType) && (prestation.paid === true && prestation.signed === true && prestation.terminationsList === null));
44
-
45
- // If there is no prestation with the same idPrestationList, return 100% of points
46
- if (samePrestation.length === 0) return numberPoint;
44
+ // Get list of prestations that are already done and check if one of them is in the list of prestations that are half price
45
+ const prestationsExistIds = prestationsSignedPaid.map((prestation) => prestation.idPrestationList);
46
+ const prestationHalfPriceAlreadyDoneIds = prestationsExistIds.filter((id) => prestationHalfPriceIds.includes(id));
47
47
 
48
- // If the prestation is in the list of half price prestation, return 50% of points
49
- if (prestationHalfPriceIds.includes(idPrestationType)) return numberPoint * 0.5;
48
+ // If one of the prestations already done is in the list of prestations that are half price and if the idPrestationType is in prestationHalfPriceIds, return 50% of points
49
+ if (prestationHalfPriceAlreadyDoneIds.length && prestationHalfPriceIds.includes(idPrestationType)) return Math.floor(numberPoint * 0.5);
50
50
 
51
- return 0;
51
+ return numberPoint;
52
52
  };
53
53
 
54
54
  export {