@zauru-sdk/utils 1.0.50 → 1.0.60

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 (79) hide show
  1. package/LICENCE.md +11 -11
  2. package/dist/cjs/index.js +40 -0
  3. package/dist/cjs/zauru/4pinos-receptions-form-history.utils.js +80 -0
  4. package/dist/cjs/zauru/automatic-number.utils.js +28 -0
  5. package/dist/cjs/zauru/bitacora-edicion-masiva.utils.js +56 -0
  6. package/dist/cjs/zauru/bundles.utils.js +168 -0
  7. package/dist/cjs/zauru/cases.utils.js +21 -0
  8. package/dist/cjs/zauru/consolidated-history.utils.js +58 -0
  9. package/dist/cjs/zauru/costos-items.utils.js +617 -0
  10. package/dist/cjs/zauru/deliveries.utils.js +50 -0
  11. package/dist/cjs/zauru/discharges-histsory.utils.js +52 -0
  12. package/dist/cjs/zauru/employees.utils.js +44 -0
  13. package/dist/cjs/zauru/form.utils.js +160 -0
  14. package/dist/cjs/zauru/invoices.utils.js +85 -0
  15. package/dist/cjs/zauru/items.utils.js +126 -0
  16. package/dist/cjs/zauru/lotes.utils.js +313 -0
  17. package/dist/cjs/zauru/motivos-rechazo.utils.js +23 -0
  18. package/dist/cjs/zauru/payees.utils.js +136 -0
  19. package/dist/cjs/zauru/profiles.utils.js +41 -0
  20. package/dist/cjs/zauru/providers.utils.js +40 -0
  21. package/dist/cjs/zauru/purchase-orders.utils.js +390 -0
  22. package/dist/cjs/zauru/shipments.utils.js +95 -0
  23. package/dist/cjs/zauru/specialItem.utils.js +69 -0
  24. package/dist/cjs/zauru/templates.utils.js +102 -0
  25. package/dist/cjs/zauru/tiposMuestra.utils.js +69 -0
  26. package/dist/cjs/zauru/webapp-tables.utils.js +20 -0
  27. package/package.json +16 -13
  28. package/CHANGELOG.md +0 -256
  29. package/src/index.ts +0 -24
  30. package/src/zauru/4pinos-receptions-form-history.utils.ts +0 -142
  31. package/src/zauru/automatic-number.utils.ts +0 -38
  32. package/src/zauru/bitacora-edicion-masiva.utils.ts +0 -99
  33. package/src/zauru/bundles.utils.ts +0 -251
  34. package/src/zauru/cases.utils.ts +0 -31
  35. package/src/zauru/consolidated-history.utils.ts +0 -102
  36. package/src/zauru/costos-items.utils.ts +0 -871
  37. package/src/zauru/deliveries.utils.ts +0 -77
  38. package/src/zauru/discharges-histsory.utils.ts +0 -105
  39. package/src/zauru/employees.utils.ts +0 -59
  40. package/src/zauru/form.utils.ts +0 -243
  41. package/src/zauru/invoices.utils.ts +0 -114
  42. package/src/zauru/items.utils.ts +0 -221
  43. package/src/zauru/lotes.utils.ts +0 -411
  44. package/src/zauru/motivos-rechazo.utils.ts +0 -47
  45. package/src/zauru/payees.utils.ts +0 -213
  46. package/src/zauru/profiles.utils.ts +0 -44
  47. package/src/zauru/providers.utils.ts +0 -67
  48. package/src/zauru/purchase-orders.utils.ts +0 -594
  49. package/src/zauru/shipments.utils.ts +0 -139
  50. package/src/zauru/specialItem.utils.ts +0 -136
  51. package/src/zauru/templates.utils.ts +0 -199
  52. package/src/zauru/tiposMuestra.utils.ts +0 -136
  53. package/src/zauru/webapp-tables.utils.ts +0 -36
  54. package/tsconfig.json +0 -24
  55. /package/dist/{index.js → esm/index.js} +0 -0
  56. /package/dist/{zauru → esm/zauru}/4pinos-receptions-form-history.utils.js +0 -0
  57. /package/dist/{zauru → esm/zauru}/automatic-number.utils.js +0 -0
  58. /package/dist/{zauru → esm/zauru}/bitacora-edicion-masiva.utils.js +0 -0
  59. /package/dist/{zauru → esm/zauru}/bundles.utils.js +0 -0
  60. /package/dist/{zauru → esm/zauru}/cases.utils.js +0 -0
  61. /package/dist/{zauru → esm/zauru}/consolidated-history.utils.js +0 -0
  62. /package/dist/{zauru → esm/zauru}/costos-items.utils.js +0 -0
  63. /package/dist/{zauru → esm/zauru}/deliveries.utils.js +0 -0
  64. /package/dist/{zauru → esm/zauru}/discharges-histsory.utils.js +0 -0
  65. /package/dist/{zauru → esm/zauru}/employees.utils.js +0 -0
  66. /package/dist/{zauru → esm/zauru}/form.utils.js +0 -0
  67. /package/dist/{zauru → esm/zauru}/invoices.utils.js +0 -0
  68. /package/dist/{zauru → esm/zauru}/items.utils.js +0 -0
  69. /package/dist/{zauru → esm/zauru}/lotes.utils.js +0 -0
  70. /package/dist/{zauru → esm/zauru}/motivos-rechazo.utils.js +0 -0
  71. /package/dist/{zauru → esm/zauru}/payees.utils.js +0 -0
  72. /package/dist/{zauru → esm/zauru}/profiles.utils.js +0 -0
  73. /package/dist/{zauru → esm/zauru}/providers.utils.js +0 -0
  74. /package/dist/{zauru → esm/zauru}/purchase-orders.utils.js +0 -0
  75. /package/dist/{zauru → esm/zauru}/shipments.utils.js +0 -0
  76. /package/dist/{zauru → esm/zauru}/specialItem.utils.js +0 -0
  77. /package/dist/{zauru → esm/zauru}/templates.utils.js +0 -0
  78. /package/dist/{zauru → esm/zauru}/tiposMuestra.utils.js +0 -0
  79. /package/dist/{zauru → esm/zauru}/webapp-tables.utils.js +0 -0
@@ -1,77 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { extractValueBetweenTags } from "@zauru-sdk/common";
3
- import { getDeliveriesDataTables } from "@zauru-sdk/services";
4
- import {
5
- AxiosUtilsResponse,
6
- DataTablesFilterBody,
7
- DeliveryHTMLDataTable,
8
- } from "@zauru-sdk/types";
9
-
10
- export type DeliveryDataTable = {
11
- zid: string;
12
- referencia: string;
13
- fechaEntregaEstimada: string;
14
- fechaEntrega: string;
15
- origen: string;
16
- destino: string;
17
- deliveryId: string;
18
- };
19
-
20
- /**
21
- * getDeliveriesFormated
22
- * @param headers
23
- * @param session
24
- */
25
- export const getDeliveriesDataTableFormated = async (
26
- headers: any,
27
- session: Session
28
- ): Promise<AxiosUtilsResponse<DeliveryDataTable[]>> => {
29
- const body: DataTablesFilterBody = {
30
- order: {
31
- "0": {
32
- column: "0",
33
- dir: "desc",
34
- },
35
- },
36
- start: 0,
37
- length: 40,
38
- search: {
39
- value: "",
40
- regex: false,
41
- },
42
- agency: session.get("agency_id"),
43
- };
44
- const response = await getDeliveriesDataTables(headers, body);
45
-
46
- if (response.error) {
47
- return { ...response, data: [] } as AxiosUtilsResponse<DeliveryDataTable[]>;
48
- }
49
-
50
- const deliveries: DeliveryDataTable[] =
51
- response.data?.data?.map((x: DeliveryHTMLDataTable) =>
52
- formatHTMLDeliveryList(x)
53
- ) ?? [];
54
-
55
- return { ...response, data: deliveries } as AxiosUtilsResponse<
56
- DeliveryDataTable[]
57
- >;
58
- };
59
-
60
- /**
61
- * formatHTMLDeliveryList
62
- * @param delivery
63
- * @returns
64
- */
65
- const formatHTMLDeliveryList = (
66
- delivery: DeliveryHTMLDataTable
67
- ): DeliveryDataTable => {
68
- return {
69
- zid: extractValueBetweenTags(delivery.zid, "a"),
70
- referencia: extractValueBetweenTags(delivery.ref, "a"),
71
- fechaEntrega: delivery.pd,
72
- fechaEntregaEstimada: delivery.dt,
73
- destino: delivery.at,
74
- origen: delivery.af,
75
- deliveryId: delivery.DT_RowId.replace("inventories-delivery-", ""),
76
- } as DeliveryDataTable;
77
- };
@@ -1,105 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- createWebAppTableRegister,
5
- getVariablesByName,
6
- getWebAppTableRegisters,
7
- updateWebAppTableRegister,
8
- } from "@zauru-sdk/services";
9
- import {
10
- AxiosUtilsResponse,
11
- WebAppRowGraphQL,
12
- DischargeHistory,
13
- WebAppTableUpdateResponse,
14
- } from "@zauru-sdk/types";
15
-
16
- /**
17
- * Get getDischargeHistories from the web app table.
18
- * @param headers Request headers.
19
- * @param session Session object.
20
- * @returns A Promise of AxiosUtilsResponse<DischargeHistory[]>.
21
- */
22
- export const getDischargeHistories = (
23
- headers: any,
24
- session: Session
25
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<DischargeHistory>[]>> => {
26
- return handlePossibleAxiosErrors(async () => {
27
- const { discharge_history_web_app_table_id } = await getVariablesByName(
28
- headers,
29
- session,
30
- ["discharge_history_web_app_table_id"]
31
- );
32
-
33
- const response = await getWebAppTableRegisters<DischargeHistory>(
34
- session,
35
- discharge_history_web_app_table_id
36
- );
37
-
38
- if (response.error) {
39
- throw new Error(
40
- `Ocurrió un error al consultar el historial de discharges: ${response.userMsg}`
41
- );
42
- }
43
-
44
- const history = response?.data ?? [];
45
-
46
- return history;
47
- });
48
- };
49
-
50
- /**
51
- * Create a template in the web app table.
52
- * @param headers Request headers.
53
- * @param session Session object.
54
- * @param body DischargeHistory data to be created.
55
- * @returns A Promise of AxiosUtilsResponse<DischargeHistory>.
56
- */
57
- export const createDischargeHistory = (
58
- headers: any,
59
- session: Session,
60
- body: DischargeHistory
61
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
62
- return handlePossibleAxiosErrors(async () => {
63
- const { discharge_history_web_app_table_id } = await getVariablesByName(
64
- headers,
65
- session,
66
- ["discharge_history_web_app_table_id"]
67
- );
68
- const response = await createWebAppTableRegister<DischargeHistory>(
69
- headers,
70
- discharge_history_web_app_table_id,
71
- body
72
- );
73
- return response;
74
- });
75
- };
76
-
77
- /**
78
- * Put updateDischargeHistory from the web app table.
79
- * @param headers Request headers.
80
- * @param session Session object.
81
- * @returns A Promise of AxiosUtilsResponse<DischargeHistory[]>.
82
- */
83
- export const updateDischargeHistory = (
84
- headers: any,
85
- session: Session,
86
- body: DischargeHistory,
87
- id_registro: string | number
88
- ): Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>> => {
89
- return handlePossibleAxiosErrors(async () => {
90
- const { discharge_history_web_app_table_id } = await getVariablesByName(
91
- headers,
92
- session,
93
- ["discharge_history_web_app_table_id"]
94
- );
95
-
96
- const response = await updateWebAppTableRegister<DischargeHistory>(
97
- headers,
98
- discharge_history_web_app_table_id,
99
- id_registro,
100
- { ...body }
101
- );
102
-
103
- return response;
104
- });
105
- };
@@ -1,59 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- getEmployeesByAgencyId,
5
- getVariablesByName,
6
- } from "@zauru-sdk/services";
7
- import { AxiosUtilsResponse, EmployeeGraphQL } from "@zauru-sdk/types";
8
-
9
- /**
10
- *
11
- * @param headers
12
- * @param session
13
- * @returns
14
- */
15
- export const getEmployeesByLabAgency = async (
16
- headers: any,
17
- session: Session
18
- ): Promise<AxiosUtilsResponse<EmployeeGraphQL[]>> => {
19
- return handlePossibleAxiosErrors(async () => {
20
- const { lab_agency_id } = await getVariablesByName(headers, session, [
21
- "lab_agency_id",
22
- ]);
23
-
24
- const response = await getEmployeesByAgencyId(session, lab_agency_id);
25
-
26
- if (response.error) {
27
- const msg = `Ocurrió un error al consultar los empleados por agencia de laboratorio: ${response.userMsg}`;
28
- console.error(msg);
29
- throw new Error(msg);
30
- }
31
-
32
- return response?.data ?? [];
33
- });
34
- };
35
-
36
- /**
37
- *
38
- * @param headers
39
- * @param session
40
- * @returns
41
- */
42
- export const getEmployeesByCurrentAgency = async (
43
- session: Session
44
- ): Promise<AxiosUtilsResponse<EmployeeGraphQL[]>> => {
45
- return handlePossibleAxiosErrors(async () => {
46
- const response = await getEmployeesByAgencyId(
47
- session,
48
- session.get("agency_id")
49
- );
50
-
51
- if (response.error) {
52
- const msg = `Ocurrió un error al consultar los empleados por la agencia actual: ${response.userMsg}`;
53
- console.error(msg);
54
- throw new Error(msg);
55
- }
56
-
57
- return response?.data ?? [];
58
- });
59
- };
@@ -1,243 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { arrayToObject, handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- createFormSubmission,
5
- getInvoiceFormSubmissionsByInvoiceId,
6
- getLastInvoiceFormSubmission,
7
- getVariablesByName,
8
- } from "@zauru-sdk/services";
9
- import {
10
- AxiosUtilsResponse,
11
- SubmissionInvoicesGraphQL,
12
- TransformedObject,
13
- } from "@zauru-sdk/types";
14
-
15
- export function transformFormSubmitObject(input: {
16
- [key: string]: any;
17
- }): TransformedObject {
18
- const form_submission_values: Array<{
19
- form_field_id: string;
20
- value: string;
21
- groups_path: string;
22
- }> = [];
23
-
24
- // Itera sobre las propiedades del objeto
25
- for (const key in input) {
26
- // Utiliza una expresión regular para detectar claves que coinciden con el patrón 'word_number'
27
- const match = key.match(/^(.+?)_(\d+)$/);
28
- if (match) {
29
- const [, , form_field_id] = match;
30
- let newObj: any = {
31
- form_field_id,
32
- groups_path: "[]",
33
- };
34
-
35
- if (input[key] instanceof File) {
36
- const fileType = input[key].type;
37
- newObj["value"] = "";
38
-
39
- if (input[key]?.size > 0) {
40
- // Verifica si el archivo es una imagen
41
- if (fileType.startsWith("image/")) {
42
- newObj["image"] = input[key];
43
- }
44
- // Verifica si el archivo es un PDF
45
- else if (fileType === "application/pdf") {
46
- newObj["pdf"] = input[key];
47
- }
48
- // Cualquier otro tipo de archivo
49
- else {
50
- newObj["file"] = input[key];
51
- }
52
- }
53
- } else {
54
- newObj["value"] = input[key];
55
- }
56
- form_submission_values.push(newObj);
57
- }
58
- }
59
-
60
- return {
61
- form_submission_values_attributes: arrayToObject(form_submission_values),
62
- form_id: input.form_id,
63
- document_id: input.document_id,
64
- zid: input.zid,
65
- document_type: input.document_type,
66
- reference: input.reference,
67
- id_number: input.id_number ?? "",
68
- };
69
- }
70
-
71
- type OutputData = {
72
- index: number;
73
- item_id: number;
74
- form_id?: number;
75
- document_id: number;
76
- reference?: string;
77
- zid?: string;
78
- fields: { [field_id: number]: string }[];
79
- };
80
-
81
- export function transformResultadosFormData(
82
- input: {
83
- [key: string]: string;
84
- },
85
- document_id: number
86
- ): OutputData[] {
87
- const resultMap: { [compositeKey: string]: OutputData } = {};
88
-
89
- for (const [key, value] of Object.entries(input)) {
90
- const parts = key.split("_");
91
-
92
- if (
93
- parts.length === 3 &&
94
- (parts[2] === "zid" || parts[2] === "reference")
95
- ) {
96
- const [index, item_id, specialField] = parts;
97
-
98
- const compositeKey = `${index}_${item_id}`;
99
-
100
- if (!resultMap[compositeKey]) {
101
- resultMap[compositeKey] = {
102
- index: parseInt(index),
103
- item_id: parseInt(item_id),
104
- document_id,
105
- fields: [],
106
- };
107
- }
108
-
109
- if (specialField === "zid") {
110
- resultMap[compositeKey].zid = value;
111
- } else if (specialField === "reference") {
112
- resultMap[compositeKey].reference = value;
113
- }
114
-
115
- continue;
116
- }
117
-
118
- if (parts.length !== 4) continue;
119
-
120
- if (parts.some((part) => isNaN(parseInt(part, 10)))) continue;
121
-
122
- const [index, item_id, form_id, field_id] = parts.map((part) =>
123
- parseInt(part, 10)
124
- );
125
-
126
- const compositeKey = `${index}_${item_id}`;
127
-
128
- if (!resultMap[compositeKey]) {
129
- resultMap[compositeKey] = {
130
- index,
131
- item_id,
132
- form_id,
133
- document_id,
134
- fields: [],
135
- };
136
- }
137
-
138
- resultMap[compositeKey].fields.push({ [field_id]: value });
139
- resultMap[compositeKey].form_id = form_id;
140
- }
141
-
142
- return Object.values(resultMap);
143
- }
144
-
145
- /**
146
- *
147
- * @param data
148
- * @returns
149
- */
150
- export const createRespuestaFormSubmission = (
151
- headers: any,
152
- data: OutputData
153
- ): Promise<AxiosUtilsResponse<any>> => {
154
- return handlePossibleAxiosErrors(async () => {
155
- const form_submission_values: Array<{
156
- form_field_id: string;
157
- value: string;
158
- groups_path: string;
159
- }> = [];
160
-
161
- for (const value of data.fields) {
162
- const form_field_id = Object.keys(value)[0];
163
- const associatedValue = value[form_field_id as any];
164
- form_submission_values.push({
165
- form_field_id,
166
- value: associatedValue,
167
- groups_path: "[]",
168
- });
169
- }
170
- const sendBody = {
171
- form_id: data.form_id,
172
- reference: `${data.index}_${data.item_id};${data?.reference}`,
173
- document_type: "invoice",
174
- document_id: data.document_id,
175
- form_submission_values_attributes: arrayToObject(form_submission_values),
176
- zid: data.zid,
177
- } as any;
178
- const response = await createFormSubmission(headers, sendBody);
179
- if (response.error) {
180
- throw new Error(
181
- `Ocurrió un error al intentar crear la respuesta de formulario: ${data}`
182
- );
183
- }
184
- return true;
185
- });
186
- };
187
-
188
- /**
189
- *
190
- * @param headers
191
- * @param session
192
- * @returns
193
- */
194
- export const getLastMuestra = (
195
- headers: any,
196
- session: Session
197
- ): Promise<AxiosUtilsResponse<SubmissionInvoicesGraphQL>> => {
198
- return handlePossibleAxiosErrors(async () => {
199
- const { lab_muestras_form_zid } = await getVariablesByName(
200
- headers,
201
- session,
202
- ["lab_muestras_form_zid"]
203
- );
204
- const response = await getLastInvoiceFormSubmission(session, {
205
- formZid: Number(lab_muestras_form_zid),
206
- });
207
-
208
- if (response.error || !response.data) {
209
- throw new Error(
210
- `Ocurrió un error al intentar obtener la última muestra registrada: ${response.userMsg}`
211
- );
212
- }
213
-
214
- return response.data;
215
- });
216
- };
217
-
218
- export const getMuestrasByInvoiceId = (
219
- headers: any,
220
- session: Session,
221
- invoice_id: string
222
- ): Promise<AxiosUtilsResponse<SubmissionInvoicesGraphQL[]>> => {
223
- return handlePossibleAxiosErrors(async () => {
224
- const { lab_muestras_form_zid } = await getVariablesByName(
225
- headers,
226
- session,
227
- ["lab_muestras_form_zid"]
228
- );
229
- const response = await getInvoiceFormSubmissionsByInvoiceId(
230
- session,
231
- invoice_id,
232
- { formZid: Number(lab_muestras_form_zid) }
233
- );
234
-
235
- if (response.error || !response.data) {
236
- throw new Error(
237
- `Ocurrió un error al intentar obtener las muestras de la remisión: ${response.userMsg}`
238
- );
239
- }
240
-
241
- return response.data;
242
- });
243
- };
@@ -1,114 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- createInvoiceOrder,
5
- getInvoicesByAgencyId,
6
- getVariablesByName,
7
- } from "@zauru-sdk/services";
8
- import {
9
- AxiosUtilsResponse,
10
- InvoiceDetailsGraphQL,
11
- InvoiceGraphQL,
12
- } from "@zauru-sdk/types";
13
-
14
- /**
15
- *
16
- * @param headers
17
- * @param session
18
- * @returns
19
- */
20
- export const getInvoicesByLabAgency = async (
21
- headers: any,
22
- session: Session
23
- ): Promise<AxiosUtilsResponse<InvoiceGraphQL[]>> => {
24
- return handlePossibleAxiosErrors(async () => {
25
- const { lab_agency_id } = await getVariablesByName(headers, session, [
26
- "lab_agency_id",
27
- ]);
28
-
29
- const response = await getInvoicesByAgencyId(session, lab_agency_id);
30
-
31
- if (response.error) {
32
- const msg = `Ocurrió un error al consultar las órdenes/facturas por agencia de laboratorio: ${response.userMsg}`;
33
- console.error(msg);
34
- throw new Error(msg);
35
- }
36
-
37
- return response?.data ?? [];
38
- });
39
- };
40
-
41
- /**
42
- * createNewLabInvoiceOrder
43
- * @param headers
44
- * @param session
45
- * @returns
46
- */
47
- export const createNewLabInvoiceOrder = async (
48
- headers: any,
49
- session: Session,
50
- body: Partial<InvoiceGraphQL>
51
- ): Promise<AxiosUtilsResponse<boolean>> => {
52
- return handlePossibleAxiosErrors(async () => {
53
- const { lab_agency_id, laboratory_proyect_id } = await getVariablesByName(
54
- headers,
55
- session,
56
- ["lab_agency_id", "laboratory_proyect_id"]
57
- );
58
-
59
- const sendBody: Partial<InvoiceGraphQL> = {
60
- ...body,
61
- agency_id: Number(lab_agency_id),
62
- tagging_invoices: [
63
- { tag_id: Number(laboratory_proyect_id), id: 0, invoice_id: 0 },
64
- ],
65
- };
66
-
67
- const bundleResponse = await createInvoiceOrder(headers, sendBody);
68
-
69
- if (bundleResponse.error) {
70
- const msg = `Ocurrió un error al intentar crear (invoice-order): ${bundleResponse.userMsg}`;
71
- console.error(msg);
72
- throw new Error(msg);
73
- }
74
-
75
- return true;
76
- });
77
- };
78
-
79
- /**
80
- * makeInvoiceDetailsWithPrice
81
- * @param invoice_details
82
- * @returns
83
- */
84
- export const makeInvoiceDetailsWithPrice = (
85
- invoice_details: any[],
86
- deleted_invoice_details: any[] = []
87
- ) => {
88
- return [
89
- ...invoice_details.map((x) => {
90
- //Si trae una B al inicio, es un bundleID, de lo contrario, es un item_id
91
- const bundle_id = x.item_id?.startsWith("B")
92
- ? Number(x.item_id.replace("B", ""))
93
- : undefined;
94
- const item_id = !bundle_id ? Number(x.item_id) : undefined;
95
-
96
- const id = isNaN(x.id) ? undefined : x.id;
97
- return {
98
- id,
99
- bundle_id,
100
- item_id,
101
- quantity: Number(x.quantity),
102
- //unit_price: Number(x.price),
103
- //price: Number(x.total),
104
- _destroy: false,
105
- } as InvoiceDetailsGraphQL;
106
- }),
107
- ...deleted_invoice_details.map((x) => {
108
- return {
109
- id: x.id,
110
- _destroy: true,
111
- } as InvoiceDetailsGraphQL;
112
- }),
113
- ];
114
- };