@silexpert/core 1.3.187 → 1.3.188

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 (98) hide show
  1. package/dist/cjs/api/resources/SocietyApproval.d.ts +47 -0
  2. package/dist/cjs/api/resources/SocietyApproval.d.ts.map +1 -0
  3. package/dist/cjs/api/resources/SocietyApproval.js +62 -0
  4. package/dist/cjs/api/resources/SocietyApproval.js.map +1 -0
  5. package/dist/cjs/api/resources.d.ts +2 -0
  6. package/dist/cjs/api/resources.d.ts.map +1 -1
  7. package/dist/cjs/api/resources.js +2 -0
  8. package/dist/cjs/api/resources.js.map +1 -1
  9. package/dist/cjs/types/Enum/Ged.d.ts +2 -1
  10. package/dist/cjs/types/Enum/Ged.d.ts.map +1 -1
  11. package/dist/cjs/types/Enum/Ged.js +31 -30
  12. package/dist/cjs/types/Enum/Ged.js.map +1 -1
  13. package/dist/cjs/types/Enum/Proceding.d.ts +4 -0
  14. package/dist/cjs/types/Enum/Proceding.d.ts.map +1 -1
  15. package/dist/cjs/types/Enum/Proceding.js +4 -0
  16. package/dist/cjs/types/Enum/Proceding.js.map +1 -1
  17. package/dist/cjs/types/Enum/SocietyApproval.d.ts +27 -0
  18. package/dist/cjs/types/Enum/SocietyApproval.d.ts.map +1 -0
  19. package/dist/cjs/types/Enum/SocietyApproval.js +205 -0
  20. package/dist/cjs/types/Enum/SocietyApproval.js.map +1 -0
  21. package/dist/cjs/types/Enum/StatutsSection.d.ts +7 -1
  22. package/dist/cjs/types/Enum/StatutsSection.d.ts.map +1 -1
  23. package/dist/cjs/types/Enum/StatutsSection.js +15 -7
  24. package/dist/cjs/types/Enum/StatutsSection.js.map +1 -1
  25. package/dist/cjs/types/Interface/api/SocietyApproval.d.ts +36 -0
  26. package/dist/cjs/types/Interface/api/SocietyApproval.d.ts.map +1 -0
  27. package/dist/cjs/types/Interface/api/SocietyApproval.js +153 -0
  28. package/dist/cjs/types/Interface/api/SocietyApproval.js.map +1 -0
  29. package/dist/cjs/types/Interface/models/ISocietyApproval.d.ts +2 -0
  30. package/dist/cjs/types/Interface/models/ISocietyApproval.d.ts.map +1 -1
  31. package/dist/cjs/types/Interface/models/ISocietyApproval.js.map +1 -1
  32. package/dist/cjs/types/index.d.ts +2 -0
  33. package/dist/cjs/types/index.d.ts.map +1 -1
  34. package/dist/cjs/types/index.js +2 -0
  35. package/dist/cjs/types/index.js.map +1 -1
  36. package/dist/cjs/utils/index.d.ts +1 -0
  37. package/dist/cjs/utils/index.d.ts.map +1 -1
  38. package/dist/cjs/utils/index.js +1 -0
  39. package/dist/cjs/utils/index.js.map +1 -1
  40. package/dist/cjs/utils/societyApproval.d.ts +31 -0
  41. package/dist/cjs/utils/societyApproval.d.ts.map +1 -0
  42. package/dist/cjs/utils/societyApproval.js +77 -0
  43. package/dist/cjs/utils/societyApproval.js.map +1 -0
  44. package/dist/mjs/api/resources/SocietyApproval.d.ts +47 -0
  45. package/dist/mjs/api/resources/SocietyApproval.d.ts.map +1 -0
  46. package/dist/mjs/api/resources/SocietyApproval.js +58 -0
  47. package/dist/mjs/api/resources/SocietyApproval.js.map +1 -0
  48. package/dist/mjs/api/resources.d.ts +2 -0
  49. package/dist/mjs/api/resources.d.ts.map +1 -1
  50. package/dist/mjs/api/resources.js +2 -0
  51. package/dist/mjs/api/resources.js.map +1 -1
  52. package/dist/mjs/types/Enum/Ged.d.ts +2 -1
  53. package/dist/mjs/types/Enum/Ged.d.ts.map +1 -1
  54. package/dist/mjs/types/Enum/Ged.js +31 -30
  55. package/dist/mjs/types/Enum/Ged.js.map +1 -1
  56. package/dist/mjs/types/Enum/Proceding.d.ts +4 -0
  57. package/dist/mjs/types/Enum/Proceding.d.ts.map +1 -1
  58. package/dist/mjs/types/Enum/Proceding.js +4 -0
  59. package/dist/mjs/types/Enum/Proceding.js.map +1 -1
  60. package/dist/mjs/types/Enum/SocietyApproval.d.ts +27 -0
  61. package/dist/mjs/types/Enum/SocietyApproval.d.ts.map +1 -0
  62. package/dist/mjs/types/Enum/SocietyApproval.js +201 -0
  63. package/dist/mjs/types/Enum/SocietyApproval.js.map +1 -0
  64. package/dist/mjs/types/Enum/StatutsSection.d.ts +7 -1
  65. package/dist/mjs/types/Enum/StatutsSection.d.ts.map +1 -1
  66. package/dist/mjs/types/Enum/StatutsSection.js +15 -7
  67. package/dist/mjs/types/Enum/StatutsSection.js.map +1 -1
  68. package/dist/mjs/types/Interface/api/SocietyApproval.d.ts +36 -0
  69. package/dist/mjs/types/Interface/api/SocietyApproval.d.ts.map +1 -0
  70. package/dist/mjs/types/Interface/api/SocietyApproval.js +167 -0
  71. package/dist/mjs/types/Interface/api/SocietyApproval.js.map +1 -0
  72. package/dist/mjs/types/Interface/models/ISocietyApproval.d.ts +2 -0
  73. package/dist/mjs/types/Interface/models/ISocietyApproval.d.ts.map +1 -1
  74. package/dist/mjs/types/Interface/models/ISocietyApproval.js.map +1 -1
  75. package/dist/mjs/types/index.d.ts +2 -0
  76. package/dist/mjs/types/index.d.ts.map +1 -1
  77. package/dist/mjs/types/index.js +2 -0
  78. package/dist/mjs/types/index.js.map +1 -1
  79. package/dist/mjs/utils/index.d.ts +1 -0
  80. package/dist/mjs/utils/index.d.ts.map +1 -1
  81. package/dist/mjs/utils/index.js +1 -0
  82. package/dist/mjs/utils/index.js.map +1 -1
  83. package/dist/mjs/utils/societyApproval.d.ts +31 -0
  84. package/dist/mjs/utils/societyApproval.d.ts.map +1 -0
  85. package/dist/mjs/utils/societyApproval.js +84 -0
  86. package/dist/mjs/utils/societyApproval.js.map +1 -0
  87. package/package.json +1 -1
  88. package/ts/api/resources/SocietyApproval.ts +75 -0
  89. package/ts/api/resources.ts +2 -0
  90. package/ts/types/Enum/Ged.ts +248 -238
  91. package/ts/types/Enum/Proceding.ts +4 -0
  92. package/ts/types/Enum/SocietyApproval.ts +217 -0
  93. package/ts/types/Enum/StatutsSection.ts +15 -7
  94. package/ts/types/Interface/api/SocietyApproval.ts +121 -0
  95. package/ts/types/Interface/models/ISocietyApproval.ts +2 -0
  96. package/ts/types/index.ts +2 -0
  97. package/ts/utils/index.ts +1 -0
  98. package/ts/utils/societyApproval.ts +104 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './objectUtils';\nexport * from './stringUtils';\nexport * from './brands';\nexport * from './webmail';\nexport * from './decorators';\nexport * from './documents';\nexport * from './balanceSheetModule';\nexport * from './siretValidation';\nexport * from './statutsGeneration';\nexport * from './email';\nexport * from './exercice';\nexport * from './prestation';\nexport * from './task';\nexport * from './social';\nexport * from './commercialManagement/document';\nexport * from './commercialManagement/recurrence';\nexport * from './amount';\nexport * from './quotation';\nexport * from './isHtml';\nexport * from './isUrl';\nexport * from './bankAccount';\nexport * from './commercialOffer';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './objectUtils';\nexport * from './stringUtils';\nexport * from './brands';\nexport * from './webmail';\nexport * from './decorators';\nexport * from './documents';\nexport * from './balanceSheetModule';\nexport * from './siretValidation';\nexport * from './statutsGeneration';\nexport * from './email';\nexport * from './exercice';\nexport * from './prestation';\nexport * from './task';\nexport * from './social';\nexport * from './commercialManagement/document';\nexport * from './commercialManagement/recurrence';\nexport * from './amount';\nexport * from './quotation';\nexport * from './isHtml';\nexport * from './isUrl';\nexport * from './bankAccount';\nexport * from './commercialOffer';\nexport * from './societyApproval';\n"]}
@@ -0,0 +1,31 @@
1
+ import { LegalFormTypeEnum } from '../types/Enum/LegalForm';
2
+ import { SocietyApprovalDocumentType, SocietyApprovalDocumentConfig, SocietyApprovalDocumentTemplate } from '../types/Enum/SocietyApproval';
3
+ import { ISocietyApproval } from '../types/Interface/models/ISocietyApproval';
4
+ /**
5
+ * Récupère la configuration des documents d'approbation pour une forme juridique donnée
6
+ * @param idLegalForm - L'identifiant de la forme juridique
7
+ * @returns La configuration des documents ou undefined si non trouvée
8
+ */
9
+ export declare function getApprovalDocumentsByLegalForm(idLegalForm: LegalFormTypeEnum): SocietyApprovalDocumentConfig | undefined;
10
+ /**
11
+ * Récupère le nom du template pour un document spécifique et une forme juridique
12
+ * @param idLegalForm - L'identifiant de la forme juridique
13
+ * @param idDocumentType - Le type de document d'approbation
14
+ * @returns Le nom du template ou undefined si non trouvé
15
+ */
16
+ export declare function getApprovalDocumentTemplateName(idLegalForm: LegalFormTypeEnum, idDocumentType: SocietyApprovalDocumentType): string | undefined;
17
+ /**
18
+ * Récupère le nom du template pour un document spécifique et une forme juridique
19
+ * @param idLegalForm - L'identifiant de la forme juridique
20
+ * @param idDocumentType - Le type de document d'approbation
21
+ * @returns Le nom du template ou undefined si non trouvé
22
+ */
23
+ export declare function getApprovalDocumentInfos(idLegalForm: LegalFormTypeEnum, idDocumentType: SocietyApprovalDocumentType): SocietyApprovalDocumentTemplate | undefined;
24
+ /**
25
+ * Construit les données formatées pour le template d'approbation
26
+ * @param existingApproval - Les données d'approbation de la société
27
+ * @param style - Le style HTML pour le document
28
+ * @returns L'objet de données formaté pour le template
29
+ */
30
+ export declare function buildApprovalTemplateData(existingApproval: ISocietyApproval, style: string): Record<string, any>;
31
+ //# sourceMappingURL=societyApproval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"societyApproval.d.ts","sourceRoot":"","sources":["../../../ts/utils/societyApproval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAE7B,+BAA+B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAM9E;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,iBAAiB,GAC7B,6BAA6B,GAAG,SAAS,CAE3C;AAED;;;;;GAKG;AAEH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,iBAAiB,EAC9B,cAAc,EAAE,2BAA2B,GAC1C,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,iBAAiB,EAC9B,cAAc,EAAE,2BAA2B,GAC1C,+BAA+B,GAAG,SAAS,CAG7C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA2ChH"}
@@ -0,0 +1,84 @@
1
+ import { SocietyApprovalDocumentsByLegalForm, } from '../types/Enum/SocietyApproval';
2
+ import { QualityList } from '../types/Enum/Quality';
3
+ import { getBrand } from './brands';
4
+ import { convertNumberToLetter } from './amount';
5
+ import * as dayjs from 'dayjs';
6
+ /**
7
+ * Récupère la configuration des documents d'approbation pour une forme juridique donnée
8
+ * @param idLegalForm - L'identifiant de la forme juridique
9
+ * @returns La configuration des documents ou undefined si non trouvée
10
+ */
11
+ export function getApprovalDocumentsByLegalForm(idLegalForm) {
12
+ return SocietyApprovalDocumentsByLegalForm.find((config) => config.idLegalForm === idLegalForm);
13
+ }
14
+ /**
15
+ * Récupère le nom du template pour un document spécifique et une forme juridique
16
+ * @param idLegalForm - L'identifiant de la forme juridique
17
+ * @param idDocumentType - Le type de document d'approbation
18
+ * @returns Le nom du template ou undefined si non trouvé
19
+ */
20
+ //@deprecated use getApprovalDocumentInfos instead
21
+ export function getApprovalDocumentTemplateName(idLegalForm, idDocumentType) {
22
+ const config = getApprovalDocumentsByLegalForm(idLegalForm);
23
+ const document = config?.documents.find((doc) => doc.idDocumentType === idDocumentType);
24
+ return document?.templateName;
25
+ }
26
+ /**
27
+ * Récupère le nom du template pour un document spécifique et une forme juridique
28
+ * @param idLegalForm - L'identifiant de la forme juridique
29
+ * @param idDocumentType - Le type de document d'approbation
30
+ * @returns Le nom du template ou undefined si non trouvé
31
+ */
32
+ export function getApprovalDocumentInfos(idLegalForm, idDocumentType) {
33
+ const config = getApprovalDocumentsByLegalForm(idLegalForm);
34
+ return config?.documents.find((doc) => doc.idDocumentType === idDocumentType);
35
+ }
36
+ /**
37
+ * Construit les données formatées pour le template d'approbation
38
+ * @param existingApproval - Les données d'approbation de la société
39
+ * @param style - Le style HTML pour le document
40
+ * @returns L'objet de données formaté pour le template
41
+ */
42
+ export function buildApprovalTemplateData(existingApproval, style) {
43
+ const yearInText = convertNumberToLetter(+dayjs().format('YYYY')).toLowerCase();
44
+ const dayAndMonthInText = `${convertNumberToLetter(+dayjs().format('D'))} ${dayjs().locale('fr').format('MMMM').toLowerCase()}`;
45
+ const brand = getBrand();
46
+ return {
47
+ // Variables globales
48
+ style,
49
+ yearInText,
50
+ dayAndMonthInText,
51
+ date: dayjs().locale('fr').format('DD MMMM YYYY'),
52
+ companyInformation: {
53
+ rcs: brand?.companyInformation?.rcs,
54
+ nomRaisonSociale: brand?.companyInformation?.nomRaisonSociale,
55
+ city: brand?.companyInformation?.city,
56
+ postalAddress: brand?.companyInformation?.postalAddress,
57
+ montantCapital: brand?.companyInformation?.montantCapital,
58
+ statut: brand?.companyInformation?.statut,
59
+ ECOrderCity: brand?.companyInformation?.ECOrderCity,
60
+ },
61
+ owner: {
62
+ identity: `${existingApproval?.exercice?.society?.users?.[0]?.idCivility === 1 ? 'Monsieur' : 'Madame'} ${existingApproval?.exercice?.society?.users?.[0]?.firstname} ${existingApproval?.exercice?.society?.users?.[0]?.lastname} `,
63
+ quality: QualityList.find((ql) => ql.id === existingApproval?.exercice?.society?.users?.[0]?.businessPartners?.[0]?.idQuality)?.label,
64
+ },
65
+ // Variables stockées en base
66
+ ...existingApproval,
67
+ generatingDatas: {
68
+ ...existingApproval?.generatingDatas,
69
+ ...(existingApproval?.generatingDatas?.approvalDate
70
+ ? {
71
+ approvalDate: dayjs(existingApproval?.generatingDatas?.approvalDate)
72
+ .locale('fr')
73
+ .format('DD MMMM YYYY')
74
+ .toUpperCase(),
75
+ }
76
+ : {}),
77
+ },
78
+ exercice: {
79
+ ...existingApproval?.exercice,
80
+ endDate: dayjs(existingApproval?.exercice?.endDate).locale('fr').format('DD MMMM YYYY').toLowerCase(),
81
+ },
82
+ };
83
+ }
84
+ //# sourceMappingURL=societyApproval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"societyApproval.js","sourceRoot":"","sources":["../../../ts/utils/societyApproval.ts"],"names":[],"mappings":"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","sourcesContent":["import { LegalFormTypeEnum } from '../types/Enum/LegalForm';\nimport {\n SocietyApprovalDocumentType,\n SocietyApprovalDocumentConfig,\n SocietyApprovalDocumentsByLegalForm,\n SocietyApprovalDocumentTemplate,\n} from '../types/Enum/SocietyApproval';\nimport { ISocietyApproval } from '../types/Interface/models/ISocietyApproval';\nimport { QualityList } from '../types/Enum/Quality';\nimport { getBrand } from './brands';\nimport { convertNumberToLetter } from './amount';\nimport * as dayjs from 'dayjs';\n\n/**\n * Récupère la configuration des documents d'approbation pour une forme juridique donnée\n * @param idLegalForm - L'identifiant de la forme juridique\n * @returns La configuration des documents ou undefined si non trouvée\n */\nexport function getApprovalDocumentsByLegalForm(\n idLegalForm: LegalFormTypeEnum,\n): SocietyApprovalDocumentConfig | undefined {\n return SocietyApprovalDocumentsByLegalForm.find((config) => config.idLegalForm === idLegalForm);\n}\n\n/**\n * Récupère le nom du template pour un document spécifique et une forme juridique\n * @param idLegalForm - L'identifiant de la forme juridique\n * @param idDocumentType - Le type de document d'approbation\n * @returns Le nom du template ou undefined si non trouvé\n */\n//@deprecated use getApprovalDocumentInfos instead\nexport function getApprovalDocumentTemplateName(\n idLegalForm: LegalFormTypeEnum,\n idDocumentType: SocietyApprovalDocumentType,\n): string | undefined {\n const config = getApprovalDocumentsByLegalForm(idLegalForm);\n const document = config?.documents.find((doc) => doc.idDocumentType === idDocumentType);\n return document?.templateName;\n}\n\n/**\n * Récupère le nom du template pour un document spécifique et une forme juridique\n * @param idLegalForm - L'identifiant de la forme juridique\n * @param idDocumentType - Le type de document d'approbation\n * @returns Le nom du template ou undefined si non trouvé\n */\nexport function getApprovalDocumentInfos(\n idLegalForm: LegalFormTypeEnum,\n idDocumentType: SocietyApprovalDocumentType,\n): SocietyApprovalDocumentTemplate | undefined {\n const config = getApprovalDocumentsByLegalForm(idLegalForm);\n return config?.documents.find((doc) => doc.idDocumentType === idDocumentType);\n}\n\n/**\n * Construit les données formatées pour le template d'approbation\n * @param existingApproval - Les données d'approbation de la société\n * @param style - Le style HTML pour le document\n * @returns L'objet de données formaté pour le template\n */\nexport function buildApprovalTemplateData(existingApproval: ISocietyApproval, style: string): Record<string, any> {\n const yearInText = convertNumberToLetter(+dayjs().format('YYYY')).toLowerCase();\n const dayAndMonthInText = `${convertNumberToLetter(+dayjs().format('D'))} ${dayjs().locale('fr').format('MMMM').toLowerCase()}`;\n const brand = getBrand();\n return {\n // Variables globales\n style,\n yearInText,\n dayAndMonthInText,\n date: dayjs().locale('fr').format('DD MMMM YYYY'),\n companyInformation: {\n rcs: brand?.companyInformation?.rcs,\n nomRaisonSociale: brand?.companyInformation?.nomRaisonSociale,\n city: brand?.companyInformation?.city,\n postalAddress: brand?.companyInformation?.postalAddress,\n montantCapital: brand?.companyInformation?.montantCapital,\n statut: brand?.companyInformation?.statut,\n ECOrderCity: brand?.companyInformation?.ECOrderCity,\n },\n owner: {\n identity: `${existingApproval?.exercice?.society?.users?.[0]?.idCivility === 1 ? 'Monsieur' : 'Madame'} ${existingApproval?.exercice?.society?.users?.[0]?.firstname} ${existingApproval?.exercice?.society?.users?.[0]?.lastname} `,\n quality: QualityList.find(\n (ql) => ql.id === existingApproval?.exercice?.society?.users?.[0]?.businessPartners?.[0]?.idQuality,\n )?.label,\n },\n // Variables stockées en base\n ...existingApproval,\n generatingDatas: {\n ...existingApproval?.generatingDatas,\n ...(existingApproval?.generatingDatas?.approvalDate\n ? {\n approvalDate: dayjs(existingApproval?.generatingDatas?.approvalDate)\n .locale('fr')\n .format('DD MMMM YYYY')\n .toUpperCase(),\n }\n : {}),\n },\n exercice: {\n ...existingApproval?.exercice,\n endDate: dayjs(existingApproval?.exercice?.endDate).locale('fr').format('DD MMMM YYYY').toLowerCase(),\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.3.187",
3
+ "version": "1.3.188",
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": "dist/cjs/index.js",
@@ -0,0 +1,75 @@
1
+ import { Resource } from '../Resource';
2
+ import {
3
+ ISocietyApproval,
4
+ CreateDocument,
5
+ ReadLibraryFile,
6
+ ResetDocument,
7
+ IDocumentSection,
8
+ IApprovalGeneratingData,
9
+ } from '../../types';
10
+
11
+ export class SocietyApproval extends Resource {
12
+ /**
13
+ * Get society approval data for a given exercice
14
+ * @param idExercice - The exercice ID
15
+ * @returns Society approval with all needed data
16
+ */
17
+ get(idExercice: number): Promise<ISocietyApproval> {
18
+ return this.axios.$get(`/exercices/${idExercice}/approvals`);
19
+ }
20
+
21
+ /**
22
+ * Get approval data needed for PDF generation
23
+ * Retrieves all necessary information before generating a PDF document
24
+ * @param idExercice - The exercice ID
25
+ * @returns Approval data with template data for PDF generation
26
+ */
27
+ getGeneratingData(idExercice: number): Promise<IApprovalGeneratingData> {
28
+ return this.axios.$get(`/exercices/${idExercice}/approvals/generating-data`);
29
+ }
30
+
31
+ /**
32
+ * Create or update society approval
33
+ * @param idExercice - The exercice ID
34
+ * @param payload - The approval data
35
+ * @returns Updated or created society approval
36
+ */
37
+ updateOrCreate(idExercice: number, payload: ISocietyApproval): Promise<ISocietyApproval> {
38
+ return this.axios.$post(`/exercices/${idExercice}/approvals`, payload);
39
+ }
40
+
41
+ /**
42
+ * Generate approval PDF document
43
+ * @param idExercice - The exercice ID
44
+ * @param payload - The document type(s) to generate
45
+ * @returns PDF file as blob
46
+ */
47
+ generatePdf(idExercice: number, payload: CreateDocument): Promise<ReadLibraryFile> {
48
+ return this.axios.$post(`/exercices/${idExercice}/approvals/pdf`, payload);
49
+ }
50
+
51
+ /**
52
+ * Reset document section by regenerating from original template
53
+ * @param idExercice - The exercice ID
54
+ * @param idDocumentSection - The documentSection ID to reset
55
+ * @param payload - The document type for template selection
56
+ * @returns Updated documentSection with new content from template
57
+ */
58
+ resetDocument(idExercice: number, idDocumentSection: number, payload: ResetDocument): Promise<IDocumentSection> {
59
+ return this.axios.$put(`/exercices/${idExercice}/document-sections/${idDocumentSection}/reset`, payload);
60
+ }
61
+
62
+ /**
63
+ * Regenerate PDF document from existing documentSection HTML content
64
+ * @param idExercice - The exercice ID
65
+ * @param idDocumentSection - The documentSection ID containing HTML content
66
+ * @returns PDF file as buffer for download
67
+ */
68
+ regeneratePdf(idExercice: number, idDocumentSection: number): Promise<Buffer> {
69
+ return this.axios.$post(
70
+ `/exercices/${idExercice}/approvals/pdf/regenerate`,
71
+ { idDocumentSection },
72
+ { responseType: 'arraybuffer' },
73
+ );
74
+ }
75
+ }
@@ -188,6 +188,7 @@ import { BalanceSheetReport } from './resources/BalanceSheetReport';
188
188
  import { Revenue } from './resources/Revenue';
189
189
  import { InformationRequest } from './resources/InformationRequest';
190
190
  import { AutomaticRegistration } from './resources/AutomaticRegistration';
191
+ import { SocietyApproval } from './resources/SocietyApproval';
191
192
 
192
193
  export const resources = {
193
194
  budgetInsight: BudgetInsight,
@@ -380,4 +381,5 @@ export const resources = {
380
381
  revenue: Revenue,
381
382
  informationRequest: InformationRequest,
382
383
  automaticRegistration: AutomaticRegistration,
384
+ societyApproval: SocietyApproval,
383
385
  };