@silexpert/core 1.1.161 → 1.1.162

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 (200) hide show
  1. package/dist/cjs/api/resources/CommercialOffer.d.ts +47 -0
  2. package/dist/cjs/api/resources/CommercialOffer.d.ts.map +1 -0
  3. package/dist/cjs/api/resources/CommercialOffer.js +64 -0
  4. package/dist/cjs/api/resources/CommercialOffer.js.map +1 -0
  5. package/dist/cjs/api/resources/prestation.d.ts +14 -1
  6. package/dist/cjs/api/resources/prestation.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/prestation.js +17 -0
  8. package/dist/cjs/api/resources/prestation.js.map +1 -1
  9. package/dist/cjs/api/resources.d.ts +2 -0
  10. package/dist/cjs/api/resources.d.ts.map +1 -1
  11. package/dist/cjs/api/resources.js +2 -0
  12. package/dist/cjs/api/resources.js.map +1 -1
  13. package/dist/cjs/types/Enum/ClosingType.d.ts +7 -0
  14. package/dist/cjs/types/Enum/ClosingType.d.ts.map +1 -0
  15. package/dist/cjs/types/Enum/ClosingType.js +19 -0
  16. package/dist/cjs/types/Enum/ClosingType.js.map +1 -0
  17. package/dist/cjs/types/Enum/CommercialOfferType.d.ts +97 -0
  18. package/dist/cjs/types/Enum/CommercialOfferType.d.ts.map +1 -0
  19. package/dist/cjs/types/Enum/CommercialOfferType.js +71 -0
  20. package/dist/cjs/types/Enum/CommercialOfferType.js.map +1 -0
  21. package/dist/cjs/types/Enum/PrestationOption.d.ts +8 -0
  22. package/dist/cjs/types/Enum/PrestationOption.d.ts.map +1 -1
  23. package/dist/cjs/types/Enum/PrestationOption.js.map +1 -1
  24. package/dist/cjs/types/Enum/PrestationType.d.ts.map +1 -1
  25. package/dist/cjs/types/Enum/PrestationType.js +175 -0
  26. package/dist/cjs/types/Enum/PrestationType.js.map +1 -1
  27. package/dist/cjs/types/Enum/PriceGridClementine.d.ts +101 -0
  28. package/dist/cjs/types/Enum/PriceGridClementine.d.ts.map +1 -0
  29. package/dist/cjs/types/Enum/PriceGridClementine.js +338 -0
  30. package/dist/cjs/types/Enum/PriceGridClementine.js.map +1 -0
  31. package/dist/cjs/types/Enum/PriceGridLegalstart.d.ts +34 -0
  32. package/dist/cjs/types/Enum/PriceGridLegalstart.d.ts.map +1 -0
  33. package/dist/cjs/types/Enum/PriceGridLegalstart.js +103 -0
  34. package/dist/cjs/types/Enum/PriceGridLegalstart.js.map +1 -0
  35. package/dist/cjs/types/Enum/PriceGridPourcentage.d.ts +52 -0
  36. package/dist/cjs/types/Enum/PriceGridPourcentage.d.ts.map +1 -0
  37. package/dist/cjs/types/Enum/PriceGridPourcentage.js +1125 -0
  38. package/dist/cjs/types/Enum/PriceGridPourcentage.js.map +1 -0
  39. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts +1 -0
  40. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
  41. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js +6 -0
  42. package/dist/cjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
  43. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts +1 -0
  44. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts.map +1 -1
  45. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js +6 -0
  46. package/dist/cjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js.map +1 -1
  47. package/dist/cjs/types/Interface/api/commercialOffer/Query.d.ts +13 -0
  48. package/dist/cjs/types/Interface/api/commercialOffer/Query.d.ts.map +1 -0
  49. package/dist/cjs/types/Interface/api/commercialOffer/Query.js +69 -0
  50. package/dist/cjs/types/Interface/api/commercialOffer/Query.js.map +1 -0
  51. package/dist/cjs/types/Interface/api/prestation/Query.d.ts +19 -0
  52. package/dist/cjs/types/Interface/api/prestation/Query.d.ts.map +1 -0
  53. package/dist/cjs/types/Interface/api/prestation/Query.js +77 -0
  54. package/dist/cjs/types/Interface/api/prestation/Query.js.map +1 -0
  55. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.d.ts +1 -0
  56. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.d.ts.map +1 -1
  57. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.js +6 -0
  58. package/dist/cjs/types/Interface/api/prestations/QueryUpdate.js.map +1 -1
  59. package/dist/cjs/types/Interface/models/ICommercialOffer.d.ts +16 -0
  60. package/dist/cjs/types/Interface/models/ICommercialOffer.d.ts.map +1 -0
  61. package/dist/cjs/types/Interface/models/ICommercialOffer.js +3 -0
  62. package/dist/cjs/types/Interface/models/ICommercialOffer.js.map +1 -0
  63. package/dist/cjs/types/Interface/models/IExercicePrestation.d.ts +2 -1
  64. package/dist/cjs/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  65. package/dist/cjs/types/Interface/models/IExercicePrestation.js.map +1 -1
  66. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.d.ts +10 -0
  67. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.d.ts.map +1 -0
  68. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.js +3 -0
  69. package/dist/cjs/types/Interface/models/IExercicePrestationOffer.js.map +1 -0
  70. package/dist/cjs/types/Interface/models/IPrestationList.d.ts +1 -0
  71. package/dist/cjs/types/Interface/models/IPrestationList.d.ts.map +1 -1
  72. package/dist/cjs/types/Interface/models/IPrestationList.js.map +1 -1
  73. package/dist/cjs/types/index.d.ts +9 -0
  74. package/dist/cjs/types/index.d.ts.map +1 -1
  75. package/dist/cjs/types/index.js +9 -0
  76. package/dist/cjs/types/index.js.map +1 -1
  77. package/dist/cjs/utils/commercialOffer.d.ts +6 -0
  78. package/dist/cjs/utils/commercialOffer.d.ts.map +1 -0
  79. package/dist/cjs/utils/commercialOffer.js +39 -0
  80. package/dist/cjs/utils/commercialOffer.js.map +1 -0
  81. package/dist/cjs/utils/index.d.ts +1 -0
  82. package/dist/cjs/utils/index.d.ts.map +1 -1
  83. package/dist/cjs/utils/index.js +1 -0
  84. package/dist/cjs/utils/index.js.map +1 -1
  85. package/dist/cjs/utils/prestation.d.ts +9 -2
  86. package/dist/cjs/utils/prestation.d.ts.map +1 -1
  87. package/dist/cjs/utils/prestation.js +155 -1
  88. package/dist/cjs/utils/prestation.js.map +1 -1
  89. package/dist/mjs/api/resources/CommercialOffer.d.ts +47 -0
  90. package/dist/mjs/api/resources/CommercialOffer.d.ts.map +1 -0
  91. package/dist/mjs/api/resources/CommercialOffer.js +60 -0
  92. package/dist/mjs/api/resources/CommercialOffer.js.map +1 -0
  93. package/dist/mjs/api/resources/prestation.d.ts +14 -1
  94. package/dist/mjs/api/resources/prestation.d.ts.map +1 -1
  95. package/dist/mjs/api/resources/prestation.js +17 -0
  96. package/dist/mjs/api/resources/prestation.js.map +1 -1
  97. package/dist/mjs/api/resources.d.ts +2 -0
  98. package/dist/mjs/api/resources.d.ts.map +1 -1
  99. package/dist/mjs/api/resources.js +2 -0
  100. package/dist/mjs/api/resources.js.map +1 -1
  101. package/dist/mjs/types/Enum/ClosingType.d.ts +7 -0
  102. package/dist/mjs/types/Enum/ClosingType.d.ts.map +1 -0
  103. package/dist/mjs/types/Enum/ClosingType.js +16 -0
  104. package/dist/mjs/types/Enum/ClosingType.js.map +1 -0
  105. package/dist/mjs/types/Enum/CommercialOfferType.d.ts +97 -0
  106. package/dist/mjs/types/Enum/CommercialOfferType.d.ts.map +1 -0
  107. package/dist/mjs/types/Enum/CommercialOfferType.js +68 -0
  108. package/dist/mjs/types/Enum/CommercialOfferType.js.map +1 -0
  109. package/dist/mjs/types/Enum/PrestationOption.d.ts +8 -0
  110. package/dist/mjs/types/Enum/PrestationOption.d.ts.map +1 -1
  111. package/dist/mjs/types/Enum/PrestationOption.js.map +1 -1
  112. package/dist/mjs/types/Enum/PrestationType.d.ts.map +1 -1
  113. package/dist/mjs/types/Enum/PrestationType.js +175 -0
  114. package/dist/mjs/types/Enum/PrestationType.js.map +1 -1
  115. package/dist/mjs/types/Enum/PriceGridClementine.d.ts +101 -0
  116. package/dist/mjs/types/Enum/PriceGridClementine.d.ts.map +1 -0
  117. package/dist/mjs/types/Enum/PriceGridClementine.js +335 -0
  118. package/dist/mjs/types/Enum/PriceGridClementine.js.map +1 -0
  119. package/dist/mjs/types/Enum/PriceGridLegalstart.d.ts +34 -0
  120. package/dist/mjs/types/Enum/PriceGridLegalstart.d.ts.map +1 -0
  121. package/dist/mjs/types/Enum/PriceGridLegalstart.js +100 -0
  122. package/dist/mjs/types/Enum/PriceGridLegalstart.js.map +1 -0
  123. package/dist/mjs/types/Enum/PriceGridPourcentage.d.ts +52 -0
  124. package/dist/mjs/types/Enum/PriceGridPourcentage.d.ts.map +1 -0
  125. package/dist/mjs/types/Enum/PriceGridPourcentage.js +1122 -0
  126. package/dist/mjs/types/Enum/PriceGridPourcentage.js.map +1 -0
  127. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts +1 -0
  128. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.d.ts.map +1 -1
  129. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js +7 -0
  130. package/dist/mjs/types/Interface/api/commercial/QueryGetStats.js.map +1 -1
  131. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts +1 -0
  132. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.d.ts.map +1 -1
  133. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js +7 -0
  134. package/dist/mjs/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.js.map +1 -1
  135. package/dist/mjs/types/Interface/api/commercialOffer/Query.d.ts +13 -0
  136. package/dist/mjs/types/Interface/api/commercialOffer/Query.d.ts.map +1 -0
  137. package/dist/mjs/types/Interface/api/commercialOffer/Query.js +72 -0
  138. package/dist/mjs/types/Interface/api/commercialOffer/Query.js.map +1 -0
  139. package/dist/mjs/types/Interface/api/prestation/Query.d.ts +19 -0
  140. package/dist/mjs/types/Interface/api/prestation/Query.d.ts.map +1 -0
  141. package/dist/mjs/types/Interface/api/prestation/Query.js +82 -0
  142. package/dist/mjs/types/Interface/api/prestation/Query.js.map +1 -0
  143. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.d.ts +1 -0
  144. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.d.ts.map +1 -1
  145. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.js +7 -0
  146. package/dist/mjs/types/Interface/api/prestations/QueryUpdate.js.map +1 -1
  147. package/dist/mjs/types/Interface/models/ICommercialOffer.d.ts +16 -0
  148. package/dist/mjs/types/Interface/models/ICommercialOffer.d.ts.map +1 -0
  149. package/dist/mjs/types/Interface/models/ICommercialOffer.js +2 -0
  150. package/dist/mjs/types/Interface/models/ICommercialOffer.js.map +1 -0
  151. package/dist/mjs/types/Interface/models/IExercicePrestation.d.ts +2 -1
  152. package/dist/mjs/types/Interface/models/IExercicePrestation.d.ts.map +1 -1
  153. package/dist/mjs/types/Interface/models/IExercicePrestation.js.map +1 -1
  154. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.d.ts +10 -0
  155. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.d.ts.map +1 -0
  156. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.js +2 -0
  157. package/dist/mjs/types/Interface/models/IExercicePrestationOffer.js.map +1 -0
  158. package/dist/mjs/types/Interface/models/IPrestationList.d.ts +1 -0
  159. package/dist/mjs/types/Interface/models/IPrestationList.d.ts.map +1 -1
  160. package/dist/mjs/types/Interface/models/IPrestationList.js.map +1 -1
  161. package/dist/mjs/types/index.d.ts +9 -0
  162. package/dist/mjs/types/index.d.ts.map +1 -1
  163. package/dist/mjs/types/index.js +9 -0
  164. package/dist/mjs/types/index.js.map +1 -1
  165. package/dist/mjs/utils/commercialOffer.d.ts +6 -0
  166. package/dist/mjs/utils/commercialOffer.d.ts.map +1 -0
  167. package/dist/mjs/utils/commercialOffer.js +33 -0
  168. package/dist/mjs/utils/commercialOffer.js.map +1 -0
  169. package/dist/mjs/utils/index.d.ts +1 -0
  170. package/dist/mjs/utils/index.d.ts.map +1 -1
  171. package/dist/mjs/utils/index.js +1 -0
  172. package/dist/mjs/utils/index.js.map +1 -1
  173. package/dist/mjs/utils/prestation.d.ts +9 -2
  174. package/dist/mjs/utils/prestation.d.ts.map +1 -1
  175. package/dist/mjs/utils/prestation.js +150 -1
  176. package/dist/mjs/utils/prestation.js.map +1 -1
  177. package/package.json +1 -1
  178. package/ts/api/resources/CommercialOffer.ts +67 -0
  179. package/ts/api/resources/prestation.ts +21 -1
  180. package/ts/api/resources.ts +2 -0
  181. package/ts/types/Enum/ClosingType.ts +17 -0
  182. package/ts/types/Enum/CommercialOfferType.ts +84 -0
  183. package/ts/types/Enum/PrestationOption.ts +9 -0
  184. package/ts/types/Enum/PrestationType.ts +175 -0
  185. package/ts/types/Enum/PriceGridClementine.ts +335 -0
  186. package/ts/types/Enum/PriceGridLegalstart.ts +100 -0
  187. package/ts/types/Enum/PriceGridPourcentage.ts +1122 -0
  188. package/ts/types/Interface/api/commercial/QueryGetStats.ts +5 -0
  189. package/ts/types/Interface/api/commercial/QueryPaginatedSocietyWithStatsCa.ts +5 -0
  190. package/ts/types/Interface/api/commercialOffer/Query.ts +46 -0
  191. package/ts/types/Interface/api/prestation/Query.ts +56 -0
  192. package/ts/types/Interface/api/prestations/QueryUpdate.ts +5 -0
  193. package/ts/types/Interface/models/ICommercialOffer.ts +18 -0
  194. package/ts/types/Interface/models/IExercicePrestation.ts +2 -1
  195. package/ts/types/Interface/models/IExercicePrestationOffer.ts +13 -0
  196. package/ts/types/Interface/models/IPrestationList.ts +1 -0
  197. package/ts/types/index.ts +9 -0
  198. package/ts/utils/commercialOffer.ts +37 -0
  199. package/ts/utils/index.ts +1 -0
  200. package/ts/utils/prestation.ts +193 -2
@@ -47,6 +47,11 @@ export class QueryGetStats {
47
47
  @IsInt({ each: true })
48
48
  idPrestationList?: number[];
49
49
 
50
+ @ApiPropertyOptional()
51
+ @IsOptional()
52
+ @IsInt({ each: true })
53
+ idOfferList?: number[];
54
+
50
55
  @ApiPropertyOptional()
51
56
  @IsOptional()
52
57
  @IsInt({ each: true })
@@ -54,6 +54,11 @@ export class QueryPaginatedSocietyWithStatsCa extends OptionalQueryPaginate {
54
54
  @IsInt({ each: true })
55
55
  idPrestationList?: number[];
56
56
 
57
+ @ApiPropertyOptional()
58
+ @IsOptional()
59
+ @IsInt({ each: true })
60
+ idOfferList?: number[];
61
+
57
62
  @ApiPropertyOptional()
58
63
  @IsOptional()
59
64
  @IsInt({ each: true })
@@ -0,0 +1,46 @@
1
+ import { IsInt, IsOptional, IsString, Min } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+
4
+ export class QueryAllCommercialOffer {
5
+ @ApiPropertyOptional()
6
+ @IsOptional()
7
+ @IsString()
8
+ search?: string;
9
+
10
+ @ApiPropertyOptional()
11
+ @IsOptional()
12
+ @IsString()
13
+ startDate?: string;
14
+
15
+ @ApiPropertyOptional()
16
+ @IsOptional()
17
+ @IsString()
18
+ endDate?: string;
19
+ }
20
+
21
+ export class QueryPaginateCommercialOffer {
22
+ @ApiPropertyOptional()
23
+ @IsOptional()
24
+ @IsString()
25
+ search?: string;
26
+
27
+ @ApiPropertyOptional()
28
+ @IsOptional()
29
+ @IsString()
30
+ startDate?: string;
31
+
32
+ @ApiPropertyOptional()
33
+ @IsOptional()
34
+ @IsString()
35
+ endDate?: string;
36
+
37
+ @ApiProperty()
38
+ @IsInt()
39
+ @Min(1)
40
+ page: number;
41
+
42
+ @ApiProperty()
43
+ @IsInt()
44
+ @Min(1)
45
+ limit: number;
46
+ }
@@ -0,0 +1,56 @@
1
+ import { IsArray, IsNumber, IsObject, IsOptional, IsString } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { IPrestation } from '../../models/IPrestation';
4
+ import { IExercicePrestation } from '../../models/IExercicePrestation';
5
+ import { ICommercialOffer } from '../../models/ICommercialOffer';
6
+ import { IExercice } from '../../models/IExercice';
7
+
8
+ export class QueryCreatePrestation {
9
+ @ApiProperty()
10
+ @IsObject()
11
+ prestation: IPrestation;
12
+
13
+ @ApiProperty()
14
+ @IsObject()
15
+ exercicePrestation: Partial<IExercicePrestation>;
16
+
17
+ @ApiPropertyOptional()
18
+ @IsArray()
19
+ options: number[];
20
+
21
+ @ApiPropertyOptional()
22
+ @IsArray()
23
+ commercialOffers: ICommercialOffer[];
24
+ }
25
+
26
+ export class QueryUpdatePrestation {
27
+ @ApiPropertyOptional()
28
+ @IsOptional()
29
+ @IsString()
30
+ commentPdf: string;
31
+
32
+ @ApiPropertyOptional()
33
+ @IsOptional()
34
+ @IsObject()
35
+ exercice: Partial<IExercice>;
36
+
37
+ @ApiPropertyOptional()
38
+ @IsOptional()
39
+ @IsObject()
40
+ exercicePrestation: Partial<IExercicePrestation>;
41
+
42
+ @ApiPropertyOptional()
43
+ @IsOptional()
44
+ @IsArray()
45
+ options: number[];
46
+
47
+ @ApiPropertyOptional()
48
+ @IsOptional()
49
+ @IsNumber()
50
+ idExercicePrestation: number;
51
+
52
+ @ApiPropertyOptional()
53
+ @IsOptional()
54
+ @IsArray()
55
+ commercialOffers: ICommercialOffer[];
56
+ }
@@ -52,6 +52,11 @@ export class QueryUpdatePrestations {
52
52
  @IsOptional()
53
53
  isBack?: boolean;
54
54
 
55
+ @ApiPropertyOptional()
56
+ @IsNumber()
57
+ @IsOptional()
58
+ minimumPrice?: number;
59
+
55
60
  @ApiPropertyOptional()
56
61
  @IsNumber()
57
62
  @IsOptional()
@@ -0,0 +1,18 @@
1
+ import { IExercicePrestationOffer } from './IExercicePrestationOffer';
2
+
3
+ export interface ICommercialOffer {
4
+ id?: number,
5
+ idCommercialOfferType: number,
6
+ title: string,
7
+ label: string,
8
+ amount?: number,
9
+ startDate: Date,
10
+ endDate: Date,
11
+ cumulative: boolean,
12
+ createdAt?: Date,
13
+ updatedAt?: Date,
14
+ deletedAt?: Date
15
+
16
+ /* Associations */
17
+ exercicePrestationOffers?: IExercicePrestationOffer[];
18
+ }
@@ -1,6 +1,6 @@
1
1
  import { IPrestation } from './IPrestation';
2
2
  import { IBalanceSheet } from './IBalanceSheet';
3
- import { IExercice } from '../..';
3
+ import { IExercice, IExercicePrestationOffer } from '../..';
4
4
 
5
5
  // exercicesPrestations
6
6
  export interface IExercicePrestation {
@@ -22,4 +22,5 @@ export interface IExercicePrestation {
22
22
  prestation?: IPrestation;
23
23
  balanceSheet?: IBalanceSheet;
24
24
  exercice?: IExercice;
25
+ exercicePrestationOffers?: IExercicePrestationOffer[];
25
26
  }
@@ -0,0 +1,13 @@
1
+ import { ICommercialOffer, IExercicePrestation } from '../..';
2
+
3
+ // exercicesPrestationsOffers
4
+ export interface IExercicePrestationOffer {
5
+ id?: number;
6
+ subtractedAmount: number;
7
+ idExercicePrestation: number;
8
+ idOffer: number;
9
+
10
+ // Associations
11
+ exercicePrestation?: IExercicePrestation;
12
+ commercialOffer?: ICommercialOffer;
13
+ }
@@ -11,6 +11,7 @@ export interface IPrestationList {
11
11
  isAttestation: boolean;
12
12
  inAverageCart: boolean;
13
13
  isBack: boolean;
14
+ minimumPrice: number | null;
14
15
  price: number | null;
15
16
  isCatalog: boolean;
16
17
  hidden: boolean;
package/ts/types/index.ts CHANGED
@@ -69,6 +69,7 @@ export * from './Interface/models/IExerciceDetail';
69
69
  export * from './Interface/models/IExerciceComment';
70
70
  export * from './Interface/models/IExercice';
71
71
  export * from './Interface/models/IExercicePrestation';
72
+ export * from './Interface/models/IExercicePrestationOffer';
72
73
  export * from './Interface/models/IFailedLoginAttempt';
73
74
  export * from './Interface/models/IFileType';
74
75
  export * from './Interface/models/IFile';
@@ -305,6 +306,7 @@ export * from './Interface/models/ITimeRecorder';
305
306
  export * from './Interface/models/IInvoiceRecurrence';
306
307
  export * from './Interface/models/ILoanFile';
307
308
  export * from './Interface/models/ICommercialMail';
309
+ export * from './Interface/models/ICommercialOffer';
308
310
  export * from './Interface/models/IRegistration';
309
311
  export * from './Interface/models/IVatRegimeHistory';
310
312
  export * from './Interface/models/ICustomerAcceptance';
@@ -330,6 +332,7 @@ export * from './Enum/NafCode';
330
332
  export * from './Enum/Acceptance';
331
333
  export * from './Enum/FolderFile';
332
334
  export * from './Enum/CommercialGrade';
335
+ export * from './Enum/CommercialOfferType';
333
336
  export * from './Enum/CommercialManagement';
334
337
  export * from './Enum/Civility';
335
338
  export * from './Enum/Registration';
@@ -408,6 +411,9 @@ export * from './Enum/Util';
408
411
  export * from './Enum/RegisterCategory';
409
412
  export * from './Enum/FieldSocietyStat';
410
413
  export * from './Enum/PrestationType';
414
+ export * from './Enum/PriceGridClementine';
415
+ export * from './Enum/PriceGridPourcentage';
416
+ export * from './Enum/PriceGridLegalstart';
411
417
  export * from './Enum/StatsCaStateDetail';
412
418
  export * from './Enum/Lab';
413
419
  export * from './Enum/ConstitutionState';
@@ -490,6 +496,7 @@ export * from './Enum/ThirdParty';
490
496
  export * from './Enum/PaymentExpectation';
491
497
  export * from './Enum/FollowList';
492
498
  export * from './Enum/ClientOrProspect';
499
+ export * from './Enum/ClosingType';
493
500
  export * from './Enum/MissionAcceptation';
494
501
  export * from './Enum/Bank';
495
502
  export * from './Enum/VatControl';
@@ -904,6 +911,7 @@ export * from './Interface/api/commercialManagement/Create';
904
911
  export * from './Interface/api/commercialManagement/Read';
905
912
  export * from './Interface/api/commercialManagement/Query';
906
913
  export * from './Interface/api/commercialManagement/Update';
914
+ export * from './Interface/api/commercialOffer/Query';
907
915
  export * from './Interface/api/documentSection/Update';
908
916
  export * from './Interface/api/connector/CreateConnector';
909
917
  export * from './Interface/api/connector/QueryConnector';
@@ -922,6 +930,7 @@ export * from './Interface/api/file/Read';
922
930
  export * from './Interface/api/societyConfig/update';
923
931
  export * from './Interface/api/wallet/UpdateAttribution';
924
932
  export * from './Interface/api/prestation/CreatePrestation';
933
+ export * from './Interface/api/prestation/Query';
925
934
  export * from './Interface/api/prestation/QueryPrestation';
926
935
  export * from './Interface/api/prestation/BodyCreatePrestationSocieties';
927
936
  export * from './Interface/api/prestation/QueryGetPaginatedSocietiesFromPrestation';
@@ -0,0 +1,37 @@
1
+ import { ICommercialOffer } from '../types';
2
+ import { CommercialOfferTypeType, CommercialOfferTypeDetail } from '../types/Enum/CommercialOfferType';
3
+ import { PrestationDetail } from '../types/Enum/PrestationType';
4
+ import * as dayjs from 'dayjs';
5
+ import * as isBetween from 'dayjs/plugin/isBetween';
6
+
7
+ dayjs.extend(isBetween);
8
+
9
+ const displayCommercialOffer = (idPrestationList: number, idCommercialOfferType: number): boolean => {
10
+ const prestationList = Object.values(PrestationDetail).find(prestation => prestation.id === idPrestationList);
11
+ const commercialOfferType: CommercialOfferTypeType | undefined = Object.values(CommercialOfferTypeDetail).find(offer => offer.id === idCommercialOfferType);
12
+ if (commercialOfferType?.idPrestationList.length && commercialOfferType?.idPrestationList.includes(idPrestationList)) return true;
13
+ else if (prestationList &&
14
+ !commercialOfferType?.idPrestationList.length &&
15
+ (
16
+ (!commercialOfferType?.isComptable || commercialOfferType?.isComptable === prestationList?.isComptable)
17
+ && (!commercialOfferType?.isCatalog || commercialOfferType?.isCatalog === prestationList.isCatalog)
18
+ && (!commercialOfferType?.isBack || commercialOfferType?.isBack === prestationList.isBack)
19
+ )
20
+ ) return true;
21
+ else return false;
22
+ };
23
+
24
+ const disableCommercialOffer = (idCurrentOffer: number, idOfferSelected: number[], commercialOfferList: ICommercialOffer[] ): boolean=> {
25
+ if (idOfferSelected.length && commercialOfferList.find(offer => offer.id === idCurrentOffer)?.cumulative === false) return true;
26
+ else if (commercialOfferList.find(offer => offer.id === idOfferSelected[0])?.cumulative === false) return true;
27
+ else return false;
28
+ };
29
+
30
+ const getCommercialOfferList = (idCommercialOfferType: number, offerList: ICommercialOffer[]): ICommercialOffer[] => {
31
+ const commercialOfferList: ICommercialOffer[] = offerList.filter((offer) => offer.idCommercialOfferType === idCommercialOfferType);
32
+ return commercialOfferList.filter(offer => dayjs().isBetween(dayjs(offer.startDate), dayjs(offer.endDate), 'day', '[]'));
33
+ };
34
+
35
+ export {
36
+ displayCommercialOffer, disableCommercialOffer, getCommercialOfferList,
37
+ };
package/ts/utils/index.ts CHANGED
@@ -18,3 +18,4 @@ export * from './isHtml';
18
18
  export * from './isUrl';
19
19
  export { getCerfa3517DDRRegistrationField } from './vat/3517/century23';
20
20
  export * from './bankAccount';
21
+ export * from './commercialOffer';
@@ -1,5 +1,58 @@
1
- import { IPrestation } from '../types';
1
+ import { IPrestation, IPrestationList } from '../types';
2
2
  import { PrestationDetail, PrestationType } from '../types/Enum/PrestationType';
3
+ import { PrestationOptionType, PrestationOption } from '../types/Enum/PrestationOption';
4
+ import { PriceGridClementine } from '../types/Enum/PriceGridClementine';
5
+ import { PriceGridPourcentage } from '../types/Enum/PriceGridPourcentage';
6
+ import { PriceGridLegalstart } from '../types/Enum/PriceGridLegalstart';
7
+ import { ClosingType } from '../types/Enum/ClosingType';
8
+ import { getBrandNameByNodeEnv } from './brands';
9
+ import * as dayjs from 'dayjs';
10
+
11
+ type priceGridBrand = {
12
+ idTypeBrand: number,
13
+ price: priceGrid[]
14
+ };
15
+
16
+ type priceGrid = {
17
+ idPrestationList: number[],
18
+ minimumMonthlyPayment?: monthlyPayment[],
19
+ maximumMonthlyPayment?: monthlyPayment[],
20
+ turnoverCreatedYear?: turnover[],
21
+ turnoverPastYear?: turnover[],
22
+ turnoverMonthly?: turnover[],
23
+ turnoverYearly?: turnover[],
24
+ employee?: employee[],
25
+ partner?: employee[],
26
+ properties?: propertie[],
27
+ vatRegimeMonthly?: vatRegime[],
28
+ vatRegimeYearly?: vatRegime[],
29
+ };
30
+
31
+ type monthlyPayment = {
32
+ id: number,
33
+ month: number,
34
+ };
35
+
36
+ type turnover = {
37
+ turnoverValue: number,
38
+ price: number,
39
+ };
40
+
41
+ type employee = {
42
+ amountMinimum: number,
43
+ amountMaximum: number,
44
+ price: number,
45
+ };
46
+
47
+ type propertie = {
48
+ amount: number,
49
+ price: number,
50
+ };
51
+
52
+ type vatRegime = {
53
+ type: number,
54
+ price: number,
55
+ };
3
56
 
4
57
  const isOtherAccountingMissions = (idPrestationList: number): boolean => [
5
58
  PrestationType.PREVISIONNEL,
@@ -51,6 +104,144 @@ const calculateScoringOfPrestation = (idPrestationType: PrestationType, prestati
51
104
  return numberPoint;
52
105
  };
53
106
 
107
+ const getPriceGrid = (idTypeBrand: number, idPrestationList: number): priceGrid | undefined => {
108
+ let currentBrandPriceGrid: priceGridBrand | undefined;
109
+ let currentPriceGrid: priceGrid | undefined;
110
+
111
+ const currentEnvName = getBrandNameByNodeEnv(process.env.NODE_ENV);
112
+ const listEnvEnum = {
113
+ PriceGridClementine, PriceGridPourcentage, PriceGridLegalstart,
114
+ };
115
+ // @ts-ignore
116
+ const currentPriceGridFile: priceGridBrand[] = listEnvEnum[`PriceGrid${currentEnvName}`];
117
+ if (currentPriceGridFile) currentBrandPriceGrid = currentPriceGridFile.find((priceGrid: priceGridBrand) => priceGrid.idTypeBrand === idTypeBrand);
118
+ if (currentBrandPriceGrid) currentPriceGrid = currentBrandPriceGrid?.price.find((price: priceGrid) => price.idPrestationList.includes(idPrestationList));
119
+ return currentPriceGrid;
120
+ };
121
+
122
+ const calculatePrestationPriceWithPriceGrid = (idPrestationList: number, endDate: string, NbrMonth: number, turnover: number, rentsNumber: number, employeesNumber: number, associatesNumber: number, idTypeBrand: number, idVatRegime: number, pastBalanceSheet: boolean, isYearly: boolean, totalMonth: number): { totalPrestation: number, reduceMonth: number } => {
123
+ let totalPrestation: number = 0;
124
+ let reduceMonth: number = 0;
125
+
126
+ /* Récupération de la grille tarifaire */
127
+ const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);
128
+
129
+ if (currentPriceGrid) {
130
+ let monthlyPrice: number | undefined;
131
+ let yearlyPrice: number | undefined;
132
+ let vatRegimePrice: number | undefined;
133
+
134
+ /* Gestion du régime de TVA */
135
+ if (currentPriceGrid.vatRegimeMonthly && !isYearly) vatRegimePrice = currentPriceGrid.vatRegimeMonthly?.find(regime => regime.type === idVatRegime)?.price;
136
+ else if (currentPriceGrid.vatRegimeYearly && isYearly) vatRegimePrice = currentPriceGrid.vatRegimeYearly?.find(regime => regime.type === idVatRegime)?.price;
137
+
138
+ /* Gestion des montants */
139
+ if (currentPriceGrid.turnoverMonthly && !isYearly) monthlyPrice = currentPriceGrid.turnoverMonthly?.find(turn => turnover < turn.turnoverValue)?.price;
140
+ else if (currentPriceGrid.properties) monthlyPrice = currentPriceGrid.properties?.find(property => property.amount === rentsNumber)?.price;
141
+ else if (currentPriceGrid.employee) monthlyPrice = currentPriceGrid.employee?.find(emp => emp.amountMinimum <= employeesNumber && emp.amountMaximum >= employeesNumber)?.price;
142
+ else if (currentPriceGrid.turnoverYearly && isYearly) yearlyPrice = currentPriceGrid.turnoverYearly?.find(turn => turnover < turn.turnoverValue)?.price;
143
+ else if (!pastBalanceSheet && currentPriceGrid.turnoverCreatedYear) yearlyPrice = currentPriceGrid.turnoverCreatedYear?.find(turn => turnover < turn.turnoverValue)?.price;
144
+ else if (pastBalanceSheet && currentPriceGrid.turnoverPastYear) yearlyPrice = currentPriceGrid.turnoverPastYear?.find(turn => turnover < turn.turnoverValue)?.price;
145
+ else if (currentPriceGrid.partner) yearlyPrice = currentPriceGrid.partner?.find(part => part.amountMinimum <= associatesNumber && part.amountMaximum >= associatesNumber)?.price;
146
+ const finalMonthlyPrice: number | undefined = (monthlyPrice ? monthlyPrice : 0) + (vatRegimePrice ? vatRegimePrice : 0);
147
+
148
+ /* Gestion des mois */
149
+ let cloturedPast: boolean = false;
150
+ if (dayjs(endDate, 'YYYY-MM-DD').subtract(15, 'day').isBefore(dayjs())) cloturedPast = true;
151
+ const minimumMonth: number | undefined = currentPriceGrid.minimumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
152
+ const maximumMonth: number | undefined = currentPriceGrid.maximumMonthlyPayment?.find(monthlyPayment => monthlyPayment.id === (cloturedPast ? ClosingType.OUTDATED : ClosingType.IN_PROGRESS))?.month;
153
+ let monthNbr: number = NbrMonth;
154
+ if (totalMonth > 0) monthNbr = monthNbr - totalMonth;
155
+ if (minimumMonth && monthNbr < minimumMonth) monthNbr = minimumMonth;
156
+ if (maximumMonth && monthNbr > maximumMonth) monthNbr = maximumMonth;
157
+
158
+ reduceMonth = (monthNbr === NbrMonth - totalMonth ? totalMonth : 0);
159
+
160
+ /* Prix Final */
161
+ totalPrestation = (yearlyPrice ? yearlyPrice : finalMonthlyPrice * monthNbr);
162
+ }
163
+ return { totalPrestation, reduceMonth };
164
+ };
165
+
166
+ const calculatePrestationPriceWithPrestationList = (prestationList: IPrestationList): number => {
167
+ let totalPrestation: number = 0;
168
+
169
+ totalPrestation = prestationList.price || 0;
170
+
171
+ return totalPrestation;
172
+ };
173
+
174
+ const calculatePrestationPrice = (idPrestationList: number, prestationList: IPrestationList, endDate: string, NbrMonth: number, turnover: number, rentsNumber: number, employeesNumber: number, associatesNumber: number, idTypeBrand: number, idVatRegime: number, pastBalanceSheet: boolean, optionsList: number[], totalPercentage: number, totalAmount: number, totalMonth: number, isYearly: boolean = false): { totalPrestation: number, reduceMonth: number } => {
175
+ let totalPrestation: number = 0;
176
+ let reduceMonth: number = 0;
177
+ let totalWithReduce: { totalPrestation: number, reduceMonth: number } = { totalPrestation: 0, reduceMonth: 0 };
178
+
179
+ /* Gestion du prix en fonction de la prestation */
180
+ if (
181
+ [
182
+ PrestationType.COMPTA_PRO,
183
+ PrestationType.COMPTA_PRO_EXPRESS,
184
+ PrestationType.COMPTA_ENTREPRISE,
185
+ PrestationType.COMPTA_ENTREPRISE_EXPRESS,
186
+ PrestationType.COMPTA_SCI,
187
+ PrestationType.COMPTA_SCI_EXPRESS,
188
+ PrestationType.BILAN_PREVISIONNEL,
189
+ PrestationType.COMPTA_PREMIUM,
190
+ PrestationType.COMPTA_POURCENTAGE_PREMIUM,
191
+ PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS,
192
+ PrestationType.COMPTA_POURCENTAGE,
193
+ PrestationType.COMPTA_POURCENTAGE_EXPRESS,
194
+ PrestationType.SOCIAL,
195
+ PrestationType.GESTION_JURIDIQUE,
196
+ PrestationType.COMPTA_PRO_COMPTASTART,
197
+ PrestationType.COMPTA_PRO_COMPTASTART_EXPRESS,
198
+ ].includes(idPrestationList)
199
+ ) {
200
+ totalWithReduce = calculatePrestationPriceWithPriceGrid(idPrestationList, endDate, NbrMonth, turnover, rentsNumber, employeesNumber, associatesNumber, idTypeBrand, idVatRegime, pastBalanceSheet, isYearly, totalMonth);
201
+ totalPrestation = totalWithReduce.totalPrestation;
202
+ reduceMonth = totalWithReduce.reduceMonth;
203
+ } else {
204
+ totalPrestation = calculatePrestationPriceWithPrestationList(prestationList);
205
+ }
206
+ if (totalPercentage > 0) totalPrestation = totalPrestation - (totalPrestation * (totalPercentage / 100));
207
+ if (totalAmount > 0) totalPrestation = totalPrestation - totalAmount;
208
+ if (prestationList.minimumPrice && totalPrestation < prestationList.minimumPrice) totalPrestation = prestationList.minimumPrice;
209
+ /* Gestion des options */
210
+ let OptionTotalPrice: number = 0;
211
+ if (optionsList.length) {
212
+ optionsList.forEach((optionId) => {
213
+ const optionPrice: number | undefined = Object.values(PrestationOption).find((option) => option.id === optionId)?.price;
214
+ if (optionPrice) OptionTotalPrice += optionPrice;
215
+ });
216
+ }
217
+ totalPrestation += (OptionTotalPrice ? OptionTotalPrice : 0);
218
+
219
+ return { totalPrestation, reduceMonth };
220
+ };
221
+
222
+ const getPrestationOptions = (idPrestationList: number): PrestationOptionType[] => {
223
+ const PrestationOptionList: PrestationOptionType[] = Object.values(PrestationOption).filter(option => option.brand.includes(getBrandNameByNodeEnv(process.env.NODE_ENV)));
224
+ return PrestationOptionList.filter(option => option.prestationList.includes(idPrestationList));
225
+ };
226
+
227
+ const isAbleToUpdatePrice = (idTypeBrand: number, idPrestationList: number, turnover: number, pastBalanceSheet: boolean): boolean => {
228
+ /* Récupération de la grille tarifaire */
229
+ const currentPriceGrid: priceGrid | undefined = getPriceGrid(idTypeBrand, idPrestationList);
230
+ if (currentPriceGrid) {
231
+ // @ts-ignore
232
+ if ([PrestationType.COMPTA_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM, PrestationType.COMPTA_POURCENTAGE_PREMIUM_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 2].turnoverValue < turnover) return true;
233
+ // @ts-ignore
234
+ else if ([PrestationType.COMPTA_POURCENTAGE, PrestationType.COMPTA_POURCENTAGE_EXPRESS].includes(idPrestationList) && currentPriceGrid.turnoverMonthly[currentPriceGrid.turnoverMonthly.length - 1].turnoverValue < turnover) return true;
235
+ // @ts-ignore
236
+ else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && !pastBalanceSheet && currentPriceGrid.turnoverCreatedYear[currentPriceGrid.turnoverCreatedYear.length - 1].turnoverValue < turnover) return true;
237
+ // @ts-ignore
238
+ else if ([PrestationType.BILAN_PREVISIONNEL].includes(idPrestationList) && pastBalanceSheet && currentPriceGrid.turnoverPastYear[currentPriceGrid.turnoverPastYear.length - 1].turnoverValue < turnover) return true;
239
+ else return false;
240
+ }
241
+ return false;
242
+
243
+ };
244
+
54
245
  export {
55
- isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation,
246
+ isOtherAccountingMissions, isOtherJuridicalMissions, isAdditionalPresta, isOtherSocialMission, isOnlyPrevi, isOnlySocial, isOnlyJuridic, isCreation, isExpress, calculateScoringOfPrestation, calculatePrestationPrice, getPrestationOptions, isAbleToUpdatePrice,
56
247
  };