@zauru-sdk/services 1.0.49 → 1.0.52
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.
- package/dist/cjs/common.js +235 -0
- package/dist/cjs/index.js +50 -0
- package/dist/cjs/sessions/sessions.js +18 -0
- package/dist/cjs/sessions/upstash.js +59 -0
- package/dist/cjs/zauru/httpGraphQL.js +42 -0
- package/dist/cjs/zauru/httpOauth.js +42 -0
- package/dist/cjs/zauru/httpZauru.js +42 -0
- package/dist/cjs/zauru/zauru-agencies.js +27 -0
- package/dist/cjs/zauru/zauru-automatic-numbers.js +28 -0
- package/dist/cjs/zauru/zauru-bookings.js +90 -0
- package/dist/cjs/zauru/zauru-bundles.js +104 -0
- package/dist/cjs/zauru/zauru-cases.js +30 -0
- package/dist/cjs/zauru/zauru-consolidated.js +81 -0
- package/dist/cjs/zauru/zauru-currencies.js +27 -0
- package/dist/cjs/zauru/zauru-deliveries.js +53 -0
- package/dist/cjs/zauru/zauru-discharges.js +55 -0
- package/dist/cjs/zauru/zauru-employees.js +30 -0
- package/dist/cjs/zauru/zauru-forms.js +363 -0
- package/dist/cjs/zauru/zauru-invoices.js +104 -0
- package/dist/cjs/zauru/zauru-items.js +293 -0
- package/dist/cjs/zauru/zauru-lote-record.js +33 -0
- package/dist/cjs/zauru/zauru-lotes.js +312 -0
- package/dist/cjs/zauru/zauru-motivos-rechazo.js +57 -0
- package/dist/cjs/zauru/zauru-payees.js +247 -0
- package/dist/cjs/zauru/zauru-payment-terms.js +75 -0
- package/dist/cjs/zauru/zauru-price-lists.js +49 -0
- package/dist/cjs/zauru/zauru-profiles.js +80 -0
- package/dist/cjs/zauru/zauru-purchase-orders.js +438 -0
- package/dist/cjs/zauru/zauru-receptions.js +104 -0
- package/dist/cjs/zauru/zauru-shipments.js +62 -0
- package/dist/cjs/zauru/zauru-suggested-prices.js +94 -0
- package/dist/cjs/zauru/zauru-tags.js +20 -0
- package/dist/cjs/zauru/zauru-templates.js +22 -0
- package/dist/cjs/zauru/zauru-variables.js +56 -0
- package/dist/cjs/zauru/zauru-web-app-tables.js +167 -0
- package/package.json +12 -9
- package/CHANGELOG.md +0 -232
- package/src/common.ts +0 -343
- package/src/index.ts +0 -37
- package/src/sessions/sessions.ts +0 -17
- package/src/sessions/upstash.ts +0 -55
- package/src/zauru/httpGraphQL.ts +0 -55
- package/src/zauru/httpOauth.ts +0 -55
- package/src/zauru/httpZauru.ts +0 -56
- package/src/zauru/zauru-agencies.ts +0 -32
- package/src/zauru/zauru-automatic-numbers.ts +0 -35
- package/src/zauru/zauru-bookings.ts +0 -134
- package/src/zauru/zauru-bundles.ts +0 -157
- package/src/zauru/zauru-cases.ts +0 -44
- package/src/zauru/zauru-consolidated.ts +0 -129
- package/src/zauru/zauru-currencies.ts +0 -39
- package/src/zauru/zauru-deliveries.ts +0 -70
- package/src/zauru/zauru-discharges.ts +0 -90
- package/src/zauru/zauru-employees.ts +0 -43
- package/src/zauru/zauru-forms.ts +0 -618
- package/src/zauru/zauru-invoices.ts +0 -142
- package/src/zauru/zauru-items.ts +0 -481
- package/src/zauru/zauru-lote-record.ts +0 -77
- package/src/zauru/zauru-lotes.ts +0 -484
- package/src/zauru/zauru-motivos-rechazo.ts +0 -121
- package/src/zauru/zauru-payees.ts +0 -402
- package/src/zauru/zauru-payment-terms.ts +0 -126
- package/src/zauru/zauru-price-lists.ts +0 -68
- package/src/zauru/zauru-profiles.ts +0 -106
- package/src/zauru/zauru-purchase-orders.ts +0 -701
- package/src/zauru/zauru-receptions.ts +0 -148
- package/src/zauru/zauru-shipments.ts +0 -88
- package/src/zauru/zauru-suggested-prices.ts +0 -137
- package/src/zauru/zauru-tags.ts +0 -22
- package/src/zauru/zauru-templates.ts +0 -24
- package/src/zauru/zauru-variables.ts +0 -67
- package/src/zauru/zauru-web-app-tables.ts +0 -256
- package/tsconfig.json +0 -24
- /package/dist/{common.js → esm/common.js} +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{sessions → esm/sessions}/sessions.js +0 -0
- /package/dist/{sessions → esm/sessions}/upstash.js +0 -0
- /package/dist/{zauru → esm/zauru}/httpGraphQL.js +0 -0
- /package/dist/{zauru → esm/zauru}/httpOauth.js +0 -0
- /package/dist/{zauru → esm/zauru}/httpZauru.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-agencies.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-automatic-numbers.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-bookings.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-bundles.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-cases.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-consolidated.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-currencies.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-deliveries.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-discharges.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-employees.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-forms.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-invoices.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-items.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-lote-record.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-lotes.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-motivos-rechazo.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-payees.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-payment-terms.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-price-lists.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-profiles.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-purchase-orders.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-receptions.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-shipments.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-suggested-prices.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-tags.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-templates.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-variables.js +0 -0
- /package/dist/{zauru → esm/zauru}/zauru-web-app-tables.js +0 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deleteItem = exports.updateItem = exports.createItem = exports.updateItemCategory = exports.deleteItemCategory = exports.createItemCategory = exports.createItemSuperCategory = exports.getItemsBySuperCategoryId = exports.getItemCategoriesBySuperCategoryId = exports.getItemCategory = exports.getItemsByCategoryId = exports.getItemCategories = exports.getItemByName = exports.getItems = exports.getItemsDataTable = void 0;
|
|
7
|
+
const common_1 = require("@zauru-sdk/common");
|
|
8
|
+
const common_js_1 = require("../common.js");
|
|
9
|
+
const httpGraphQL_js_1 = __importDefault(require("./httpGraphQL.js"));
|
|
10
|
+
const graphql_1 = require("@zauru-sdk/graphql");
|
|
11
|
+
const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
|
|
12
|
+
//============================ FORMATEADO DE ITEMS
|
|
13
|
+
function extractIdFromURL(input) {
|
|
14
|
+
const regex = /\/items\/(\d+)/;
|
|
15
|
+
const match = input.match(regex);
|
|
16
|
+
return match ? parseInt(match[1], 10) : -1;
|
|
17
|
+
}
|
|
18
|
+
function formatHTMLItemList(item) {
|
|
19
|
+
return {
|
|
20
|
+
zid: parseInt((0, common_1.extractValueBetweenTags)(item.zid, "a"), 10),
|
|
21
|
+
itemId: extractIdFromURL(item.cod),
|
|
22
|
+
name: (0, common_1.extractValueBetweenTags)(item.name, "a"),
|
|
23
|
+
stck: (0, common_1.extractValueBetweenTags)(item.stck, "i") || null,
|
|
24
|
+
act: (0, common_1.extractValueBetweenTags)(item.act, "i") || null,
|
|
25
|
+
sell: (0, common_1.extractValueBetweenTags)(item.sell, "i") || null,
|
|
26
|
+
purch: (0, common_1.extractValueBetweenTags)(item.purch, "i") || null,
|
|
27
|
+
vat: (0, common_1.extractValueBetweenTags)(item.vat, "i") || null,
|
|
28
|
+
cat: item.cat,
|
|
29
|
+
warr: item.warr,
|
|
30
|
+
cat_note: item.cat_note,
|
|
31
|
+
DT_RowId: parseInt(item.DT_RowId.replace("settings-item-", ""), 10),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param headers
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
const getItemsDataTable = async (headers, search) => {
|
|
40
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
41
|
+
const response = await httpZauru_js_1.default.post(`/settings/items/datatables.json`, search, { headers });
|
|
42
|
+
const items = response.data?.data?.map((x) => formatHTMLItemList(x)) ?? [];
|
|
43
|
+
return items;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.getItemsDataTable = getItemsDataTable;
|
|
47
|
+
/**
|
|
48
|
+
* getItems
|
|
49
|
+
*/
|
|
50
|
+
async function getItems(session) {
|
|
51
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
52
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
53
|
+
const response = await httpGraphQL_js_1.default.post("", {
|
|
54
|
+
query: graphql_1.getItemsStringQuery,
|
|
55
|
+
}, { headers });
|
|
56
|
+
if (response.data.errors) {
|
|
57
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
58
|
+
}
|
|
59
|
+
const items = response?.data?.data?.items ?? [];
|
|
60
|
+
return items;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.getItems = getItems;
|
|
64
|
+
/**
|
|
65
|
+
* getItemByName
|
|
66
|
+
*/
|
|
67
|
+
async function getItemByName(session, name) {
|
|
68
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
69
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
70
|
+
const response = await httpGraphQL_js_1.default.post("", {
|
|
71
|
+
query: graphql_1.getItemByNameStringQuery,
|
|
72
|
+
variables: {
|
|
73
|
+
name,
|
|
74
|
+
},
|
|
75
|
+
}, { headers });
|
|
76
|
+
if (response.data.errors) {
|
|
77
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
78
|
+
}
|
|
79
|
+
if (!response?.data?.data?.items[0]) {
|
|
80
|
+
throw new Error(`No se encontró ningún item con el nombre: ${name} asociado`);
|
|
81
|
+
}
|
|
82
|
+
const register = response?.data?.data?.items[0];
|
|
83
|
+
return register;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.getItemByName = getItemByName;
|
|
87
|
+
//===================== ITEM CATEGORIES
|
|
88
|
+
/**
|
|
89
|
+
* getItemCategories
|
|
90
|
+
* @param headers
|
|
91
|
+
* @param agency_id
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
async function getItemCategories(headers, item_category_id) {
|
|
95
|
+
const response = await httpZauru_js_1.default.get(`/settings/items/item_categories/${item_category_id}.json`, {
|
|
96
|
+
headers,
|
|
97
|
+
});
|
|
98
|
+
return response.data;
|
|
99
|
+
}
|
|
100
|
+
exports.getItemCategories = getItemCategories;
|
|
101
|
+
/**
|
|
102
|
+
* getItemsByCategoryId
|
|
103
|
+
*/
|
|
104
|
+
async function getItemsByCategoryId(session, id) {
|
|
105
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
106
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
107
|
+
const response = await httpGraphQL_js_1.default.post("", {
|
|
108
|
+
query: graphql_1.getItemsByCategoryStringQuery,
|
|
109
|
+
variables: {
|
|
110
|
+
id,
|
|
111
|
+
},
|
|
112
|
+
}, { headers });
|
|
113
|
+
if (response.data.errors) {
|
|
114
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
115
|
+
}
|
|
116
|
+
if (!response?.data?.data?.item_categories[0]) {
|
|
117
|
+
throw new Error("No se encontró la categoría de item indicada");
|
|
118
|
+
}
|
|
119
|
+
const items = response?.data?.data?.item_categories[0]?.items ?? [];
|
|
120
|
+
return items;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.getItemsByCategoryId = getItemsByCategoryId;
|
|
124
|
+
/**
|
|
125
|
+
* getItemCategory
|
|
126
|
+
* @param session
|
|
127
|
+
* @param id
|
|
128
|
+
*/
|
|
129
|
+
async function getItemCategory(session, id) {
|
|
130
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
131
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
132
|
+
const response = await httpGraphQL_js_1.default.post("", {
|
|
133
|
+
query: graphql_1.getItemCategoryByIdStringQuery,
|
|
134
|
+
variables: {
|
|
135
|
+
id,
|
|
136
|
+
},
|
|
137
|
+
}, { headers });
|
|
138
|
+
if (response.data.errors) {
|
|
139
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
140
|
+
}
|
|
141
|
+
if (!response?.data?.data?.item_categories[0]) {
|
|
142
|
+
throw new Error("No se encontró la categoría de item indicada");
|
|
143
|
+
}
|
|
144
|
+
return response?.data?.data?.item_categories[0];
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
exports.getItemCategory = getItemCategory;
|
|
148
|
+
/**
|
|
149
|
+
* getItemCategoriesBySuperCategoryId
|
|
150
|
+
* @param session
|
|
151
|
+
* @param categoryId
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
async function getItemCategoriesBySuperCategoryId(session, id) {
|
|
155
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
156
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
157
|
+
const response = await httpGraphQL_js_1.default.post(``, {
|
|
158
|
+
query: graphql_1.getSuperCategoryByIdStringQuery,
|
|
159
|
+
variables: { id },
|
|
160
|
+
}, { headers });
|
|
161
|
+
if (response.data.errors) {
|
|
162
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
163
|
+
}
|
|
164
|
+
if (!response?.data?.data.item_super_categories[0].item_categories) {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
return response.data?.data.item_super_categories[0]?.item_categories;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
exports.getItemCategoriesBySuperCategoryId = getItemCategoriesBySuperCategoryId;
|
|
171
|
+
/**
|
|
172
|
+
* getItemsBySuperCategoryId
|
|
173
|
+
* @param session
|
|
174
|
+
* @param categoryId
|
|
175
|
+
* @returns
|
|
176
|
+
*/
|
|
177
|
+
async function getItemsBySuperCategoryId(session, id, agency_id) {
|
|
178
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
179
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
180
|
+
const response = await httpGraphQL_js_1.default.post(``, {
|
|
181
|
+
query: graphql_1.getItemsBySuperCategoryStringQuery,
|
|
182
|
+
variables: { id, agency_id },
|
|
183
|
+
}, { headers });
|
|
184
|
+
if (response.data.errors) {
|
|
185
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
186
|
+
}
|
|
187
|
+
if (!response?.data?.data.item_super_categories[0].item_categories) {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
const items = [];
|
|
191
|
+
response.data?.data.item_super_categories[0]?.item_categories.forEach((x) => items.push(...x.items));
|
|
192
|
+
return items;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
exports.getItemsBySuperCategoryId = getItemsBySuperCategoryId;
|
|
196
|
+
/**
|
|
197
|
+
* createItemSuperCategory
|
|
198
|
+
* @param session
|
|
199
|
+
* @param headers
|
|
200
|
+
* @returns
|
|
201
|
+
*/
|
|
202
|
+
async function createItemSuperCategory(headers, body) {
|
|
203
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
204
|
+
const response = await httpZauru_js_1.default.post("/settings/items/item_super_categories.json", { item_super_category: body }, { headers });
|
|
205
|
+
return response.data;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
exports.createItemSuperCategory = createItemSuperCategory;
|
|
209
|
+
/**
|
|
210
|
+
* createItemCategory
|
|
211
|
+
* @param session
|
|
212
|
+
* @param headers
|
|
213
|
+
* @returns
|
|
214
|
+
*/
|
|
215
|
+
async function createItemCategory(headers, body) {
|
|
216
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
217
|
+
const itemCategoryResponse = await httpZauru_js_1.default.post("/settings/items/item_categories", { item_category: body }, { headers });
|
|
218
|
+
return itemCategoryResponse.data;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
exports.createItemCategory = createItemCategory;
|
|
222
|
+
/**
|
|
223
|
+
* deleteItemCategory
|
|
224
|
+
* @param headers
|
|
225
|
+
* @param id
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
async function deleteItemCategory(headers, id) {
|
|
229
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
230
|
+
await httpZauru_js_1.default.delete(`/settings/items/item_categories/${id}?destroy=true`, {
|
|
231
|
+
headers,
|
|
232
|
+
});
|
|
233
|
+
return true;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
exports.deleteItemCategory = deleteItemCategory;
|
|
237
|
+
/**
|
|
238
|
+
* updatePayee
|
|
239
|
+
* @param session
|
|
240
|
+
* @param headers
|
|
241
|
+
* @returns
|
|
242
|
+
*/
|
|
243
|
+
async function updateItemCategory(headers, body) {
|
|
244
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
245
|
+
await httpZauru_js_1.default.patch(`/settings/items/item_categories/${body.id}`, { item_category: body }, { headers });
|
|
246
|
+
return true;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
exports.updateItemCategory = updateItemCategory;
|
|
250
|
+
/**
|
|
251
|
+
* createItem
|
|
252
|
+
* @param headers
|
|
253
|
+
* @param body
|
|
254
|
+
* @returns
|
|
255
|
+
*/
|
|
256
|
+
async function createItem(headers, body) {
|
|
257
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
258
|
+
const response = await httpZauru_js_1.default.post(`/settings/items.json`, { item: body }, { headers });
|
|
259
|
+
return response.data;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
exports.createItem = createItem;
|
|
263
|
+
/**
|
|
264
|
+
* updateItem
|
|
265
|
+
* @param headers
|
|
266
|
+
* @param body
|
|
267
|
+
* @param id
|
|
268
|
+
* @returns
|
|
269
|
+
*/
|
|
270
|
+
async function updateItem(headers, body) {
|
|
271
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
272
|
+
await httpZauru_js_1.default.patch(`/settings/items/${body.id}.json`, body, {
|
|
273
|
+
headers,
|
|
274
|
+
});
|
|
275
|
+
return true;
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
exports.updateItem = updateItem;
|
|
279
|
+
/**
|
|
280
|
+
* deleteItemCategory
|
|
281
|
+
* @param headers
|
|
282
|
+
* @param id
|
|
283
|
+
* @returns
|
|
284
|
+
*/
|
|
285
|
+
async function deleteItem(headers, id) {
|
|
286
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
287
|
+
await httpZauru_js_1.default.delete(`/settings/items/${id}?destroy=true`, {
|
|
288
|
+
headers,
|
|
289
|
+
});
|
|
290
|
+
return true;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
exports.deleteItem = deleteItem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateLoteRecord = exports.createLoteRecord = exports.deleteLoteRecord = exports.getLoteRecord = void 0;
|
|
4
|
+
const common_js_1 = require("../common.js");
|
|
5
|
+
const zauru_web_app_tables_js_1 = require("./zauru-web-app-tables.js");
|
|
6
|
+
async function getLoteRecord(headers, session) {
|
|
7
|
+
const { lote_record_webapp_table_id: webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, ["lote_record_webapp_table_id"]);
|
|
8
|
+
const response = await (0, zauru_web_app_tables_js_1.getWebAppTableRegisters)(session, webapp_table_id);
|
|
9
|
+
if (response.error) {
|
|
10
|
+
throw new Error(`Error al obtener el lote: ${response.userMsg}`);
|
|
11
|
+
}
|
|
12
|
+
const lotes = response.data ?? [];
|
|
13
|
+
return lotes;
|
|
14
|
+
}
|
|
15
|
+
exports.getLoteRecord = getLoteRecord;
|
|
16
|
+
async function deleteLoteRecord(headers, session, id) {
|
|
17
|
+
const { lote_record_webapp_table_id: webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, ["lote_record_webapp_table_id"]);
|
|
18
|
+
const response = await (0, zauru_web_app_tables_js_1.deleteWebAppTableRegister)(headers, webapp_table_id, id);
|
|
19
|
+
return response.data;
|
|
20
|
+
}
|
|
21
|
+
exports.deleteLoteRecord = deleteLoteRecord;
|
|
22
|
+
async function createLoteRecord(headers, session, body) {
|
|
23
|
+
const { lote_record_webapp_table_id: webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, ["lote_record_webapp_table_id"]);
|
|
24
|
+
const response = await (0, zauru_web_app_tables_js_1.createWebAppTableRegister)(headers, webapp_table_id, body);
|
|
25
|
+
return response.data;
|
|
26
|
+
}
|
|
27
|
+
exports.createLoteRecord = createLoteRecord;
|
|
28
|
+
async function updateLoteRecord(headers, session, id) {
|
|
29
|
+
const { lote_record_webapp_table_id: webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, ["lote_record_webapp_table_id"]);
|
|
30
|
+
const response = await (0, zauru_web_app_tables_js_1.deleteWebAppTableRegister)(headers, webapp_table_id, id);
|
|
31
|
+
return response.data;
|
|
32
|
+
}
|
|
33
|
+
exports.updateLoteRecord = updateLoteRecord;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.inactivarLote = exports.getLotesProcesados = exports.getLotesWithPurchaseFormated = exports.getLotesFiltered = exports.getLotesExportJSON = exports.updateLote = exports.getMyAgencyLotStocks = exports.getLoteByName = exports.getLote = exports.liberarLote = exports.retenerLote = exports.getBasketsLots = void 0;
|
|
7
|
+
const common_1 = require("@zauru-sdk/common");
|
|
8
|
+
const moment_1 = __importDefault(require("moment"));
|
|
9
|
+
const common_js_1 = require("../common.js");
|
|
10
|
+
const httpZauru_js_1 = __importDefault(require("./httpZauru.js"));
|
|
11
|
+
const zauru_lote_record_js_1 = require("./zauru-lote-record.js");
|
|
12
|
+
const httpGraphQL_js_1 = __importDefault(require("./httpGraphQL.js"));
|
|
13
|
+
const graphql_1 = require("@zauru-sdk/graphql");
|
|
14
|
+
const zauru_deliveries_js_1 = require("./zauru-deliveries.js");
|
|
15
|
+
/**
|
|
16
|
+
* getBasketsLots
|
|
17
|
+
* @param headers
|
|
18
|
+
* @param session
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
const getBasketsLots = async (headers, session) => {
|
|
22
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
23
|
+
const { recepciones_basket_item_id } = await (0, common_js_1.getVariablesByName)(headers, session, ["recepciones_basket_item_id"]);
|
|
24
|
+
const basketLotsResponse = await httpZauru_js_1.default.get(`/inventories/lots/${recepciones_basket_item_id}/item`, { headers });
|
|
25
|
+
const poBasket = {};
|
|
26
|
+
basketLotsResponse?.data?.lots.map((basket) => (poBasket[basket.name] = {
|
|
27
|
+
lot_id: basket.id,
|
|
28
|
+
rBaskets: 0,
|
|
29
|
+
qcBaskets: 0,
|
|
30
|
+
}));
|
|
31
|
+
return {
|
|
32
|
+
...basketLotsResponse.data,
|
|
33
|
+
recepciones_basket_item_id: Number(recepciones_basket_item_id),
|
|
34
|
+
poBasket,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.getBasketsLots = getBasketsLots;
|
|
39
|
+
//LIBERAR/RETENER LOTES
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param headers
|
|
43
|
+
* @param lot_id
|
|
44
|
+
* @param lot_name
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
const retenerLote = async (headers, session, lot_id, lot_name) => {
|
|
48
|
+
await httpZauru_js_1.default.patch(`/inventories/lots/${lot_id}.json`, { lot: { name: `${lot_name}-RETENIDO` } }, { headers });
|
|
49
|
+
return await (0, zauru_lote_record_js_1.createLoteRecord)(headers, session, {
|
|
50
|
+
agency_id: session.get("agency_id"),
|
|
51
|
+
created_at: (0, moment_1.default)().toISOString(),
|
|
52
|
+
employee_id: session.get("employee_id"),
|
|
53
|
+
employee_name: session.get("name"),
|
|
54
|
+
lote_id: lot_id,
|
|
55
|
+
lote_name: lot_name,
|
|
56
|
+
retenido: 1,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
exports.retenerLote = retenerLote;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param headers
|
|
63
|
+
* @param lot_id
|
|
64
|
+
* @param lot_name
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
const liberarLote = async (headers, session, lot_id, lot_name) => {
|
|
68
|
+
await httpZauru_js_1.default.patch(`/inventories/lots/${lot_id}.json`, { lot: { name: `${lot_name.split("-")[0]}` } }, { headers });
|
|
69
|
+
return await (0, zauru_lote_record_js_1.createLoteRecord)(headers, session, {
|
|
70
|
+
agency_id: session.get("agency_id"),
|
|
71
|
+
created_at: (0, moment_1.default)().toISOString(),
|
|
72
|
+
employee_id: session.get("employee_id"),
|
|
73
|
+
employee_name: session.get("name"),
|
|
74
|
+
lote_id: lot_id,
|
|
75
|
+
lote_name: lot_name,
|
|
76
|
+
retenido: 0,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
exports.liberarLote = liberarLote;
|
|
80
|
+
/**
|
|
81
|
+
* getLote Function for get all details of the current lote
|
|
82
|
+
* @param headers
|
|
83
|
+
* @param agency_id
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
async function getLote(headers, lot_id, agency_id) {
|
|
87
|
+
const response = await httpZauru_js_1.default.get(`/inventories/lots/${lot_id}.json`, {
|
|
88
|
+
headers,
|
|
89
|
+
});
|
|
90
|
+
//Paso de 23-1234-VERDE, 34-34242-AZUL => a un objeto completo de canastas
|
|
91
|
+
const baskets = (0, common_1.getBasketsSchema)(response.data.description);
|
|
92
|
+
response.data.description_baskets = baskets;
|
|
93
|
+
//Calculo el total de canastas, la suma de todas
|
|
94
|
+
response.data.baskets_quantity = baskets
|
|
95
|
+
.map((x) => x.total)
|
|
96
|
+
.reduce(common_1.reduceAdd, 0);
|
|
97
|
+
if (agency_id) {
|
|
98
|
+
//Saco el available actual
|
|
99
|
+
response.data.stock_actual = response.data.stocks[agency_id];
|
|
100
|
+
//El available by basket
|
|
101
|
+
response.data.availableByBaskets =
|
|
102
|
+
Number(response.data.stock_actual.available) /
|
|
103
|
+
response.data.baskets_quantity;
|
|
104
|
+
}
|
|
105
|
+
return response.data;
|
|
106
|
+
}
|
|
107
|
+
exports.getLote = getLote;
|
|
108
|
+
/**
|
|
109
|
+
* getLoteByName
|
|
110
|
+
* @param headers
|
|
111
|
+
* @param lot_name
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
async function getLoteByName(session, lot_name) {
|
|
115
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
116
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
117
|
+
const response = await httpGraphQL_js_1.default.post("", {
|
|
118
|
+
query: graphql_1.getLotsByNameStringQuery,
|
|
119
|
+
variables: {
|
|
120
|
+
name: lot_name,
|
|
121
|
+
entity_id: session.get("selectedEntity"),
|
|
122
|
+
},
|
|
123
|
+
}, { headers });
|
|
124
|
+
if (response.data.errors) {
|
|
125
|
+
throw new Error(`Ocurrió un error al obtener el lote por nombre: ${response.data.errors
|
|
126
|
+
.map((x) => x.message)
|
|
127
|
+
.join(";")}`);
|
|
128
|
+
}
|
|
129
|
+
if (response?.data?.data.lots?.length <= 0) {
|
|
130
|
+
throw new Error(`No se encontró ningún resultado para el name del lote enviado: ${lot_name}`);
|
|
131
|
+
}
|
|
132
|
+
const registerFound = response.data?.data?.lots[0];
|
|
133
|
+
return registerFound;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
exports.getLoteByName = getLoteByName;
|
|
137
|
+
/**
|
|
138
|
+
* getMyAgencyLotStocks
|
|
139
|
+
* @param session
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
142
|
+
async function getMyAgencyLotStocks(session) {
|
|
143
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
144
|
+
const headers = await (0, common_js_1.getGraphQLAPIHeaders)(session);
|
|
145
|
+
const response = await httpGraphQL_js_1.default.post("", {
|
|
146
|
+
query: graphql_1.getLotStocksByAgencyIdStringQuery,
|
|
147
|
+
variables: {
|
|
148
|
+
agency_id: session.get("agency_id"),
|
|
149
|
+
},
|
|
150
|
+
}, { headers });
|
|
151
|
+
if (response.data.errors) {
|
|
152
|
+
throw new Error(`Ocurrió un error al obtener el stock de lotes por agencia: ${response.data.errors
|
|
153
|
+
.map((x) => x.message)
|
|
154
|
+
.join(";")}`);
|
|
155
|
+
}
|
|
156
|
+
if (response?.data?.data.lot_stocks?.length <= 0) {
|
|
157
|
+
throw new Error(`No se encontró ningún resultado para el stock de lotes por agencia: ${session.get("agency_id")}`);
|
|
158
|
+
}
|
|
159
|
+
const registerFound = response.data?.data?.lot_stocks;
|
|
160
|
+
return registerFound;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
exports.getMyAgencyLotStocks = getMyAgencyLotStocks;
|
|
164
|
+
/**
|
|
165
|
+
* getLote Function for get all details of the current lote
|
|
166
|
+
* @param headers
|
|
167
|
+
* @param agency_id
|
|
168
|
+
* @returns
|
|
169
|
+
*/
|
|
170
|
+
async function updateLote(headers, lot_id, updatedData) {
|
|
171
|
+
const response = await httpZauru_js_1.default.patch(`/inventories/lots/${lot_id}.json`, updatedData, {
|
|
172
|
+
headers,
|
|
173
|
+
});
|
|
174
|
+
return response.data;
|
|
175
|
+
}
|
|
176
|
+
exports.updateLote = updateLote;
|
|
177
|
+
/**
|
|
178
|
+
* getLotesExportJSON Function for get all zauru lotes by id_agencia
|
|
179
|
+
* @param headers
|
|
180
|
+
* @param agency_id
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
async function getLotesExportJSON(headers, agency_id, desde, hasta) {
|
|
184
|
+
const response = await httpZauru_js_1.default.get(`/inventories/lots/lots_export.json`, {
|
|
185
|
+
headers,
|
|
186
|
+
params: {
|
|
187
|
+
warehouse: agency_id,
|
|
188
|
+
//Desde: desde,
|
|
189
|
+
//Hasta: hasta,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
return response.data;
|
|
193
|
+
}
|
|
194
|
+
exports.getLotesExportJSON = getLotesExportJSON;
|
|
195
|
+
/**
|
|
196
|
+
*
|
|
197
|
+
* @param headers
|
|
198
|
+
* @param agency_id
|
|
199
|
+
* @param baskets
|
|
200
|
+
* @param basket_id
|
|
201
|
+
* @returns
|
|
202
|
+
*/
|
|
203
|
+
async function getLotesFiltered(headers, agency_id, baskets, basket_id) {
|
|
204
|
+
let lotes = await getLotesExportJSON(headers, agency_id);
|
|
205
|
+
if (!baskets && basket_id) {
|
|
206
|
+
//quito los que son de tipo canasta
|
|
207
|
+
lotes = lotes.filter((lot) => lot.lot?.item_id !== basket_id);
|
|
208
|
+
}
|
|
209
|
+
else if (baskets && basket_id) {
|
|
210
|
+
//jalo sólo los que son de tipo canasta
|
|
211
|
+
lotes = lotes.filter((lot) => lot.lot?.item_id === basket_id);
|
|
212
|
+
}
|
|
213
|
+
lotes = lotes.map((lot) => {
|
|
214
|
+
const baskets = (0, common_1.getBasketsSchema)(lot.lot.description);
|
|
215
|
+
const baskets_quantity = baskets.map((x) => x.total).reduce(common_1.reduceAdd, 0);
|
|
216
|
+
const availableByBasket = (0, common_1.truncateDecimals)(Number(lot.available) / baskets_quantity, 2);
|
|
217
|
+
return {
|
|
218
|
+
...lot,
|
|
219
|
+
baskets,
|
|
220
|
+
availableByBasket,
|
|
221
|
+
baskets_quantity,
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
return lotes;
|
|
225
|
+
}
|
|
226
|
+
exports.getLotesFiltered = getLotesFiltered;
|
|
227
|
+
/**
|
|
228
|
+
*
|
|
229
|
+
* @param headers
|
|
230
|
+
* @param agency_id
|
|
231
|
+
* @param basket_id
|
|
232
|
+
* @param orders
|
|
233
|
+
* @param desde
|
|
234
|
+
* @param hasta
|
|
235
|
+
* @returns
|
|
236
|
+
*/
|
|
237
|
+
async function getLotesWithPurchaseFormated(headers, agency_id, basket_id, orders, desde, hasta) {
|
|
238
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
239
|
+
const TODAY = new Date().getTime();
|
|
240
|
+
const lotes = (await getLotesExportJSON(headers, agency_id, desde, hasta))
|
|
241
|
+
//quito los que son de tipo canasta
|
|
242
|
+
.filter((lot) => lot.lot?.item_id !== basket_id)
|
|
243
|
+
//filtro sólo los de las ordenes que vienen
|
|
244
|
+
.filter((lot) => Object.keys(orders).includes(lot.lot.name))
|
|
245
|
+
.map((lot) => {
|
|
246
|
+
return {
|
|
247
|
+
...orders[lot.lot.name],
|
|
248
|
+
id_lote: lot.lot?.id,
|
|
249
|
+
name_lote: lot.lot?.name,
|
|
250
|
+
item: lot.lot?.item?.name,
|
|
251
|
+
created_at: lot.lot?.created_at,
|
|
252
|
+
weight: lot.available,
|
|
253
|
+
baskets: lot?.lot?.description !== null && lot?.lot?.description?.length > 0
|
|
254
|
+
? lot.lot?.description
|
|
255
|
+
.split(",")
|
|
256
|
+
.map((basket) => parseInt(basket.split("-")[0]))
|
|
257
|
+
.reduce((sum, qty) => sum + qty)
|
|
258
|
+
: 0,
|
|
259
|
+
editable: Math.floor((TODAY - new Date(lot.lot?.created_at).getTime()) /
|
|
260
|
+
(1000 * 3600 * 24)) < 1,
|
|
261
|
+
};
|
|
262
|
+
})
|
|
263
|
+
.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
|
|
264
|
+
return lotes;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
exports.getLotesWithPurchaseFormated = getLotesWithPurchaseFormated;
|
|
268
|
+
async function getLotesProcesados(headers, agency_id) {
|
|
269
|
+
const deliveries = await (0, zauru_deliveries_js_1.getDeliveriesDataTables)(headers, {
|
|
270
|
+
length: 0,
|
|
271
|
+
order: {
|
|
272
|
+
"0": {
|
|
273
|
+
column: "0",
|
|
274
|
+
dir: "desc",
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
start: 0,
|
|
278
|
+
agency_from: agency_id,
|
|
279
|
+
});
|
|
280
|
+
const dataFormateada = deliveries?.data?.data
|
|
281
|
+
?.filter((result) => result.mem)
|
|
282
|
+
.map((result) => {
|
|
283
|
+
//Ejemplo: "53876;351693;MINI ZANAHORIA (NARANJA);1775.0;35;25;2022-06-10"
|
|
284
|
+
//${LOTE_ID};${LOTE_NAME};${VERDURA};${booked_quantity};${CANTIDAD_CANASTAS_ENVIADAS_A_CC};${porcentajeRechazo};${DELIVERY_DATE}
|
|
285
|
+
const memSplited = result.mem.split(";");
|
|
286
|
+
return {
|
|
287
|
+
lote_id: memSplited[0],
|
|
288
|
+
lote_name: memSplited[1],
|
|
289
|
+
verdura: memSplited[2],
|
|
290
|
+
pesoNeto: memSplited[3],
|
|
291
|
+
canastas: memSplited[4],
|
|
292
|
+
rechazo: `${(0, common_1.truncateDecimals)(Number(memSplited[5]), 2)}`,
|
|
293
|
+
delivery_date: memSplited[6],
|
|
294
|
+
pesoNetoPorCanasta: `${(0, common_1.truncateDecimals)((Number(memSplited[3]) ?? 0) / (Number(memSplited[4]) ?? 1), 2)}`,
|
|
295
|
+
};
|
|
296
|
+
});
|
|
297
|
+
return dataFormateada ?? [];
|
|
298
|
+
}
|
|
299
|
+
exports.getLotesProcesados = getLotesProcesados;
|
|
300
|
+
/**
|
|
301
|
+
*
|
|
302
|
+
* @param headers
|
|
303
|
+
* @param lot_id
|
|
304
|
+
* @returns
|
|
305
|
+
*/
|
|
306
|
+
const inactivarLote = (headers, lot_id) => {
|
|
307
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
308
|
+
await httpZauru_js_1.default.patch(`/inventories/lots/${lot_id}.json`, { active: false }, { headers });
|
|
309
|
+
return true;
|
|
310
|
+
});
|
|
311
|
+
};
|
|
312
|
+
exports.inactivarLote = inactivarLote;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveMotivosDeRechazoByPurchase = exports.updateMotivosRechazo = exports.createMotivoRechazo = exports.deleteMotivosRechazo = exports.getMotivosRechazo = void 0;
|
|
4
|
+
const common_1 = require("@zauru-sdk/common");
|
|
5
|
+
const common_js_1 = require("../common.js");
|
|
6
|
+
const zauru_web_app_tables_js_1 = require("./zauru-web-app-tables.js");
|
|
7
|
+
async function getMotivosRechazo(headers, session) {
|
|
8
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
9
|
+
const { recepciones_rejection_types_webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, [
|
|
10
|
+
"recepciones_rejection_types_webapp_table_id",
|
|
11
|
+
]);
|
|
12
|
+
const response = await (0, zauru_web_app_tables_js_1.getWebAppTableRegisters)(session, recepciones_rejection_types_webapp_table_id);
|
|
13
|
+
if (response.error || !response.data) {
|
|
14
|
+
throw new Error(response.userMsg);
|
|
15
|
+
}
|
|
16
|
+
return response?.data;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.getMotivosRechazo = getMotivosRechazo;
|
|
20
|
+
async function deleteMotivosRechazo(headers, session, id) {
|
|
21
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
22
|
+
const { recepciones_rejection_types_webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, [
|
|
23
|
+
"recepciones_rejection_types_webapp_table_id",
|
|
24
|
+
]);
|
|
25
|
+
const response = await (0, zauru_web_app_tables_js_1.deleteWebAppTableRegister)(headers, recepciones_rejection_types_webapp_table_id, id);
|
|
26
|
+
return response;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.deleteMotivosRechazo = deleteMotivosRechazo;
|
|
30
|
+
async function createMotivoRechazo(headers, session, body) {
|
|
31
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
32
|
+
const { recepciones_rejection_types_webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, [
|
|
33
|
+
"recepciones_rejection_types_webapp_table_id",
|
|
34
|
+
]);
|
|
35
|
+
const response = await (0, zauru_web_app_tables_js_1.createWebAppTableRegister)(headers, recepciones_rejection_types_webapp_table_id, body);
|
|
36
|
+
return response;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.createMotivoRechazo = createMotivoRechazo;
|
|
40
|
+
async function updateMotivosRechazo(headers, session, id) {
|
|
41
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
42
|
+
const { recepciones_rejection_types_webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, [
|
|
43
|
+
"recepciones_rejection_types_webapp_table_id",
|
|
44
|
+
]);
|
|
45
|
+
const response = await (0, zauru_web_app_tables_js_1.deleteWebAppTableRegister)(headers, recepciones_rejection_types_webapp_table_id, id);
|
|
46
|
+
return response;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.updateMotivosRechazo = updateMotivosRechazo;
|
|
50
|
+
async function saveMotivosDeRechazoByPurchase(headers, session, body, extraBody) {
|
|
51
|
+
return (0, common_1.handlePossibleAxiosErrors)(async () => {
|
|
52
|
+
const { qc_rejections_webapp_table_id } = await (0, common_js_1.getVariablesByName)(headers, session, ["qc_rejections_webapp_table_id"]);
|
|
53
|
+
const response = await (0, zauru_web_app_tables_js_1.createWebAppTableRegister)(headers, qc_rejections_webapp_table_id, body, extraBody);
|
|
54
|
+
return response.data;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.saveMotivosDeRechazoByPurchase = saveMotivosDeRechazoByPurchase;
|