@zauru-sdk/graphql 1.0.33 → 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.
@@ -1,1132 +1,1206 @@
1
- export const getLast100ReceptionsStringQuery = `
2
- query getLast100Receptions($agencyId: Int) @cached {
3
- purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $agencyId}}) {
4
- id
5
- created_at
6
- due
7
- id_number
8
- memo
9
- payee_id
10
- issue_date
11
- discount
12
- authorized
13
- received
14
- transport_type
15
- purchase_order_details {
16
- item_id
17
- id
18
- reference
19
- booked_quantity
20
- delivered_quantity
21
- }
22
- lots(where: {active: {_eq: true}}) {
23
- id
24
- name
25
- description
26
- item_id
27
- }
28
- }
29
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = exports.getShipmentsStringQuery = exports.getItemByNameStringQuery = exports.getBundleByNameStringQuery = exports.getBundlesByItemCategoryIdStringQuery = exports.getEmployeesByAgencyIdStringQuery = exports.getEmployeeProfileStringQuery = exports.getConsolidatesBetweenDatesStringQuery = exports.getItemsBySuperCategoryStringQuery = exports.getItemsStringQuery = exports.getItemsByCategoryStringQuery = exports.getItemCategoryByIdStringQuery = exports.getSuperCategoryByIdStringQuery = exports.getPayeeByIdStringQuery = exports.getClientCategoriesStringQuery = exports.getProviderCategoriesStringQuery = exports.getPayeeCategoriesStringQuery = exports.getPayeeCategoriesByNotesMatchStringQuery = exports.getPayeeCategoryByIdStringQuery = exports.getWebAppRowsByWebAppTableIdStringQuery = exports.getWebAppRowStringQuery = exports.getAgenciesStringQuery = exports.getProvidersStringQuery = exports.getPayeesStringQuery = exports.getPurchaseOrdersBetweenDatesStringQuery = exports.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsByToAgencyLast100StringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
4
+ exports.getLast100ReceptionsStringQuery = `
5
+ query getLast100Receptions($agencyId: Int) @cached {
6
+ purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $agencyId}}) {
7
+ id
8
+ created_at
9
+ due
10
+ id_number
11
+ memo
12
+ payee_id
13
+ issue_date
14
+ discount
15
+ authorized
16
+ received
17
+ transport_type
18
+ purchase_order_details {
19
+ item_id
20
+ id
21
+ reference
22
+ booked_quantity
23
+ delivered_quantity
24
+ }
25
+ lots(where: {active: {_eq: true}}) {
26
+ id
27
+ name
28
+ description
29
+ item_id
30
+ }
31
+ }
32
+ }
30
33
  `;
31
- export const getPurchaseOrderByIdNumberStringQuery = `
32
- query getPurchaseOrderByIdNumber($id_number: String) @cached {
33
- purchase_orders(where: {id_number: {_eq: $id_number}}) {
34
- id
35
- created_at
36
- due
37
- id_number
38
- memo
39
- payee_id
40
- transport_type
41
- reference
42
- incoterm_destination
43
- issue_date
44
- voided
45
- received
46
- discount
47
- other_charges
48
- webapp_table_rowables {
49
- webapp_rows {
50
- data
51
- }
52
- }
53
- purchase_order_details {
54
- item_id
55
- id
56
- reference
57
- booked_quantity
58
- delivered_quantity
59
- }
60
- lots(where: {active: {_eq: true}}) {
61
- id
62
- description
63
- }
64
- receptions {
65
- id
66
- received
67
- voided
68
- }
69
- shipments {
70
- shipment_id
71
- }
72
- }
73
- }
34
+ exports.getPurchaseOrderByIdNumberStringQuery = `
35
+ query getPurchaseOrderByIdNumber($id_number: String) @cached {
36
+ purchase_orders(where: {id_number: {_eq: $id_number}}) {
37
+ id
38
+ created_at
39
+ due
40
+ id_number
41
+ memo
42
+ payee_id
43
+ transport_type
44
+ reference
45
+ incoterm_destination
46
+ issue_date
47
+ voided
48
+ received
49
+ discount
50
+ other_charges
51
+ webapp_table_rowables {
52
+ webapp_rows {
53
+ data
54
+ }
55
+ }
56
+ purchase_order_details {
57
+ item_id
58
+ id
59
+ reference
60
+ booked_quantity
61
+ delivered_quantity
62
+ }
63
+ lots(where: {active: {_eq: true}}) {
64
+ id
65
+ description
66
+ }
67
+ receptions {
68
+ id
69
+ received
70
+ voided
71
+ }
72
+ shipments {
73
+ shipment_id
74
+ }
75
+ }
76
+ }
74
77
  `;
75
- export const getPurchaseOrderStringQuery = (config = { withLotStocks: false }) => `
76
- query getPurchaseOrder($id: Int) @cached {
77
- purchase_orders(where: {id: {_eq: $id}}) {
78
- id
79
- agency_id
80
- entity_id
81
- created_at
82
- due
83
- id_number
84
- memo
85
- payee_id
86
- transport_type
87
- reference
88
- incoterm_destination
89
- issue_date
90
- voided
91
- received
92
- discount
93
- delivery_date
94
- other_charges
95
- webapp_table_rowables {
96
- webapp_rows {
97
- data
98
- }
99
- }
100
- purchase_order_details {
101
- item_id
102
- id
103
- reference
104
- booked_quantity
105
- delivered_quantity
106
- item {
107
- name
108
- }
109
- }
110
- lots(where: {active: {_eq: true}}) {
111
- id
112
- name
113
- description
78
+ const getPurchaseOrderStringQuery = (config = { withLotStocks: false }) => `
79
+ query getPurchaseOrder($id: Int) @cached {
80
+ purchase_orders(where: {id: {_eq: $id}}) {
81
+ id
82
+ agency_id
83
+ entity_id
84
+ created_at
85
+ due
86
+ id_number
87
+ memo
88
+ payee_id
89
+ transport_type
90
+ reference
91
+ incoterm_destination
92
+ issue_date
93
+ voided
94
+ received
95
+ discount
96
+ delivery_date
97
+ other_charges
98
+ webapp_table_rowables {
99
+ webapp_rows {
100
+ data
101
+ }
102
+ }
103
+ purchase_order_details {
104
+ item_id
105
+ id
106
+ reference
107
+ booked_quantity
108
+ delivered_quantity
109
+ item {
110
+ name
111
+ }
112
+ }
113
+ lots(where: {active: {_eq: true}}) {
114
+ id
115
+ name
116
+ description
114
117
  ${config.withLotStocks
115
- ? `lot_stocks {
116
- id
117
- available
118
- incoming
119
- outgoing
120
- agency_id
118
+ ? `lot_stocks {
119
+ id
120
+ available
121
+ incoming
122
+ outgoing
123
+ agency_id
121
124
  }`
122
- : ""}
123
- }
124
- receptions {
125
- id
126
- received
127
- voided
128
- agency_id
129
- entity_id
130
- reception_details {
131
- purchase_order_detail_id
132
- item_id
133
- lot_delivered_quantity
134
- lot_description
135
- lot_expire
136
- lot_name
137
- }
138
- }
139
- shipment_purchase_orders {
140
- shipment_id
141
- }
142
- }
143
- }
125
+ : ""}
126
+ }
127
+ receptions {
128
+ id
129
+ received
130
+ voided
131
+ agency_id
132
+ entity_id
133
+ reception_details {
134
+ purchase_order_detail_id
135
+ item_id
136
+ lot_delivered_quantity
137
+ lot_description
138
+ lot_expire
139
+ lot_name
140
+ }
141
+ }
142
+ shipment_purchase_orders {
143
+ shipment_id
144
+ }
145
+ }
146
+ }
144
147
  `;
145
- export const getShipmentsByToAgencyLast100StringQuery = `
146
- query getShipmentsByToAgencyLast100(
147
- $agency_to_id: Int
148
- ){
149
- shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {
150
- id
151
- zid
152
- id_number
153
- reference
154
- needs_transport
155
- payee_id
156
- income
157
- booker_id
158
- agency_from_id
159
- agency_to_id
160
- transporter_id
161
- created_at
162
- movements {
163
- id
164
- booked_quantity
165
- delivered_quantity
166
- reference
167
- lot {
168
- id
169
- name
170
- description
171
- }
172
- }
173
- }
174
- }
148
+ exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
149
+ exports.getShipmentsByToAgencyLast100StringQuery = `
150
+ query getShipmentsByToAgencyLast100(
151
+ $agency_to_id: Int
152
+ ){
153
+ shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {
154
+ id
155
+ zid
156
+ id_number
157
+ reference
158
+ needs_transport
159
+ payee_id
160
+ income
161
+ booker_id
162
+ agency_from_id
163
+ agency_to_id
164
+ transporter_id
165
+ created_at
166
+ movements {
167
+ id
168
+ booked_quantity
169
+ delivered_quantity
170
+ reference
171
+ lot {
172
+ id
173
+ name
174
+ description
175
+ }
176
+ }
177
+ }
178
+ }
175
179
  `;
176
- export const getLotsByNameStringQuery = `
177
- query getLots($name: String, $entity_id: Int){
178
- lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {
179
- id
180
- name
181
- description
182
- }
183
- }
180
+ exports.getLotsByNameStringQuery = `
181
+ query getLots($name: String, $entity_id: Int){
182
+ lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {
183
+ id
184
+ name
185
+ description
186
+ }
187
+ }
184
188
  `;
185
- export const getLotStocksByAgencyIdStringQuery = `
186
- query getLotStocksByAgencyId($agency_id: Int){
187
- lot_stocks (
188
- order_by: { id: desc },
189
- where: { agency_id: { _eq: $agency_id }}
190
- ){
191
- id
192
- available
193
- lot_id
194
- lot {
195
- id
196
- item_id
197
- expires
198
- }
199
- }
200
- }
189
+ exports.getLotStocksByAgencyIdStringQuery = `
190
+ query getLotStocksByAgencyId($agency_id: Int){
191
+ lot_stocks (
192
+ order_by: { id: desc },
193
+ where: { agency_id: { _eq: $agency_id }}
194
+ ){
195
+ id
196
+ available
197
+ lot_id
198
+ lot {
199
+ id
200
+ item_id
201
+ expires
202
+ }
203
+ }
204
+ }
201
205
  `;
202
- export const getPurchaseOrdersBetweenDatesStringQuery = (config = {
206
+ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
203
207
  agencyFilter: false,
204
208
  payeeCategoryFilter: false,
205
209
  itemIdFilter: false,
206
210
  consolidateIdFilter: false,
207
211
  withLotStocks: false,
208
- }) => `
209
- query getPurchaseOrdersBetweenDates(
210
- $agencyId: Int,
211
- $startDate: timestamp,
212
- $endDate: timestamp,
213
- $lotItemIdExclusion: Int = null,
214
- $poDetailTagId: Int = null,
215
- $payeeCategoryId: Int = null
216
- ) {
217
- purchase_orders(
218
- order_by: {id: desc},
219
- where: {
220
- ${config.agencyFilter ? "agency_id: {_eq: $agencyId}," : ""}
212
+ }) => `
213
+ query getPurchaseOrdersBetweenDates(
214
+ $agencyId: Int,
215
+ $startDate: timestamp,
216
+ $endDate: timestamp,
217
+ $lotItemIdExclusion: Int = null,
218
+ $poDetailTagId: Int = null,
219
+ $payeeCategoryId: Int = null
220
+ ) {
221
+ purchase_orders(
222
+ order_by: {id: desc},
223
+ where: {
224
+ ${config.agencyFilter ? "agency_id: {_eq: $agencyId}," : ""}
221
225
  ${config.payeeCategoryFilter
222
226
  ? "payee: {payee_category: {id: {_eq: $payeeCategoryId}}}},"
223
- : ""}
227
+ : ""}
224
228
  ${config.itemIdFilter
225
229
  ? "purchase_order_details: {item_id: {_eq: 10}},"
226
- : ""}
230
+ : ""}
227
231
  ${config.lotItemIdExclusion
228
232
  ? "lots: {item_id: {_neq: $lotItemIdExclusion}},"
229
- : ""}
233
+ : ""}
230
234
  ${config.poDetailTagId
231
235
  ? "purchase_order_details: {tag_id: {_eq: $poDetailTagId}},"
232
- : ""}
233
- ${config.consolidateIdFilter ? "consolidate_id: {_is_null: true}," : ""}
234
- created_at: {_gte: $startDate, _lte: $endDate}
235
- }
236
- ) {
237
- id
238
- created_at
239
- due
240
- id_number
241
- memo
242
- payee_id
243
- issue_date
244
- agency_id
245
- discount
246
- consolidate_id
247
- purchase_order_details {
248
- item_id
249
- id
250
- reference
251
- booked_quantity
252
- delivered_quantity
253
- }
254
- lots(where: {active: {_eq: true}}){
255
- id
256
- name
257
- description
236
+ : ""}
237
+ ${config.consolidateIdFilter ? "consolidate_id: {_is_null: true}," : ""}
238
+ created_at: {_gte: $startDate, _lte: $endDate}
239
+ }
240
+ ) {
241
+ id
242
+ created_at
243
+ due
244
+ id_number
245
+ memo
246
+ payee_id
247
+ issue_date
248
+ agency_id
249
+ discount
250
+ consolidate_id
251
+ purchase_order_details {
252
+ item_id
253
+ id
254
+ reference
255
+ booked_quantity
256
+ delivered_quantity
257
+ }
258
+ lots(where: {active: {_eq: true}}){
259
+ id
260
+ name
261
+ description
258
262
  ${config.withLotStocks
259
- ? `lot_stocks {
260
- id
261
- available
262
- incoming
263
- outgoing
264
- agency_id
263
+ ? `lot_stocks {
264
+ id
265
+ available
266
+ incoming
267
+ outgoing
268
+ agency_id
265
269
  }`
266
- : ""}
267
- }
268
- shipment_purchase_orders {
269
- shipment {
270
- id
271
- zid
272
- id_number
273
- reference
274
- needs_transport
275
- payee_id
276
- income
277
- booker_id
278
- agency_from_id
279
- agency_to_id
280
- }
281
- }
282
- }
283
- }
270
+ : ""}
271
+ }
272
+ shipment_purchase_orders {
273
+ shipment {
274
+ id
275
+ zid
276
+ id_number
277
+ reference
278
+ needs_transport
279
+ payee_id
280
+ income
281
+ booker_id
282
+ agency_from_id
283
+ agency_to_id
284
+ }
285
+ }
286
+ }
287
+ }
284
288
  `;
285
- export const getPayeesStringQuery = `
286
- query getPayees {
287
- payees {
288
- id
289
- id_number
290
- name
291
- tin
292
- vendor
293
- address_line_1
294
- }
295
- }
289
+ exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
290
+ exports.getPayeesStringQuery = `
291
+ query getPayees {
292
+ payees {
293
+ id
294
+ id_number
295
+ name
296
+ tin
297
+ vendor
298
+ address_line_1
299
+ }
300
+ }
296
301
  `;
297
- export const getProvidersStringQuery = `
298
- query getProviders {
299
- payees (where: {vendor: {_eq: true}}) {
300
- id
301
- id_number
302
- name
303
- tin
304
- address_line_1
305
- }
306
- }
302
+ exports.getProvidersStringQuery = `
303
+ query getProviders {
304
+ payees (where: {vendor: {_eq: true}}) {
305
+ id
306
+ id_number
307
+ name
308
+ tin
309
+ address_line_1
310
+ }
311
+ }
307
312
  `;
308
- export const getAgenciesStringQuery = `
309
- query getAgencies {
310
- agencies {
311
- id
312
- name
313
- }
314
- }
313
+ exports.getAgenciesStringQuery = `
314
+ query getAgencies {
315
+ agencies {
316
+ id
317
+ name
318
+ }
319
+ }
315
320
  `;
316
- export const getWebAppRowStringQuery = `
317
- query getWebAppRow($id: Int){
318
- webapp_rows(where: {id: {_eq: $id}}) {
319
- data
320
- }
321
- }
321
+ exports.getWebAppRowStringQuery = `
322
+ query getWebAppRow($id: Int){
323
+ webapp_rows(where: {id: {_eq: $id}}) {
324
+ data
325
+ }
326
+ }
322
327
  `;
323
- export const getWebAppRowsByWebAppTableIdStringQuery = `
324
- query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
325
- webapp_rows (where: {webapp_table_id: {_eq: $webapp_table_id }}) {
326
- id
327
- data
328
- created_at
329
- }
330
- }
328
+ exports.getWebAppRowsByWebAppTableIdStringQuery = `
329
+ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
330
+ webapp_rows (where: {webapp_table_id: {_eq: $webapp_table_id }}) {
331
+ id
332
+ data
333
+ created_at
334
+ }
335
+ }
331
336
  `;
332
- export const getPayeeCategoryByIdStringQuery = `
333
- query getPayeeCategoryById ($id: Int) {
334
- payee_categories (where: {id: {_eq: $id }}) {
335
- payees (order_by: { id: desc }) {
336
- id
337
- name
338
- id_number
339
- email
340
- phone
341
- tin
342
- active
343
- address_line_1
344
- }
345
- }
346
- }
337
+ exports.getPayeeCategoryByIdStringQuery = `
338
+ query getPayeeCategoryById ($id: Int) {
339
+ payee_categories (where: {id: {_eq: $id }}) {
340
+ payees (order_by: { id: desc }) {
341
+ id
342
+ name
343
+ id_number
344
+ email
345
+ phone
346
+ tin
347
+ active
348
+ address_line_1
349
+ }
350
+ }
351
+ }
347
352
  `;
348
- export const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
349
- query getPayeeCategoriesByNotesMatch {
350
- payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
351
- id
352
- name
353
- notes
354
- payees_count
355
- price_list_id
356
- price_list {
357
- id
358
- name
359
- }
360
- payees(order_by: {id: desc}) {
361
- id
362
- name
363
- id_number
364
- email
365
- phone
366
- tin
367
- active
368
- payee_category_id
369
- allowed_payment_terms {
370
- payment_term_id
371
- }
372
- }
373
- }
374
- }
353
+ const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
354
+ query getPayeeCategoriesByNotesMatch {
355
+ payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
356
+ id
357
+ name
358
+ notes
359
+ payees_count
360
+ price_list_id
361
+ price_list {
362
+ id
363
+ name
364
+ }
365
+ payees(order_by: {id: desc}) {
366
+ id
367
+ name
368
+ id_number
369
+ email
370
+ phone
371
+ tin
372
+ active
373
+ payee_category_id
374
+ allowed_payment_terms {
375
+ payment_term_id
376
+ }
377
+ }
378
+ }
379
+ }
375
380
  `;
376
- export const getPayeeCategoriesStringQuery = `
377
- query getPayeeCategories {
378
- payee_categories {
379
- id
380
- name
381
- notes
382
- payees_count
383
- price_list_id
384
- }
385
- }
381
+ exports.getPayeeCategoriesByNotesMatchStringQuery = getPayeeCategoriesByNotesMatchStringQuery;
382
+ exports.getPayeeCategoriesStringQuery = `
383
+ query getPayeeCategories {
384
+ payee_categories {
385
+ id
386
+ name
387
+ notes
388
+ payees_count
389
+ price_list_id
390
+ }
391
+ }
386
392
  `;
387
- export const getProviderCategoriesStringQuery = `
388
- query getProviderCategories {
389
- payee_categories (where: {vendor: {_eq: true}}) {
390
- id
391
- name
392
- notes
393
- payees_count
394
- price_list_id
395
- }
396
- }
393
+ exports.getProviderCategoriesStringQuery = `
394
+ query getProviderCategories {
395
+ payee_categories (where: {vendor: {_eq: true}}) {
396
+ id
397
+ name
398
+ notes
399
+ payees_count
400
+ price_list_id
401
+ }
402
+ }
397
403
  `;
398
- export const getClientCategoriesStringQuery = `
399
- query getClientCategories {
400
- payee_categories (where: {vendor: {_eq: false}}) {
401
- id
402
- name
403
- notes
404
- payees_count
405
- price_list_id
406
- }
407
- }
404
+ exports.getClientCategoriesStringQuery = `
405
+ query getClientCategories {
406
+ payee_categories (where: {vendor: {_eq: false}}) {
407
+ id
408
+ name
409
+ notes
410
+ payees_count
411
+ price_list_id
412
+ }
413
+ }
408
414
  `;
409
- export const getPayeeByIdStringQuery = `
410
- query getPayeeById ($id: Int) {
411
- payees (where: {id: {_eq: $id }}) {
412
- id
413
- name
414
- id_number
415
- email
416
- phone
417
- tin
418
- active
419
- address_line_1
420
- }
421
- }
415
+ exports.getPayeeByIdStringQuery = `
416
+ query getPayeeById ($id: Int) {
417
+ payees (where: {id: {_eq: $id }}) {
418
+ id
419
+ name
420
+ id_number
421
+ email
422
+ phone
423
+ tin
424
+ active
425
+ address_line_1
426
+ }
427
+ }
422
428
  `;
423
- export const getSuperCategoryByIdStringQuery = `
424
- query getSuperCategoryById ($id: Int) {
425
- item_super_categories (where: {id: {_eq: $id }}) {
426
- item_categories {
427
- id
428
- name
429
- notes
430
- items_count
431
- }
432
- }
433
- }
429
+ exports.getSuperCategoryByIdStringQuery = `
430
+ query getSuperCategoryById ($id: Int) {
431
+ item_super_categories (where: {id: {_eq: $id }}) {
432
+ item_categories {
433
+ id
434
+ name
435
+ notes
436
+ items_count
437
+ }
438
+ }
439
+ }
434
440
  `;
435
- export const getItemCategoryByIdStringQuery = `
436
- query getItemCategoryById ($id: Int) {
437
- item_categories (where: {id: {_eq: $id }}) {
438
- id
439
- name
440
- notes
441
- items_count
442
- }
443
- }
441
+ exports.getItemCategoryByIdStringQuery = `
442
+ query getItemCategoryById ($id: Int) {
443
+ item_categories (where: {id: {_eq: $id }}) {
444
+ id
445
+ name
446
+ notes
447
+ items_count
448
+ }
449
+ }
444
450
  `;
445
- export const getItemsByCategoryStringQuery = `
446
- query getItemsByCategory ($id: Int) {
447
- item_categories (where: {id: {_eq: $id }}) {
448
- items (where: {active: {_eq: true }}) {
449
- id,
450
- name,
451
- stocks_only_integer,
452
- code
453
- product_type
454
- }
455
- }
456
- }
451
+ exports.getItemsByCategoryStringQuery = `
452
+ query getItemsByCategory ($id: Int) {
453
+ item_categories (where: {id: {_eq: $id }}) {
454
+ items (where: {active: {_eq: true }}) {
455
+ id,
456
+ name,
457
+ stocks_only_integer,
458
+ code
459
+ product_type
460
+ }
461
+ }
462
+ }
457
463
  `;
458
- export const getItemsStringQuery = `
459
- query getItems {
460
- items (where: {active: {_eq: true }}) {
461
- id,
462
- name
463
- }
464
- }
464
+ exports.getItemsStringQuery = `
465
+ query getItems {
466
+ items (where: {active: {_eq: true }}) {
467
+ id,
468
+ name
469
+ }
470
+ }
465
471
  `;
466
- export const getItemsBySuperCategoryStringQuery = `
467
- query getItemsBySuperCategory ($id: Int, $agency_id: Int) {
468
- item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
469
- item_categories {
470
- items (where: {active: {_eq: true }}) {
471
- id,
472
- name,
473
- stocks_only_integer,
474
- code,
475
- item_category_id,
476
- measurement_unit,
477
- description
478
- product_type
479
- stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
480
- available
481
- id
482
- incoming
483
- outgoing
484
- }
485
- }
486
- }
487
- }
488
- }
472
+ exports.getItemsBySuperCategoryStringQuery = `
473
+ query getItemsBySuperCategory ($id: Int, $agency_id: Int) {
474
+ item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
475
+ item_categories {
476
+ items (where: {active: {_eq: true }}) {
477
+ id,
478
+ name,
479
+ stocks_only_integer,
480
+ code,
481
+ item_category_id,
482
+ measurement_unit,
483
+ description
484
+ product_type
485
+ stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
486
+ available
487
+ id
488
+ incoming
489
+ outgoing
490
+ }
491
+ }
492
+ }
493
+ }
494
+ }
489
495
  `;
490
- export const getConsolidatesBetweenDatesStringQuery = `
491
- query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
492
- consolidates (order_by: {id: desc}, where: {created_at: {_gte: $startDate, _lte: $endDate}}) {
493
- id
494
- id_number
495
- created_at
496
- name
497
- purchase_orders {
498
- id
499
- due
500
- }
501
- }
502
- }
496
+ exports.getConsolidatesBetweenDatesStringQuery = `
497
+ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
498
+ consolidates (order_by: {id: desc}, where: {created_at: {_gte: $startDate, _lte: $endDate}}) {
499
+ id
500
+ id_number
501
+ created_at
502
+ name
503
+ purchase_orders {
504
+ id
505
+ due
506
+ }
507
+ }
508
+ }
503
509
  `;
504
- export const getEmployeeProfileStringQuery = `
505
- query getEmployeeProfile ($id: Int) {
506
- employees(where: {id: {_eq: $id}}) {
507
- agency_id
508
- email
509
- entity_id
510
- id
511
- name
512
- user_id
513
- }
514
- }
510
+ exports.getEmployeeProfileStringQuery = `
511
+ query getEmployeeProfile ($id: Int) {
512
+ employees(where: {id: {_eq: $id}}) {
513
+ agency_id
514
+ email
515
+ entity_id
516
+ id
517
+ name
518
+ user_id
519
+ }
520
+ }
515
521
  `;
516
- export const getEmployeesByAgencyIdStringQuery = `
517
- query getEmployeesByAgencyId ($id: Int) {
518
- employees(where: {agency_id: {_eq: $id}}) {
519
- name
520
- id
521
- user_id
522
- }
523
- }
522
+ exports.getEmployeesByAgencyIdStringQuery = `
523
+ query getEmployeesByAgencyId ($id: Int) {
524
+ employees(where: {agency_id: {_eq: $id}}) {
525
+ name
526
+ id
527
+ user_id
528
+ }
529
+ }
524
530
  `;
525
- export const getBundlesByItemCategoryIdStringQuery = `
526
- query getBundlesByItemCategoryId ($id: Int) {
527
- bundles(where: {active: {_eq: true}, item_category_id: {_eq: $id}}) {
528
- id
529
- code
530
- description
531
- name
532
- updated_at
533
- image5
534
- bundle_details_count
535
- bundle_details {
536
- id
537
- item_id
538
- quantity
539
- }
540
- }
541
- }
531
+ exports.getBundlesByItemCategoryIdStringQuery = `
532
+ query getBundlesByItemCategoryId ($id: Int) {
533
+ bundles(where: {active: {_eq: true}, item_category_id: {_eq: $id}}) {
534
+ id
535
+ code
536
+ description
537
+ name
538
+ updated_at
539
+ image5
540
+ bundle_details_count
541
+ bundle_details {
542
+ id
543
+ item_id
544
+ quantity
545
+ }
546
+ }
547
+ }
542
548
  `;
543
- export const getBundleByNameStringQuery = `
544
- query getBundleByName ($name: String) {
545
- bundles (where: {name: {_eq: $name }}) {
546
- id
547
- }
548
- }
549
+ exports.getBundleByNameStringQuery = `
550
+ query getBundleByName ($name: String) {
551
+ bundles (where: {name: {_eq: $name }}) {
552
+ id
553
+ }
554
+ }
549
555
  `;
550
- export const getItemByNameStringQuery = `
551
- query getItemByName ($name: String) {
552
- items (where: {active: {_eq: true }, name: {_eq: $name }}) {
553
- id
554
- name
555
- stocks_only_integer
556
- code
557
- product_type
558
- }
559
- }
556
+ exports.getItemByNameStringQuery = `
557
+ query getItemByName ($name: String) {
558
+ items (where: {active: {_eq: true }, name: {_eq: $name }}) {
559
+ id
560
+ name
561
+ stocks_only_integer
562
+ code
563
+ product_type
564
+ }
565
+ }
560
566
  `;
561
- export const getShipmentsStringQuery = (wheres = []) => {
567
+ const getShipmentsStringQuery = (wheres = []) => {
562
568
  const additionalWheres = wheres.join(",");
563
- return `query getShipments {
564
- shipments (${additionalWheres.length > 0 ? `where: {${additionalWheres}},` : ""} order_by: {id: desc}) {
565
- id
566
- id_number
567
- reference
568
- needs_transport
569
- payee_id
570
- booker_id
571
- shipped
572
- shipper_id
573
- delivered
574
- delivered_at
575
- voided
576
- returned
577
- memo
578
- planned_delivery
579
- }
580
- }
569
+ return `query getShipments {
570
+ shipments (${additionalWheres.length > 0 ? `where: {${additionalWheres}},` : ""} order_by: {id: desc}) {
571
+ id
572
+ id_number
573
+ reference
574
+ needs_transport
575
+ payee_id
576
+ booker_id
577
+ shipped
578
+ shipper_id
579
+ delivered
580
+ delivered_at
581
+ voided
582
+ returned
583
+ memo
584
+ planned_delivery
585
+ }
586
+ }
581
587
  `;
582
588
  };
583
- export const getFormByNameStringQuery = `
584
- query getFormByName ($name: String) {
585
- settings_forms (
586
- where: {name: {_eq: $name }},
587
- order_by: {zid: desc, version: desc}
588
- ) {
589
- id
590
- zid
591
- name
592
- description
593
- version
594
- active
595
- settings_form_fields (order_by: {position: asc}) {
596
- id
597
- name
598
- field_type
599
- hint
600
- required
601
- default_value
602
- position
603
- print_var_name
604
- form_id
605
- settings_form_field_options {
606
- id
607
- label
608
- position
609
- value
610
- }
611
- }
612
- }
613
- }
589
+ exports.getShipmentsStringQuery = getShipmentsStringQuery;
590
+ const getAllFormsStringQuery = (config = { withSubmissions: false }) => `
591
+ query getAllForms {
592
+ settings_forms (
593
+ order_by: {zid: desc, version: desc}
594
+ ) {
595
+ id
596
+ zid
597
+ name
598
+ description
599
+ version
600
+ active
601
+ ${config.withSubmissions
602
+ ? `settings_form_submissions {
603
+ id
604
+ zid
605
+ reference
606
+ created_at
607
+ version
608
+ id_number
609
+ user_id
610
+ settings_form_submission_values {
611
+ id
612
+ form_field_id
613
+ value
614
+ settings_form_field {
615
+ id
616
+ name
617
+ print_var_name
618
+ field_type
619
+ settings_form_field_options {
620
+ id
621
+ label
622
+ position
623
+ value
624
+ }
625
+ }
626
+ }
627
+ }`
628
+ : ""}
629
+ settings_form_fields (order_by: {position: asc}) {
630
+ id
631
+ name
632
+ field_type
633
+ hint
634
+ required
635
+ default_value
636
+ position
637
+ print_var_name
638
+ form_id
639
+ settings_form_field_options {
640
+ id
641
+ label
642
+ position
643
+ value
644
+ }
645
+ }
646
+ }
647
+ }
614
648
  `;
615
- export const getFormsStringQuery = `
616
- query getForms {
617
- settings_forms (
618
- order_by: {zid: desc, version: desc}
619
- ) {
620
- id
621
- zid
622
- name
623
- description
624
- version
625
- active
626
- settings_form_fields (order_by: {position: asc}) {
627
- id
628
- name
629
- field_type
630
- hint
631
- required
632
- default_value
633
- position
634
- print_var_name
635
- form_id
636
- settings_form_field_options {
637
- id
638
- label
639
- position
640
- value
641
- }
642
- }
643
- }
644
- }
649
+ exports.getAllFormsStringQuery = getAllFormsStringQuery;
650
+ exports.getFormByNameStringQuery = `
651
+ query getFormByName ($name: String) {
652
+ settings_forms (
653
+ where: {name: {_eq: $name }},
654
+ order_by: {zid: desc, version: desc}
655
+ ) {
656
+ id
657
+ zid
658
+ name
659
+ description
660
+ version
661
+ active
662
+ settings_form_fields (order_by: {position: asc}) {
663
+ id
664
+ name
665
+ field_type
666
+ hint
667
+ required
668
+ default_value
669
+ position
670
+ print_var_name
671
+ form_id
672
+ settings_form_field_options {
673
+ id
674
+ label
675
+ position
676
+ value
677
+ }
678
+ }
679
+ }
680
+ }
645
681
  `;
646
- export const getFormsByDocumentTypeStringQuery = (filters = {}) => `
647
- query getFormsByDocumentType ($document_type: String) {
648
- settings_forms (
649
- where: {
650
- ${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
651
- document_type: {_eq: $document_type}
652
- },
653
- order_by: {zid: desc, version: desc}
654
- ) {
655
- id
656
- zid
657
- name
658
- description
659
- version
660
- active
661
- settings_form_fields (order_by: {position: asc}) {
662
- id
663
- name
664
- field_type
665
- hint
666
- required
667
- default_value
668
- position
669
- print_var_name
670
- form_id
671
- settings_form_field_table_headers {
672
- id
673
- name
674
- cell_type
675
- position
676
- }
677
- settings_form_field_options {
678
- id
679
- label
680
- position
681
- value
682
- }
683
- }
684
- }
685
- }
682
+ exports.getFormsStringQuery = `
683
+ query getForms {
684
+ settings_forms (
685
+ order_by: {zid: desc, version: desc}
686
+ ) {
687
+ id
688
+ zid
689
+ name
690
+ description
691
+ version
692
+ active
693
+ settings_form_fields (order_by: {position: asc}) {
694
+ id
695
+ name
696
+ field_type
697
+ hint
698
+ required
699
+ default_value
700
+ position
701
+ print_var_name
702
+ form_id
703
+ settings_form_field_options {
704
+ id
705
+ label
706
+ position
707
+ value
708
+ }
709
+ }
710
+ }
711
+ }
686
712
  `;
687
- export const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
688
- query getMyCaseFormSubmissions ($responsible_id: Int) {
689
- submission_cases (
690
- limit: 500,
691
- where: {
692
- settings_form_submission: {
713
+ const getFormsByDocumentTypeStringQuery = (filters = {}) => `
714
+ query getFormsByDocumentType ($document_type: String) {
715
+ settings_forms (
716
+ where: {
717
+ ${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
718
+ document_type: {_eq: $document_type}
719
+ },
720
+ order_by: {zid: desc, version: desc}
721
+ ) {
722
+ id
723
+ zid
724
+ name
725
+ description
726
+ version
727
+ active
728
+ settings_form_fields (order_by: {position: asc}) {
729
+ id
730
+ name
731
+ field_type
732
+ hint
733
+ required
734
+ default_value
735
+ position
736
+ print_var_name
737
+ form_id
738
+ settings_form_field_table_headers {
739
+ id
740
+ name
741
+ cell_type
742
+ position
743
+ }
744
+ settings_form_field_options {
745
+ id
746
+ label
747
+ position
748
+ value
749
+ }
750
+ }
751
+ }
752
+ }
753
+ `;
754
+ exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
755
+ const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
756
+ query getMyCaseFormSubmissions ($responsible_id: Int) {
757
+ submission_cases (
758
+ limit: 500,
759
+ where: {
760
+ settings_form_submission: {
693
761
  ${filters?.formZid
694
762
  ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
695
- : ""}
696
- voided: {_eq: false}
697
- },
698
- case: {
699
- ${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
700
- responsible_id: {_eq: $responsible_id}
701
- }
702
- },
703
- order_by: {id: desc})
704
- {
705
- id
706
- case_id
707
- form_submission_id
708
- case {
709
- id
710
- id_number
711
- reference
712
- date
713
- symptom
714
- solution
715
- memo
716
- client {
717
- name
718
- address_line_1
719
- }
720
- }
721
- settings_form_submission {
722
- id
723
- zid
724
- reference
725
- created_at
726
- version
727
- id_number
728
- user_id
729
- settings_form_submission_values {
730
- id
731
- form_field_id
732
- value
733
- settings_form_field {
734
- id
735
- name
736
- print_var_name
737
- field_type
738
- settings_form_field_options {
739
- id
740
- label
741
- position
742
- value
743
- }
744
- }
745
- }
746
- settings_form {
747
- id
748
- name
749
- zid
750
- description
751
- created_at
752
- version
753
- }
754
- }
755
- }
756
- }
763
+ : ""}
764
+ voided: {_eq: false}
765
+ },
766
+ case: {
767
+ ${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
768
+ responsible_id: {_eq: $responsible_id}
769
+ }
770
+ },
771
+ order_by: {id: desc})
772
+ {
773
+ id
774
+ case_id
775
+ form_submission_id
776
+ case {
777
+ id
778
+ id_number
779
+ reference
780
+ date
781
+ symptom
782
+ solution
783
+ memo
784
+ client {
785
+ name
786
+ address_line_1
787
+ }
788
+ }
789
+ settings_form_submission {
790
+ id
791
+ zid
792
+ reference
793
+ created_at
794
+ version
795
+ id_number
796
+ user_id
797
+ settings_form_submission_values {
798
+ id
799
+ form_field_id
800
+ value
801
+ settings_form_field {
802
+ id
803
+ name
804
+ print_var_name
805
+ field_type
806
+ settings_form_field_options {
807
+ id
808
+ label
809
+ position
810
+ value
811
+ }
812
+ }
813
+ }
814
+ settings_form {
815
+ id
816
+ name
817
+ zid
818
+ description
819
+ created_at
820
+ version
821
+ }
822
+ }
823
+ }
824
+ }
757
825
  `;
758
- export const getFormSubmissionByIdStringQuery = `
759
- query getFormSubmissionById ($formId: bigint) {
760
- settings_form_submissions (where: {id: { _eq: $formId }}) {
761
- id
762
- zid
763
- reference
764
- created_at
765
- version
766
- id_number
767
- settings_form {
768
- id
769
- name
770
- description
771
- }
772
- settings_form_submission_values {
773
- id
774
- form_field_id
775
- value
776
- settings_form_field {
777
- id
778
- name
779
- print_var_name
780
- field_type
781
- settings_form_field_options {
782
- id
783
- label
784
- position
785
- value
786
- }
787
- }
788
- }
789
- }
790
- }
826
+ exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
827
+ exports.getFormSubmissionByIdStringQuery = `
828
+ query getFormSubmissionById ($formId: bigint) {
829
+ settings_form_submissions (where: {id: { _eq: $formId }}) {
830
+ id
831
+ zid
832
+ reference
833
+ created_at
834
+ version
835
+ id_number
836
+ settings_form {
837
+ id
838
+ name
839
+ description
840
+ }
841
+ settings_form_submission_values {
842
+ id
843
+ form_field_id
844
+ value
845
+ settings_form_field {
846
+ id
847
+ name
848
+ print_var_name
849
+ field_type
850
+ settings_form_field_options {
851
+ id
852
+ label
853
+ position
854
+ value
855
+ }
856
+ }
857
+ }
858
+ }
859
+ }
791
860
  `;
792
- export const getInvoiceFormSubmissionsByAgencyIdStringQuery = (filters) => {
793
- return `
794
- query getInvoiceFormSubmissionsByAgencyId (
795
- $agency_id: Int
796
- ) {
797
- submission_invoices(
798
- where: {
799
- settings_form_submission: {
861
+ const getInvoiceFormSubmissionsByAgencyIdStringQuery = (filters) => {
862
+ return `
863
+ query getInvoiceFormSubmissionsByAgencyId (
864
+ $agency_id: Int
865
+ ) {
866
+ submission_invoices(
867
+ where: {
868
+ settings_form_submission: {
800
869
  ${filters?.some_field_value
801
- ? `settings_form_submission_values: {
802
- value: { _eq: "${filters?.some_field_value}" }
870
+ ? `settings_form_submission_values: {
871
+ value: { _eq: "${filters?.some_field_value}" }
803
872
  },`
804
- : ""}
805
- voided: {_eq: false}
806
- },
873
+ : ""}
874
+ voided: {_eq: false}
875
+ },
807
876
  ${filters?.startDate?.length && filters?.endDate?.length
808
877
  ? `created_at: { _gte: "${filters?.startDate}", _lte: "${filters?.endDate}" },`
809
- : ""}
810
- invoice: {
811
- agency_id: {_eq: $agency_id},
812
- ${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
878
+ : ""}
879
+ invoice: {
880
+ agency_id: {_eq: $agency_id},
881
+ ${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
813
882
  ${filters?.payee_id_number_search
814
883
  ? `payee: { id_number: { _ilike: "%${filters?.payee_id_number_search}%"} },`
815
- : ""}
884
+ : ""}
816
885
  ${filters?.item_ids?.length
817
886
  ? `invoice_details: {item_id: {_in: [${filters?.item_ids?.join(",")}]}}`
818
- : ""}
887
+ : ""}
819
888
  ${filters?.bundle_ids?.length
820
889
  ? `invoice_details: {bundle_id: {_in: [${filters?.bundle_ids?.join(",")}]}}`
821
- : ""}
822
- voided: {_eq: false}
823
- }
824
- },
825
- order_by: {id: desc}
826
- )
827
- {
828
- id
829
- invoice_id
830
- form_submission_id
831
- created_at
832
- invoice {
833
- id_number
834
- date
835
- currency_id
836
- order_number
837
- seller_id
838
- payee_id
839
- payee {
840
- id_number
841
- name
842
- }
843
- }
844
- settings_form_submission {
845
- id
846
- zid
847
- reference
848
- created_at
849
- version
850
- id_number
851
- settings_form_submission_values {
852
- id
853
- form_field_id
854
- value
855
- settings_form_field {
856
- id
857
- name
858
- print_var_name
859
- settings_form_field_options {
860
- id
861
- label
862
- position
863
- value
864
- }
865
- }
866
- }
867
- settings_form {
868
- id
869
- name
870
- zid
871
- description
872
- created_at
873
- version
874
- }
875
- }
876
- }
877
- }
890
+ : ""}
891
+ voided: {_eq: false}
892
+ }
893
+ },
894
+ order_by: {id: desc}
895
+ )
896
+ {
897
+ id
898
+ invoice_id
899
+ form_submission_id
900
+ created_at
901
+ invoice {
902
+ id_number
903
+ date
904
+ currency_id
905
+ order_number
906
+ seller_id
907
+ payee_id
908
+ payee {
909
+ id_number
910
+ name
911
+ }
912
+ }
913
+ settings_form_submission {
914
+ id
915
+ zid
916
+ reference
917
+ created_at
918
+ version
919
+ id_number
920
+ settings_form_submission_values {
921
+ id
922
+ form_field_id
923
+ value
924
+ settings_form_field {
925
+ id
926
+ name
927
+ print_var_name
928
+ settings_form_field_options {
929
+ id
930
+ label
931
+ position
932
+ value
933
+ }
934
+ }
935
+ }
936
+ settings_form {
937
+ id
938
+ name
939
+ zid
940
+ description
941
+ created_at
942
+ version
943
+ }
944
+ }
945
+ }
946
+ }
878
947
  `;
879
948
  };
880
- export const getLastInvoiceFormSubmissionStringQuery = (filters = {}) => `
881
- query getLastInvoiceFormSubmission {
882
- submission_invoices(
883
- where: {
884
- settings_form_submission: {
949
+ exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = getInvoiceFormSubmissionsByAgencyIdStringQuery;
950
+ const getLastInvoiceFormSubmissionStringQuery = (filters = {}) => `
951
+ query getLastInvoiceFormSubmission {
952
+ submission_invoices(
953
+ where: {
954
+ settings_form_submission: {
885
955
  ${filters?.formZid
886
956
  ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
887
- : ""}
888
- voided: {_eq: false}
889
- }
890
- },
891
- order_by: {id: desc},
892
- limit: 1
893
- ) {
894
- settings_form_submission {
895
- id
896
- id_number
897
- }
898
- }
899
- }
957
+ : ""}
958
+ voided: {_eq: false}
959
+ }
960
+ },
961
+ order_by: {id: desc},
962
+ limit: 1
963
+ ) {
964
+ settings_form_submission {
965
+ id
966
+ id_number
967
+ }
968
+ }
969
+ }
900
970
  `;
901
- export const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
902
- query getInvoiceFormSubmissionsByInvoiceId ($invoice_id: bigint) {
903
- submission_invoices(
904
- where: {
905
- invoice_id: {_eq: $invoice_id},
906
- settings_form_submission: {
971
+ exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
972
+ const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
973
+ query getInvoiceFormSubmissionsByInvoiceId ($invoice_id: bigint) {
974
+ submission_invoices(
975
+ where: {
976
+ invoice_id: {_eq: $invoice_id},
977
+ settings_form_submission: {
907
978
  ${filters?.formZid
908
979
  ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
909
- : ""}
910
- voided: {_eq: false}
911
- }
912
- },
913
- order_by: {id: desc}
914
- ) {
915
- id
916
- invoice_id
917
- form_submission_id
918
- created_at
919
- settings_form_submission {
920
- id
921
- zid
922
- reference
923
- created_at
924
- version
925
- id_number
926
- settings_form_submission_values {
927
- id
928
- form_field_id
929
- value
930
- settings_form_field {
931
- id
932
- name
933
- print_var_name
934
- settings_form_field_options {
935
- id
936
- label
937
- position
938
- value
939
- }
940
- }
941
- }
942
- settings_form {
943
- id
944
- name
945
- zid
946
- description
947
- created_at
948
- version
949
- }
950
- }
951
- }
952
- }
980
+ : ""}
981
+ voided: {_eq: false}
982
+ }
983
+ },
984
+ order_by: {id: desc}
985
+ ) {
986
+ id
987
+ invoice_id
988
+ form_submission_id
989
+ created_at
990
+ settings_form_submission {
991
+ id
992
+ zid
993
+ reference
994
+ created_at
995
+ version
996
+ id_number
997
+ settings_form_submission_values {
998
+ id
999
+ form_field_id
1000
+ value
1001
+ settings_form_field {
1002
+ id
1003
+ name
1004
+ print_var_name
1005
+ settings_form_field_options {
1006
+ id
1007
+ label
1008
+ position
1009
+ value
1010
+ }
1011
+ }
1012
+ }
1013
+ settings_form {
1014
+ id
1015
+ name
1016
+ zid
1017
+ description
1018
+ created_at
1019
+ version
1020
+ }
1021
+ }
1022
+ }
1023
+ }
953
1024
  `;
954
- export const getCurrenciesStringQuery = `
955
- query getCurrencies {
956
- currencies {
957
- id
958
- name
959
- prefix
960
- code
961
- country
962
- plural_name
963
- }
964
- }
1025
+ exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = getInvoiceFormSubmissionsByInvoiceIdStringQuery;
1026
+ exports.getCurrenciesStringQuery = `
1027
+ query getCurrencies {
1028
+ currencies {
1029
+ id
1030
+ name
1031
+ prefix
1032
+ code
1033
+ country
1034
+ plural_name
1035
+ }
1036
+ }
965
1037
  `;
966
- export const getSuggestedPricesStringQuery = (config = {
1038
+ const getSuggestedPricesStringQuery = (config = {
967
1039
  notNullPriceList: false,
968
1040
  withItems: false,
969
1041
  withItemCategories: false,
970
1042
  onlyCurrent: false,
971
- }) => `
972
- query getSuggestedPrices {
1043
+ }) => `
1044
+ query getSuggestedPrices {
973
1045
  suggested_prices ${config?.notNullPriceList || config?.onlyCurrent
974
- ? `(
1046
+ ? `(
975
1047
  where: {${[
976
1048
  config?.onlyCurrent ? "current: { _eq: true }" : "",
977
1049
  config?.notNullPriceList ? "price_list_id: { _is_null: false }" : "",
978
1050
  ]
979
1051
  .filter(Boolean)
980
- .join(", ")}
981
- }
1052
+ .join(", ")}
1053
+ }
982
1054
  )`
983
- : ""} {
984
- id
985
- current
986
- currency_id
987
- amount
988
- bundle_id
989
- item_id
990
- notes
991
- price_list_id
992
- flexible_price
993
- price_list {
994
- payee_categories {
995
- id
996
- }
997
- }
1055
+ : ""} {
1056
+ id
1057
+ current
1058
+ currency_id
1059
+ amount
1060
+ bundle_id
1061
+ item_id
1062
+ notes
1063
+ price_list_id
1064
+ flexible_price
1065
+ price_list {
1066
+ payee_categories {
1067
+ id
1068
+ }
1069
+ }
998
1070
  ${config?.withItems
999
- ? `item {
1000
- id
1001
- name
1002
- stocks_only_integer
1003
- code
1004
- product_type
1071
+ ? `item {
1072
+ id
1073
+ name
1074
+ stocks_only_integer
1075
+ code
1076
+ product_type
1005
1077
  ${config?.withItemCategories
1006
- ? `
1007
- item_category {
1008
- id
1009
- name
1010
- notes
1011
- items_count
1012
- }
1078
+ ? `
1079
+ item_category {
1080
+ id
1081
+ name
1082
+ notes
1083
+ items_count
1084
+ }
1013
1085
  `
1014
- : ""}
1086
+ : ""}
1015
1087
  }`
1016
- : ""}
1017
- }
1018
- }
1088
+ : ""}
1089
+ }
1090
+ }
1019
1091
  `;
1020
- export const getPaymentTermsStringQuery = `
1021
- query getPaymentTerms {
1022
- payment_terms {
1023
- active
1024
- id
1025
- memo
1026
- name
1027
- }
1028
- }
1092
+ exports.getSuggestedPricesStringQuery = getSuggestedPricesStringQuery;
1093
+ exports.getPaymentTermsStringQuery = `
1094
+ query getPaymentTerms {
1095
+ payment_terms {
1096
+ active
1097
+ id
1098
+ memo
1099
+ name
1100
+ }
1101
+ }
1029
1102
  `;
1030
- export const getPaymentTermByIdStringQuery = `
1031
- query getPaymentTermById ($id: Int) {
1032
- payment_terms (where: {id: {_eq: $id }}) {
1033
- active
1034
- id
1035
- memo
1036
- name
1037
- account_from_id
1038
- account_to_id
1039
- allowed_payment_terms {
1040
- payee_category_id
1041
- }
1042
- }
1043
- }
1103
+ exports.getPaymentTermByIdStringQuery = `
1104
+ query getPaymentTermById ($id: Int) {
1105
+ payment_terms (where: {id: {_eq: $id }}) {
1106
+ active
1107
+ id
1108
+ memo
1109
+ name
1110
+ account_from_id
1111
+ account_to_id
1112
+ allowed_payment_terms {
1113
+ payee_category_id
1114
+ }
1115
+ }
1116
+ }
1044
1117
  `;
1045
- export const getInvoicesByAgencyIdStringQuery = `
1046
- query getInvoicesByAgencyId($id: Int) {
1047
- invoices(limit: 1000, where: {agency_id: {_eq: $id}, voided: {_eq: false}}, order_by: {id: desc}) {
1048
- id
1049
- zid
1050
- id_number
1051
- currency_id
1052
- date
1053
- payee_id
1054
- total
1055
- subtotal
1056
- seller_id
1057
- order_number
1058
- memo
1059
- issued
1060
- invoice_number
1061
- id_number
1062
- payment_term_id
1063
- reference
1064
- submission_invoices {
1065
- id
1066
- settings_form_submission {
1067
- zid
1068
- voided
1069
- settings_form {
1070
- id
1071
- zid
1072
- }
1073
- }
1074
- }
1075
- invoice_details {
1076
- bundle_id
1077
- id
1078
- item_bundle_name
1079
- item_bundle_description
1080
- item_id
1081
- price
1082
- quantity
1083
- unit_price
1084
- }
1085
- payee {
1086
- name
1087
- payee_category_id
1088
- }
1089
- }
1090
- }
1118
+ exports.getInvoicesByAgencyIdStringQuery = `
1119
+ query getInvoicesByAgencyId($id: Int) {
1120
+ invoices(limit: 1000, where: {agency_id: {_eq: $id}, voided: {_eq: false}}, order_by: {id: desc}) {
1121
+ id
1122
+ zid
1123
+ id_number
1124
+ currency_id
1125
+ date
1126
+ payee_id
1127
+ total
1128
+ subtotal
1129
+ seller_id
1130
+ order_number
1131
+ memo
1132
+ issued
1133
+ invoice_number
1134
+ id_number
1135
+ payment_term_id
1136
+ reference
1137
+ submission_invoices {
1138
+ id
1139
+ settings_form_submission {
1140
+ zid
1141
+ voided
1142
+ settings_form {
1143
+ id
1144
+ zid
1145
+ }
1146
+ }
1147
+ }
1148
+ invoice_details {
1149
+ bundle_id
1150
+ id
1151
+ item_bundle_name
1152
+ item_bundle_description
1153
+ item_id
1154
+ price
1155
+ quantity
1156
+ unit_price
1157
+ }
1158
+ payee {
1159
+ name
1160
+ payee_category_id
1161
+ }
1162
+ }
1163
+ }
1091
1164
  `;
1092
- export const getCasesByResponsibleIdStringQuery = (wheres = []) => {
1165
+ const getCasesByResponsibleIdStringQuery = (wheres = []) => {
1093
1166
  const additionalWheres = wheres.join(",");
1094
- return `
1095
- query getCasesByResponsibleId($responsible_id: Int) {
1096
- cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1097
- id
1098
- id_number
1099
- serial_id
1100
- critical
1101
- reference
1102
- date
1103
- closing_expected_at
1104
- contact_method_id
1105
- symptom
1106
- solution
1107
- memo
1108
- closed
1109
- closed_at
1110
- seller_id
1111
- closer_id
1112
- client_id
1113
- warranty
1114
- courtesy
1115
- client {
1116
- name
1117
- address_line_1
1118
- }
1119
- case_invoices {
1120
- invoice {
1121
- id
1122
- paid
1123
- }
1124
- }
1125
- case_supplies {
1126
- id
1127
- item_id
1128
- }
1129
- }
1130
- }
1167
+ return `
1168
+ query getCasesByResponsibleId($responsible_id: Int) {
1169
+ cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1170
+ id
1171
+ id_number
1172
+ serial_id
1173
+ critical
1174
+ reference
1175
+ date
1176
+ closing_expected_at
1177
+ contact_method_id
1178
+ symptom
1179
+ solution
1180
+ memo
1181
+ closed
1182
+ closed_at
1183
+ seller_id
1184
+ closer_id
1185
+ client_id
1186
+ warranty
1187
+ courtesy
1188
+ client {
1189
+ name
1190
+ address_line_1
1191
+ }
1192
+ case_invoices {
1193
+ invoice {
1194
+ id
1195
+ paid
1196
+ }
1197
+ }
1198
+ case_supplies {
1199
+ id
1200
+ item_id
1201
+ }
1202
+ }
1203
+ }
1131
1204
  `;
1132
1205
  };
1206
+ exports.getCasesByResponsibleIdStringQuery = getCasesByResponsibleIdStringQuery;