@silexpert/core 1.0.109 → 1.0.111

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 (88) hide show
  1. package/es/api/resources/RevisionGuide.d.ts +3 -3
  2. package/es/api/resources/RevisionGuide.d.ts.map +1 -1
  3. package/es/api/resources/RevisionGuide.js +6 -6
  4. package/es/api/resources/RevisionGuide.js.map +1 -1
  5. package/es/types/Enum/Activity.d.ts +9 -1
  6. package/es/types/Enum/Activity.d.ts.map +1 -1
  7. package/es/types/Enum/Activity.js +8 -0
  8. package/es/types/Enum/Activity.js.map +1 -1
  9. package/es/types/Enum/BalanceSheet.d.ts +11 -11
  10. package/es/types/Enum/BalanceSheet.js +11 -11
  11. package/es/types/Enum/BalanceSheet.js.map +1 -1
  12. package/es/types/Enum/GeneralThirdParty.d.ts.map +1 -1
  13. package/es/types/Enum/GeneralThirdParty.js +0 -1
  14. package/es/types/Enum/GeneralThirdParty.js.map +1 -1
  15. package/es/types/Enum/MailDomainType.d.ts +3 -0
  16. package/es/types/Enum/MailDomainType.d.ts.map +1 -0
  17. package/es/types/Enum/MailDomainType.js +105 -0
  18. package/es/types/Enum/MailDomainType.js.map +1 -0
  19. package/es/types/Interface/api/facturation/CreateRebilling.js +2 -2
  20. package/es/types/Interface/api/facturation/CreateRebilling.js.map +1 -1
  21. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.d.ts +1 -0
  22. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.d.ts.map +1 -1
  23. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.js +4 -0
  24. package/es/types/Interface/api/revisionGuide/CreateRevisionGuide.js.map +1 -1
  25. package/es/types/Interface/models/IExercice.d.ts +2 -2
  26. package/es/types/Interface/models/IExercice.js.map +1 -1
  27. package/es/types/Interface/models/IRevisionGuide.d.ts +1 -0
  28. package/es/types/Interface/models/IRevisionGuide.d.ts.map +1 -1
  29. package/es/types/Interface/models/IRevisionGuide.js.map +1 -1
  30. package/es/types/Interface/models/ISociety.d.ts +1 -0
  31. package/es/types/Interface/models/ISociety.d.ts.map +1 -1
  32. package/es/types/Interface/models/ISociety.js.map +1 -1
  33. package/es/types/index.d.ts +1 -0
  34. package/es/types/index.d.ts.map +1 -1
  35. package/es/types/index.js +1 -0
  36. package/es/types/index.js.map +1 -1
  37. package/es/utils/commercialManagement/document.d.ts +3 -3
  38. package/es/utils/commercialManagement/document.d.ts.map +1 -1
  39. package/es/utils/commercialManagement/document.js.map +1 -1
  40. package/es/utils/commercialManagement/templates/common.js +2 -2
  41. package/es/utils/commercialManagement/templates/common.js.map +1 -1
  42. package/es/utils/index.d.ts +1 -0
  43. package/es/utils/index.d.ts.map +1 -1
  44. package/es/utils/index.js +1 -0
  45. package/es/utils/index.js.map +1 -1
  46. package/es/utils/quotation.d.ts +13 -0
  47. package/es/utils/quotation.d.ts.map +1 -0
  48. package/es/utils/quotation.js +107 -0
  49. package/es/utils/quotation.js.map +1 -0
  50. package/js/api/resources/RevisionGuide.js +6 -6
  51. package/js/api/resources/RevisionGuide.js.map +1 -1
  52. package/js/types/Enum/Activity.js +8 -0
  53. package/js/types/Enum/Activity.js.map +1 -1
  54. package/js/types/Enum/BalanceSheet.js +11 -11
  55. package/js/types/Enum/BalanceSheet.js.map +1 -1
  56. package/js/types/Enum/GeneralThirdParty.js +0 -3
  57. package/js/types/Enum/GeneralThirdParty.js.map +1 -1
  58. package/js/types/Enum/MailDomainType.js +8 -0
  59. package/js/types/Enum/MailDomainType.js.map +1 -0
  60. package/js/types/Interface/api/facturation/CreateRebilling.js +1 -1
  61. package/js/types/Interface/api/facturation/CreateRebilling.js.map +1 -1
  62. package/js/types/Interface/api/revisionGuide/CreateRevisionGuide.js +2 -0
  63. package/js/types/Interface/api/revisionGuide/CreateRevisionGuide.js.map +1 -1
  64. package/js/types/index.js +12 -0
  65. package/js/types/index.js.map +1 -1
  66. package/js/utils/commercialManagement/document.js.map +1 -1
  67. package/js/utils/commercialManagement/templates/common.js +2 -2
  68. package/js/utils/commercialManagement/templates/common.js.map +1 -1
  69. package/js/utils/index.js +12 -0
  70. package/js/utils/index.js.map +1 -1
  71. package/js/utils/quotation.js +137 -0
  72. package/js/utils/quotation.js.map +1 -0
  73. package/package.json +1 -1
  74. package/ts/api/resources/RevisionGuide.ts +6 -6
  75. package/ts/types/Enum/Activity.ts +8 -0
  76. package/ts/types/Enum/BalanceSheet.ts +11 -11
  77. package/ts/types/Enum/GeneralThirdParty.ts +0 -1
  78. package/ts/types/Enum/MailDomainType.ts +105 -0
  79. package/ts/types/Interface/api/facturation/CreateRebilling.ts +2 -2
  80. package/ts/types/Interface/api/revisionGuide/CreateRevisionGuide.ts +3 -0
  81. package/ts/types/Interface/models/IExercice.ts +2 -2
  82. package/ts/types/Interface/models/IRevisionGuide.ts +1 -0
  83. package/ts/types/Interface/models/ISociety.ts +1 -0
  84. package/ts/types/index.ts +1 -0
  85. package/ts/utils/commercialManagement/document.ts +3 -3
  86. package/ts/utils/commercialManagement/templates/common.ts +2 -2
  87. package/ts/utils/index.ts +2 -1
  88. package/ts/utils/quotation.ts +125 -0
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLeadQuotation = getLeadQuotation;
7
+
8
+ var _MailDomainType = require("../types/Enum/MailDomainType");
9
+
10
+ var _Activity = require("../types/Enum/Activity");
11
+
12
+ function getLeadQuotation(params) {
13
+ const {
14
+ firstname,
15
+ lastname,
16
+ phone,
17
+ mail,
18
+ annualTurnover,
19
+ source,
20
+ alreadyExist,
21
+ activitySector
22
+ } = params;
23
+
24
+ if (firstname === 'test' || lastname === 'test' || (mail === null || mail === void 0 ? void 0 : mail.includes('test')) || ['606060606', '707070707', '612345678', '712345678', '687654321', '787654321'].includes(phone)) {
25
+ return 0;
26
+ }
27
+
28
+ let quotation = 0;
29
+ /* cotation du prénom */
30
+
31
+ if (firstname) quotation += 5;
32
+ /* cotation du nom */
33
+
34
+ if (lastname) quotation += 5;
35
+ /* cotation du numéro de téléphone */
36
+
37
+ if (['6', '7'].includes(phone.substr(0, 1))) {
38
+ quotation += 15;
39
+ } else {
40
+ quotation += 5;
41
+ }
42
+ /* cotation de l'adresse email */
43
+
44
+
45
+ if (_MailDomainType.BasicDomain.find(domain => mail === null || mail === void 0 ? void 0 : mail.includes(domain))) {
46
+ quotation += 5;
47
+ } else if (!_MailDomainType.ForbidenDomain.find(domain => mail === null || mail === void 0 ? void 0 : mail.includes(domain))) {
48
+ quotation += 15;
49
+ }
50
+ /* cotation du CA annuel */
51
+
52
+
53
+ if ([0, 150000, 400000, 783000, 783001].includes(annualTurnover)) {
54
+ quotation += 10;
55
+ } else if ([50000, 234000].includes(annualTurnover)) {
56
+ quotation += 5;
57
+ }
58
+ /* cotation de la date d'ajout */
59
+
60
+
61
+ if ([1, 2, 3, 4, 5].includes(new Date().getDay())) {
62
+ const dateTime = new Date();
63
+ const year = dateTime.getFullYear();
64
+ const month = dateTime.getMonth();
65
+ const day = dateTime.getDate();
66
+ const startTime = new Date(`${year}-${month + 1}-${day} 08:45:00`);
67
+ const endTime = new Date(`${year}-${month + 1}-${day} 18:45:00`);
68
+
69
+ if (startTime.getTime() <= dateTime.getTime() && endTime.getTime() >= dateTime.getTime()) {
70
+ quotation += 15;
71
+ } else {
72
+ quotation += 5;
73
+ }
74
+ } else {
75
+ quotation += 5;
76
+ }
77
+ /* cotation de la source */
78
+
79
+ /* Parrainage */
80
+
81
+
82
+ if (source === 49) {
83
+ quotation += 10;
84
+ /* calendly, appel entrant */
85
+ } else if (source === 2) {
86
+ quotation += 8;
87
+ /* adWords, Bing, Formulaire */
88
+ } else if (source === 4) {
89
+ quotation += 6;
90
+ /* Chat, Whatsapp */
91
+ } else if ([29, 92].includes(source)) {
92
+ quotation += 2;
93
+ }
94
+ /* cotation de la qualité (nombre de champs remplis) */
95
+
96
+
97
+ const fieldNumber = [firstname, lastname, phone, mail, annualTurnover, activitySector].filter(data => !!data).length;
98
+
99
+ switch (fieldNumber) {
100
+ case 6:
101
+ quotation += 10;
102
+ break;
103
+
104
+ case 5:
105
+ quotation += 8;
106
+ break;
107
+
108
+ case 4:
109
+ quotation += 6;
110
+ break;
111
+
112
+ case 3:
113
+ quotation += 4;
114
+ break;
115
+
116
+ case 2:
117
+ quotation += 2;
118
+ break;
119
+
120
+ default:
121
+ break;
122
+ }
123
+ /* cotation de l'existence du lead (déjà existant ou non) */
124
+
125
+
126
+ if (alreadyExist) quotation += 8;
127
+ /* cotation du secteur d'activité */
128
+
129
+ if ([_Activity.Activity.INFORMATIQUE, _Activity.Activity.CONSEIL].includes(activitySector)) {
130
+ quotation += 10;
131
+ } else if ([_Activity.Activity.TRANSPORT, _Activity.Activity.BTP, _Activity.Activity.RESTAURATION, _Activity.Activity.COMMERCANT, _Activity.Activity.MEDICAL, _Activity.Activity.PROF_LIB].includes(activitySector)) {
132
+ quotation += 5;
133
+ }
134
+
135
+ return quotation;
136
+ }
137
+ //# sourceMappingURL=quotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotation.js","mappings":";;;;;QAcgBA,gB,GAAAA,gB;;AAdhB;;AACA;;AAaM,SAAUA,gBAAV,CAA2BC,MAA3B,EAAyD;EAC7D,MAAM;IACJC,SADI;IACOC,QADP;IACiBC,KADjB;IACwBC,IADxB;IAC8BC,cAD9B;IAC8CC,MAD9C;IACsDC,YADtD;IACoEC;EADpE,IAEFR,MAFJ;;EAGA,IACEC,SAAS,KAAK,MAAd,IACGC,QAAQ,KAAK,MADhB,KAEGE,IAAI,SAAJ,QAAI,WAAJ,GAAI,MAAJ,OAAI,CAAEK,QAAN,CAAe,MAAf,CAFH,KAGG,CAAC,WAAD,EAAc,WAAd,EAA2B,WAA3B,EAAwC,WAAxC,EAAqD,WAArD,EAAkE,WAAlE,EAA+EA,QAA/E,CAAwFN,KAAxF,CAJL,EAKE;IACA,OAAO,CAAP;EACD;;EACD,IAAIO,SAAS,GAAG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ACF,KAAK,CAAL;MACEA,SAAS,IAAI,CAAb;MACA;;IACF,KAAK,CAAL;MACEA,SAAS,IAAI,CAAb;MACA;;IACF,KAAK,CAAL;MACEA,SAAS,IAAI,CAAb;MACA;;IACF;MACE;EAjBJ;EAoBA;;;EACA,IAAIH,YAAJ,EAAkBG,SAAS,IAAI,CAAb;EAElB;;EACA,IAAI,CAACsB,mBAASC,YAAV,EAAwBD,mBAASE,OAAjC,EAA0CzB,QAA1C,CAAmDD,cAAnD,CAAJ,EAAwE;IACtEE,SAAS,IAAI,EAAb;EACD,CAFD,MAEO,IAAI,CAACsB,mBAASG,SAAV,EAAqBH,mBAASI,GAA9B,EAAmCJ,mBAASK,YAA5C,EAA0DL,mBAASM,UAAnE,EAA+EN,mBAASO,OAAxF,EAAiGP,mBAASQ,QAA1G,EAAoH/B,QAApH,CAA6HD,cAA7H,CAAJ,EAAkJ;IACvJE,SAAS,IAAI,CAAb;EACD;;EAED,OAAOA,SAAP;AACD","names":["getLeadQuotation","params","firstname","lastname","phone","mail","annualTurnover","source","alreadyExist","activitySector","includes","quotation","substr","BasicDomain","find","domain","ForbidenDomain","Date","getDay","dateTime","year","getFullYear","month","getMonth","day","getDate","startTime","endTime","getTime","fieldNumber","filter","data","length","Activity","INFORMATIQUE","CONSEIL","TRANSPORT","BTP","RESTAURATION","COMMERCANT","MEDICAL","PROF_LIB"],"sourceRoot":"","sources":["../../ts/utils/quotation.ts"],"sourcesContent":["import { ForbidenDomain, BasicDomain } from '../types/Enum/MailDomainType';\nimport { Activity } from '../types/Enum/Activity';\n\ntype getLeadQuotationParams = {\n firstname: string,\n lastname: string,\n phone: string,\n mail: string,\n annualTurnover: number,\n source: number,\n alreadyExist: boolean,\n activitySector: number,\n};\n\nexport function getLeadQuotation(params: getLeadQuotationParams):number {\n const {\n firstname, lastname, phone, mail, annualTurnover, source, alreadyExist, activitySector,\n } = params;\n if (\n firstname === 'test'\n || lastname === 'test'\n || mail?.includes('test')\n || ['606060606', '707070707', '612345678', '712345678', '687654321', '787654321'].includes(phone)\n ) {\n return 0;\n }\n let quotation = 0;\n\n /* cotation du prénom */\n if (firstname) quotation += 5;\n\n /* cotation du nom */\n if (lastname) quotation += 5;\n\n /* cotation du numéro de téléphone */\n if (['6', '7'].includes(phone.substr(0, 1))) {\n quotation += 15;\n } else {\n quotation += 5;\n }\n\n /* cotation de l'adresse email */\n if (BasicDomain.find((domain) => mail?.includes(domain))) {\n quotation += 5;\n } else\n if (!ForbidenDomain.find((domain) => mail?.includes(domain))) {\n quotation += 15;\n }\n\n /* cotation du CA annuel */\n if ([0, 150000, 400000, 783000, 783001].includes(annualTurnover)) {\n quotation += 10;\n } else if ([50000, 234000].includes(annualTurnover)) {\n quotation += 5;\n }\n\n /* cotation de la date d'ajout */\n if ([1, 2, 3, 4, 5].includes(new Date().getDay())) {\n const dateTime = new Date();\n const year = dateTime.getFullYear();\n const month = dateTime.getMonth();\n const day = dateTime.getDate();\n const startTime = new Date(`${year}-${month + 1}-${day} 08:45:00`);\n const endTime = new Date(`${year}-${month + 1}-${day} 18:45:00`);\n if ((startTime.getTime() <= dateTime.getTime()) && (endTime.getTime() >= dateTime.getTime())) {\n quotation += 15;\n } else {\n quotation += 5;\n }\n } else {\n quotation += 5;\n }\n\n /* cotation de la source */\n /* Parrainage */\n if (source === 49) {\n quotation += 10;\n\n /* calendly, appel entrant */\n } else if (source === 2) {\n quotation += 8;\n\n /* adWords, Bing, Formulaire */\n } else if (source === 4) {\n quotation += 6;\n\n /* Chat, Whatsapp */\n } else if ([29, 92].includes(source)) {\n quotation += 2;\n }\n\n /* cotation de la qualité (nombre de champs remplis) */\n const fieldNumber = [firstname, lastname, phone, mail, annualTurnover, activitySector].filter((data) => !!data).length;\n switch (fieldNumber) {\n case 6:\n quotation += 10;\n break;\n case 5:\n quotation += 8;\n break;\n case 4:\n quotation += 6;\n break;\n case 3:\n quotation += 4;\n break;\n case 2:\n quotation += 2;\n break;\n default:\n break;\n }\n\n /* cotation de l'existence du lead (déjà existant ou non) */\n if (alreadyExist) quotation += 8;\n\n /* cotation du secteur d'activité */\n if ([Activity.INFORMATIQUE, Activity.CONSEIL].includes(activitySector)) {\n quotation += 10;\n } else if ([Activity.TRANSPORT, Activity.BTP, Activity.RESTAURATION, Activity.COMMERCANT, Activity.MEDICAL, Activity.PROF_LIB].includes(activitySector)) {\n quotation += 5;\n }\n\n return quotation;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.0.109",
3
+ "version": "1.0.111",
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",
@@ -2,15 +2,15 @@ import { Resource } from '../Resource';
2
2
  import { CreateRevisionGuide, IRevisionGuide } from '../../types';
3
3
 
4
4
  export class RevisionGuide extends Resource {
5
- getAll(idExercice: number): Promise<IRevisionGuide[]> {
6
- return this.axios.$get(`/exercice/${idExercice}/revisionGuide`);
5
+ getAll(idBalanceSheet: number): Promise<IRevisionGuide[]> {
6
+ return this.axios.$get(`/balancesheet/${idBalanceSheet}/revisionGuide`);
7
7
  }
8
8
 
9
- updateOrCreate(idExercice: number, payload: CreateRevisionGuide[]): Promise<IRevisionGuide[]> {
10
- return this.axios.$post(`/exercice/${idExercice}/revisionGuide`, payload);
9
+ updateOrCreate(idBalanceSheet: number, payload: CreateRevisionGuide[]): Promise<IRevisionGuide[]> {
10
+ return this.axios.$post(`/balancesheet/${idBalanceSheet}/revisionGuide`, payload);
11
11
  }
12
12
 
13
- generateFile(idExercice: number): Promise<IRevisionGuide[]> {
14
- return this.axios.$post(`/exercice/${idExercice}/revisionGuide/file`);
13
+ generateFile(idBalanceSheet: number): Promise<IRevisionGuide[]> {
14
+ return this.axios.$post(`/balancesheet/${idBalanceSheet}/revisionGuide/file`);
15
15
  }
16
16
  }
@@ -3,4 +3,12 @@ export enum Activity {
3
3
  COMMERCANT = 2,
4
4
  PROF_LIB = 3,
5
5
  AUTRES = 4,
6
+ AGRICOLE = 5,
7
+ INFORMATIQUE = 6,
8
+ CONSEIL = 7,
9
+ ART = 8,
10
+ RESTAURATION = 9,
11
+ TRANSPORT = 10,
12
+ BTP = 11,
13
+ MEDICAL = 12,
6
14
  }
@@ -28,7 +28,7 @@ export const BalanceSheetDetails = [
28
28
  text: 'À faire',
29
29
  color: 'grey',
30
30
  textColor: 'grey--text',
31
- forRoles: [['front_office'], ['expert'], ['customer_success']],
31
+ forRoles: [['front_office', 'front_office_express'], ['expert'], ['customer_success']],
32
32
  },
33
33
  {
34
34
  text: 'En cours de prod.',
@@ -36,7 +36,7 @@ export const BalanceSheetDetails = [
36
36
  alias: 'ENC',
37
37
  color: 'grey',
38
38
  textColor: 'grey--text ',
39
- forRoles: [['front_office'], ['expert']],
39
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
40
40
  },
41
41
  {
42
42
  text: 'Att. retour client',
@@ -44,14 +44,14 @@ export const BalanceSheetDetails = [
44
44
  alias: 'ARC',
45
45
  color: 'cyan',
46
46
  textColor: 'cyan--text',
47
- forRoles: [['front_office'], ['expert']],
47
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
48
48
  },
49
49
  {
50
50
  text: 'À réviser',
51
51
  value: BalanceSheetState.TO_REVISE,
52
52
  color: 'purple lighten-2',
53
53
  textColor: 'purple--text',
54
- forRoles: [['front_office'], ['expert']],
54
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
55
55
  },
56
56
  {
57
57
  text: 'À revoir',
@@ -66,7 +66,7 @@ export const BalanceSheetDetails = [
66
66
  value: BalanceSheetState.TO_SUPERVISE,
67
67
  color: 'teal',
68
68
  textColor: 'teal--text',
69
- forRoles: [['front_office'], ['expert']],
69
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
70
70
  },
71
71
  {
72
72
  text: 'À envoyer',
@@ -80,7 +80,7 @@ export const BalanceSheetDetails = [
80
80
  value: BalanceSheetState.SENDED_TO_CLIENT,
81
81
  color: 'blue',
82
82
  textColor: 'blue--text',
83
- forRoles: [['front_office'], ['expert']],
83
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
84
84
  },
85
85
  {
86
86
  text: 'Accepté par client',
@@ -88,35 +88,35 @@ export const BalanceSheetDetails = [
88
88
  color: 'blue darken-2',
89
89
  textColor: 'blue--text ',
90
90
  alias: 'APC',
91
- forRoles: [['front_office'], ['expert']],
91
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
92
92
  },
93
93
  {
94
94
  text: 'Envoyé au SIE',
95
95
  value: BalanceSheetState.SENDED_TO_SIE,
96
96
  color: 'blue darken-4',
97
97
  textColor: 'blue--text',
98
- forRoles: [['front_office'], ['expert']],
98
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
99
99
  },
100
100
  {
101
101
  value: BalanceSheetState.ACCEPTED_BY_SIE,
102
102
  text: 'Accepté au SIE',
103
103
  color: 'grey darken-1',
104
104
  textColor: 'green--text',
105
- forRoles: [['front_office'], ['expert']],
105
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
106
106
  },
107
107
  {
108
108
  text: 'Refus SIE',
109
109
  value: BalanceSheetState.REFUSED_BY_SIE,
110
110
  color: 'red darken-3',
111
111
  textColor: 'green--text ',
112
- forRoles: [['front_office'], ['expert']],
112
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
113
113
  },
114
114
  {
115
115
  text: 'Envoi provisoire SIE',
116
116
  value: BalanceSheetState.SENDED_PROVISIONALLY_TO_SIE,
117
117
  color: 'green darken-4',
118
118
  textColor: 'green--text ',
119
- forRoles: [['front_office'], ['expert']],
119
+ forRoles: [['front_office', 'front_office_express'], ['expert']],
120
120
  },
121
121
  {
122
122
  value: BalanceSheetState.NOT_SUBJECT_TO,
@@ -88,7 +88,6 @@ export const generalThirdParties: GeneralThirdParty[] = [
88
88
  { company: 'ELECTRO DEPOT', idAccount: 24 },
89
89
  { company: 'UBER', idAccount: 58383 },
90
90
  { company: 'DELIVEROO', idAccount: 117 },
91
- { company: 'PROMOCASH', idAccount: 58357 },
92
91
  { company: 'LYRECO', idAccount: 25 },
93
92
  { company: 'YZICO', idAccount: 104 },
94
93
  { company: 'AXA', idAccount: 27292 },
@@ -0,0 +1,105 @@
1
+ export const ForbidenDomain = [
2
+ '@test.fr',
3
+ '@test.com',
4
+ '@yopmail.com',
5
+ '@yopmail.fr',
6
+ '@armyspy.com',
7
+ '@cuvox.de',
8
+ '@dayrep.com',
9
+ '@einrot.com',
10
+ '@fleckens.com',
11
+ '@gustr.com',
12
+ '@jourrapide.com',
13
+ '@rhyta.com',
14
+ '@superrito.com',
15
+ '@teleworm.us',
16
+ '@nedoz.com',
17
+ '@wimsg.com',
18
+ '@tzymail.com',
19
+ '@firemailbox.club',
20
+ ];
21
+
22
+ export const BasicDomain = [
23
+ '@gmail.com',
24
+ '@yahoo.com',
25
+ '@outlook.com',
26
+ '@aol.com',
27
+ '@mail.com',
28
+ '@yandex.com',
29
+ '@protonmail.com',
30
+ '@icloud.com',
31
+ '@zoho.com',
32
+ '@gmx.com',
33
+ '@qq.com',
34
+ '@163.com',
35
+ '@sina.com',
36
+ '@hotmail.com',
37
+ '@rediffmail.com',
38
+ '@live.com',
39
+ '@naver.com',
40
+ '@daum.net',
41
+ '@hanmail.net',
42
+ '@walla.co',
43
+ '@yahoo.co',
44
+ '@mail.ru',
45
+ '@t-online.de',
46
+ '@web.de',
47
+ '@gmx.net',
48
+ '@yahoo.de',
49
+ '@outlook.es',
50
+ '@live.co',
51
+ '@libero.it',
52
+ '@virgilio.it',
53
+ '@alice.it',
54
+ '@tin.it',
55
+ '@indiatimes.com',
56
+ '@bigpond.com',
57
+ '@orange.fr',
58
+ '@free.fr',
59
+ '@laposte.net',
60
+ '@wanadoo.fr',
61
+ '@rocketmail.com',
62
+ '@aim.com',
63
+ '@inbox.com',
64
+ '@netscape.net',
65
+ '@uol.com',
66
+ '@bol.com',
67
+ '@ig.com',
68
+ '@outlook.com',
69
+ '@icloud.com',
70
+ '@bigpond.net',
71
+ '@mail.bg',
72
+ '@post.cz',
73
+ '@seznam.cz',
74
+ '@gmail.ru',
75
+ '@tut.by',
76
+ '@bk.ru',
77
+ '@list.ru',
78
+ '@mail.kz',
79
+ '@yahoo.es',
80
+ '@yahoo.fr',
81
+ '@yahoo.it',
82
+ '@outlook.in',
83
+ '@outlook.com',
84
+ '@hotmail.es',
85
+ '@hotmail.fr',
86
+ '@hotmail.it',
87
+ '@hotmail.de',
88
+ '@hotmail.com',
89
+ '@hotmail.sg',
90
+ '@hotmail.be',
91
+ '@hotmail.cl',
92
+ '@hotmail.co',
93
+ '@hotmail.pt',
94
+ '@hotmail.gr',
95
+ '@hotmail.cz',
96
+ '@hotmail.ch',
97
+ '@hotmail.ru',
98
+ '@hotmail.hu',
99
+ '@hotmail.ro',
100
+ '@hotmail.sk',
101
+ '@hotmail.no',
102
+ '@hotmail.dk',
103
+ '@hotmail.fi',
104
+ '@hotmail.ie',
105
+ ];
@@ -1,5 +1,5 @@
1
1
  import {
2
- IsBoolean, IsInt, IsNumber, IsOptional, IsString,
2
+ IsBoolean, IsInt, IsOptional, IsString,
3
3
  } from 'class-validator';
4
4
  import { ApiProperty, ApiPropertyOptional } from '../../../..';
5
5
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
@@ -17,7 +17,7 @@ export class CreateRebilling {
17
17
  hasToBeAccruals?: string;
18
18
 
19
19
  @ApiProperty()
20
- @IsNumber()
20
+ @IsInt()
21
21
  turnoverMax: number;
22
22
 
23
23
  @ApiProperty()
@@ -11,4 +11,7 @@ export class CreateRevisionGuide {
11
11
 
12
12
  @ApiPropertyOptional()
13
13
  comment?: string | null;
14
+
15
+ @ApiProperty()
16
+ idExercice: number;
14
17
  }
@@ -16,7 +16,7 @@ export interface IExercice {
16
16
  id?: number;
17
17
  startDate: Date | null;
18
18
  endDate: Date | null;
19
- turnover?: string | null;
19
+ turnover?: number | null;
20
20
  invoicePurchase?: number | null;
21
21
  invoiceSales?: number | null;
22
22
  isBack: boolean;
@@ -32,7 +32,7 @@ export interface IExercice {
32
32
  labKeeping: number;
33
33
  receiptJeDeclare: boolean;
34
34
  annualFolderEdition: boolean;
35
- turnoverDone: string;
35
+ turnoverDone: number;
36
36
  turnoverMax?: number;
37
37
  processClossingExercice: boolean;
38
38
  idFilePaymentSchedule?: number | null;
@@ -5,6 +5,7 @@ export interface IRevisionGuide {
5
5
  state: number;
6
6
  comment?: string | null;
7
7
  idExercice: number | null;
8
+ idBalanceSheet: number | null;
8
9
  idQuestion: number | null;
9
10
  createdAt?: Date | null;
10
11
  updatedAt?: Date | null;
@@ -101,6 +101,7 @@ export interface ISociety {
101
101
  dateRelanceCommercial: Date | null;
102
102
  firstPayslipDate: Date | null;
103
103
  totalSharesHeld: number | null;
104
+ leadQuotation: number | null;
104
105
  idVatRegime: number | null;
105
106
  idTaxSystem: number | null;
106
107
  idActivity: number | null;
package/ts/types/index.ts CHANGED
@@ -466,6 +466,7 @@ export * from './Enum/StatusSignature';
466
466
  export * from './Enum/BankCollectingState';
467
467
  export * from './Enum/Phone';
468
468
  export * from './Enum/GeneralThirdParty';
469
+ export * from './Enum/MailDomainType';
469
470
 
470
471
  // Interfaces API
471
472
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
@@ -31,7 +31,7 @@ type brandColorType = {
31
31
  primary700: string
32
32
  };
33
33
 
34
- export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv = undefined): ReadCommercialDocumentTemplate {
34
+ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {
35
35
  const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));
36
36
  const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);
37
37
  const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);
@@ -121,7 +121,7 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
121
121
  };
122
122
  }
123
123
 
124
- export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv = undefined): ReadCommercialDocumentTemplate {
124
+ export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {
125
125
  if (!payload.deposit) throw new Error('Aucun acompte défini');
126
126
 
127
127
  const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {
@@ -213,7 +213,7 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHi
213
213
  };
214
214
  }
215
215
 
216
- export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv = undefined): ReadCommercialMailTemplate {
216
+ export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {
217
217
  dayjs.locale('fr');
218
218
  const data = {
219
219
  ...params.payload,
@@ -361,13 +361,13 @@ export class CommercialDocumentMailHTML {
361
361
  <div style="display: flex; width: 240px; color: #838384; margin-bottom: 10px;">
362
362
  Total TVA <div style="margin-left: auto;"><%- totalVatFormatted.integerValue %>,<span style="font-size: 12px;"><%- totalVatFormatted.centValue %> €</span></div>
363
363
  </div>
364
- <div style="width: 240px; height: 2px; background-color: <%= brandColors.primary500 %>; margin-bottom: 10px;"></div>
364
+ <div style="width: 240px; height: 2px; background-color: <%= brandColors.primary300 %>; margin-bottom: 10px;"></div>
365
365
  <% } %>
366
366
  <div style="display: flex; width: 240px; font-size: 16px; color: black;">
367
367
  Total <% if (hasVat) { %>TTC<% } %> <div style="font-size: 20px; font-weight: 500; margin-left: auto;" ><%- totalTaxIncludedFormatted.integerValue %>,<span style="font-size: 16px;"><%- totalTaxIncludedFormatted.centValue %> €</span></div>
368
368
  </div>
369
369
  </div>
370
- <a <% if (fileUrl) { %>href="<%= fileUrl %>"<% } %> target="_blank" style="color: white; text-decoration: none; background-color: <%= brandColors.primary500 %>; <% if (fileUrl) { %> cursor: pointer; <% } %> padding: 10px 45px; font-size: 16px; border-radius: 4px;">
370
+ <a <% if (fileUrl) { %>href="<%= fileUrl %>"<% } %> target="_blank" style="color: white; text-decoration: none; background-color: <%= brandColors.primary500 %>; <% if (fileUrl) { %> cursor: pointer; <% } else { %> cursor: default; pointer-events: none; <% } %> padding: 10px 45px; font-size: 16px; border-radius: 4px;">
371
371
  Afficher le document
372
372
  </a>
373
373
  </div>
package/ts/utils/index.ts CHANGED
@@ -10,4 +10,5 @@ export * from './task';
10
10
  export * from './social';
11
11
  export * from './commercialManagement/document';
12
12
  export * from './commercialManagement/recurrence';
13
- export * from './amount';
13
+ export * from './amount';
14
+ export * from './quotation';
@@ -0,0 +1,125 @@
1
+ import { ForbidenDomain, BasicDomain } from '../types/Enum/MailDomainType';
2
+ import { Activity } from '../types/Enum/Activity';
3
+
4
+ type getLeadQuotationParams = {
5
+ firstname: string,
6
+ lastname: string,
7
+ phone: string,
8
+ mail: string,
9
+ annualTurnover: number,
10
+ source: number,
11
+ alreadyExist: boolean,
12
+ activitySector: number,
13
+ };
14
+
15
+ export function getLeadQuotation(params: getLeadQuotationParams):number {
16
+ const {
17
+ firstname, lastname, phone, mail, annualTurnover, source, alreadyExist, activitySector,
18
+ } = params;
19
+ if (
20
+ firstname === 'test'
21
+ || lastname === 'test'
22
+ || mail?.includes('test')
23
+ || ['606060606', '707070707', '612345678', '712345678', '687654321', '787654321'].includes(phone)
24
+ ) {
25
+ return 0;
26
+ }
27
+ let quotation = 0;
28
+
29
+ /* cotation du prénom */
30
+ if (firstname) quotation += 5;
31
+
32
+ /* cotation du nom */
33
+ if (lastname) quotation += 5;
34
+
35
+ /* cotation du numéro de téléphone */
36
+ if (['6', '7'].includes(phone.substr(0, 1))) {
37
+ quotation += 15;
38
+ } else {
39
+ quotation += 5;
40
+ }
41
+
42
+ /* cotation de l'adresse email */
43
+ if (BasicDomain.find((domain) => mail?.includes(domain))) {
44
+ quotation += 5;
45
+ } else
46
+ if (!ForbidenDomain.find((domain) => mail?.includes(domain))) {
47
+ quotation += 15;
48
+ }
49
+
50
+ /* cotation du CA annuel */
51
+ if ([0, 150000, 400000, 783000, 783001].includes(annualTurnover)) {
52
+ quotation += 10;
53
+ } else if ([50000, 234000].includes(annualTurnover)) {
54
+ quotation += 5;
55
+ }
56
+
57
+ /* cotation de la date d'ajout */
58
+ if ([1, 2, 3, 4, 5].includes(new Date().getDay())) {
59
+ const dateTime = new Date();
60
+ const year = dateTime.getFullYear();
61
+ const month = dateTime.getMonth();
62
+ const day = dateTime.getDate();
63
+ const startTime = new Date(`${year}-${month + 1}-${day} 08:45:00`);
64
+ const endTime = new Date(`${year}-${month + 1}-${day} 18:45:00`);
65
+ if ((startTime.getTime() <= dateTime.getTime()) && (endTime.getTime() >= dateTime.getTime())) {
66
+ quotation += 15;
67
+ } else {
68
+ quotation += 5;
69
+ }
70
+ } else {
71
+ quotation += 5;
72
+ }
73
+
74
+ /* cotation de la source */
75
+ /* Parrainage */
76
+ if (source === 49) {
77
+ quotation += 10;
78
+
79
+ /* calendly, appel entrant */
80
+ } else if (source === 2) {
81
+ quotation += 8;
82
+
83
+ /* adWords, Bing, Formulaire */
84
+ } else if (source === 4) {
85
+ quotation += 6;
86
+
87
+ /* Chat, Whatsapp */
88
+ } else if ([29, 92].includes(source)) {
89
+ quotation += 2;
90
+ }
91
+
92
+ /* cotation de la qualité (nombre de champs remplis) */
93
+ const fieldNumber = [firstname, lastname, phone, mail, annualTurnover, activitySector].filter((data) => !!data).length;
94
+ switch (fieldNumber) {
95
+ case 6:
96
+ quotation += 10;
97
+ break;
98
+ case 5:
99
+ quotation += 8;
100
+ break;
101
+ case 4:
102
+ quotation += 6;
103
+ break;
104
+ case 3:
105
+ quotation += 4;
106
+ break;
107
+ case 2:
108
+ quotation += 2;
109
+ break;
110
+ default:
111
+ break;
112
+ }
113
+
114
+ /* cotation de l'existence du lead (déjà existant ou non) */
115
+ if (alreadyExist) quotation += 8;
116
+
117
+ /* cotation du secteur d'activité */
118
+ if ([Activity.INFORMATIQUE, Activity.CONSEIL].includes(activitySector)) {
119
+ quotation += 10;
120
+ } else if ([Activity.TRANSPORT, Activity.BTP, Activity.RESTAURATION, Activity.COMMERCANT, Activity.MEDICAL, Activity.PROF_LIB].includes(activitySector)) {
121
+ quotation += 5;
122
+ }
123
+
124
+ return quotation;
125
+ }