@silexpert/core 1.0.11 → 1.0.14

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 (172) hide show
  1. package/es/api/resources/{commercialDocument.d.ts → CommercialDocument.d.ts} +2 -1
  2. package/es/api/resources/{commercialDocument.d.ts.map → CommercialDocument.d.ts.map} +1 -1
  3. package/es/api/resources/{commercialDocument.js → CommercialDocument.js} +4 -1
  4. package/es/api/resources/CommercialDocument.js.map +1 -0
  5. package/es/api/resources/Exercice.d.ts +1 -0
  6. package/es/api/resources/Exercice.d.ts.map +1 -1
  7. package/es/api/resources/Exercice.js +3 -0
  8. package/es/api/resources/Exercice.js.map +1 -1
  9. package/es/api/resources/Invoice.d.ts +1 -0
  10. package/es/api/resources/Invoice.d.ts.map +1 -1
  11. package/es/api/resources/Invoice.js +3 -0
  12. package/es/api/resources/Invoice.js.map +1 -1
  13. package/es/api/resources/Recurrence.d.ts +9 -0
  14. package/es/api/resources/Recurrence.d.ts.map +1 -0
  15. package/es/api/resources/Recurrence.js +13 -0
  16. package/es/api/resources/Recurrence.js.map +1 -0
  17. package/es/api/resources/{reminder.d.ts → Reminder.d.ts} +1 -1
  18. package/es/api/resources/{reminder.d.ts.map → Reminder.d.ts.map} +1 -1
  19. package/es/api/resources/{reminder.js → Reminder.js} +2 -2
  20. package/es/api/resources/{reminder.js.map → Reminder.js.map} +1 -1
  21. package/es/api/resources.d.ts +4 -2
  22. package/es/api/resources.d.ts.map +1 -1
  23. package/es/api/resources.js +4 -2
  24. package/es/api/resources.js.map +1 -1
  25. package/es/types/Enum/RecurrenceType.d.ts +11 -0
  26. package/es/types/Enum/RecurrenceType.d.ts.map +1 -0
  27. package/es/types/Enum/RecurrenceType.js +26 -0
  28. package/es/types/Enum/RecurrenceType.js.map +1 -0
  29. package/es/types/Enum/TaskResponseType.d.ts +10 -0
  30. package/es/types/Enum/TaskResponseType.d.ts.map +1 -1
  31. package/es/types/Enum/TaskResponseType.js +11 -0
  32. package/es/types/Enum/TaskResponseType.js.map +1 -1
  33. package/es/types/Interface/api/commercialManagement/Create.d.ts +25 -18
  34. package/es/types/Interface/api/commercialManagement/Create.d.ts.map +1 -1
  35. package/es/types/Interface/api/commercialManagement/Create.js +65 -81
  36. package/es/types/Interface/api/commercialManagement/Create.js.map +1 -1
  37. package/es/types/Interface/api/commercialManagement/Update.d.ts +6 -0
  38. package/es/types/Interface/api/commercialManagement/Update.d.ts.map +1 -1
  39. package/es/types/Interface/api/commercialManagement/Update.js +29 -1
  40. package/es/types/Interface/api/commercialManagement/Update.js.map +1 -1
  41. package/es/types/Interface/api/revision/QueryRevision.d.ts +2 -0
  42. package/es/types/Interface/api/revision/QueryRevision.d.ts.map +1 -1
  43. package/es/types/Interface/api/revision/QueryRevision.js +16 -2
  44. package/es/types/Interface/api/revision/QueryRevision.js.map +1 -1
  45. package/es/types/Interface/api/revision/QueryRevisionAccount.d.ts +1 -1
  46. package/es/types/Interface/api/revision/QueryRevisionAccount.d.ts.map +1 -1
  47. package/es/types/Interface/api/revision/QueryRevisionAccount.js +11 -5
  48. package/es/types/Interface/api/revision/QueryRevisionAccount.js.map +1 -1
  49. package/es/types/Interface/api/revision/QueryRevisionPaginate.d.ts +2 -0
  50. package/es/types/Interface/api/revision/QueryRevisionPaginate.d.ts.map +1 -1
  51. package/es/types/Interface/api/revision/QueryRevisionPaginate.js +16 -2
  52. package/es/types/Interface/api/revision/QueryRevisionPaginate.js.map +1 -1
  53. package/es/types/Interface/api/revision/QueryRevisionSearchEntries.d.ts +1 -1
  54. package/es/types/Interface/api/revision/QueryRevisionSearchEntries.d.ts.map +1 -1
  55. package/es/types/Interface/api/revision/QueryRevisionSearchEntries.js.map +1 -1
  56. package/es/types/Interface/api/task/QueryCountTask.d.ts +1 -1
  57. package/es/types/Interface/api/task/QueryCountTask.d.ts.map +1 -1
  58. package/es/types/Interface/api/task/QueryCountTask.js +1 -1
  59. package/es/types/Interface/api/task/QueryCountTask.js.map +1 -1
  60. package/es/types/Interface/api/task/QueryPaginatedTask.d.ts +2 -0
  61. package/es/types/Interface/api/task/QueryPaginatedTask.d.ts.map +1 -1
  62. package/es/types/Interface/api/task/QueryPaginatedTask.js +11 -0
  63. package/es/types/Interface/api/task/QueryPaginatedTask.js.map +1 -1
  64. package/es/types/Interface/models/IApiError.d.ts +2 -1
  65. package/es/types/Interface/models/IApiError.d.ts.map +1 -1
  66. package/es/types/Interface/models/IApiError.js +1 -0
  67. package/es/types/Interface/models/IApiError.js.map +1 -1
  68. package/es/types/Interface/models/IEstimateInvoice.d.ts +2 -0
  69. package/es/types/Interface/models/IEstimateInvoice.d.ts.map +1 -1
  70. package/es/types/Interface/models/IEstimateInvoice.js.map +1 -1
  71. package/es/types/Interface/models/IInvoiceRecurrence.d.ts +15 -0
  72. package/es/types/Interface/models/IInvoiceRecurrence.d.ts.map +1 -0
  73. package/es/types/Interface/models/IInvoiceRecurrence.js +2 -0
  74. package/es/types/Interface/models/IInvoiceRecurrence.js.map +1 -0
  75. package/es/types/Interface/models/IInvoiceReminder.d.ts +1 -1
  76. package/es/types/Interface/models/IInvoiceReminder.d.ts.map +1 -1
  77. package/es/types/Interface/models/IInvoiceReminder.js.map +1 -1
  78. package/es/types/Interface/models/ITask.d.ts +2 -2
  79. package/es/types/Interface/models/ITask.d.ts.map +1 -1
  80. package/es/types/Interface/models/ITask.js.map +1 -1
  81. package/es/types/index.d.ts +2 -0
  82. package/es/types/index.d.ts.map +1 -1
  83. package/es/types/index.js +2 -0
  84. package/es/types/index.js.map +1 -1
  85. package/es/utils/commercialManagement/document.js +3 -3
  86. package/es/utils/commercialManagement/document.js.map +1 -1
  87. package/es/utils/commercialManagement/recurrence.d.ts +7 -0
  88. package/es/utils/commercialManagement/recurrence.d.ts.map +1 -0
  89. package/es/utils/commercialManagement/recurrence.js +31 -0
  90. package/es/utils/commercialManagement/recurrence.js.map +1 -0
  91. package/es/utils/index.d.ts +1 -0
  92. package/es/utils/index.d.ts.map +1 -1
  93. package/es/utils/index.js +1 -0
  94. package/es/utils/index.js.map +1 -1
  95. package/es/utils/task.d.ts +3 -1
  96. package/es/utils/task.d.ts.map +1 -1
  97. package/es/utils/task.js +8 -1
  98. package/es/utils/task.js.map +1 -1
  99. package/js/api/resources/{commercialDocument.js → CommercialDocument.js} +5 -1
  100. package/js/api/resources/CommercialDocument.js.map +1 -0
  101. package/js/api/resources/Exercice.js +4 -0
  102. package/js/api/resources/Exercice.js.map +1 -1
  103. package/js/api/resources/Invoice.js +4 -0
  104. package/js/api/resources/Invoice.js.map +1 -1
  105. package/js/api/resources/Recurrence.js +26 -0
  106. package/js/api/resources/Recurrence.js.map +1 -0
  107. package/js/api/resources/{reminder.js → Reminder.js} +2 -2
  108. package/js/api/resources/{reminder.js.map → Reminder.js.map} +1 -1
  109. package/js/api/resources.js +7 -4
  110. package/js/api/resources.js.map +1 -1
  111. package/js/types/Enum/RecurrenceType.js +28 -0
  112. package/js/types/Enum/RecurrenceType.js.map +1 -0
  113. package/js/types/Enum/TaskResponseType.js +14 -1
  114. package/js/types/Enum/TaskResponseType.js.map +1 -1
  115. package/js/types/Interface/api/commercialManagement/Create.js +47 -33
  116. package/js/types/Interface/api/commercialManagement/Create.js.map +1 -1
  117. package/js/types/Interface/api/commercialManagement/Update.js +15 -1
  118. package/js/types/Interface/api/commercialManagement/Update.js.map +1 -1
  119. package/js/types/Interface/api/revision/QueryRevision.js +6 -0
  120. package/js/types/Interface/api/revision/QueryRevision.js.map +1 -1
  121. package/js/types/Interface/api/revision/QueryRevisionAccount.js +7 -5
  122. package/js/types/Interface/api/revision/QueryRevisionAccount.js.map +1 -1
  123. package/js/types/Interface/api/revision/QueryRevisionPaginate.js +6 -0
  124. package/js/types/Interface/api/revision/QueryRevisionPaginate.js.map +1 -1
  125. package/js/types/Interface/api/revision/QueryRevisionSearchEntries.js.map +1 -1
  126. package/js/types/Interface/api/task/QueryCountTask.js +1 -1
  127. package/js/types/Interface/api/task/QueryCountTask.js.map +1 -1
  128. package/js/types/Interface/api/task/QueryPaginatedTask.js +6 -0
  129. package/js/types/Interface/api/task/QueryPaginatedTask.js.map +1 -1
  130. package/js/types/Interface/models/IApiError.js +1 -0
  131. package/js/types/Interface/models/IApiError.js.map +1 -1
  132. package/js/types/Interface/models/IInvoiceRecurrence.js +6 -0
  133. package/js/types/Interface/models/IInvoiceRecurrence.js.map +1 -0
  134. package/js/types/index.js +24 -0
  135. package/js/types/index.js.map +1 -1
  136. package/js/utils/commercialManagement/document.js +3 -3
  137. package/js/utils/commercialManagement/document.js.map +1 -1
  138. package/js/utils/commercialManagement/recurrence.js +47 -0
  139. package/js/utils/commercialManagement/recurrence.js.map +1 -0
  140. package/js/utils/index.js +12 -0
  141. package/js/utils/index.js.map +1 -1
  142. package/js/utils/task.js +14 -1
  143. package/js/utils/task.js.map +1 -1
  144. package/package.json +1 -1
  145. package/ts/api/resources/{commercialDocument.ts → CommercialDocument.ts} +4 -0
  146. package/ts/api/resources/Exercice.ts +4 -0
  147. package/ts/api/resources/Invoice.ts +4 -0
  148. package/ts/api/resources/Recurrence.ts +17 -0
  149. package/ts/api/resources/{reminder.ts → Reminder.ts} +1 -1
  150. package/ts/api/resources.ts +4 -2
  151. package/ts/types/Enum/RecurrenceType.ts +25 -0
  152. package/ts/types/Enum/TaskResponseType.ts +11 -0
  153. package/ts/types/Interface/api/commercialManagement/Create.ts +62 -81
  154. package/ts/types/Interface/api/commercialManagement/Update.ts +25 -1
  155. package/ts/types/Interface/api/revision/QueryRevision.ts +15 -2
  156. package/ts/types/Interface/api/revision/QueryRevisionAccount.ts +11 -4
  157. package/ts/types/Interface/api/revision/QueryRevisionPaginate.ts +15 -2
  158. package/ts/types/Interface/api/revision/QueryRevisionSearchEntries.ts +1 -1
  159. package/ts/types/Interface/api/task/QueryCountTask.ts +1 -1
  160. package/ts/types/Interface/api/task/QueryPaginatedTask.ts +9 -0
  161. package/ts/types/Interface/models/IApiError.ts +1 -0
  162. package/ts/types/Interface/models/IEstimateInvoice.ts +2 -0
  163. package/ts/types/Interface/models/IInvoiceRecurrence.ts +16 -0
  164. package/ts/types/Interface/models/IInvoiceReminder.ts +1 -1
  165. package/ts/types/Interface/models/ITask.ts +2 -2
  166. package/ts/types/index.ts +2 -0
  167. package/ts/utils/commercialManagement/document.ts +3 -3
  168. package/ts/utils/commercialManagement/recurrence.ts +39 -0
  169. package/ts/utils/index.ts +1 -0
  170. package/ts/utils/task.ts +9 -1
  171. package/es/api/resources/commercialDocument.js.map +0 -1
  172. package/js/api/resources/commercialDocument.js.map +0 -1
@@ -5,6 +5,10 @@ import { ApiPropertyOptional } from '../../../../utils';
5
5
  import { ToBoolean } from '../../../../utils/transforms/boolean.transform';
6
6
 
7
7
  export class QueryPaginatedTask {
8
+ @ApiPropertyOptional()
9
+ @IsOptional()
10
+ isIntern?: boolean;
11
+
8
12
  @ApiPropertyOptional()
9
13
  @IsOptional()
10
14
  @IsInt()
@@ -36,6 +40,11 @@ export class QueryPaginatedTask {
36
40
  @IsInt()
37
41
  idUser?: number;
38
42
 
43
+ @ApiPropertyOptional({ description: 'roles for filter tasks' })
44
+ @IsOptional()
45
+ @IsInt()
46
+ idService?: number;
47
+
39
48
  @ApiPropertyOptional({ description: 'user who terminate the task' })
40
49
  @IsOptional()
41
50
  @IsInt()
@@ -173,6 +173,7 @@ export enum Code {
173
173
  // Gescom
174
174
  CAN_NOT_DELETE_DOCUMENT = 'can_not_delete_document',
175
175
  CAN_NOT_EDIT_INVOICE = 'can_not_edit_invoice',
176
+ INVALID_INVOICE_TYPE = 'invalid_invoice_type',
176
177
  }
177
178
 
178
179
  export interface IApiError {
@@ -7,6 +7,7 @@ import { IEstimateInvoiceType } from './IEstimateInvoiceType';
7
7
  import { ISociety } from './ISociety';
8
8
  import { IInvoiceReminder } from './IInvoiceReminder';
9
9
  import { IFile } from './IFile';
10
+ import { IInvoiceRecurrence } from './IInvoiceRecurrence';
10
11
 
11
12
  // estimatesInvoices
12
13
  export interface IEstimateInvoice {
@@ -62,5 +63,6 @@ export interface IEstimateInvoice {
62
63
  estimateInvoiceForThisRepeat?: IEstimateInvoice;
63
64
  invoiceReminder?: IInvoiceReminder;
64
65
  relatedInvoice?: IEstimateInvoice;
66
+ recurrence?: IInvoiceRecurrence;
65
67
  file?: IFile;
66
68
  }
@@ -0,0 +1,16 @@
1
+ import { IEstimateInvoice } from '../..';
2
+ import { RecurrenceType } from '../../Enum/RecurrenceType';
3
+
4
+ export interface IInvoiceRecurrence {
5
+ id?: number;
6
+ type: RecurrenceType;
7
+ startDate: Date;
8
+ endDate: Date;
9
+ lastSend: Date | null;
10
+ isActive: boolean;
11
+ idEstimateInvoice: number;
12
+ createdAt?: Date;
13
+ updatedAt?: Date;
14
+
15
+ estimateInvoice?: IEstimateInvoice;
16
+ }
@@ -18,5 +18,5 @@ export interface IInvoiceReminder {
18
18
 
19
19
  // Associations
20
20
  society?: ISociety;
21
- estimatesInvoice?: IEstimateInvoice;
21
+ estimateInvoice?: IEstimateInvoice;
22
22
  }
@@ -16,7 +16,7 @@ export interface ITask {
16
16
  idSociety: number,
17
17
  description?: string | null,
18
18
  idRole?: number,
19
- idUser?: number,
19
+ idService?: number,
20
20
  idMail?: number,
21
21
  deadlineAt: Date,
22
22
  idUserWhoProcessed?: number,
@@ -29,7 +29,7 @@ export interface ITask {
29
29
  userWhoCreated?: IUser;
30
30
  society?: ISociety;
31
31
  role?: IRole;
32
- user?: IUser;
32
+ service?: IRole;
33
33
  userWhoProcessed?: IUser;
34
34
  userWhoRefused?: IUser;
35
35
  calendarEvent?: ICalendarEvent;
package/ts/types/index.ts CHANGED
@@ -311,6 +311,7 @@ export * from './Interface/models/ITask';
311
311
  export * from './Interface/models/IMobileNotificationLog';
312
312
  export * from './Interface/models/IMobileNotificationSetting';
313
313
  export * from './Interface/models/ITimeRecorder';
314
+ export * from './Interface/models/IInvoiceRecurrence';
314
315
  export * from './Interface/models/ILoanFile';
315
316
  export * from './Interface/models/ICommercialMail';
316
317
 
@@ -434,6 +435,7 @@ export * from './Enum/InternalService';
434
435
  export * from './Enum/SocietyTypeEvent';
435
436
  export * from './Enum/Call';
436
437
  export * from './Enum/ConnectionError';
438
+ export * from './Enum/RecurrenceType';
437
439
 
438
440
  // Interfaces API
439
441
  export * from './Interface/api/partnerTransactionType/ReadPartnerTransactionType';
@@ -104,9 +104,9 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument): ReadCom
104
104
  const commonTemplate = new CommercialDocumentCommonHTML();
105
105
 
106
106
  return {
107
- header: ejs.render(commonTemplate.header, data),
108
- body: ejs.render(bodyTemplate, data),
109
- footer: ejs.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),
107
+ header: ejs?.render(commonTemplate.header, data),
108
+ body: ejs?.render(bodyTemplate, data),
109
+ footer: ejs?.render(commonTemplate.footer, { ...data, freeText: payload?.settings?.freeInvoiceText ?? null }),
110
110
  data,
111
111
  };
112
112
  }
@@ -0,0 +1,39 @@
1
+ import * as dayjs from 'dayjs';
2
+ import { OpUnitType } from 'dayjs';
3
+ import { RecurrenceType } from '../../types/Enum/RecurrenceType';
4
+
5
+ const isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
6
+ const quarterOfYear = require('dayjs/plugin/quarterOfYear');
7
+
8
+ dayjs.extend(quarterOfYear);
9
+ dayjs.extend(isSameOrBefore);
10
+
11
+ export function getAllRecurrences(params: {
12
+ startDate: string;
13
+ endDate: string | null;
14
+ type: RecurrenceType;
15
+ }): string[] {
16
+ const { startDate, type } = params;
17
+ const endDate = params.endDate ?? '2100-01-01';
18
+
19
+ let loop = 0;
20
+
21
+ let recurrency: OpUnitType = 'month';
22
+
23
+ if (type === RecurrenceType.MONHLY) recurrency = 'month';
24
+ // @ts-ignore
25
+ else if (type === RecurrenceType.QUATERLY) recurrency = 'quarter';
26
+ else if (type === RecurrenceType.WEEKLY) recurrency = 'week';
27
+ else if (type === RecurrenceType.YEARLY) recurrency = 'year';
28
+
29
+ const nextInvoices: string[] = [];
30
+
31
+ // @ts-ignore
32
+ while (dayjs(startDate).add(loop, recurrency).isSameOrBefore(endDate)) {
33
+ const currentDate = dayjs(startDate).add(loop, recurrency);
34
+ nextInvoices.push(currentDate.format('YYYY-MM-DD'));
35
+ loop += 1;
36
+ }
37
+
38
+ return nextInvoices;
39
+ }
package/ts/utils/index.ts CHANGED
@@ -8,4 +8,5 @@ export * from './siretValidation';
8
8
  export * from './task';
9
9
  export * from './social';
10
10
  export * from './commercialManagement/document';
11
+ export * from './commercialManagement/recurrence';
11
12
  export * from './amount';
package/ts/utils/task.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Role } from '../types/Enum/Role';
2
+ import { TaskResponseType, RoleAvailableForTask } from '../types/Enum/TaskResponseType';
2
3
 
3
4
  const getIdRoleUsedForTask = (listRoles: number[]): number => {
4
5
  let idRole = 0;
@@ -32,6 +33,13 @@ const getIdRoleUsedForManagerTask = (listRoles: number[]): number => {
32
33
  return idRole;
33
34
  };
34
35
 
36
+ const getIdRoleUsedForAttribution = (isIntern: boolean, idTaskType: number): number | undefined => {
37
+ const taskTypeList = isIntern ? TaskResponseType.INTERN.types : TaskResponseType.EXTERN.types;
38
+ return taskTypeList.find((taskType) => taskType.id === idTaskType)?.role;
39
+ };
40
+
41
+ const getIdRoleUsedForGetTaskOfUser = (idRole: number): boolean => !!Object.values(RoleAvailableForTask).find((role) => role === idRole);
42
+
35
43
  export {
36
- getIdRoleUsedForTask, getIdRoleUsedForManagerTask,
44
+ getIdRoleUsedForTask, getIdRoleUsedForManagerTask, getIdRoleUsedForAttribution, getIdRoleUsedForGetTaskOfUser,
37
45
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"commercialDocument.js","sourceRoot":"","sources":["../../../ts/api/resources/commercialDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAIL,mBAAmB,GAQpB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IAC9C,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,OAAiC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,oCAAoC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,gBAAgB,CAAC,MAA0B;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,6CAA6C,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,YAAY,CAAC,MAA8C;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kCAAkC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,cAAc,CAAC,OAA6D;QAC1E,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,kCAAkC,kCAAO,OAAO,KAAE,qBAAqB,EAAE,mBAAmB,CAAC,KAAK,IAAG,CAAC;IAChI,CAAC;IAED,WAAW,CAAC,OAA6D;QACvE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,+BAA+B,kCAAO,OAAO,KAAE,qBAAqB,EAAE,mBAAmB,CAAC,GAAG,IAAG,CAAC;IAC3H,CAAC;IAED,cAAc,CAAC,EAAU,EAAE,OAA8B;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,oCAAoC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED,WAAW,CAAC,EAAU,EAAE,OAA8B;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,qBAA0C,EAAE,OAAsD;QACxG,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,kCAAO,OAAO,KAAE,qBAAqB,IAAG,CAAC;IACpG,CAAC;CACF","sourcesContent":["import { Resource } from '../Resource';\nimport {\n BasePaginate,\n CreateInvoiceDocument,\n CreatePreSaleDocument,\n EstimateInvoiceType,\n IEstimateInvoice,\n IFile,\n QueryDocumentPaginated,\n QueryNextReference,\n QueryPaginate,\n ReadEstimateInvoice,\n UpdateCommercialDocument,\n} from '../../types';\n\nexport class CommercialDocument extends Resource {\n get(id: number): Promise<ReadEstimateInvoice> {\n return this.axios.$get(`/commercial-management/documents/${id}`);\n }\n\n update(id: number, payload: UpdateCommercialDocument): Promise<IEstimateInvoice> {\n return this.axios.patch(`/commercial-management/documents/${id}`, payload);\n }\n\n delete(id: number): Promise<true> {\n return this.axios.$delete(`/commercial-management/documents/${id}`);\n }\n\n getNextReference(params: QueryNextReference): Promise<string> {\n return this.axios.$get('/commercial-management/documents/references', { params });\n }\n\n getPaginated(params: QueryDocumentPaginated & QueryPaginate): Promise<BasePaginate<ReadEstimateInvoice>> {\n return this.axios.$get('/commercial-management/documents', { params });\n }\n\n createEstimate(payload: Omit<CreatePreSaleDocument, 'idEstimateInvoiceType'>): Promise<IEstimateInvoice> {\n return this.axios.$post('/commercial-management/estimates', { ...payload, idEstimateInvoiceType: EstimateInvoiceType.DEVIS });\n }\n\n createOrder(payload: Omit<CreatePreSaleDocument, 'idEstimateInvoiceType'>): Promise<IEstimateInvoice> {\n return this.axios.$post('/commercial-management/orders', { ...payload, idEstimateInvoiceType: EstimateInvoiceType.BON });\n }\n\n updateEstimate(id: number, payload: CreatePreSaleDocument): Promise<IEstimateInvoice> {\n return this.axios.$post(`/commercial-management/estimates/${id}`, payload);\n }\n\n updateOrder(id: number, payload: CreatePreSaleDocument): Promise<IEstimateInvoice> {\n return this.axios.$post(`/commercial-management/orders/${id}`, payload);\n }\n\n preview(idEstimateInvoiceType: EstimateInvoiceType, payload: CreatePreSaleDocument | CreateInvoiceDocument): Promise<IFile> {\n return this.axios.$post('/commercial-management/preview/', { ...payload, idEstimateInvoiceType });\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"commercialDocument.js","mappings":";;;;;;;AAAA;;AACA;;AAcM,MAAOA,kBAAP,SAAkCC,kBAAlC,CAA0C;EAC9CC,GAAG,CAACC,EAAD,EAAW;IACZ,OAAO,KAAKC,KAAL,CAAWC,IAAX,CAAgB,oCAAoCF,EAAE,EAAtD,CAAP;EACD;;EAEDG,MAAM,CAACH,EAAD,EAAaI,OAAb,EAA8C;IAClD,OAAO,KAAKH,KAAL,CAAWI,KAAX,CAAiB,oCAAoCL,EAAE,EAAvD,EAA2DI,OAA3D,CAAP;EACD;;EAEDE,MAAM,CAACN,EAAD,EAAW;IACf,OAAO,KAAKC,KAAL,CAAWM,OAAX,CAAmB,oCAAoCP,EAAE,EAAzD,CAAP;EACD;;EAEDQ,gBAAgB,CAACC,MAAD,EAA2B;IACzC,OAAO,KAAKR,KAAL,CAAWC,IAAX,CAAgB,6CAAhB,EAA+D;MAAEO;IAAF,CAA/D,CAAP;EACD;;EAEDC,YAAY,CAACD,MAAD,EAA+C;IACzD,OAAO,KAAKR,KAAL,CAAWC,IAAX,CAAgB,kCAAhB,EAAoD;MAAEO;IAAF,CAApD,CAAP;EACD;;EAEDE,cAAc,CAACP,OAAD,EAA8D;IAC1E,OAAO,KAAKH,KAAL,CAAWW,KAAX,CAAiB,kCAAjB,EAAmDC,gCAAOT,OAAP,GAAc;MAAEU,qBAAqB,EAAEC,2BAAoBC;IAA7C,CAAd,CAAnD,CAAP;EACD;;EAEDC,WAAW,CAACb,OAAD,EAA8D;IACvE,OAAO,KAAKH,KAAL,CAAWW,KAAX,CAAiB,+BAAjB,EAAgDC,gCAAOT,OAAP,GAAc;MAAEU,qBAAqB,EAAEC,2BAAoBG;IAA7C,CAAd,CAAhD,CAAP;EACD;;EAEDC,cAAc,CAACnB,EAAD,EAAaI,OAAb,EAA2C;IACvD,OAAO,KAAKH,KAAL,CAAWW,KAAX,CAAiB,oCAAoCZ,EAAE,EAAvD,EAA2DI,OAA3D,CAAP;EACD;;EAEDgB,WAAW,CAACpB,EAAD,EAAaI,OAAb,EAA2C;IACpD,OAAO,KAAKH,KAAL,CAAWW,KAAX,CAAiB,iCAAiCZ,EAAE,EAApD,EAAwDI,OAAxD,CAAP;EACD;;EAEDiB,OAAO,CAACP,qBAAD,EAA6CV,OAA7C,EAAmG;IACxG,OAAO,KAAKH,KAAL,CAAWW,KAAX,CAAiB,iCAAjB,EAAkDC,gCAAOT,OAAP,GAAc;MAAEU;IAAF,CAAd,CAAlD,CAAP;EACD;;AAvC6C;;QAAnCjB,kB,GAAAA,kB","names":["CommercialDocument","Resource","get","id","axios","$get","update","payload","patch","delete","$delete","getNextReference","params","getPaginated","createEstimate","$post","Object","idEstimateInvoiceType","EstimateInvoiceType","DEVIS","createOrder","BON","updateEstimate","updateOrder","preview"],"sourceRoot":"","sources":["../../../ts/api/resources/commercialDocument.ts"],"sourcesContent":["import { Resource } from '../Resource';\nimport {\n BasePaginate,\n CreateInvoiceDocument,\n CreatePreSaleDocument,\n EstimateInvoiceType,\n IEstimateInvoice,\n IFile,\n QueryDocumentPaginated,\n QueryNextReference,\n QueryPaginate,\n ReadEstimateInvoice,\n UpdateCommercialDocument,\n} from '../../types';\n\nexport class CommercialDocument extends Resource {\n get(id: number): Promise<ReadEstimateInvoice> {\n return this.axios.$get(`/commercial-management/documents/${id}`);\n }\n\n update(id: number, payload: UpdateCommercialDocument): Promise<IEstimateInvoice> {\n return this.axios.patch(`/commercial-management/documents/${id}`, payload);\n }\n\n delete(id: number): Promise<true> {\n return this.axios.$delete(`/commercial-management/documents/${id}`);\n }\n\n getNextReference(params: QueryNextReference): Promise<string> {\n return this.axios.$get('/commercial-management/documents/references', { params });\n }\n\n getPaginated(params: QueryDocumentPaginated & QueryPaginate): Promise<BasePaginate<ReadEstimateInvoice>> {\n return this.axios.$get('/commercial-management/documents', { params });\n }\n\n createEstimate(payload: Omit<CreatePreSaleDocument, 'idEstimateInvoiceType'>): Promise<IEstimateInvoice> {\n return this.axios.$post('/commercial-management/estimates', { ...payload, idEstimateInvoiceType: EstimateInvoiceType.DEVIS });\n }\n\n createOrder(payload: Omit<CreatePreSaleDocument, 'idEstimateInvoiceType'>): Promise<IEstimateInvoice> {\n return this.axios.$post('/commercial-management/orders', { ...payload, idEstimateInvoiceType: EstimateInvoiceType.BON });\n }\n\n updateEstimate(id: number, payload: CreatePreSaleDocument): Promise<IEstimateInvoice> {\n return this.axios.$post(`/commercial-management/estimates/${id}`, payload);\n }\n\n updateOrder(id: number, payload: CreatePreSaleDocument): Promise<IEstimateInvoice> {\n return this.axios.$post(`/commercial-management/orders/${id}`, payload);\n }\n\n preview(idEstimateInvoiceType: EstimateInvoiceType, payload: CreatePreSaleDocument | CreateInvoiceDocument): Promise<IFile> {\n return this.axios.$post('/commercial-management/preview/', { ...payload, idEstimateInvoiceType });\n }\n}"]}