@zauru-sdk/services 1.0.6 → 1.0.8

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 (77) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.d.ts +23 -0
  3. package/dist/index.js +23 -0
  4. package/dist/zauru/zauru-bookings.server.d.ts +28 -0
  5. package/dist/zauru/zauru-bookings.server.js +80 -0
  6. package/dist/zauru/zauru-bundles.service.d.ts +28 -0
  7. package/dist/zauru/zauru-bundles.service.js +93 -0
  8. package/dist/zauru/zauru-cases.server.d.ts +6 -0
  9. package/dist/zauru/zauru-cases.server.js +23 -0
  10. package/dist/zauru/zauru-consolidated.server.d.ts +36 -0
  11. package/dist/zauru/zauru-consolidated.server.js +71 -0
  12. package/dist/zauru/zauru-currencies.server.d.ts +6 -0
  13. package/dist/zauru/zauru-currencies.server.js +20 -0
  14. package/dist/zauru/zauru-deliveries.server.d.ts +22 -0
  15. package/dist/zauru/zauru-deliveries.server.js +44 -0
  16. package/dist/zauru/zauru-discharges.server.d.ts +26 -0
  17. package/dist/zauru/zauru-discharges.server.js +46 -0
  18. package/dist/zauru/zauru-employees.server.d.ts +6 -0
  19. package/dist/zauru/zauru-employees.server.js +23 -0
  20. package/dist/zauru/zauru-forms.server.d.ts +96 -0
  21. package/dist/zauru/zauru-forms.server.js +343 -0
  22. package/dist/zauru/zauru-invoices.server.d.ts +26 -0
  23. package/dist/zauru/zauru-invoices.server.js +94 -0
  24. package/dist/zauru/zauru-items.server.d.ts +91 -0
  25. package/dist/zauru/zauru-items.server.js +238 -0
  26. package/dist/zauru/zauru-lote-record.server.d.ts +8 -0
  27. package/dist/zauru/zauru-lote-record.server.js +26 -0
  28. package/dist/zauru/zauru-lotes.server.d.ts +91 -0
  29. package/dist/zauru/zauru-lotes.server.js +294 -0
  30. package/dist/zauru/zauru-motivos-rechazo.server.d.ts +9 -0
  31. package/dist/zauru/zauru-motivos-rechazo.server.js +49 -0
  32. package/dist/zauru/zauru-payees.server.d.ts +97 -0
  33. package/dist/zauru/zauru-payees.server.js +227 -0
  34. package/dist/zauru/zauru-payment-terms.server.d.ts +20 -0
  35. package/dist/zauru/zauru-payment-terms.server.js +65 -0
  36. package/dist/zauru/zauru-price-lists.server.d.ts +22 -0
  37. package/dist/zauru/zauru-price-lists.server.js +40 -0
  38. package/dist/zauru/zauru-purchase-orders.server.d.ts +160 -0
  39. package/dist/zauru/zauru-purchase-orders.server.js +414 -0
  40. package/dist/zauru/zauru-receptions.server.d.ts +33 -0
  41. package/dist/zauru/zauru-receptions.server.js +94 -0
  42. package/dist/zauru/zauru-shipments.server.d.ts +20 -0
  43. package/dist/zauru/zauru-shipments.server.js +53 -0
  44. package/dist/zauru/zauru-suggested-prices.server.d.ts +30 -0
  45. package/dist/zauru/zauru-suggested-prices.server.js +83 -0
  46. package/dist/zauru/zauru-tags.server.d.ts +7 -0
  47. package/dist/zauru/zauru-tags.server.js +13 -0
  48. package/dist/zauru/zauru-templates.server.d.ts +7 -0
  49. package/dist/zauru/zauru-templates.server.js +15 -0
  50. package/dist/zauru/zauru-web-app-tables.server.d.ts +48 -0
  51. package/dist/zauru/zauru-web-app-tables.server.js +120 -0
  52. package/package.json +6 -6
  53. package/src/index.ts +23 -0
  54. package/src/zauru/zauru-bookings.server.ts +134 -0
  55. package/src/zauru/zauru-bundles.service.ts +157 -0
  56. package/src/zauru/zauru-cases.server.ts +44 -0
  57. package/src/zauru/zauru-consolidated.server.ts +129 -0
  58. package/src/zauru/zauru-currencies.server.ts +39 -0
  59. package/src/zauru/zauru-deliveries.server.ts +70 -0
  60. package/src/zauru/zauru-discharges.server.ts +90 -0
  61. package/src/zauru/zauru-employees.server.ts +43 -0
  62. package/src/zauru/zauru-forms.server.ts +618 -0
  63. package/src/zauru/zauru-invoices.server.ts +142 -0
  64. package/src/zauru/zauru-items.server.ts +427 -0
  65. package/src/zauru/zauru-lote-record.server.ts +77 -0
  66. package/src/zauru/zauru-lotes.server.ts +484 -0
  67. package/src/zauru/zauru-motivos-rechazo.server.ts +121 -0
  68. package/src/zauru/zauru-payees.server.ts +398 -0
  69. package/src/zauru/zauru-payment-terms.server.ts +126 -0
  70. package/src/zauru/zauru-price-lists.server.ts +68 -0
  71. package/src/zauru/zauru-purchase-orders.server.ts +701 -0
  72. package/src/zauru/zauru-receptions.server.ts +148 -0
  73. package/src/zauru/zauru-shipments.server.ts +88 -0
  74. package/src/zauru/zauru-suggested-prices.server.ts +134 -0
  75. package/src/zauru/zauru-tags.server.ts +22 -0
  76. package/src/zauru/zauru-templates.server.ts +24 -0
  77. package/src/zauru/zauru-web-app-tables.server.ts +200 -0
@@ -0,0 +1,49 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { getVariablesByName } from "~/common.server.js";
3
+ import { createWebAppTableRegister, deleteWebAppTableRegister, getWebAppTableRegisters, } from "./zauru-web-app-tables.server.js";
4
+ export async function getMotivosRechazo(headers, session) {
5
+ return handlePossibleAxiosErrors(async () => {
6
+ const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
7
+ "recepciones_rejection_types_webapp_table_id",
8
+ ]);
9
+ const response = await getWebAppTableRegisters(session, recepciones_rejection_types_webapp_table_id);
10
+ if (response.error || !response.data) {
11
+ throw new Error(response.userMsg);
12
+ }
13
+ return response?.data;
14
+ });
15
+ }
16
+ export async function deleteMotivosRechazo(headers, session, id) {
17
+ return handlePossibleAxiosErrors(async () => {
18
+ const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
19
+ "recepciones_rejection_types_webapp_table_id",
20
+ ]);
21
+ const response = await deleteWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, id);
22
+ return response;
23
+ });
24
+ }
25
+ export async function createMotivoRechazo(headers, session, body) {
26
+ return handlePossibleAxiosErrors(async () => {
27
+ const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
28
+ "recepciones_rejection_types_webapp_table_id",
29
+ ]);
30
+ const response = await createWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, body);
31
+ return response;
32
+ });
33
+ }
34
+ export async function updateMotivosRechazo(headers, session, id) {
35
+ return handlePossibleAxiosErrors(async () => {
36
+ const { recepciones_rejection_types_webapp_table_id } = await getVariablesByName(headers, session, [
37
+ "recepciones_rejection_types_webapp_table_id",
38
+ ]);
39
+ const response = await deleteWebAppTableRegister(headers, recepciones_rejection_types_webapp_table_id, id);
40
+ return response;
41
+ });
42
+ }
43
+ export async function saveMotivosDeRechazoByPurchase(headers, session, body, extraBody) {
44
+ return handlePossibleAxiosErrors(async () => {
45
+ const { qc_rejections_webapp_table_id } = await getVariablesByName(headers, session, ["qc_rejections_webapp_table_id"]);
46
+ const response = await createWebAppTableRegister(headers, qc_rejections_webapp_table_id, body, extraBody);
47
+ return response.data;
48
+ });
49
+ }
@@ -0,0 +1,97 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, PayeeCategoryGraphQL, PayeeGraphQL } from "@zauru-sdk/types";
3
+ /**
4
+ * getPayees
5
+ * @param headers
6
+ * @returns
7
+ */
8
+ export declare function getPayees(session: Session): Promise<AxiosUtilsResponse<PayeeGraphQL[]>>;
9
+ /**
10
+ * getProviders
11
+ * @param headers
12
+ * @returns
13
+ */
14
+ export declare function getProviders(session: Session): Promise<AxiosUtilsResponse<PayeeGraphQL[]>>;
15
+ /**
16
+ * getPayee
17
+ * @param session
18
+ * @param id
19
+ */
20
+ export declare function getPayee(session: Session, id: number | string): Promise<AxiosUtilsResponse<PayeeGraphQL | undefined>>;
21
+ /**
22
+ * getPayeesByCategoryId
23
+ * @param session
24
+ * @param categoryId
25
+ * @returns
26
+ */
27
+ export declare function getPayeesByCategoryId(session: Session, id: number | string): Promise<AxiosUtilsResponse<PayeeGraphQL[]>>;
28
+ /**
29
+ * getPayeeCategoriesByNotesMatch
30
+ * @param session
31
+ * @param match
32
+ * @returns
33
+ */
34
+ export declare function getPayeeCategoriesByNotesMatch(session: Session, match: string): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
35
+ /**
36
+ * getPayeeCategories
37
+ * @param session
38
+ * @param match
39
+ * @returns
40
+ */
41
+ export declare function getPayeeCategories(session: Session): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
42
+ /**
43
+ * getProviderCategories
44
+ * @param session
45
+ * @param match
46
+ * @returns
47
+ */
48
+ export declare function getProviderCategories(session: Session): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
49
+ /**
50
+ * getProviderCategories
51
+ * @param session
52
+ * @param match
53
+ * @returns
54
+ */
55
+ export declare function getClientCategories(session: Session): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL[]>>;
56
+ /**
57
+ * createPayee
58
+ * @param session
59
+ * @param headers
60
+ * @returns
61
+ */
62
+ export declare function createPayee(headers: any, body: Partial<PayeeGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
63
+ /**
64
+ * deletePayee
65
+ * @param headers
66
+ * @param id
67
+ * @returns
68
+ */
69
+ export declare function deletePayee(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
70
+ /**
71
+ * updatePayee
72
+ * @param session
73
+ * @param headers
74
+ * @returns
75
+ */
76
+ export declare function updatePayee(headers: any, body: Partial<PayeeGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
77
+ /**
78
+ * createPayeeCategory
79
+ * @param session
80
+ * @param headers
81
+ * @returns
82
+ */
83
+ export declare function createPayeeCategory(headers: any, body: Partial<PayeeCategoryGraphQL>): Promise<AxiosUtilsResponse<PayeeCategoryGraphQL>>;
84
+ /**
85
+ * updatePayeeCategory
86
+ * @param session
87
+ * @param headers
88
+ * @returns
89
+ */
90
+ export declare function updatePayeeCategory(headers: any, body: Partial<PayeeCategoryGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
91
+ /**
92
+ * deletePayeeCategory
93
+ * @param headers
94
+ * @param id
95
+ * @returns
96
+ */
97
+ export declare function deletePayeeCategory(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
@@ -0,0 +1,227 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
3
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
4
+ import { getClientCategoriesStringQuery, getPayeeByIdStringQuery, getPayeeCategoriesByNotesMatchStringQuery, getPayeeCategoriesStringQuery, getPayeeCategoryByIdStringQuery, getPayeesStringQuery, getProviderCategoriesStringQuery, getProvidersStringQuery, } from "@zauru-sdk/graphql";
5
+ import httpZauru from "./httpZauru.server.js";
6
+ /**
7
+ * getPayees
8
+ * @param headers
9
+ * @returns
10
+ */
11
+ export async function getPayees(session) {
12
+ return handlePossibleAxiosErrors(async () => {
13
+ const headers = await getGraphQLAPIHeaders(session);
14
+ const response = await httpGraphQLAPI.post(``, {
15
+ query: getPayeesStringQuery,
16
+ }, {
17
+ headers,
18
+ });
19
+ return response.data?.data.payees;
20
+ });
21
+ }
22
+ /**
23
+ * getProviders
24
+ * @param headers
25
+ * @returns
26
+ */
27
+ export async function getProviders(session) {
28
+ return handlePossibleAxiosErrors(async () => {
29
+ const headers = await getGraphQLAPIHeaders(session);
30
+ const response = await httpGraphQLAPI.post(``, {
31
+ query: getProvidersStringQuery,
32
+ }, {
33
+ headers,
34
+ });
35
+ return response.data?.data.payees;
36
+ });
37
+ }
38
+ /**
39
+ * getPayee
40
+ * @param session
41
+ * @param id
42
+ */
43
+ export async function getPayee(session, id) {
44
+ return handlePossibleAxiosErrors(async () => {
45
+ const headers = await getGraphQLAPIHeaders(session);
46
+ const responsePayee = await httpGraphQLAPI.post("", {
47
+ query: getPayeeByIdStringQuery,
48
+ variables: {
49
+ id,
50
+ },
51
+ }, { headers });
52
+ if (!responsePayee?.data?.data?.payees[0]) {
53
+ throw new Error("No se encontró el beneficiario indicado");
54
+ }
55
+ return responsePayee?.data?.data?.payees[0];
56
+ });
57
+ }
58
+ /**
59
+ * getPayeesByCategoryId
60
+ * @param session
61
+ * @param categoryId
62
+ * @returns
63
+ */
64
+ export async function getPayeesByCategoryId(session, id) {
65
+ return handlePossibleAxiosErrors(async () => {
66
+ const headers = await getGraphQLAPIHeaders(session);
67
+ const response = await httpGraphQLAPI.post(``, {
68
+ query: getPayeeCategoryByIdStringQuery,
69
+ variables: { id },
70
+ }, { headers });
71
+ if (response.data.errors) {
72
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
73
+ }
74
+ if (!response?.data?.data?.payee_categories[0]) {
75
+ return [];
76
+ }
77
+ return response.data?.data?.payee_categories[0]?.payees;
78
+ });
79
+ }
80
+ /**
81
+ * getPayeeCategoriesByNotesMatch
82
+ * @param session
83
+ * @param match
84
+ * @returns
85
+ */
86
+ export async function getPayeeCategoriesByNotesMatch(session, match) {
87
+ return handlePossibleAxiosErrors(async () => {
88
+ const headers = await getGraphQLAPIHeaders(session);
89
+ const response = await httpGraphQLAPI.post(``, {
90
+ query: getPayeeCategoriesByNotesMatchStringQuery(match),
91
+ }, { headers });
92
+ if (response.data.errors) {
93
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
94
+ }
95
+ return response.data?.data?.payee_categories;
96
+ });
97
+ }
98
+ /**
99
+ * getPayeeCategories
100
+ * @param session
101
+ * @param match
102
+ * @returns
103
+ */
104
+ export async function getPayeeCategories(session) {
105
+ return handlePossibleAxiosErrors(async () => {
106
+ const headers = await getGraphQLAPIHeaders(session);
107
+ const response = await httpGraphQLAPI.post(``, {
108
+ query: getPayeeCategoriesStringQuery,
109
+ }, { headers });
110
+ if (response.data.errors) {
111
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
112
+ }
113
+ return response.data?.data?.payee_categories;
114
+ });
115
+ }
116
+ /**
117
+ * getProviderCategories
118
+ * @param session
119
+ * @param match
120
+ * @returns
121
+ */
122
+ export async function getProviderCategories(session) {
123
+ return handlePossibleAxiosErrors(async () => {
124
+ const headers = await getGraphQLAPIHeaders(session);
125
+ const response = await httpGraphQLAPI.post(``, {
126
+ query: getProviderCategoriesStringQuery,
127
+ }, { headers });
128
+ if (response.data.errors) {
129
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
130
+ }
131
+ return response.data?.data?.payee_categories;
132
+ });
133
+ }
134
+ /**
135
+ * getProviderCategories
136
+ * @param session
137
+ * @param match
138
+ * @returns
139
+ */
140
+ export async function getClientCategories(session) {
141
+ return handlePossibleAxiosErrors(async () => {
142
+ const headers = await getGraphQLAPIHeaders(session);
143
+ const response = await httpGraphQLAPI.post(``, {
144
+ query: getClientCategoriesStringQuery,
145
+ }, { headers });
146
+ if (response.data.errors) {
147
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
148
+ }
149
+ return response.data?.data?.payee_categories;
150
+ });
151
+ }
152
+ /**
153
+ * createPayee
154
+ * @param session
155
+ * @param headers
156
+ * @returns
157
+ */
158
+ export async function createPayee(headers, body) {
159
+ return handlePossibleAxiosErrors(async () => {
160
+ await httpZauru.post("/settings/payees", { payee: body }, { headers });
161
+ return true;
162
+ });
163
+ }
164
+ /**
165
+ * deletePayee
166
+ * @param headers
167
+ * @param id
168
+ * @returns
169
+ */
170
+ export async function deletePayee(headers, id) {
171
+ return handlePossibleAxiosErrors(async () => {
172
+ await httpZauru.delete(`/settings/payees/${id}?destroy=true`, {
173
+ headers,
174
+ });
175
+ return true;
176
+ });
177
+ }
178
+ /**
179
+ * updatePayee
180
+ * @param session
181
+ * @param headers
182
+ * @returns
183
+ */
184
+ export async function updatePayee(headers, body) {
185
+ return handlePossibleAxiosErrors(async () => {
186
+ await httpZauru.patch(`/settings/payees/${body.id}`, { payee: body }, { headers });
187
+ return true;
188
+ });
189
+ }
190
+ /**
191
+ * createPayeeCategory
192
+ * @param session
193
+ * @param headers
194
+ * @returns
195
+ */
196
+ export async function createPayeeCategory(headers, body) {
197
+ return handlePossibleAxiosErrors(async () => {
198
+ const response = await httpZauru.post("/settings/payees/payee_categories", { payee_category: body }, { headers });
199
+ return response.data;
200
+ });
201
+ }
202
+ /**
203
+ * updatePayeeCategory
204
+ * @param session
205
+ * @param headers
206
+ * @returns
207
+ */
208
+ export async function updatePayeeCategory(headers, body) {
209
+ return handlePossibleAxiosErrors(async () => {
210
+ await httpZauru.patch(`/settings/payees/payee_categories/${body.id}`, { payee_category: body }, { headers });
211
+ return true;
212
+ });
213
+ }
214
+ /**
215
+ * deletePayeeCategory
216
+ * @param headers
217
+ * @param id
218
+ * @returns
219
+ */
220
+ export async function deletePayeeCategory(headers, id) {
221
+ return handlePossibleAxiosErrors(async () => {
222
+ await httpZauru.delete(`/settings/payees/payee_categories/${id}?destroy=true`, {
223
+ headers,
224
+ });
225
+ return true;
226
+ });
227
+ }
@@ -0,0 +1,20 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, PaymentTermGraphQL } from "@zauru-sdk/types";
3
+ /**
4
+ * getPaymentTerms
5
+ */
6
+ export declare function getPaymentTerms(session: Session): Promise<AxiosUtilsResponse<PaymentTermGraphQL[]>>;
7
+ /**
8
+ * getPaymentTermById
9
+ */
10
+ export declare function getPaymentTermById(session: Session, id: string | number): Promise<AxiosUtilsResponse<PaymentTermGraphQL>>;
11
+ /**
12
+ * createPaymentTerm
13
+ * @param headers
14
+ */
15
+ export declare function createPaymentTerm(headers: any, payment_term: PaymentTermGraphQL): Promise<AxiosUtilsResponse<PaymentTermGraphQL>>;
16
+ /**
17
+ * updatePaymentTerm
18
+ * @param headers
19
+ */
20
+ export declare function updatePaymentTerm(headers: any, payment_term: Partial<PaymentTermGraphQL> & any): Promise<AxiosUtilsResponse<PaymentTermGraphQL>>;
@@ -0,0 +1,65 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
3
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
4
+ import { getPaymentTermByIdStringQuery, getPaymentTermsStringQuery, } from "@zauru-sdk/graphql";
5
+ import httpZauru from "./httpZauru.server.js";
6
+ /**
7
+ * getPaymentTerms
8
+ */
9
+ export async function getPaymentTerms(session) {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ const headers = await getGraphQLAPIHeaders(session);
12
+ const response = await httpGraphQLAPI.post("", {
13
+ query: getPaymentTermsStringQuery,
14
+ }, { headers });
15
+ if (response.data.errors) {
16
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
17
+ }
18
+ const registers = response?.data?.data?.payment_terms;
19
+ return registers;
20
+ });
21
+ }
22
+ /**
23
+ * getPaymentTermById
24
+ */
25
+ export async function getPaymentTermById(session, id) {
26
+ return handlePossibleAxiosErrors(async () => {
27
+ const headers = await getGraphQLAPIHeaders(session);
28
+ const response = await httpGraphQLAPI.post("", {
29
+ query: getPaymentTermByIdStringQuery,
30
+ variables: { id },
31
+ }, { headers });
32
+ if (response.data.errors) {
33
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
34
+ }
35
+ if (!response?.data?.data?.payment_terms[0]) {
36
+ throw new Error("No se encontró ningún método de pago con este id: " + id);
37
+ }
38
+ const registers = response?.data?.data?.payment_terms[0] ?? [];
39
+ return registers;
40
+ });
41
+ }
42
+ /**
43
+ * createPaymentTerm
44
+ * @param headers
45
+ */
46
+ export async function createPaymentTerm(headers, payment_term) {
47
+ return handlePossibleAxiosErrors(async () => {
48
+ const response = await httpZauru.patch(`/sales/settings/payment_terms.json`, {
49
+ payment_term,
50
+ }, { headers });
51
+ return response.data;
52
+ });
53
+ }
54
+ /**
55
+ * updatePaymentTerm
56
+ * @param headers
57
+ */
58
+ export async function updatePaymentTerm(headers, payment_term) {
59
+ return handlePossibleAxiosErrors(async () => {
60
+ const response = await httpZauru.patch(`/sales/settings/payment_terms/${payment_term.id}.json`, {
61
+ payment_term,
62
+ }, { headers });
63
+ return response.data;
64
+ });
65
+ }
@@ -0,0 +1,22 @@
1
+ import { AxiosUtilsResponse, CreatePriceListBody, PriceListGraphQL } from "@zauru-sdk/types";
2
+ /**
3
+ * createPriceList
4
+ * @param session
5
+ * @param headers
6
+ * @returns
7
+ */
8
+ export declare function createPriceList(headers: any, body: CreatePriceListBody): Promise<AxiosUtilsResponse<PriceListGraphQL>>;
9
+ /**
10
+ * deletePriceList
11
+ * @param headers
12
+ * @param id
13
+ * @returns
14
+ */
15
+ export declare function deletePriceList(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
16
+ /**
17
+ * updatePriceList
18
+ * @param session
19
+ * @param headers
20
+ * @returns
21
+ */
22
+ export declare function updatePriceList(headers: any, body: Partial<PriceListGraphQL>): Promise<AxiosUtilsResponse<boolean>>;
@@ -0,0 +1,40 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import httpZauru from "./httpZauru.server.js";
3
+ /**
4
+ * createPriceList
5
+ * @param session
6
+ * @param headers
7
+ * @returns
8
+ */
9
+ export async function createPriceList(headers, body) {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ const response = await httpZauru.post("/sales/settings/price_lists", { price_list: body }, { headers });
12
+ return response.data;
13
+ });
14
+ }
15
+ /**
16
+ * deletePriceList
17
+ * @param headers
18
+ * @param id
19
+ * @returns
20
+ */
21
+ export async function deletePriceList(headers, id) {
22
+ return handlePossibleAxiosErrors(async () => {
23
+ await httpZauru.delete(`/sales/settings/price_lists/${id}?destroy=true`, {
24
+ headers,
25
+ });
26
+ return true;
27
+ });
28
+ }
29
+ /**
30
+ * updatePriceList
31
+ * @param session
32
+ * @param headers
33
+ * @returns
34
+ */
35
+ export async function updatePriceList(headers, body) {
36
+ return handlePossibleAxiosErrors(async () => {
37
+ await httpZauru.patch(`/sales/settings/price_lists/${body.id}`, { price_list: body }, { headers });
38
+ return true;
39
+ });
40
+ }
@@ -0,0 +1,160 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, BasketSchema, CreateNewPurchaseOrderBody, DataTablesFilterBody, HTMLPurchasesListSchema, NewPurchaseOrderResponse, PurchaseOrderGraphQL, PurchasesListResponseSchema, UpdatePurchaseOrderBody } from "@zauru-sdk/types";
3
+ /**
4
+ * markAsReceivePurchaseOrder
5
+ * Esta función sólo se utiliza cuando se van a marcar como recibida toda la órden de compra, se recibe todo lo que se envío
6
+ * si se quiere recibir parcialmente, utilizar el endpoint de /receptions
7
+ * @param headers
8
+ * @param body
9
+ * @returns
10
+ */
11
+ export declare function markAsReceivePurchaseOrder(headers: any, body: Partial<PurchaseOrderGraphQL> & {
12
+ fechaVencimiento?: string;
13
+ }): Promise<AxiosUtilsResponse<boolean>>;
14
+ /**
15
+ * markAsReceivePartialPurchaseOrder
16
+ * @param headers
17
+ * @param body
18
+ * @returns
19
+ */
20
+ export declare function markAsReceivePartialPurchaseOrder(headers: any, session: Session, body: Partial<PurchaseOrderGraphQL> & {
21
+ fechaVencimiento?: string;
22
+ }): Promise<AxiosUtilsResponse<boolean>>;
23
+ /**
24
+ *
25
+ * @param headers
26
+ * @param body
27
+ * @returns
28
+ */
29
+ export declare function createNewPurchaseOrder(headers: any, body: Partial<PurchaseOrderGraphQL>): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
30
+ /**
31
+ *
32
+ * @param headers
33
+ * @param body
34
+ * @returns
35
+ */
36
+ export declare function createNewAuthorizedPurchaseOrder(headers: any, body: CreateNewPurchaseOrderBody, withReceive?: boolean): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
37
+ /**
38
+ * receiveLotPurchaseOrder
39
+ * @param headers
40
+ * @param body
41
+ * @returns
42
+ */
43
+ export declare function receiveLotPurchaseOrder(headers: any, body: PurchaseOrderGraphQL & {
44
+ fechaVencimiento: string;
45
+ }): Promise<AxiosUtilsResponse<boolean>>;
46
+ /**
47
+ * receivePurchaseOrder
48
+ * @param headers
49
+ * @param body
50
+ * @returns
51
+ */
52
+ export declare function receivePurchaseOrder(headers: any, body: PurchaseOrderGraphQL): Promise<AxiosUtilsResponse<boolean>>;
53
+ /**
54
+ *
55
+ * @param headers
56
+ * @returns
57
+ */
58
+ export declare function getNewPurchaseOrderInfo(headers: any): Promise<AxiosUtilsResponse<NewPurchaseOrderResponse>>;
59
+ /**
60
+ * getPurchasesListDataTables Function for get all zauru orden-compras
61
+ * @param headers
62
+ * @returns
63
+ */
64
+ export declare function getPurchasesListDataTables(headers: any, body: DataTablesFilterBody): Promise<AxiosUtilsResponse<PurchasesListResponseSchema<HTMLPurchasesListSchema>>>;
65
+ /**
66
+ * getPurchasesList Function for get all zauru orden-compras
67
+ * @param headers
68
+ * @param params
69
+ * @returns
70
+ */
71
+ export declare function getPurchasesList(headers: any, session: Session, params?: {
72
+ fechaInicio?: string;
73
+ fechaFin?: string;
74
+ item?: string | number;
75
+ payeeCategory?: string | number;
76
+ agency_id?: string | number;
77
+ }, config?: {
78
+ fromProduction?: boolean;
79
+ }): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
80
+ /**
81
+ * getPurchase Function for get an especific purchase order
82
+ * @param headers
83
+ * @returns
84
+ */
85
+ export declare function getPurchase(headers: any, purchase_order_id: number | string): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL & {
86
+ baskets_memo: BasketSchema[];
87
+ baskets_memo_quantity: number;
88
+ }>>;
89
+ /**
90
+ * enablePurchase Enable a purchase order
91
+ * @param headers
92
+ * @param purchase_order_id
93
+ * @param reception_id
94
+ * @returns
95
+ */
96
+ export declare function enablePurchase(headers: any, purchase_order_id: number, reception_id: number): Promise<AxiosUtilsResponse<any>>;
97
+ /**
98
+ * updatePurchaseOrder
99
+ * @param headers
100
+ * @param body
101
+ * @param purchase_order_id
102
+ * @returns
103
+ */
104
+ export declare function updatePurchaseOrder(headers: any, body: UpdatePurchaseOrderBody, purchase_order_id: number): Promise<AxiosUtilsResponse<any>>;
105
+ /**
106
+ * updatePurchaseOrder
107
+ * @param headers
108
+ * @param body
109
+ * @param purchase_order_id
110
+ * @returns
111
+ */
112
+ export declare function updateReceivedPurchaseOrder(headers: any, body: UpdatePurchaseOrderBody, purchase_order_id: number): Promise<AxiosUtilsResponse<any>>;
113
+ /**
114
+ * getLast100Receptions
115
+ * @param headers
116
+ * @returns
117
+ */
118
+ export declare function getLast100Receptions(session: Session, agency_id?: number | string): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
119
+ /**
120
+ * getPurchaseOrder
121
+ * @param headers
122
+ * @returns
123
+ */
124
+ export declare function getPurchaseOrder(session: Session, poId: string | number, config?: {
125
+ withLotStocksToMyAgency: boolean;
126
+ }): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL>>;
127
+ /**
128
+ * getPurchaseOrder
129
+ * @param headers
130
+ * @returns
131
+ */
132
+ export declare function getGraphQLPurchaseOrderBetweenDates(session: Session, dates: {
133
+ startDate: string;
134
+ endDate: string;
135
+ }, config?: {
136
+ agencyFilter: boolean;
137
+ agencyId?: number;
138
+ useProductionAgencyId?: boolean;
139
+ consolidateIdFilter?: boolean;
140
+ lotItemIdExclusion?: number;
141
+ poDetailTagId?: number;
142
+ withShipmentToMyAgency?: boolean;
143
+ withLotStocksToMyAgency?: boolean;
144
+ itemId?: number | string;
145
+ payeeCategoryId?: number | string;
146
+ }): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
147
+ /**
148
+ * deletePurchaseOrder
149
+ * @param headers
150
+ * @param id
151
+ * @returns
152
+ */
153
+ export declare function deletePurchaseOrder(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
154
+ /**
155
+ * getPurchaseOrderByIdNumber
156
+ * @param session
157
+ * @param idNumber
158
+ * @returns
159
+ */
160
+ export declare function getPurchasesOrderByIdNumber(session: Session, id_number: string): Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;