@silexpert/core 1.1.185 → 1.1.187

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 (196) hide show
  1. package/dist/cjs/api/resources/Card.d.ts +2 -2
  2. package/dist/cjs/api/resources/Card.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/Card.js +4 -4
  4. package/dist/cjs/api/resources/Card.js.map +1 -1
  5. package/dist/cjs/api/resources/Contest.d.ts +12 -0
  6. package/dist/cjs/api/resources/Contest.d.ts.map +1 -0
  7. package/dist/cjs/api/resources/Contest.js +43 -0
  8. package/dist/cjs/api/resources/Contest.js.map +1 -0
  9. package/dist/cjs/api/resources/GeneralLedger.d.ts +8 -0
  10. package/dist/cjs/api/resources/GeneralLedger.d.ts.map +1 -1
  11. package/dist/cjs/api/resources/GeneralLedger.js +32 -0
  12. package/dist/cjs/api/resources/GeneralLedger.js.map +1 -1
  13. package/dist/cjs/api/resources/IncomeStatement.d.ts +2 -0
  14. package/dist/cjs/api/resources/IncomeStatement.d.ts.map +1 -1
  15. package/dist/cjs/api/resources/IncomeStatement.js +10 -0
  16. package/dist/cjs/api/resources/IncomeStatement.js.map +1 -1
  17. package/dist/cjs/api/resources/Journal.d.ts +2 -0
  18. package/dist/cjs/api/resources/Journal.d.ts.map +1 -1
  19. package/dist/cjs/api/resources/Journal.js +7 -0
  20. package/dist/cjs/api/resources/Journal.js.map +1 -1
  21. package/dist/cjs/api/resources/prestation.d.ts +2 -1
  22. package/dist/cjs/api/resources/prestation.d.ts.map +1 -1
  23. package/dist/cjs/api/resources/prestation.js +3 -0
  24. package/dist/cjs/api/resources/prestation.js.map +1 -1
  25. package/dist/cjs/api/resources.d.ts +2 -0
  26. package/dist/cjs/api/resources.d.ts.map +1 -1
  27. package/dist/cjs/api/resources.js +2 -0
  28. package/dist/cjs/api/resources.js.map +1 -1
  29. package/dist/cjs/index.d.ts +1 -0
  30. package/dist/cjs/index.d.ts.map +1 -1
  31. package/dist/cjs/index.js +1 -0
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/cjs/types/Enum/BrandClementine.d.ts +7 -0
  34. package/dist/cjs/types/Enum/BrandClementine.d.ts.map +1 -1
  35. package/dist/cjs/types/Enum/BrandClementine.js +3 -0
  36. package/dist/cjs/types/Enum/BrandClementine.js.map +1 -1
  37. package/dist/cjs/types/Enum/BrandPourcentage.d.ts +1 -1
  38. package/dist/cjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
  39. package/dist/cjs/types/Enum/BrandPourcentage.js +29 -28
  40. package/dist/cjs/types/Enum/BrandPourcentage.js.map +1 -1
  41. package/dist/cjs/types/Enum/PriceGridPourcentage.js +48 -48
  42. package/dist/cjs/types/Enum/PriceGridPourcentage.js.map +1 -1
  43. package/dist/cjs/types/Interface/api/contest/Create.d.ts +26 -0
  44. package/dist/cjs/types/Interface/api/contest/Create.d.ts.map +1 -0
  45. package/dist/cjs/types/Interface/api/contest/Create.js +102 -0
  46. package/dist/cjs/types/Interface/api/contest/Create.js.map +1 -0
  47. package/dist/cjs/types/Interface/api/contest/Query.d.ts +7 -0
  48. package/dist/cjs/types/Interface/api/contest/Query.d.ts.map +1 -0
  49. package/dist/cjs/types/Interface/api/contest/Query.js +38 -0
  50. package/dist/cjs/types/Interface/api/contest/Query.js.map +1 -0
  51. package/dist/cjs/types/Interface/api/contest/Read.d.ts +6 -0
  52. package/dist/cjs/types/Interface/api/contest/Read.d.ts.map +1 -0
  53. package/dist/cjs/types/Interface/api/contest/Read.js +3 -0
  54. package/dist/cjs/types/Interface/api/contest/Read.js.map +1 -0
  55. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
  56. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
  57. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js +19 -1
  58. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
  59. package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
  60. package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
  61. package/dist/cjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
  62. package/dist/cjs/types/Interface/models/IUserContest.d.ts +20 -0
  63. package/dist/cjs/types/Interface/models/IUserContest.d.ts.map +1 -0
  64. package/dist/cjs/types/Interface/models/IUserContest.js +3 -0
  65. package/dist/cjs/types/Interface/models/IUserContest.js.map +1 -0
  66. package/dist/cjs/types/Interface/models/IVoteContest.d.ts +14 -0
  67. package/dist/cjs/types/Interface/models/IVoteContest.d.ts.map +1 -0
  68. package/dist/cjs/types/Interface/models/IVoteContest.js +3 -0
  69. package/dist/cjs/types/Interface/models/IVoteContest.js.map +1 -0
  70. package/dist/cjs/types/index.d.ts +5 -0
  71. package/dist/cjs/types/index.d.ts.map +1 -1
  72. package/dist/cjs/types/index.js +5 -0
  73. package/dist/cjs/types/index.js.map +1 -1
  74. package/dist/cjs/utils/commercialManagement/document.d.ts +0 -1
  75. package/dist/cjs/utils/commercialManagement/document.d.ts.map +1 -1
  76. package/dist/cjs/utils/commercialManagement/document.js +1 -41
  77. package/dist/cjs/utils/commercialManagement/document.js.map +1 -1
  78. package/dist/cjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
  79. package/dist/cjs/utils/commercialManagement/templates/common.js +34 -46
  80. package/dist/cjs/utils/commercialManagement/templates/common.js.map +1 -1
  81. package/dist/cjs/utils/email/templates/signature.d.ts.map +1 -1
  82. package/dist/cjs/utils/email/templates/signature.js +42 -10
  83. package/dist/cjs/utils/email/templates/signature.js.map +1 -1
  84. package/dist/cjs/utils/email.d.ts.map +1 -1
  85. package/dist/cjs/utils/email.js +9 -1
  86. package/dist/cjs/utils/email.js.map +1 -1
  87. package/dist/mjs/api/resources/Card.d.ts +2 -2
  88. package/dist/mjs/api/resources/Card.d.ts.map +1 -1
  89. package/dist/mjs/api/resources/Card.js +10 -4
  90. package/dist/mjs/api/resources/Card.js.map +1 -1
  91. package/dist/mjs/api/resources/Contest.d.ts +12 -0
  92. package/dist/mjs/api/resources/Contest.d.ts.map +1 -0
  93. package/dist/mjs/api/resources/Contest.js +39 -0
  94. package/dist/mjs/api/resources/Contest.js.map +1 -0
  95. package/dist/mjs/api/resources/GeneralLedger.d.ts +8 -0
  96. package/dist/mjs/api/resources/GeneralLedger.d.ts.map +1 -1
  97. package/dist/mjs/api/resources/GeneralLedger.js +32 -0
  98. package/dist/mjs/api/resources/GeneralLedger.js.map +1 -1
  99. package/dist/mjs/api/resources/IncomeStatement.d.ts +2 -0
  100. package/dist/mjs/api/resources/IncomeStatement.d.ts.map +1 -1
  101. package/dist/mjs/api/resources/IncomeStatement.js +10 -0
  102. package/dist/mjs/api/resources/IncomeStatement.js.map +1 -1
  103. package/dist/mjs/api/resources/Journal.d.ts +2 -0
  104. package/dist/mjs/api/resources/Journal.d.ts.map +1 -1
  105. package/dist/mjs/api/resources/Journal.js +7 -0
  106. package/dist/mjs/api/resources/Journal.js.map +1 -1
  107. package/dist/mjs/api/resources/prestation.d.ts +2 -1
  108. package/dist/mjs/api/resources/prestation.d.ts.map +1 -1
  109. package/dist/mjs/api/resources/prestation.js +3 -0
  110. package/dist/mjs/api/resources/prestation.js.map +1 -1
  111. package/dist/mjs/api/resources.d.ts +2 -0
  112. package/dist/mjs/api/resources.d.ts.map +1 -1
  113. package/dist/mjs/api/resources.js +2 -0
  114. package/dist/mjs/api/resources.js.map +1 -1
  115. package/dist/mjs/index.d.ts +1 -0
  116. package/dist/mjs/index.d.ts.map +1 -1
  117. package/dist/mjs/index.js +1 -0
  118. package/dist/mjs/index.js.map +1 -1
  119. package/dist/mjs/types/Enum/BrandClementine.d.ts +7 -0
  120. package/dist/mjs/types/Enum/BrandClementine.d.ts.map +1 -1
  121. package/dist/mjs/types/Enum/BrandClementine.js +3 -0
  122. package/dist/mjs/types/Enum/BrandClementine.js.map +1 -1
  123. package/dist/mjs/types/Enum/BrandPourcentage.d.ts +1 -1
  124. package/dist/mjs/types/Enum/BrandPourcentage.d.ts.map +1 -1
  125. package/dist/mjs/types/Enum/BrandPourcentage.js +29 -28
  126. package/dist/mjs/types/Enum/BrandPourcentage.js.map +1 -1
  127. package/dist/mjs/types/Enum/PriceGridPourcentage.js +48 -48
  128. package/dist/mjs/types/Enum/PriceGridPourcentage.js.map +1 -1
  129. package/dist/mjs/types/Interface/api/contest/Create.d.ts +26 -0
  130. package/dist/mjs/types/Interface/api/contest/Create.d.ts.map +1 -0
  131. package/dist/mjs/types/Interface/api/contest/Create.js +114 -0
  132. package/dist/mjs/types/Interface/api/contest/Create.js.map +1 -0
  133. package/dist/mjs/types/Interface/api/contest/Query.d.ts +7 -0
  134. package/dist/mjs/types/Interface/api/contest/Query.d.ts.map +1 -0
  135. package/dist/mjs/types/Interface/api/contest/Query.js +38 -0
  136. package/dist/mjs/types/Interface/api/contest/Query.js.map +1 -0
  137. package/dist/mjs/types/Interface/api/contest/Read.d.ts +6 -0
  138. package/dist/mjs/types/Interface/api/contest/Read.d.ts.map +1 -0
  139. package/dist/mjs/types/Interface/api/contest/Read.js +2 -0
  140. package/dist/mjs/types/Interface/api/contest/Read.js.map +1 -0
  141. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
  142. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
  143. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js +20 -0
  144. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
  145. package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
  146. package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
  147. package/dist/mjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
  148. package/dist/mjs/types/Interface/models/IUserContest.d.ts +20 -0
  149. package/dist/mjs/types/Interface/models/IUserContest.d.ts.map +1 -0
  150. package/dist/mjs/types/Interface/models/IUserContest.js +2 -0
  151. package/dist/mjs/types/Interface/models/IUserContest.js.map +1 -0
  152. package/dist/mjs/types/Interface/models/IVoteContest.d.ts +14 -0
  153. package/dist/mjs/types/Interface/models/IVoteContest.d.ts.map +1 -0
  154. package/dist/mjs/types/Interface/models/IVoteContest.js +2 -0
  155. package/dist/mjs/types/Interface/models/IVoteContest.js.map +1 -0
  156. package/dist/mjs/types/index.d.ts +5 -0
  157. package/dist/mjs/types/index.d.ts.map +1 -1
  158. package/dist/mjs/types/index.js +5 -0
  159. package/dist/mjs/types/index.js.map +1 -1
  160. package/dist/mjs/utils/commercialManagement/document.d.ts +0 -1
  161. package/dist/mjs/utils/commercialManagement/document.d.ts.map +1 -1
  162. package/dist/mjs/utils/commercialManagement/document.js +1 -76
  163. package/dist/mjs/utils/commercialManagement/document.js.map +1 -1
  164. package/dist/mjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
  165. package/dist/mjs/utils/commercialManagement/templates/common.js +34 -46
  166. package/dist/mjs/utils/commercialManagement/templates/common.js.map +1 -1
  167. package/dist/mjs/utils/email/templates/signature.d.ts.map +1 -1
  168. package/dist/mjs/utils/email/templates/signature.js +42 -10
  169. package/dist/mjs/utils/email/templates/signature.js.map +1 -1
  170. package/dist/mjs/utils/email.d.ts.map +1 -1
  171. package/dist/mjs/utils/email.js +18 -1
  172. package/dist/mjs/utils/email.js.map +1 -1
  173. package/package.json +1 -1
  174. package/ts/api/resources/Card.ts +10 -4
  175. package/ts/api/resources/Contest.ts +47 -0
  176. package/ts/api/resources/GeneralLedger.ts +36 -0
  177. package/ts/api/resources/IncomeStatement.ts +13 -0
  178. package/ts/api/resources/Journal.ts +9 -0
  179. package/ts/api/resources/prestation.ts +6 -0
  180. package/ts/api/resources.ts +2 -0
  181. package/ts/index.ts +1 -0
  182. package/ts/types/Enum/BrandClementine.ts +3 -0
  183. package/ts/types/Enum/BrandPourcentage.ts +29 -28
  184. package/ts/types/Enum/PriceGridPourcentage.ts +48 -48
  185. package/ts/types/Interface/api/contest/Create.ts +69 -0
  186. package/ts/types/Interface/api/contest/Query.ts +20 -0
  187. package/ts/types/Interface/api/contest/Read.ts +6 -0
  188. package/ts/types/Interface/api/prestation/CreatePrestation.ts +14 -0
  189. package/ts/types/Interface/models/IPrestationComplementary.ts +21 -20
  190. package/ts/types/Interface/models/IUserContest.ts +22 -0
  191. package/ts/types/Interface/models/IVoteContest.ts +16 -0
  192. package/ts/types/index.ts +6 -1
  193. package/ts/utils/commercialManagement/document.ts +1 -93
  194. package/ts/utils/commercialManagement/templates/common.ts +34 -46
  195. package/ts/utils/email/templates/signature.ts +43 -10
  196. package/ts/utils/email.ts +18 -1
@@ -0,0 +1,69 @@
1
+ import { IsOptional, IsBoolean } from 'class-validator';
2
+ import { ApiProperty, ApiPropertyOptional } from '../../../../utils';
3
+ import { TFile } from '../file/TFile';
4
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
5
+
6
+ export class CreateUserContest {
7
+ @ApiProperty()
8
+ firstname: string;
9
+
10
+ @ApiProperty()
11
+ lastname: string;
12
+
13
+ @ApiProperty()
14
+ email: string;
15
+
16
+ @ApiProperty()
17
+ phone: string;
18
+
19
+ @ApiProperty()
20
+ societyName: string;
21
+
22
+ @ApiProperty()
23
+ siren: string;
24
+
25
+ @ApiPropertyOptional()
26
+ productDescription?: string;
27
+
28
+ @ApiPropertyOptional()
29
+ societyDescription?: string;
30
+
31
+ @ApiPropertyOptional()
32
+ @IsOptional()
33
+ photo?: TFile;
34
+
35
+ @ApiPropertyOptional()
36
+ @IsOptional()
37
+ logo?: TFile;
38
+
39
+ @ApiPropertyOptional()
40
+ @IsOptional()
41
+ @IsBoolean()
42
+ @ToBoolean()
43
+ isTestMode?: boolean;
44
+
45
+ @ApiPropertyOptional()
46
+ recaptcha?: string;
47
+ }
48
+
49
+ export class CreateCheckVote {
50
+ @ApiProperty()
51
+ email: string;
52
+
53
+ @ApiProperty()
54
+ ipAddress: string;
55
+
56
+ @ApiProperty()
57
+ idVoter: number;
58
+
59
+ @ApiPropertyOptional()
60
+ recaptcha?: string;
61
+ }
62
+
63
+ export class CreateVoteContest {
64
+ @ApiProperty()
65
+ emailHash: string;
66
+
67
+ @ApiProperty()
68
+ userHash: string;
69
+ }
@@ -0,0 +1,20 @@
1
+ import { IsBoolean, IsOptional } from 'class-validator';
2
+ import { ApiPropertyOptional } from '../../../../utils';
3
+ import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
4
+
5
+ export class QueryFetchUserContest {
6
+ @ApiPropertyOptional()
7
+ search?: string;
8
+
9
+ @ApiPropertyOptional()
10
+ orderBy?: string;
11
+
12
+ @ApiPropertyOptional()
13
+ @IsBoolean()
14
+ @ToBoolean()
15
+ @IsOptional()
16
+ top?: boolean | null;
17
+
18
+ @ApiPropertyOptional()
19
+ idToExclude?: number;
20
+ }
@@ -0,0 +1,6 @@
1
+ import { IUserContest } from '../../models/IUserContest';
2
+
3
+ export type ReadVoteChecking = {
4
+ success: boolean;
5
+ existingVoteUser: IUserContest | null
6
+ };
@@ -13,3 +13,17 @@ export class CreatePrestation {
13
13
  @ApiPropertyOptional()
14
14
  label?: string;
15
15
  }
16
+
17
+ export class CreateSocietyPrestationComplementary {
18
+ @ApiProperty()
19
+ @IsNumber()
20
+ idPrestationList: number;
21
+
22
+ @ApiProperty()
23
+ @IsNumber()
24
+ idExercice: number;
25
+
26
+ @ApiProperty()
27
+ @IsNumber()
28
+ totalTaxExcluded: number;
29
+ }
@@ -2,34 +2,35 @@ import { IUser } from './IUser';
2
2
  import { IPaymentExpectation } from './IPaymentExpectation';
3
3
  import { IGedFile } from './IGedFile';
4
4
  import { IPrestation } from './IPrestation';
5
+ import { AcceptationAdmin } from '../../Enum/AdditionnalSells';
5
6
 
6
7
  // prestationsCompl
7
8
  export interface IPrestationComplementary {
8
9
  id?: number;
9
10
  generateLink: boolean;
10
- deadline: Date | null;
11
- dateEstimateSigned: Date | null;
12
- dateSendToClient: Date | null;
13
- dateInvoice: Date | null;
14
- datePayment: Date | null;
15
- dateTransmission: Date | null;
16
- idGedFile: number | null;
17
- idCollaborater: number | null;
18
- idUser: number | null;
19
- idPaymentExpectation: number | null;
20
- description: string | null;
21
- note: string | null;
22
- forOtherMission: string | null;
23
- statePrestationJuridique: number | null;
24
- acceptationAdmin: number;
11
+ deadline?: Date | null;
12
+ dateEstimateSigned?: Date | null;
13
+ dateSendToClient?: Date | null;
14
+ dateInvoice?: Date | null;
15
+ datePayment?: Date | null;
16
+ dateTransmission?: Date | null;
17
+ idGedFile?: number | null;
18
+ idCollaborater?: number | null;
19
+ idUser?: number | null;
20
+ idPaymentExpectation?: number | null;
21
+ description?: string | null;
22
+ note?: string | null;
23
+ forOtherMission?: string | null;
24
+ statePrestationJuridique?: number | null;
25
+ acceptationAdmin: AcceptationAdmin;
25
26
  createdAt?: Date | null;
26
27
  updatedAt?: Date | null;
27
28
  deletedAt?: Date | null;
28
29
 
29
30
  // Associations
30
- prestationUser: IUser;
31
- prestationCollaborater: IUser;
32
- prestationPaymentExpectation: IPaymentExpectation;
33
- prestationGedFile: IGedFile;
34
- prestation: IPrestation;
31
+ prestationUser?: IUser;
32
+ prestationCollaborater?: IUser;
33
+ prestationPaymentExpectation?: IPaymentExpectation;
34
+ prestationGedFile?: IGedFile;
35
+ prestation?: IPrestation;
35
36
  }
@@ -0,0 +1,22 @@
1
+ import { IVoteContest } from './IVoteContest';
2
+
3
+ export interface IUserContest {
4
+ id?: number;
5
+ firstname: string;
6
+ lastname: string;
7
+ email: string;
8
+ hash: string;
9
+ phone: string;
10
+ societyName: string;
11
+ siren: string;
12
+ productDescription?: string | null;
13
+ societyDescription?: string | null;
14
+ tokenPhoto?: string | null;
15
+ tokenLogo?: string | null;
16
+ createdAt?: Date | null;
17
+ updatedAt?: Date | null;
18
+ deletedAt?: Date | null;
19
+
20
+ // associations
21
+ voteContests: IVoteContest[]
22
+ }
@@ -0,0 +1,16 @@
1
+ import { IUser } from '../..';
2
+
3
+ export interface IVoteContest {
4
+ id?: number;
5
+ emailVoter: string;
6
+ emailHash: string;
7
+ ipAddress: string;
8
+ hasVoteBeenCompleted: boolean
9
+ idUserVoteFor?: number | null;
10
+ createdAt?: Date | null;
11
+ updatedAt?: Date | null;
12
+ deletedAt?: Date | null;
13
+
14
+ // Associations
15
+ userVoteFor?: IUser;
16
+ }
package/ts/types/index.ts CHANGED
@@ -320,6 +320,9 @@ export * from './Interface/models/IBalanceSheetHistory';
320
320
  export * from './Interface/models/ICard';
321
321
  export * from './Interface/models/ICardHistory';
322
322
  export * from './Interface/models/IDubiousCustomer';
323
+ export * from './Interface/models/IUserContest';
324
+ export * from './Interface/models/IVoteContest';
325
+
323
326
 
324
327
  // Schemas
325
328
  export * from './Interface/schemas/IRegistrationDetail';
@@ -998,7 +1001,9 @@ export * from './Interface/api/card/QueryUserCardsStats';
998
1001
  export * from './Interface/api/card/UpdateCard';
999
1002
  export * from './Interface/api/notion/NotionResponse';
1000
1003
  export * from './Interface/api/IntermediateManagementRebate';
1001
-
1004
+ export * from './Interface/api/contest/Create';
1005
+ export * from './Interface/api/contest/Query';
1006
+ export * from './Interface/api/contest/Read';
1002
1007
  // Enums types
1003
1008
  export * from './Interface/enum/Util';
1004
1009
  export * from './Interface/enum/Date';
@@ -4,7 +4,7 @@ import {
4
4
  import * as dayjs from 'dayjs';
5
5
  import { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';
6
6
  import {
7
- AccountingCategoryList, FontIds, fontList, VatMarginCategyList,
7
+ AccountingCategoryList, FontIds, fontList,
8
8
  } from '../../types/Enum/CommercialManagement';
9
9
  import { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';
10
10
  import { Vat } from '../../types/Enum/Vat';
@@ -122,98 +122,6 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
122
122
  };
123
123
  }
124
124
 
125
- export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {
126
- if (!payload.deposit) throw new Error('Aucun acompte défini');
127
-
128
- const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {
129
- ...payload,
130
- title: payload.title ?? null,
131
- paymentLink: payload.paymentLink ?? '#',
132
- idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,
133
- phoneContact: payload.settings?.phoneContact ?? null,
134
- products: [],
135
- vats: [],
136
- totalTaxExcluded: payload.deposit,
137
- totalTaxIncluded: payload.deposit,
138
- totalTaxAndDiscountIncluded: payload.deposit,
139
- generalDiscountFormatted: null,
140
- depositFormatted: integerToFormattedAmountString(payload.deposit),
141
- totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),
142
- totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),
143
- totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(
144
- payload.deposit,
145
- ),
146
- totalVatAmountFormatted: integerToFormattedAmountString(0),
147
- font: {
148
- id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,
149
- name:
150
- fontList.find((f) => f.id === payload.settings?.idFont)?.name
151
- ?? fontList[0].name,
152
- url:
153
- fontList.find((f) => f.id === payload.settings?.idFont)?.link
154
- ?? fontList[0].link,
155
- },
156
- capitalFormatted: payload.capital
157
- ? `${payload.capital}`
158
- .split('')
159
- .reduceRight(
160
- (acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`,
161
- '',
162
- )
163
- .trim()
164
- : null,
165
- dueDateFormatted: payload.dueDate
166
- ? dayjs(payload.dueDate).format('DD/MM/YYYY')
167
- : null,
168
- expirationDateFormatted: payload.expirationDate
169
- ? dayjs(payload.expirationDate).format('DD/MM/YYYY')
170
- : null,
171
- emissionDateFormatted: payload.emissionDate
172
- ? dayjs(payload.emissionDate).format('DD/MM/YYYY')
173
- : null,
174
- shouldDisplayDiscountColumn: false,
175
- disableVat: true,
176
- // @ts-ignore
177
- marginVats: _uniq(
178
- (payload.assetMarginVatIds ?? []).map(
179
- (m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null,
180
- ),
181
- ),
182
- accountingCategoryFormatted:
183
- AccountingCategoryList.find((a) => a.id === payload.accountingCategory)
184
- ?.label ?? null,
185
- // @ts-ignore
186
- brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,
187
- brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,
188
- shouldHideBrandName,
189
- };
190
-
191
- const commonTemplate = new CommercialDocumentCommonHTML();
192
-
193
- return {
194
- header: ejs?.render(commonTemplate.header, data),
195
- body: ejs?.render(bodyTemplate, {
196
- ...data,
197
- comment:
198
- data.comment && typeof data.comment === 'string'
199
- ? data.comment?.replace(/\n/g, '<br/>')
200
- : null,
201
- products: data.products.map((p) => ({
202
- ...p,
203
- comment:
204
- p.comment && typeof p.comment === 'string'
205
- ? p.comment?.replace(/\n/g, '<br/>')
206
- : null,
207
- })),
208
- }),
209
- footer: ejs?.render(commonTemplate.footer, {
210
- ...data,
211
- freeText: payload?.settings?.freeInvoiceText ?? null,
212
- }),
213
- data,
214
- };
215
- }
216
-
217
125
  export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {
218
126
  dayjs.locale('fr');
219
127
  const data = {
@@ -50,16 +50,6 @@ export class CommercialDocumentCommonHTML {
50
50
  <td>Montant <%= disableVat !== true ? 'HT' : ''%></td>
51
51
  </tr>
52
52
  </thead>
53
- <% if (idEstimateInvoiceType === ${EstimateInvoiceType.ACOMPTE}) { %>
54
- <tr>
55
- <td class="product-title">
56
- <%= title %>
57
- </td>
58
- <td class="product-quantity">1</td>
59
- <td class="product-price-without-vat"><%= depositFormatted %>€</td>
60
- <td class="product-total-price-without-vat"><%= depositFormatted %>€</td>
61
- </tr>
62
- <% } %>
63
53
  <% if (products) { %>
64
54
  <% products.forEach(function (product) { %>
65
55
  <tr>
@@ -107,42 +97,40 @@ export class CommercialDocumentCommonHTML {
107
97
  <td colspan="2">Récapitulatif</td>
108
98
  </tr>
109
99
  </thead>
110
- <% if (idEstimateInvoiceType !== ${EstimateInvoiceType.ACOMPTE}) { %>
111
- <% if (disableVat !== true) { %>
112
- <tr>
113
- <td>Total HT</td>
114
- <td><%= totalTaxExcludedFormatted %>€</td>
115
- </tr>
116
- <% } %>
117
- <% if (generalDiscountFormatted) { %>
118
- <tr>
119
- <td>Remise</td>
120
- <td><%= generalDiscountFormatted %>€</td>
121
- </tr>
122
- <% } %>
123
- <% if (disableVat !== true) { %>
124
- <tr>
125
- <td>TVA</td>
126
- <td><%= totalVatAmountFormatted %>€</td>
127
- </tr>
128
- <% } %>
129
- <% if (disableVat !== true || generalDiscountFormatted || depositFormatted) { %>
130
- <tr>
131
- <td>Total <%= disableVat !== true ? 'TTC' : ''%></td>
132
- <td><%= totalTaxIncludedFormatted %>€</td>
133
- </tr>
134
- <% } else if (disableVat === true && ![${EstimateInvoiceType.FACTURE}, ${EstimateInvoiceType.RESTE}, ${EstimateInvoiceType.ACOMPTE}].includes(idEstimateInvoiceType)) { %>
135
- <tr>
136
- <td>Total</td>
137
- <td><%= totalTaxIncludedFormatted %>€</td>
138
- </tr>
139
- <% } %>
140
- <% if (depositFormatted) { %>
141
- <tr>
142
- <td>Acompte</td>
143
- <td><%= depositFormatted %>€</td>
144
- </tr>
145
- <% } %>
100
+ <% if (disableVat !== true) { %>
101
+ <tr>
102
+ <td>Total HT</td>
103
+ <td><%= totalTaxExcludedFormatted %>€</td>
104
+ </tr>
105
+ <% } %>
106
+ <% if (generalDiscountFormatted) { %>
107
+ <tr>
108
+ <td>Remise</td>
109
+ <td><%= generalDiscountFormatted %>€</td>
110
+ </tr>
111
+ <% } %>
112
+ <% if (disableVat !== true) { %>
113
+ <tr>
114
+ <td>TVA</td>
115
+ <td><%= totalVatAmountFormatted %>€</td>
116
+ </tr>
117
+ <% } %>
118
+ <% if (disableVat !== true || generalDiscountFormatted || depositFormatted) { %>
119
+ <tr>
120
+ <td>Total <%= disableVat !== true ? 'TTC' : ''%></td>
121
+ <td><%= totalTaxIncludedFormatted %>€</td>
122
+ </tr>
123
+ <% } else if (disableVat === true && ![${EstimateInvoiceType.FACTURE}, ${EstimateInvoiceType.RESTE}, ${EstimateInvoiceType.ACOMPTE}].includes(idEstimateInvoiceType)) { %>
124
+ <tr>
125
+ <td>Total</td>
126
+ <td><%= totalTaxIncludedFormatted %>€</td>
127
+ </tr>
128
+ <% } %>
129
+ <% if (depositFormatted) { %>
130
+ <tr>
131
+ <td>Acompte</td>
132
+ <td><%= depositFormatted %>€</td>
133
+ </tr>
146
134
  <% } %>
147
135
  <% if ([${EstimateInvoiceType.FACTURE}, ${EstimateInvoiceType.RESTE}, ${EstimateInvoiceType.ACOMPTE}].includes(idEstimateInvoiceType)) { %>
148
136
  <tr>
@@ -1,4 +1,15 @@
1
- const logoClementine = `<% if (brandName === 'Clementine') { %><tr>
1
+ const newIban = `<% if (commercialName === 'Clementine' && isFacturation) { %>
2
+ <p style="font-size: 15px; font-family: Arial; margin:0; padding:0px 0 4px; color:#6E6E71; margin-bottom: 10px; font-weight: bold;">
3
+ <span style="color: #A0A0A0">Nos coordonnées bancaires </span>IBAN : <%= iban %> - BIC : <%= bic %>
4
+ </p>
5
+ <% }else if (commercialName === 'Pourcentage' && [5, 7].includes(idTypeBrand)) { %>
6
+ <p style="font-size: 15px; font-family: Arial; margin:0; padding:0px 0 4px; color:#6E6E71; margin-bottom: 10px; font-weight: bold;">
7
+ <span style="color: #A0A0A0">Attention changement de RIB </span>IBAN : <%= iban %> - BIC : <%= bic %>
8
+ </p>
9
+ <% } %>
10
+ `;
11
+
12
+ const logoClementine = `<% if (commercialName === 'Clementine') { %><tr>
2
13
  <td
3
14
  colspan="3"
4
15
  class="logo"
@@ -17,17 +28,27 @@ const avatar = `<% if (!forceRole && user?.avatar?.token) { %>
17
28
  class="avatar"
18
29
  style="text-align:center; padding: 20px 0 20px 20px; position: relative;"
19
30
  width="100">
20
- <p style="padding: 20px;background-image: url('https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_quotes.png');background-size: 26%;background-position: 81% -3%;background-repeat: no-repeat;">
21
- <img
22
- style="max-height: 90px;max-width: 90px; border-radius: 100%; padding-top: 10px"
31
+ <% if(commercialName === 'Clementine') { %>
32
+ <p style="padding: 20px;background-image: url('https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_quotes.png');background-size: 26%;background-position: 81% -3%;background-repeat: no-repeat;">
33
+ <img
34
+ style="max-height: 90px;max-width: 90px; border-radius: 100%; margin-top: 10px"
35
+ alt="Avatar"
36
+ src="<%= hostS3 %>users/<%= user.id %>/<%= user.avatar.token %>"
37
+ />
38
+ </p>
39
+ <% } else { %>
40
+ <p style="padding: 20px;">
41
+ <img
42
+ style="max-height: 90px;max-width: 90px; border-radius: 100%; margin-top: 10px"
23
43
  alt="Avatar"
24
44
  src="<%= hostS3 %>users/<%= user.id %>/<%= user.avatar.token %>"
25
- />
26
- </p>
45
+ />
46
+ </p>
47
+ <% } %>
27
48
  </td>
28
49
  <% } %>`;
29
50
 
30
- const footer = `<% if(brandName === 'Clementine') { %>
51
+ const footer = `<% if(commercialName === 'Clementine') { %>
31
52
  <tr>
32
53
  <td
33
54
  style="clear:both; padding-top: 20px; font-size:17px; line-height:14px; color:#ADADAD; text-align: justify; font-family: Arial;"
@@ -95,7 +116,7 @@ const footer = `<% if(brandName === 'Clementine') { %>
95
116
  </table>
96
117
  </td>
97
118
  </tr>
98
- <% } else if(brandName === 'Pourcentage') { %>
119
+ <% } else if(commercialName === 'Pourcentage') { %>
99
120
  <tr>
100
121
  <td
101
122
  style="clear:both; padding-top: 20px; font-size:17px; line-height:14px; color:#ADADAD; text-align: justify; font-family: Arial;"
@@ -111,13 +132,25 @@ const footer = `<% if(brandName === 'Clementine') { %>
111
132
  alt="Connexion"> Connexion
112
133
  </a>
113
134
  </td>
135
+ <td style="text-align: right; vertical-align: middle; color: #6E6E71" width="430">
136
+ <span>Télécharger l'app</span>
137
+ <a href="https://apps.apple.com/fr/app/pourcentage-fr/id1631156043" target="_blank" style="vertical-align: middle; margin-left: 10px"><img
138
+ src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_appstore.png"
139
+ alt="App Store"
140
+ style="width: 20px"></a>
141
+ <a href="https://play.google.com/store/apps/details?id=com.clementine.pourcentage" target="_blank" style="vertical-align: middle; margin-left: 10px"><img
142
+ src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_playstore.png"
143
+ alt="Play Store"
144
+ style="width: 20px"></a>
145
+ </td>
146
+ </tr>
114
147
  </table>
115
148
  </td>
116
149
  </tr>
117
150
  <% } %>
118
151
  `;
119
152
 
120
- export const signatureTemplate = `<table
153
+ export const signatureTemplate = `${newIban}<table
121
154
  border="0"
122
155
  cellpadding="0"
123
156
  cellspacing="0"
@@ -179,7 +212,7 @@ ${logoClementine}
179
212
  <% if(user.calendlyUrl) { %>
180
213
  <a href="<%= user.calendlyUrl %>" style="display: inline-block; color:#6E6E71;" target="_blank">
181
214
  <img
182
- src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_rdv_tel<%= brandName === 'Pourcentage' ? '_pourcentage' : '' %>.png"
215
+ src="https://clementine-website.s3.eu-west-3.amazonaws.com/signaturemail_rdv_tel<%= commercialName === 'Pourcentage' ? '_pourcentage' : '' %>.png"
183
216
  alt="Demande de rdv téléphonique">
184
217
  </a>
185
218
  <% } %>
package/ts/utils/email.ts CHANGED
@@ -166,6 +166,18 @@ export function generateSignature(params: any): string {
166
166
  ...(idTypeBrand ? { idTypeBrand } : {}),
167
167
  objectWaited: 'name',
168
168
  }) as unknown as string;
169
+ const commercialName = getBrandConfig({
170
+ ...(idTypeBrand ? { idTypeBrand } : {}),
171
+ objectWaited: 'commercialName',
172
+ }) as unknown as string;
173
+ const iban = getBrandConfig({
174
+ ...(idTypeBrand ? { idTypeBrand } : {}),
175
+ objectWaited: 'bank.IBAN',
176
+ }) as unknown as string;
177
+ const bic = getBrandConfig({
178
+ ...(idTypeBrand ? { idTypeBrand } : {}),
179
+ objectWaited: 'bank.BIC',
180
+ }) as unknown as string;
169
181
  const bonjourMail = getBrandConfig({
170
182
  ...(idTypeBrand ? { idTypeBrand } : {}),
171
183
  objectWaited: 'listMails.bonjour',
@@ -242,7 +254,7 @@ export function generateSignature(params: any): string {
242
254
  phoneSignature = standardPhoneSignature;
243
255
  } else if (!user) { // Signature Clementine
244
256
  user = {
245
- firstname: `L'équipe ${brandName}`,
257
+ firstname: `L'équipe ${commercialName}`,
246
258
  isAll: true,
247
259
  };
248
260
  roleSignature = '';
@@ -255,7 +267,12 @@ export function generateSignature(params: any): string {
255
267
 
256
268
  return ejs.render(signatureTemplate, {
257
269
  forceRole,
270
+ isFacturation: user.roles ? user.roles.some((r: any) => r.id === Role.FACTURATION) : false,
258
271
  brandName,
272
+ idTypeBrand,
273
+ commercialName,
274
+ iban,
275
+ bic,
259
276
  hostS3,
260
277
  user,
261
278
  roleSignature,