@silexpert/core 1.1.186 → 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 (78) hide show
  1. package/dist/cjs/api/resources/GeneralLedger.d.ts +8 -0
  2. package/dist/cjs/api/resources/GeneralLedger.d.ts.map +1 -1
  3. package/dist/cjs/api/resources/GeneralLedger.js +32 -0
  4. package/dist/cjs/api/resources/GeneralLedger.js.map +1 -1
  5. package/dist/cjs/api/resources/IncomeStatement.d.ts +2 -0
  6. package/dist/cjs/api/resources/IncomeStatement.d.ts.map +1 -1
  7. package/dist/cjs/api/resources/IncomeStatement.js +10 -0
  8. package/dist/cjs/api/resources/IncomeStatement.js.map +1 -1
  9. package/dist/cjs/api/resources/Journal.d.ts +2 -0
  10. package/dist/cjs/api/resources/Journal.d.ts.map +1 -1
  11. package/dist/cjs/api/resources/Journal.js +7 -0
  12. package/dist/cjs/api/resources/Journal.js.map +1 -1
  13. package/dist/cjs/api/resources/prestation.d.ts +2 -1
  14. package/dist/cjs/api/resources/prestation.d.ts.map +1 -1
  15. package/dist/cjs/api/resources/prestation.js +3 -0
  16. package/dist/cjs/api/resources/prestation.js.map +1 -1
  17. package/dist/cjs/index.d.ts +1 -0
  18. package/dist/cjs/index.d.ts.map +1 -1
  19. package/dist/cjs/index.js +1 -0
  20. package/dist/cjs/index.js.map +1 -1
  21. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
  22. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
  23. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js +19 -1
  24. package/dist/cjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
  25. package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
  26. package/dist/cjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
  27. package/dist/cjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
  28. package/dist/cjs/utils/commercialManagement/document.d.ts +0 -1
  29. package/dist/cjs/utils/commercialManagement/document.d.ts.map +1 -1
  30. package/dist/cjs/utils/commercialManagement/document.js +1 -41
  31. package/dist/cjs/utils/commercialManagement/document.js.map +1 -1
  32. package/dist/cjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
  33. package/dist/cjs/utils/commercialManagement/templates/common.js +34 -46
  34. package/dist/cjs/utils/commercialManagement/templates/common.js.map +1 -1
  35. package/dist/mjs/api/resources/GeneralLedger.d.ts +8 -0
  36. package/dist/mjs/api/resources/GeneralLedger.d.ts.map +1 -1
  37. package/dist/mjs/api/resources/GeneralLedger.js +32 -0
  38. package/dist/mjs/api/resources/GeneralLedger.js.map +1 -1
  39. package/dist/mjs/api/resources/IncomeStatement.d.ts +2 -0
  40. package/dist/mjs/api/resources/IncomeStatement.d.ts.map +1 -1
  41. package/dist/mjs/api/resources/IncomeStatement.js +10 -0
  42. package/dist/mjs/api/resources/IncomeStatement.js.map +1 -1
  43. package/dist/mjs/api/resources/Journal.d.ts +2 -0
  44. package/dist/mjs/api/resources/Journal.d.ts.map +1 -1
  45. package/dist/mjs/api/resources/Journal.js +7 -0
  46. package/dist/mjs/api/resources/Journal.js.map +1 -1
  47. package/dist/mjs/api/resources/prestation.d.ts +2 -1
  48. package/dist/mjs/api/resources/prestation.d.ts.map +1 -1
  49. package/dist/mjs/api/resources/prestation.js +3 -0
  50. package/dist/mjs/api/resources/prestation.js.map +1 -1
  51. package/dist/mjs/index.d.ts +1 -0
  52. package/dist/mjs/index.d.ts.map +1 -1
  53. package/dist/mjs/index.js +1 -0
  54. package/dist/mjs/index.js.map +1 -1
  55. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts +5 -0
  56. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.d.ts.map +1 -1
  57. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js +20 -0
  58. package/dist/mjs/types/Interface/api/prestation/CreatePrestation.js.map +1 -1
  59. package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts +21 -20
  60. package/dist/mjs/types/Interface/models/IPrestationComplementary.d.ts.map +1 -1
  61. package/dist/mjs/types/Interface/models/IPrestationComplementary.js.map +1 -1
  62. package/dist/mjs/utils/commercialManagement/document.d.ts +0 -1
  63. package/dist/mjs/utils/commercialManagement/document.d.ts.map +1 -1
  64. package/dist/mjs/utils/commercialManagement/document.js +1 -76
  65. package/dist/mjs/utils/commercialManagement/document.js.map +1 -1
  66. package/dist/mjs/utils/commercialManagement/templates/common.d.ts.map +1 -1
  67. package/dist/mjs/utils/commercialManagement/templates/common.js +34 -46
  68. package/dist/mjs/utils/commercialManagement/templates/common.js.map +1 -1
  69. package/package.json +1 -1
  70. package/ts/api/resources/GeneralLedger.ts +36 -0
  71. package/ts/api/resources/IncomeStatement.ts +13 -0
  72. package/ts/api/resources/Journal.ts +9 -0
  73. package/ts/api/resources/prestation.ts +6 -0
  74. package/ts/index.ts +1 -0
  75. package/ts/types/Interface/api/prestation/CreatePrestation.ts +14 -0
  76. package/ts/types/Interface/models/IPrestationComplementary.ts +21 -20
  77. package/ts/utils/commercialManagement/document.ts +1 -93
  78. package/ts/utils/commercialManagement/templates/common.ts +34 -46
@@ -5,10 +5,18 @@ import { Resource } from '../Resource';
5
5
  export declare class GeneralLedger extends Resource {
6
6
  getBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>>;
7
7
  getBalanceBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>>;
8
+ /**
9
+ * @deprecated use exportCsv instead
10
+ */
8
11
  getCsv(params: QueryGeneralLedger): Promise<Buffer>;
12
+ exportCsv(idSociety: number, query: QueryGeneralLedger): Promise<Buffer>;
13
+ /** @deprecated use exportBalanceCsv() instead */
9
14
  getBalanceCsv(params: QueryGeneralLedger): Promise<Buffer>;
15
+ exportBalanceCsv(idSociety: number, params: QueryGeneralLedger): Promise<Buffer>;
10
16
  getPdf(idSociety: number, params: QueryGeneralLedger): Promise<Buffer>;
17
+ /** @deprecated use exportBalancePdf() instead */
11
18
  getBalancePdf(params: QueryGeneralLedger): Promise<Buffer>;
19
+ exportBalancePdf(idSociety: number, params: QueryGeneralLedger): Promise<Buffer>;
12
20
  getAuxiliary(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<IGeneralLedgerThirdParty[]>>;
13
21
  getAuxiliarySummaries(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<ReadGeneralLedgerSummary[]>>;
14
22
  getThirdParty(id: number, params: QueryGeneralLedgerThirdParty): Promise<ReadIGeneralLedgerThirdPartyPaginated>;
@@ -1 +1 @@
1
- {"version":3,"file":"GeneralLedger.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/GeneralLedger.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,qBAAqB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,qCAAqC,EACnM,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4DAA4D,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,aAAc,SAAQ,QAAQ;IACzC,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAMjG,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,qBAAqB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAMxG,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAE,OAAO,CAAC,MAAM,CAAC;IAUlD,aAAa,CAAC,MAAM,EAAE,kBAAkB,GAAE,OAAO,CAAC,MAAM,CAAC;IAUzD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAE,OAAO,CAAC,MAAM,CAAC;IAUrE,aAAa,CAAC,MAAM,EAAE,kBAAk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AAO,CAAC,MAAM,CAAC;IAUhF,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAE,OAAO,CAAC,MAAM,CAAC;IAUrE,iDAAiD;IACjD,aAAa,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAU1D,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhF,YAAY,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,qBAAqB,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAI7G,qBAAqB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,qBAAqB,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAItH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,qCAAqC,CAAC;CAGhH"}
@@ -13,6 +13,9 @@ class GeneralLedger extends Resource_1.Resource {
13
13
  params,
14
14
  });
15
15
  }
16
+ /**
17
+ * @deprecated use exportCsv instead
18
+ */
16
19
  getCsv(params) {
17
20
  return this.axios.$get('/generalLedger/csv', {
18
21
  params,
@@ -22,6 +25,16 @@ class GeneralLedger extends Resource_1.Resource {
22
25
  },
23
26
  });
24
27
  }
28
+ exportCsv(idSociety, query) {
29
+ return this.axios.$post(`/societies/${idSociety}/general-ledgers/csv`, null, {
30
+ params: query,
31
+ responseType: 'arraybuffer',
32
+ headers: {
33
+ Accept: 'application/csv',
34
+ },
35
+ });
36
+ }
37
+ /** @deprecated use exportBalanceCsv() instead */
25
38
  getBalanceCsv(params) {
26
39
  return this.axios.$get('/generalLedger/balance/csv', {
27
40
  params,
@@ -31,6 +44,15 @@ class GeneralLedger extends Resource_1.Resource {
31
44
  },
32
45
  });
33
46
  }
47
+ exportBalanceCsv(idSociety, params) {
48
+ return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/csv`, null, {
49
+ params,
50
+ responseType: 'arraybuffer',
51
+ headers: {
52
+ Accept: 'application/pdf',
53
+ },
54
+ });
55
+ }
34
56
  getPdf(idSociety, params) {
35
57
  return this.axios.$get(`/societies/${idSociety}/general-ledger/pdf`, {
36
58
  params,
@@ -40,6 +62,7 @@ class GeneralLedger extends Resource_1.Resource {
40
62
  },
41
63
  });
42
64
  }
65
+ /** @deprecated use exportBalancePdf() instead */
43
66
  getBalancePdf(params) {
44
67
  return this.axios.$get('/generalLedger/balance/pdf', {
45
68
  params,
@@ -49,6 +72,15 @@ class GeneralLedger extends Resource_1.Resource {
49
72
  },
50
73
  });
51
74
  }
75
+ exportBalancePdf(idSociety, params) {
76
+ return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/pdf`, null, {
77
+ params,
78
+ responseType: 'arraybuffer',
79
+ headers: {
80
+ Accept: 'application/pdf',
81
+ },
82
+ });
83
+ }
52
84
  getAuxiliary(params) {
53
85
  return this.axios.$get('/generalLedger/auxiliary', { params });
54
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GeneralLedger.js","sourceRoot":"","sources":["../../../../ts/api/resources/GeneralLedger.ts"],"names":[],"mappings":";;;AAIA,0CAAuC;AAEvC,MAAa,aAAc,SAAQ,mBAAQ;IACzC,YAAY,CAAC,MAA0B;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACvC,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB,CAAC,MAA0B;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE;YAC/C,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,MAA0B;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC3C,MAAM;YACN,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,MAA0B;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACnD,MAAM;YACN,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,SAAiB,EAAE,MAA0B;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,SAAS,qBAAqB,EAAE;YACnE,MAAM;YACN,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,MAA0B;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACnD,MAAM;YACN,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CAAC,MAAmC;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,qBAAqB,CAAC,MAAmC;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,aAAa,CAAC,EAAU,EAAE,MAAoC;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AAhED,sCAgEC","sourcesContent":["import {\n BasePaginateInterface, IGeneralLedgerAccount, IGeneralLedgerThirdParty, QueryGeneralLedgerAuxiliary, QueryGeneralLedgerThirdParty, ReadGeneralLedgerSummary, ReadIGeneralLedgerThirdPartyPaginated,\n} from '../../types';\nimport { QueryGeneralLedger } from '../../types/Interface/api/generalLedger/QueryGeneralLedger';\nimport { Resource } from '../Resource';\n\nexport class GeneralLedger extends Resource {\n getBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger', {\n params,\n });\n }\n\n getBalanceBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger/balance', {\n params,\n });\n }\n\n getCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n getBalanceCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n getPdf(idSociety: number, params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get(`/societies/${idSociety}/general-ledger/pdf`, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getBalancePdf(params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/pdf', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getAuxiliary(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<IGeneralLedgerThirdParty[]>> {\n return this.axios.$get('/generalLedger/auxiliary', { params });\n }\n\n getAuxiliarySummaries(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<ReadGeneralLedgerSummary[]>> {\n return this.axios.$get('/general-ledger/auxiliary/summaries', { params });\n }\n\n getThirdParty(id: number, params: QueryGeneralLedgerThirdParty): Promise<ReadIGeneralLedgerThirdPartyPaginated> {\n return this.axios.$get(`/general-ledger/third-parties/${id}`, { params });\n }\n}"]}
1
+ {"version":3,"file":"GeneralL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erAccount, IGeneralLedgerThirdParty, QueryGeneralLedgerAuxiliary, QueryGeneralLedgerThirdParty, ReadGeneralLedgerSummary, ReadIGeneralLedgerThirdPartyPaginated,\n} from '../../types';\nimport { QueryGeneralLedger } from '../../types/Interface/api/generalLedger/QueryGeneralLedger';\nimport { Resource } from '../Resource';\n\nexport class GeneralLedger extends Resource {\n getBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger', {\n params,\n });\n }\n\n getBalanceBySociety(params: QueryGeneralLedger): Promise<BasePaginateInterface<IGeneralLedgerAccount[]>> {\n return this.axios.$get('/generalLedger/balance', {\n params,\n });\n }\n\n /**\n * @deprecated use exportCsv instead\n */\n getCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n exportCsv(idSociety: number, query: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/general-ledgers/csv`, null, {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n\n /** @deprecated use exportBalanceCsv() instead */\n getBalanceCsv(params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/csv', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/csv',\n },\n });\n }\n\n exportBalanceCsv(idSociety: number, params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/csv`, null, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getPdf(idSociety: number, params: QueryGeneralLedger):Promise<Buffer> {\n return this.axios.$get(`/societies/${idSociety}/general-ledger/pdf`, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n /** @deprecated use exportBalancePdf() instead */\n getBalancePdf(params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$get('/generalLedger/balance/pdf', {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n exportBalancePdf(idSociety: number, params: QueryGeneralLedger): Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/general-ledgers/balances/pdf`, null, {\n params,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n getAuxiliary(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<IGeneralLedgerThirdParty[]>> {\n return this.axios.$get('/generalLedger/auxiliary', { params });\n }\n\n getAuxiliarySummaries(params: QueryGeneralLedgerAuxiliary): Promise<BasePaginateInterface<ReadGeneralLedgerSummary[]>> {\n return this.axios.$get('/general-ledger/auxiliary/summaries', { params });\n }\n\n getThirdParty(id: number, params: QueryGeneralLedgerThirdParty): Promise<ReadIGeneralLedgerThirdPartyPaginated> {\n return this.axios.$get(`/general-ledger/third-parties/${id}`, { params });\n }\n}"]}
@@ -2,6 +2,8 @@
2
2
  import { Resource } from '../Resource';
3
3
  import { QueryIncomeStatementPdf } from '../../types';
4
4
  export declare class IncomeStatement extends Resource {
5
+ /** @deprecated use exportPdf() instead */
5
6
  getPdf(query: QueryIncomeStatementPdf): Promise<Buffer>;
7
+ exportPdf(idSociety: number, query: QueryIncomeStatementPdf): Promise<Buffer>;
6
8
  }
7
9
  //# sourceMappingURL=IncomeStatement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IncomeStatement.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAI,OAAO,CAAC,MAAM,CAAC;CASzD"}
1
+ {"version":3,"file":"IncomeStatement.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,eAAgB,SAAQ,QAAQ;IAE3C,0CAA0C;IAC1C,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAI,OAAO,CAAC,MAAM,CAAC;IAUxD,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,GAAI,OAAO,CAAC,MAAM,CAAC;CAU/E"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IncomeStatement = void 0;
4
4
  const Resource_1 = require("../Resource");
5
5
  class IncomeStatement extends Resource_1.Resource {
6
+ /** @deprecated use exportPdf() instead */
6
7
  getPdf(query) {
7
8
  return this.axios.$get('/incomeStatement/pdf', {
8
9
  params: query,
@@ -12,6 +13,15 @@ class IncomeStatement extends Resource_1.Resource {
12
13
  },
13
14
  });
14
15
  }
16
+ exportPdf(idSociety, query) {
17
+ return this.axios.$post(`/societies/${idSociety}/income-statements/pdf`, null, {
18
+ params: query,
19
+ responseType: 'arraybuffer',
20
+ headers: {
21
+ Accept: 'application/pdf',
22
+ },
23
+ });
24
+ }
15
25
  }
16
26
  exports.IncomeStatement = IncomeStatement;
17
27
  //# sourceMappingURL=IncomeStatement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IncomeStatement.js","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAGvC,MAAa,eAAgB,SAAQ,mBAAQ;IAC3C,MAAM,CAAC,KAA8B;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC7C,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAVD,0CAUC","sourcesContent":["import { Resource } from '../Resource';\nimport { QueryIncomeStatementPdf } from '../../types';\n\nexport class IncomeStatement extends Resource {\n getPdf(query: QueryIncomeStatementPdf) : Promise<Buffer> {\n return this.axios.$get('/incomeStatement/pdf', {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n}"]}
1
+ {"version":3,"file":"IncomeStatement.js","sourceRoot":"","sources":["../../../../ts/api/resources/IncomeStatement.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAGvC,MAAa,eAAgB,SAAQ,mBAAQ;IAE3C,0CAA0C;IAC1C,MAAM,CAAC,KAA8B;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAC7C,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,SAAiB,EAAE,KAA8B;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,SAAS,wBAAwB,EAAE,IAAI,EAAE;YAC7E,MAAM,EAAE,KAAK;YACb,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;CAEF;AAvBD,0CAuBC","sourcesContent":["import { Resource } from '../Resource';\nimport { QueryIncomeStatementPdf } from '../../types';\n\nexport class IncomeStatement extends Resource {\n\n /** @deprecated use exportPdf() instead */\n getPdf(query: QueryIncomeStatementPdf) : Promise<Buffer> {\n return this.axios.$get('/incomeStatement/pdf', {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n exportPdf(idSociety: number, query: QueryIncomeStatementPdf) : Promise<Buffer> {\n return this.axios.$post(`/societies/${idSociety}/income-statements/pdf`, null, {\n params: query,\n responseType: 'arraybuffer',\n headers: {\n Accept: 'application/pdf',\n },\n });\n }\n\n}"]}
@@ -2,6 +2,8 @@
2
2
  import { Resource } from '../Resource';
3
3
  import { Journals, QueryJournal } from '../../types';
4
4
  export declare class Journal extends Resource {
5
+ /** @deprecated use export() instead */
5
6
  getExport(exportType: 'pdf' | 'json', params: QueryJournal): Promise<Journals | Buffer>;
7
+ export(idSociety: number, exportType: 'pdf' | 'json', params: QueryJournal): Promise<Buffer | Journals>;
6
8
  }
7
9
  //# sourceMappingURL=Journal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Journal.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErD,qBAAa,OAAQ,SAAQ,QAAQ;IACnC,SAAS,CAAC,UAAU,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;CAMxF"}
1
+ {"version":3,"file":"Journal.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAErD,qBAAa,OAAQ,SAAQ,QAAQ;IAEnC,uCAAuC;IACvC,SAAS,CAAC,UAAU,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;IAOvF,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;CAMxG"}
@@ -3,12 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Journal = void 0;
4
4
  const Resource_1 = require("../Resource");
5
5
  class Journal extends Resource_1.Resource {
6
+ /** @deprecated use export() instead */
6
7
  getExport(exportType, params) {
7
8
  return this.axios.$get(`/balance-sheets/journals/export/${exportType}`, {
8
9
  params,
9
10
  responseType: 'arraybuffer',
10
11
  });
11
12
  }
13
+ export(idSociety, exportType, params) {
14
+ return this.axios.$get(`/societies/${idSociety}/journals/export/${exportType}`, {
15
+ params,
16
+ responseType: 'arraybuffer',
17
+ });
18
+ }
12
19
  }
13
20
  exports.Journal = Journal;
14
21
  //# sourceMappingURL=Journal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Journal.js","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAGvC,MAAa,OAAQ,SAAQ,mBAAQ;IACnC,SAAS,CAAC,UAA0B,EAAE,MAAoB;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAmC,UAAU,EAAE,EAAE;YACtE,MAAM;YACN,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AAPD,0BAOC","sourcesContent":["import { Resource } from '../Resource';\nimport { Journals, QueryJournal } from '../../types';\n\nexport class Journal extends Resource {\n getExport(exportType: 'pdf' | 'json', params: QueryJournal): Promise<Journals | Buffer> {\n return this.axios.$get(`/balance-sheets/journals/export/${exportType}`, {\n params,\n responseType: 'arraybuffer',\n });\n }\n}\n"]}
1
+ {"version":3,"file":"Journal.js","sourceRoot":"","sources":["../../../../ts/api/resources/Journal.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAGvC,MAAa,OAAQ,SAAQ,mBAAQ;IAEnC,uCAAuC;IACvC,SAAS,CAAC,UAA0B,EAAE,MAAoB;QACxD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAmC,UAAU,EAAE,EAAE;YACtE,MAAM;YACN,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,SAAiB,EAAE,UAA0B,EAAE,MAAoB;QACxE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,SAAS,oBAAoB,UAAU,EAAE,EAAE;YAC9E,MAAM;YACN,YAAY,EAAE,aAAa;SAC5B,CAAC,CAAC;IACL,CAAC;CACF;AAhBD,0BAgBC","sourcesContent":["import { Resource } from '../Resource';\nimport { Journals, QueryJournal } from '../../types';\n\nexport class Journal extends Resource {\n\n /** @deprecated use export() instead */\n getExport(exportType: 'pdf' | 'json', params: QueryJournal): Promise<Journals | Buffer> {\n return this.axios.$get(`/balance-sheets/journals/export/${exportType}`, {\n params,\n responseType: 'arraybuffer',\n });\n }\n\n export(idSociety: number, exportType: 'pdf' | 'json', params: QueryJournal): Promise<Buffer | Journals> {\n return this.axios.$get(`/societies/${idSociety}/journals/export/${exportType}`, {\n params,\n responseType: 'arraybuffer',\n });\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { CancelToken } from 'axios';
2
2
  import { Resource } from '../Resource';
3
- import { BasePaginate, IPrestation, ISociety, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation } from '../../types';
3
+ import { BasePaginate, CreateSocietyPrestationComplementary, IPrestation, ISociety, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation } from '../../types';
4
4
  export declare class Prestation extends Resource {
5
5
  /**
6
6
  * Crée une prestationavec tous les éléments lié à celle-ci.
@@ -24,5 +24,6 @@ export declare class Prestation extends Resource {
24
24
  getPaginatedSocietiesFromPrestation(params: QueryGetPaginatedSocietiesFromPrestation): Promise<BasePaginate<ISociety>>;
25
25
  getAllFromSociety(id: number, params?: QueryPrestation, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]>;
26
26
  getAllSocialFromSociety(id: number, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]>;
27
+ createCustomerPrestation(idSociety: number, payload: CreateSocietyPrestationComplementary): Promise<IPrestation>;
27
28
  }
28
29
  //# sourceMappingURL=prestation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,WAAW,EAAE,QAAQ,EAAkB,qBAAqB,EAAE,wCAAwC,EAAE,eAAe,EAAE,qBAAqB,EAC/I,MAAM,aAAa,CAAC;AAErB,qBAAa,UAAW,SAAQ,QAAQ;IAEtC;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlE;;;;;OAKG;IACI,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxF;;;;OAIG;IACI,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D,mCAAmC,CAAC,MAAM,EAAE,wCAAwC,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAItH,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIhI,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAqBpH"}
1
+ {"version":3,"file":"prestation.d.ts","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,oCAAoC,EACpC,WAAW,EAAE,QAAQ,EAAkB,qBAAqB,EAAE,wCAAwC,EAAE,eAAe,EAAE,qBAAqB,EAC/I,MAAM,aAAa,CAAC;AAErB,qBAAa,UAAW,SAAQ,QAAQ;IAEtC;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIlE;;;;;OAKG;IACI,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC;IAIxF;;;;OAIG;IACI,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D,mCAAmC,CAAC,MAAM,EAAE,wCAAwC,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAItH,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAIhI,uBAAuB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAsB5G,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,oCAAoC,GAAG,OAAO,CAAC,WAAW,CAAC;CAIxH"}
@@ -53,6 +53,9 @@ class Prestation extends Resource_1.Resource {
53
53
  ],
54
54
  } }));
55
55
  }
56
+ createCustomerPrestation(idSociety, payload) {
57
+ return this.axios.$post(`/societies/${idSociety}/prestations`, payload);
58
+ }
56
59
  }
57
60
  exports.Prestation = Prestation;
58
61
  //# sourceMappingURL=prestation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AACvC,uCAGqB;AAErB,MAAa,UAAW,SAAQ,mBAAQ;IAEtC;;;;OAIG;IACI,MAAM,CAAC,MAA6B;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,YAAoB,EAAE,MAA6B;QAC/D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,YAAY,EAAE,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IAED;;;;OAIG;IACI,wBAAwB,CAAC,EAAU;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;IACjE,CAAC;IAEM,mCAAmC,CAAC,MAAgD;QACzF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC9D,CAAC;IAEM,iBAAiB,CAAC,EAAU,EAAE,MAAwB,EAAE,WAAyB,EAAE,MAAoB;QAC5G,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,gDAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAE,MAAM,IAAG,CAAC;IAC7I,CAAC;IAEM,uBAAuB,CAAC,EAAU,EAAE,WAAyB,EAAE,MAAoB;QACxF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,gDAChD,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACpC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAC7B,MAAM,EAAE;gBACN,iBAAiB,EAAE;oBACjB,sBAAc,CAAC,UAAU;oBACzB,sBAAc,CAAC,MAAM;oBACrB,sBAAc,CAAC,qBAAqB;oBACpC,sBAAc,CAAC,6BAA6B;oBAC5C,sBAAc,CAAC,sCAAsC;oBACrD,sBAAc,CAAC,8BAA8B;oBAC7C,sBAAc,CAAC,2BAA2B;oBAC1C,sBAAc,CAAC,mBAAmB;oBAClC,sBAAc,CAAC,eAAe;oBAC9B,sBAAc,CAAC,uBAAuB;oBACtC,sBAAc,CAAC,sBAAsB;oBACrC,sBAAc,CAAC,8BAA8B;iBAAC;aACjD,IACD,CAAC;IACL,CAAC;CACF;AA3DD,gCA2DC","sourcesContent":["import { CancelToken } from 'axios';\nimport { Resource } from '../Resource';\nimport {\n BasePaginate,\n IPrestation, ISociety, PrestationType, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation,\n} from '../../types';\n\nexport class Prestation extends Resource {\n\n /**\n * Crée une prestationavec tous les éléments lié à celle-ci.\n * @param { QueryCreatePrestation } params \n * @returns { IPrestation }\n */\n public create(params: QueryCreatePrestation): Promise<IPrestation> {\n return this.axios.$post('/prestation', params);\n }\n\n /**\n * Crée une prestationavec tous les éléments lié à celle-ci.\n * @param { number } id\n * @param { QueryUpdatePrestation } params \n * @returns { IPrestation }\n */\n public update(idPrestation: number, params: QueryUpdatePrestation): Promise<IPrestation> {\n return this.axios.$put(`/prestation/${idPrestation}`, params);\n }\n \n /**\n * retourne toutes les prestations juridique d'une société\n * @param { number } id\n * @returns { IPrestation }\n */\n public getAllJuridicFromSociety(id: number): Promise<IPrestation[]> {\n return this.axios.$get(`/prestation/society/${id}/juridicals`);\n }\n\n public getPaginatedSocietiesFromPrestation(params: QueryGetPaginatedSocietiesFromPrestation): Promise<BasePaginate<ISociety>> {\n return this.axios.$get('/prestation/societies', { params });\n }\n\n public getAllFromSociety(id: number, params?: QueryPrestation, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]> {\n return this.axios.$get(`/societies/${id}/prestations`, { ...(cancelToken ? { cancelToken } : {}), ...(signal ? { signal } : {}), params });\n }\n\n public getAllSocialFromSociety(id: number, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]> {\n return this.axios.$get(`/societies/${id}/prestations`, {\n ...(cancelToken ? { cancelToken } : {}),\n ...(signal ? { signal } : {}),\n params: {\n prestationListIds: [\n PrestationType.FRUCTUPAIE,\n PrestationType.SOCIAL,\n PrestationType.MYFRUCTUCOMPTA_SOCIAL,\n PrestationType.MYFRUCTUCOMPTA_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_ASSISTANCE_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_ASSISTANCE_SOCIAL,\n PrestationType.FRUCTUCOMPTA_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_SOCIAL,\n PrestationType.COMPTA_PRO_PAIE,\n PrestationType.COMPTA_PRO_EXPRESS_PAIE,\n PrestationType.COMPTA_ENTREPRISE_PAIE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS_PAIE],\n },\n });\n }\n}"]}
1
+ {"version":3,"file":"prestation.js","sourceRoot":"","sources":["../../../../ts/api/resources/prestation.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AACvC,uCAIqB;AAErB,MAAa,UAAW,SAAQ,mBAAQ;IAEtC;;;;OAIG;IACI,MAAM,CAAC,MAA6B;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG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CAAC,8BAA8B;oBAC7C,sBAAc,CAAC,2BAA2B;oBAC1C,sBAAc,CAAC,mBAAmB;oBAClC,sBAAc,CAAC,eAAe;oBAC9B,sBAAc,CAAC,uBAAuB;oBACtC,sBAAc,CAAC,sBAAsB;oBACrC,sBAAc,CAAC,8BAA8B;iBAAC;aACjD,IACD,CAAC;IACL,CAAC;IAEM,wBAAwB,CAAC,SAAiB,EAAE,OAA6C;QAC9F,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,SAAS,cAAc,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;CAEF;AAhED,gCAgEC","sourcesContent":["import { CancelToken } from 'axios';\nimport { Resource } from '../Resource';\nimport {\n BasePaginate,\n CreateSocietyPrestationComplementary,\n IPrestation, ISociety, PrestationType, QueryCreatePrestation, QueryGetPaginatedSocietiesFromPrestation, QueryPrestation, QueryUpdatePrestation,\n} from '../../types';\n\nexport class Prestation extends Resource {\n\n /**\n * Crée une prestationavec tous les éléments lié à celle-ci.\n * @param { QueryCreatePrestation } params \n * @returns { IPrestation }\n */\n public create(params: QueryCreatePrestation): Promise<IPrestation> {\n return this.axios.$post('/prestation', params);\n }\n\n /**\n * Crée une prestationavec tous les éléments lié à celle-ci.\n * @param { number } id\n * @param { QueryUpdatePrestation } params \n * @returns { IPrestation }\n */\n public update(idPrestation: number, params: QueryUpdatePrestation): Promise<IPrestation> {\n return this.axios.$put(`/prestation/${idPrestation}`, params);\n }\n \n /**\n * retourne toutes les prestations juridique d'une société\n * @param { number } id\n * @returns { IPrestation }\n */\n public getAllJuridicFromSociety(id: number): Promise<IPrestation[]> {\n return this.axios.$get(`/prestation/society/${id}/juridicals`);\n }\n\n public getPaginatedSocietiesFromPrestation(params: QueryGetPaginatedSocietiesFromPrestation): Promise<BasePaginate<ISociety>> {\n return this.axios.$get('/prestation/societies', { params });\n }\n\n public getAllFromSociety(id: number, params?: QueryPrestation, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]> {\n return this.axios.$get(`/societies/${id}/prestations`, { ...(cancelToken ? { cancelToken } : {}), ...(signal ? { signal } : {}), params });\n }\n\n public getAllSocialFromSociety(id: number, cancelToken?: CancelToken, signal?: AbortSignal): Promise<IPrestation[]> {\n return this.axios.$get(`/societies/${id}/prestations`, {\n ...(cancelToken ? { cancelToken } : {}),\n ...(signal ? { signal } : {}),\n params: {\n prestationListIds: [\n PrestationType.FRUCTUPAIE,\n PrestationType.SOCIAL,\n PrestationType.MYFRUCTUCOMPTA_SOCIAL,\n PrestationType.MYFRUCTUCOMPTA_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_ASSISTANCE_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_ASSISTANCE_SOCIAL,\n PrestationType.FRUCTUCOMPTA_EXPRESS_SOCIAL,\n PrestationType.FRUCTUCOMPTA_SOCIAL,\n PrestationType.COMPTA_PRO_PAIE,\n PrestationType.COMPTA_PRO_EXPRESS_PAIE,\n PrestationType.COMPTA_ENTREPRISE_PAIE,\n PrestationType.COMPTA_ENTREPRISE_EXPRESS_PAIE],\n },\n });\n }\n\n public createCustomerPrestation(idSociety: number, payload: CreateSocietyPrestationComplementary): Promise<IPrestation> {\n return this.axios.$post(`/societies/${idSociety}/prestations`, payload);\n }\n\n}"]}
@@ -1,5 +1,6 @@
1
1
  export * from './utils';
2
2
  export * from './utils/commercialManagement/product';
3
+ export * from './utils/commercialManagement/vat';
3
4
  export * from './types';
4
5
  export * from './api';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sCAAsC,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./utils"), exports);
18
18
  __exportStar(require("./utils/commercialManagement/product"), exports);
19
+ __exportStar(require("./utils/commercialManagement/vat"), exports);
19
20
  // eslint-disable-next-line
20
21
  __exportStar(require("./types"), exports);
21
22
  __exportStar(require("./api"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uEAAqD;AACrD,2BAA2B;AAC3B,0CAAwB;AACxB,wCAAsB","sourcesContent":["export * from './utils';\nexport * from './utils/commercialManagement/product';\n// eslint-disable-next-line\nexport * from './types';\nexport * from './api';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uEAAqD;AACrD,mEAAiD;AACjD,2BAA2B;AAC3B,0CAAwB;AACxB,wCAAsB","sourcesContent":["export * from './utils';\nexport * from './utils/commercialManagement/product';\nexport * from './utils/commercialManagement/vat';\n// eslint-disable-next-line\nexport * from './types';\nexport * from './api';\n"]}
@@ -3,4 +3,9 @@ export declare class CreatePrestation {
3
3
  amountTtc: number;
4
4
  label?: string;
5
5
  }
6
+ export declare class CreateSocietyPrestationComplementary {
7
+ idPrestationList: number;
8
+ idExercice: number;
9
+ totalTaxExcluded: number;
10
+ }
6
11
  //# sourceMappingURL=CreatePrestation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreatePrestation.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAgB;IAGzB,WAAW,EAAE,MAAM,CAAC;IAIpB,SAAS,EAAE,MAAM,CAAC;IAGlB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"CreatePrestation.d.ts","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAgB;IAGzB,WAAW,EAAE,MAAM,CAAC;IAIpB,SAAS,EAAE,MAAM,CAAC;IAGlB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,oCAAoC;IAG7C,gBAAgB,EAAE,MAAM,CAAC;IAIzB,UAAU,EAAE,MAAM,CAAC;IAInB,gBAAgB,EAAE,MAAM,CAAC;CAC5B"}
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CreatePrestation = void 0;
12
+ exports.CreateSocietyPrestationComplementary = exports.CreatePrestation = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const __1 = require("../../../..");
15
15
  class CreatePrestation {
@@ -29,4 +29,22 @@ __decorate([
29
29
  __metadata("design:type", String)
30
30
  ], CreatePrestation.prototype, "label", void 0);
31
31
  exports.CreatePrestation = CreatePrestation;
32
+ class CreateSocietyPrestationComplementary {
33
+ }
34
+ __decorate([
35
+ (0, __1.ApiProperty)(),
36
+ (0, class_validator_1.IsNumber)(),
37
+ __metadata("design:type", Number)
38
+ ], CreateSocietyPrestationComplementary.prototype, "idPrestationList", void 0);
39
+ __decorate([
40
+ (0, __1.ApiProperty)(),
41
+ (0, class_validator_1.IsNumber)(),
42
+ __metadata("design:type", Number)
43
+ ], CreateSocietyPrestationComplementary.prototype, "idExercice", void 0);
44
+ __decorate([
45
+ (0, __1.ApiProperty)(),
46
+ (0, class_validator_1.IsNumber)(),
47
+ __metadata("design:type", Number)
48
+ ], CreateSocietyPrestationComplementary.prototype, "totalTaxExcluded", void 0);
49
+ exports.CreateSocietyPrestationComplementary = CreateSocietyPrestationComplementary;
32
50
  //# sourceMappingURL=CreatePrestation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreatePrestation.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAC3C,mCAA+D;AAE/D,MAAa,gBAAgB;CAW5B;AAVC;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;qDACW;AAEtB;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;mDACS;AAEpB;IAAC,IAAA,uBAAmB,GAAE;;+CACL;AAVnB,4CAWC","sourcesContent":["import { IsNumber } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\n\nexport class CreatePrestation {\n @ApiProperty()\n @IsNumber()\n orderStatus: number;\n\n @ApiProperty()\n @IsNumber()\n amountTtc: number;\n\n @ApiPropertyOptional()\n label?: string;\n}\n"]}
1
+ {"version":3,"file":"CreatePrestation.js","sourceRoot":"","sources":["../../../../../../ts/types/Interface/api/prestation/CreatePrestation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAC3C,mCAA+D;AAE/D,MAAa,gBAAgB;CAW5B;AAVC;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;qDACW;AAEtB;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;mDACS;AAEpB;IAAC,IAAA,uBAAmB,GAAE;;+CACL;AAVnB,4CAWC;AAED,MAAa,oCAAoC;CAYhD;AAXC;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;8EACgB;AAE3B;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;wEACU;AAErB;IAAC,IAAA,eAAW,GAAE;IACb,IAAA,0BAAQ,GAAE;;8EACgB;AAX7B,oFAYC","sourcesContent":["import { IsNumber } from 'class-validator';\nimport { ApiProperty, ApiPropertyOptional } from '../../../..';\n\nexport class CreatePrestation {\n @ApiProperty()\n @IsNumber()\n orderStatus: number;\n\n @ApiProperty()\n @IsNumber()\n amountTtc: number;\n\n @ApiPropertyOptional()\n label?: string;\n}\n\nexport class CreateSocietyPrestationComplementary {\n @ApiProperty()\n @IsNumber()\n idPrestationList: number;\n\n @ApiProperty()\n @IsNumber()\n idExercice: number;\n\n @ApiProperty()\n @IsNumber()\n totalTaxExcluded: number;\n}\n"]}
@@ -2,31 +2,32 @@ 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
  export interface IPrestationComplementary {
6
7
  id?: number;
7
8
  generateLink: boolean;
8
- deadline: Date | null;
9
- dateEstimateSigned: Date | null;
10
- dateSendToClient: Date | null;
11
- dateInvoice: Date | null;
12
- datePayment: Date | null;
13
- dateTransmission: Date | null;
14
- idGedFile: number | null;
15
- idCollaborater: number | null;
16
- idUser: number | null;
17
- idPaymentExpectation: number | null;
18
- description: string | null;
19
- note: string | null;
20
- forOtherMission: string | null;
21
- statePrestationJuridique: number | null;
22
- acceptationAdmin: number;
9
+ deadline?: Date | null;
10
+ dateEstimateSigned?: Date | null;
11
+ dateSendToClient?: Date | null;
12
+ dateInvoice?: Date | null;
13
+ datePayment?: Date | null;
14
+ dateTransmission?: Date | null;
15
+ idGedFile?: number | null;
16
+ idCollaborater?: number | null;
17
+ idUser?: number | null;
18
+ idPaymentExpectation?: number | null;
19
+ description?: string | null;
20
+ note?: string | null;
21
+ forOtherMission?: string | null;
22
+ statePrestationJuridique?: number | null;
23
+ acceptationAdmin: AcceptationAdmin;
23
24
  createdAt?: Date | null;
24
25
  updatedAt?: Date | null;
25
26
  deletedAt?: Date | null;
26
- prestationUser: IUser;
27
- prestationCollaborater: IUser;
28
- prestationPaymentExpectation: IPaymentExpectation;
29
- prestationGedFile: IGedFile;
30
- prestation: IPrestation;
27
+ prestationUser?: IUser;
28
+ prestationCollaborater?: IUser;
29
+ prestationPaymentExpectation?: IPaymentExpectation;
30
+ prestationGedFile?: IGedFile;
31
+ prestation?: IPrestation;
31
32
  }
32
33
  //# sourceMappingURL=IPrestationComplementary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IPrestationComplementary.d.ts","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGxB,cAAc,EAAE,KAAK,CAAC;IACtB,sBAAsB,EAAE,KAAK,CAAC;IAC9B,4BAA4B,EAAE,mBAAmB,CAAC;IAClD,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,UAAU,EAAE,WAAW,CAAC;CACzB"}
1
+ {"version":3,"file":"IPrestationComplementary.d.ts","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,kBAAkB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACjC,gBAAgB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,gBAAgB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGxB,cAAc,CAAC,EAAE,KAAK,CAAC;IACvB,sBAAsB,CAAC,EAAE,KAAK,CAAC;IAC/B,4BAA4B,CAAC,EAAE,mBAAmB,CAAC;IACnD,iBAAiB,CAAC,EAAE,QAAQ,CAAC;IAC7B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"IPrestationComplementary.js","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"","sourcesContent":["import { IUser } from './IUser';\nimport { IPaymentExpectation } from './IPaymentExpectation';\nimport { IGedFile } from './IGedFile';\nimport { IPrestation } from './IPrestation';\n\n// prestationsCompl\nexport interface IPrestationComplementary {\n id?: number;\n generateLink: boolean;\n deadline: Date | null;\n dateEstimateSigned: Date | null;\n dateSendToClient: Date | null;\n dateInvoice: Date | null;\n datePayment: Date | null;\n dateTransmission: Date | null;\n idGedFile: number | null;\n idCollaborater: number | null;\n idUser: number | null;\n idPaymentExpectation: number | null;\n description: string | null;\n note: string | null;\n forOtherMission: string | null;\n statePrestationJuridique: number | null;\n acceptationAdmin: number;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n deletedAt?: Date | null;\n\n // Associations\n prestationUser: IUser;\n prestationCollaborater: IUser;\n prestationPaymentExpectation: IPaymentExpectation;\n prestationGedFile: IGedFile;\n prestation: IPrestation;\n}\n"]}
1
+ {"version":3,"file":"IPrestationComplementary.js","sourceRoot":"","sources":["../../../../../ts/types/Interface/models/IPrestationComplementary.ts"],"names":[],"mappings":"","sourcesContent":["import { IUser } from './IUser';\nimport { IPaymentExpectation } from './IPaymentExpectation';\nimport { IGedFile } from './IGedFile';\nimport { IPrestation } from './IPrestation';\nimport { AcceptationAdmin } from '../../Enum/AdditionnalSells';\n\n// prestationsCompl\nexport interface IPrestationComplementary {\n id?: number;\n generateLink: boolean;\n deadline?: Date | null;\n dateEstimateSigned?: Date | null;\n dateSendToClient?: Date | null;\n dateInvoice?: Date | null;\n datePayment?: Date | null;\n dateTransmission?: Date | null;\n idGedFile?: number | null;\n idCollaborater?: number | null;\n idUser?: number | null;\n idPaymentExpectation?: number | null;\n description?: string | null;\n note?: string | null;\n forOtherMission?: string | null;\n statePrestationJuridique?: number | null;\n acceptationAdmin: AcceptationAdmin;\n createdAt?: Date | null;\n updatedAt?: Date | null;\n deletedAt?: Date | null;\n\n // Associations\n prestationUser?: IUser;\n prestationCollaborater?: IUser;\n prestationPaymentExpectation?: IPaymentExpectation;\n prestationGedFile?: IGedFile;\n prestation?: IPrestation;\n}\n"]}
@@ -2,6 +2,5 @@ import { ReadCommercialDocumentTemplate } from '../../types/Interface/api/commer
2
2
  import { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';
3
3
  import { CreateInvoiceDocument, CreateMailHeader, CreatePreSaleDocument, ReadCommercialMailTemplate } from '../../types';
4
4
  export declare function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialDocumentTemplate;
5
- export declare function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialDocumentTemplate;
6
5
  export declare function generateMailHeader(params: CreateMailHeader, shouldHideBrandName?: boolean, nodeEnv?: string | undefined): ReadCommercialMailTemplate;
7
6
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAuB,MAAM,qDAAqD,CAAC;AAI1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOvE,OAAO,EACL,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,0BAA0B,EAC3F,MAAM,aAAa,CAAC;AAgBrB,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,8BAA8B,CAyFnP;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,8BAA8B,CA0F5K;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,0BAA0B,CAuB7J"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAuB,MAAM,qDAAqD,CAAC;AAI1H,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOvE,OAAO,EACL,qBAAqB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,0BAA0B,EAC3F,MAAM,aAAa,CAAC;AAgBrB,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,mBAAmB,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,8BAA8B,CAyFnP;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,UAAQ,EAAE,OAAO,GAAE,MAAM,GAAG,SAAqB,GAAG,0BAA0B,CAuB7J"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateMailHeader = exports.generateAdvanceDocument = exports.generateCommercialDocument = void 0;
3
+ exports.generateMailHeader = exports.generateCommercialDocument = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const dayjs = require("dayjs");
6
6
  const CommercialManagement_1 = require("../../types/Enum/CommercialManagement");
@@ -58,46 +58,6 @@ function generateCommercialDocument(idEstimateInvoiceType, payload, shouldHideBr
58
58
  };
59
59
  }
60
60
  exports.generateCommercialDocument = generateCommercialDocument;
61
- function generateAdvanceDocument(payload, shouldHideBrandName = false, nodeEnv = undefined) {
62
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
63
- if (!payload.deposit)
64
- throw new Error('Aucun acompte défini');
65
- const data = Object.assign(Object.assign({}, payload), { title: (_a = payload.title) !== null && _a !== void 0 ? _a : null, paymentLink: (_b = payload.paymentLink) !== null && _b !== void 0 ? _b : '#', idEstimateInvoiceType: EstimateInvoice_1.EstimateInvoiceType.ACOMPTE, phoneContact: (_d = (_c = payload.settings) === null || _c === void 0 ? void 0 : _c.phoneContact) !== null && _d !== void 0 ? _d : null, products: [], vats: [], totalTaxExcluded: payload.deposit, totalTaxIncluded: payload.deposit, totalTaxAndDiscountIncluded: payload.deposit, generalDiscountFormatted: null, depositFormatted: (0, amount_1.integerToFormattedAmountString)(payload.deposit), totalTaxExcludedFormatted: (0, amount_1.integerToFormattedAmountString)(payload.deposit), totalTaxIncludedFormatted: (0, amount_1.integerToFormattedAmountString)(payload.deposit), totalTaxAndDiscountIncludedFormatted: (0, amount_1.integerToFormattedAmountString)(payload.deposit), totalVatAmountFormatted: (0, amount_1.integerToFormattedAmountString)(0), font: {
66
- id: (_f = (_e = payload.settings) === null || _e === void 0 ? void 0 : _e.idFont) !== null && _f !== void 0 ? _f : CommercialManagement_1.FontIds.CIRCULAR_STD,
67
- name: (_h = (_g = CommercialManagement_1.fontList.find((f) => { var _a; return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont); })) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : CommercialManagement_1.fontList[0].name,
68
- url: (_k = (_j = CommercialManagement_1.fontList.find((f) => { var _a; return f.id === ((_a = payload.settings) === null || _a === void 0 ? void 0 : _a.idFont); })) === null || _j === void 0 ? void 0 : _j.link) !== null && _k !== void 0 ? _k : CommercialManagement_1.fontList[0].link,
69
- }, capitalFormatted: payload.capital
70
- ? `${payload.capital}`
71
- .split('')
72
- .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '')
73
- .trim()
74
- : null, dueDateFormatted: payload.dueDate
75
- ? dayjs(payload.dueDate).format('DD/MM/YYYY')
76
- : null, expirationDateFormatted: payload.expirationDate
77
- ? dayjs(payload.expirationDate).format('DD/MM/YYYY')
78
- : null, emissionDateFormatted: payload.emissionDate
79
- ? dayjs(payload.emissionDate).format('DD/MM/YYYY')
80
- : null, shouldDisplayDiscountColumn: false, disableVat: true,
81
- // @ts-ignore
82
- marginVats: (0, lodash_1.uniq)(((_l = payload.assetMarginVatIds) !== null && _l !== void 0 ? _l : []).map((m) => { var _a, _b; return (_b = (_a = CommercialManagement_1.VatMarginCategyList.find((c) => c.id === m)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : null; })), accountingCategoryFormatted: (_o = (_m = CommercialManagement_1.AccountingCategoryList.find((a) => a.id === payload.accountingCategory)) === null || _m === void 0 ? void 0 : _m.label) !== null && _o !== void 0 ? _o : null,
83
- // @ts-ignore
84
- brandColors: (0, brands_1.getBrandConfig)({ objectWaited: 'colors', nodeEnv }), brandName: `${(0, brands_1.getBrandConfig)({ objectWaited: 'name', nodeEnv })}`, shouldHideBrandName });
85
- const commonTemplate = new common_1.CommercialDocumentCommonHTML();
86
- return {
87
- header: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.header, data),
88
- body: ejs === null || ejs === void 0 ? void 0 : ejs.render(body_1.bodyTemplate, Object.assign(Object.assign({}, data), { comment: data.comment && typeof data.comment === 'string'
89
- ? (_p = data.comment) === null || _p === void 0 ? void 0 : _p.replace(/\n/g, '<br/>')
90
- : null, products: data.products.map((p) => {
91
- var _a;
92
- return (Object.assign(Object.assign({}, p), { comment: p.comment && typeof p.comment === 'string'
93
- ? (_a = p.comment) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, '<br/>')
94
- : null }));
95
- }) })),
96
- footer: ejs === null || ejs === void 0 ? void 0 : ejs.render(commonTemplate.footer, Object.assign(Object.assign({}, data), { freeText: (_r = (_q = payload === null || payload === void 0 ? void 0 : payload.settings) === null || _q === void 0 ? void 0 : _q.freeInvoiceText) !== null && _r !== void 0 ? _r : null })),
97
- data,
98
- };
99
- }
100
- exports.generateAdvanceDocument = generateAdvanceDocument;
101
61
  function generateMailHeader(params, shouldHideBrandName = false, nodeEnv = undefined) {
102
62
  dayjs.locale('fr');
103
63
  const data = Object.assign(Object.assign({}, params.payload), { totalTaxExcludedFormatted: (0, amount_1.integerToFormattedAmountObject)(params.payload.totalTaxExcluded), totalTaxIncludedFormatted: (0, amount_1.integerToFormattedAmountObject)(params.payload.totalTaxIncluded), totalVatFormatted: (0, amount_1.integerToFormattedAmountObject)(params.payload.totalTaxIncluded - params.payload.totalTaxExcluded), dueDateFormatted: params.payload.dueDate ? dayjs(params.payload.dueDate).format('DD MMMM YYYY') : null, hasVat: params.hasVat, hostS3: params.hostS3, logoUrl: params.logoUrl, companyName: params.companyName, fileUrl: params.fileUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":";;;AAAA,mCAEgB;AAChB,+BAA+B;AAE/B,gFAE+C;AAC/C,sEAAuE;AACvE,8CAA2C;AAC3C,sCAA2F;AAC3F,+CAA8F;AAC9F,2CAAgD;AAChD,uCAAwD;AACxD,+BAA4C;AAI5C,6CAAiE;AACjE,sCAA2C;AAE3C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3B,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAW3B,SAAgB,0BAA0B,CAAC,qBAA0C,EAAE,OAAsD,EAAE,mBAAmB,GAAG,KAAK,EAAE,UAA8B,SAAS;;IACjN,MAAM,QAAQ,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,qCAA2B,EAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAC9G,MAAM,IAAI,GAAG,IAAA,gBAAQ,EAAC,MAAM,CAAC,MAAM,CAAC,IAAA,gBAAQ,EAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,yBAAmB,EAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5J,MAAM,UAAU,GAAG,IAAA,8CAAiC,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzE,MAAM,IAAI,mCACL,OAAO,KACV,UAAU,EACV,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,GAAG,EAC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AAM,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,WAAW,EAAE,MAAM,CAAC,WAAW,EAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,aAAa;QACb,WAAW,EAAE,IAAA,uBAAc,EAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAmB,EAClF,mBAAmB,GACpB,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,mCAA0B,EAAE,CAAC;IAEtD,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC;AAvBD,gDAuBC","sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport {\n AccountingCategoryList, FontIds, fontList, VatMarginCategyList,\n} from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString, integerToFormattedAmountObject } from '../amount';\nimport { CommercialDocumentCommonHTML, CommercialDocumentMailHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport {\n CreateInvoiceDocument, CreateMailHeader, CreatePreSaleDocument, ReadCommercialMailTemplate,\n} from '../../types';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\nimport { getBrandConfig } from '../brands';\n\nconst ejs = require('ejs');\nrequire('dayjs/locale/fr');\n\ntype brandColorType = {\n primary: string,\n primary50: string,\n primary100: string,\n primary300: string,\n primary500: string,\n primary700: string\n};\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital\n ? `${payload.capital}`.split('')\n .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '')\n .trim()\n : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find(\n (p) => p.discount2 && p.discount2 > 0,\n ),\n // @ts-ignore\n marginVats: _uniq(\n products\n .filter((p) => p.marginVatFormatted !== null)\n .map((p) => p.marginVatFormatted),\n ),\n accountingCategoryFormatted:\n AccountingCategoryList.find((a) => a.id === payload.accountingCategory)\n ?.label ?? null,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,\n shouldHideBrandName,\n paymentType: payload.paymentType,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [\n EstimateInvoiceType.DEVIS,\n EstimateInvoiceType.BON,\n ].includes(idEstimateInvoiceType)\n ? payload?.settings?.freeEstimateText\n : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, {\n ...data,\n comment:\n data.comment && typeof data.comment === 'string'\n ? data.comment?.replace(/\\n/g, '<br/>')\n : null,\n products: data.products.map((p) => ({\n ...p,\n comment:\n p.comment && typeof p.comment === 'string'\n ? p.comment?.replace(/\\n/g, '<br/>')\n : null,\n })),\n }),\n footer: ejs.render(commonTemplate.footer, {\n ...data,\n freeText: documentFreeText ?? null,\n }),\n data,\n };\n}\n\nexport function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {\n if (!payload.deposit) throw new Error('Aucun acompte défini');\n\n const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {\n ...payload,\n title: payload.title ?? null,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType: EstimateInvoiceType.ACOMPTE,\n phoneContact: payload.settings?.phoneContact ?? null,\n products: [],\n vats: [],\n totalTaxExcluded: payload.deposit,\n totalTaxIncluded: payload.deposit,\n totalTaxAndDiscountIncluded: payload.deposit,\n generalDiscountFormatted: null,\n depositFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxExcludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxIncludedFormatted: integerToFormattedAmountString(payload.deposit),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(\n payload.deposit,\n ),\n totalVatAmountFormatted: integerToFormattedAmountString(0),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name:\n fontList.find((f) => f.id === payload.settings?.idFont)?.name\n ?? fontList[0].name,\n url:\n fontList.find((f) => f.id === payload.settings?.idFont)?.link\n ?? fontList[0].link,\n },\n capitalFormatted: payload.capital\n ? `${payload.capital}`\n .split('')\n .reduceRight(\n (acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`,\n '',\n )\n .trim()\n : null,\n dueDateFormatted: payload.dueDate\n ? dayjs(payload.dueDate).format('DD/MM/YYYY')\n : null,\n expirationDateFormatted: payload.expirationDate\n ? dayjs(payload.expirationDate).format('DD/MM/YYYY')\n : null,\n emissionDateFormatted: payload.emissionDate\n ? dayjs(payload.emissionDate).format('DD/MM/YYYY')\n : null,\n shouldDisplayDiscountColumn: false,\n disableVat: true,\n // @ts-ignore\n marginVats: _uniq(\n (payload.assetMarginVatIds ?? []).map(\n (m) => VatMarginCategyList.find((c) => c.id === m)?.label ?? null,\n ),\n ),\n accountingCategoryFormatted:\n AccountingCategoryList.find((a) => a.id === payload.accountingCategory)\n ?.label ?? null,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,\n shouldHideBrandName,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n\n return {\n header: ejs?.render(commonTemplate.header, data),\n body: ejs?.render(bodyTemplate, {\n ...data,\n comment:\n data.comment && typeof data.comment === 'string'\n ? data.comment?.replace(/\\n/g, '<br/>')\n : null,\n products: data.products.map((p) => ({\n ...p,\n comment:\n p.comment && typeof p.comment === 'string'\n ? p.comment?.replace(/\\n/g, '<br/>')\n : null,\n })),\n }),\n footer: ejs?.render(commonTemplate.footer, {\n ...data,\n freeText: payload?.settings?.freeInvoiceText ?? null,\n }),\n data,\n };\n}\n\nexport function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {\n dayjs.locale('fr');\n const data = {\n ...params.payload,\n totalTaxExcludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxExcluded),\n totalTaxIncludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded),\n totalVatFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded - params.payload.totalTaxExcluded),\n dueDateFormatted: params.payload.dueDate ? dayjs(params.payload.dueDate).format('DD MMMM YYYY') : null,\n hasVat: params.hasVat,\n hostS3: params.hostS3,\n logoUrl: params.logoUrl,\n companyName: params.companyName,\n fileUrl: params.fileUrl,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n shouldHideBrandName,\n };\n\n const mailTemplate = new CommercialDocumentMailHTML();\n\n return {\n header: ejs.render(mailTemplate.header, data),\n };\n}"]}
1
+ {"version":3,"file":"document.js","sourceRoot":"","sources":["../../../../ts/utils/commercialManagement/document.ts"],"names":[],"mappings":";;;AAAA,mCAEgB;AAChB,+BAA+B;AAE/B,gFAE+C;AAC/C,sEAAuE;AACvE,8CAA2C;AAC3C,sCAA2F;AA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jB,yBAAyB,EAAE,IAAA,uCAA8B,EAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC1F,yBAAyB,EAAE,IAAA,uCAA8B,EAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC1F,iBAAiB,EAAE,IAAA,uCAA8B,EAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EACpH,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EACtG,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,WAAW,EAAE,MAAM,CAAC,WAAW,EAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,aAAa;QACb,WAAW,EAAE,IAAA,uBAAc,EAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAmB,EAClF,mBAAmB,GACpB,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,mCAA0B,EAAE,CAAC;IAEtD,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC;AAvBD,gDAuBC","sourcesContent":["import {\n orderBy as _orderBy, groupBy as _groupBy, sumBy as _sumBy, uniq as _uniq,\n} from 'lodash';\nimport * as dayjs from 'dayjs';\nimport { ReadCommercialDocumentTemplate, ReadDocumentEditing } from '../../types/Interface/api/commercialManagement/Read';\nimport {\n AccountingCategoryList, FontIds, fontList,\n} from '../../types/Enum/CommercialManagement';\nimport { EstimateInvoiceType } from '../../types/Enum/EstimateInvoice';\nimport { Vat } from '../../types/Enum/Vat';\nimport { integerToFormattedAmountString, integerToFormattedAmountObject } from '../amount';\nimport { CommercialDocumentCommonHTML, CommercialDocumentMailHTML } from './templates/common';\nimport { bodyTemplate } from './templates/body';\nimport { productToReadProductEditing } from './product';\nimport { vatToReadVatEditing } from './vat';\nimport {\n CreateInvoiceDocument, CreateMailHeader, CreatePreSaleDocument, ReadCommercialMailTemplate,\n} from '../../types';\nimport { thirdPartyToReadThirdPartyEditing } from './thirdParty';\nimport { getBrandConfig } from '../brands';\n\nconst ejs = require('ejs');\nrequire('dayjs/locale/fr');\n\ntype brandColorType = {\n primary: string,\n primary50: string,\n primary100: string,\n primary300: string,\n primary500: string,\n primary700: string\n};\n\nexport function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialDocumentTemplate {\n const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));\n const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);\n const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);\n\n const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {\n ...payload,\n thirdParty,\n paymentLink: payload.paymentLink ?? '#',\n idEstimateInvoiceType,\n title: payload.title ?? null,\n penalties: payload.penalties ?? null,\n compensation: payload.compensation ?? null,\n discount: payload.discount ?? null,\n vatMention: payload.vatMention ?? null,\n phoneContact: payload.settings?.phoneContact ?? null,\n products,\n vats,\n totalTaxExcluded: _sumBy(products, 'totalTaxExcluded'),\n totalTaxIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n totalTaxAndDiscountIncluded: _sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount'),\n generalDiscountFormatted: payload.generalDiscount2 ? integerToFormattedAmountString(payload.generalDiscount2) : null,\n depositFormatted: payload.deposit ? integerToFormattedAmountString(payload.deposit) : null,\n totalTaxExcludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded')),\n totalTaxIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount')),\n totalTaxAndDiscountIncludedFormatted: integerToFormattedAmountString(_sumBy(products, 'totalTaxExcluded') + _sumBy(vats, 'amount') - (payload.generalDiscount2 ?? 0) - (payload.deposit ?? 0)),\n totalVatAmountFormatted: integerToFormattedAmountString(_sumBy(vats, 'amount')),\n font: {\n id: payload.settings?.idFont ?? FontIds.CIRCULAR_STD,\n name: fontList.find((f) => f.id === payload.settings?.idFont)?.name ?? fontList[0].name,\n url: fontList.find((f) => f.id === payload.settings?.idFont)?.link ?? fontList[0].link,\n },\n capitalFormatted: payload.capital\n ? `${payload.capital}`.split('')\n .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '')\n .trim()\n : null,\n dueDateFormatted: payload.dueDate ? dayjs(payload.dueDate).format('DD/MM/YYYY') : null,\n expirationDateFormatted: payload.expirationDate ? dayjs(payload.expirationDate).format('DD/MM/YYYY') : null,\n emissionDateFormatted: payload.emissionDate ? dayjs(payload.emissionDate).format('DD/MM/YYYY') : null,\n shouldDisplayDiscountColumn: !!products.find(\n (p) => p.discount2 && p.discount2 > 0,\n ),\n // @ts-ignore\n marginVats: _uniq(\n products\n .filter((p) => p.marginVatFormatted !== null)\n .map((p) => p.marginVatFormatted),\n ),\n accountingCategoryFormatted:\n AccountingCategoryList.find((a) => a.id === payload.accountingCategory)\n ?.label ?? null,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,\n shouldHideBrandName,\n paymentType: payload.paymentType,\n };\n\n const commonTemplate = new CommercialDocumentCommonHTML();\n const documentFreeText = [\n EstimateInvoiceType.DEVIS,\n EstimateInvoiceType.BON,\n ].includes(idEstimateInvoiceType)\n ? payload?.settings?.freeEstimateText\n : payload?.settings?.freeInvoiceText;\n\n return {\n header: ejs.render(commonTemplate.header, data),\n body: ejs.render(bodyTemplate, {\n ...data,\n comment:\n data.comment && typeof data.comment === 'string'\n ? data.comment?.replace(/\\n/g, '<br/>')\n : null,\n products: data.products.map((p) => ({\n ...p,\n comment:\n p.comment && typeof p.comment === 'string'\n ? p.comment?.replace(/\\n/g, '<br/>')\n : null,\n })),\n }),\n footer: ejs.render(commonTemplate.footer, {\n ...data,\n freeText: documentFreeText ?? null,\n }),\n data,\n };\n}\n\nexport function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv: string | undefined = undefined): ReadCommercialMailTemplate {\n dayjs.locale('fr');\n const data = {\n ...params.payload,\n totalTaxExcludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxExcluded),\n totalTaxIncludedFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded),\n totalVatFormatted: integerToFormattedAmountObject(params.payload.totalTaxIncluded - params.payload.totalTaxExcluded),\n dueDateFormatted: params.payload.dueDate ? dayjs(params.payload.dueDate).format('DD MMMM YYYY') : null,\n hasVat: params.hasVat,\n hostS3: params.hostS3,\n logoUrl: params.logoUrl,\n companyName: params.companyName,\n fileUrl: params.fileUrl,\n // @ts-ignore\n brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,\n shouldHideBrandName,\n };\n\n const mailTemplate = new CommercialDocumentMailHTML();\n\n return {\n header: ejs.render(mailTemplate.header, data),\n };\n}"]}