@freteclick/quasar-financial-ui 1.0.85 → 1.0.86

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 (51) hide show
  1. package/package.json +17 -17
  2. package/src/components/common/Filters.vue +140 -140
  3. package/src/components/expense/FormExpense.vue +309 -309
  4. package/src/components/expense/TableExpenses.vue +305 -305
  5. package/src/components/invoice/client/ClientInvoiceDetails.vue +212 -212
  6. package/src/components/invoice/client/InvoiceSearching.vue +382 -382
  7. package/src/components/invoice/client/details/InvoiceInvoice.vue +248 -248
  8. package/src/components/invoice/client/details/InvoiceOrders.vue +327 -327
  9. package/src/components/invoice/expense/CreateExpense.vue +539 -539
  10. package/src/components/invoice/expense/DetailExpense.vue +393 -393
  11. package/src/components/invoice/pay/InvoiceDetails.vue +210 -210
  12. package/src/components/invoice/pay/InvoiceSearching.vue +388 -388
  13. package/src/components/invoice/pay/details/InvoiceInvoice.vue +47 -47
  14. package/src/components/invoice/pay/details/InvoiceOrders.vue +342 -342
  15. package/src/components/invoice/receive/InvoiceDetails.vue +280 -280
  16. package/src/components/invoice/receive/InvoiceSearching.vue +359 -359
  17. package/src/components/invoice/receive/details/InvoiceInvoice.vue +445 -371
  18. package/src/components/invoice/receive/details/InvoiceInvoiceBkp.vue +259 -259
  19. package/src/components/invoice/receive/details/InvoiceOrders.vue +369 -369
  20. package/src/i18n/en-us/index.js +8 -8
  21. package/src/i18n/index.js +5 -5
  22. package/src/i18n/pt-br/index.js +30 -30
  23. package/src/pages/Invoice/Client/Details.vue +23 -23
  24. package/src/pages/Invoice/Client/Index.vue +26 -26
  25. package/src/pages/Invoice/Pay/Details.vue +23 -23
  26. package/src/pages/Invoice/Pay/Index.vue +53 -53
  27. package/src/pages/Invoice/Receive/Details.vue +23 -23
  28. package/src/pages/Invoice/Receive/Index.vue +26 -26
  29. package/src/router/routes.js +32 -32
  30. package/src/store/modules/invoice/comission/actions.js +66 -66
  31. package/src/store/modules/invoice/comission/getters.js +6 -6
  32. package/src/store/modules/invoice/comission/index.js +19 -19
  33. package/src/store/modules/invoice/comission/mutation_types.js +7 -7
  34. package/src/store/modules/invoice/comission/mutations.js +42 -42
  35. package/src/store/modules/invoice/expense/actions.js +98 -98
  36. package/src/store/modules/invoice/expense/getters.js +1 -1
  37. package/src/store/modules/invoice/expense/index.js +12 -12
  38. package/src/store/modules/invoice/expense/mutations.js +3 -3
  39. package/src/store/modules/invoice/expense/state.js +5 -5
  40. package/src/store/modules/invoice/pay/actions.js +114 -114
  41. package/src/store/modules/invoice/pay/getters.js +6 -6
  42. package/src/store/modules/invoice/pay/index.js +19 -19
  43. package/src/store/modules/invoice/pay/mutation_types.js +7 -7
  44. package/src/store/modules/invoice/pay/mutations.js +42 -42
  45. package/src/store/modules/invoice/receive/actions.js +163 -152
  46. package/src/store/modules/invoice/receive/actionsBkp.js +77 -77
  47. package/src/store/modules/invoice/receive/getters.js +6 -6
  48. package/src/store/modules/invoice/receive/index.js +19 -19
  49. package/src/store/modules/invoice/receive/mutation_types.js +7 -7
  50. package/src/store/modules/invoice/receive/mutations.js +42 -42
  51. package/src/store/store-flag.d.ts +9 -9
@@ -1,383 +1,383 @@
1
- <template>
2
- <div>
3
- <q-table
4
- :loading ="isLoading"
5
- :data ="data"
6
- :columns ="settings.columns"
7
- :pagination.sync="pagination"
8
- @request ="onRequest"
9
- row-key ="id"
10
- :visible-columns="settings.visibleColumns"
11
- style ="min-height: 90vh;"
12
- >
13
- <template v-slot:top v-if="search === true">
14
- <div class="col-xs-12 q-pb-md text-h6">
15
- Faturas
16
- </div>
17
- <div class="col-sm-6 col-xs-12 q-pa-md">
18
- <q-input stack-label
19
- label ="Buscar por"
20
- debounce="1000"
21
- v-model ="filters.text"
22
- class ="full-width"
23
- />
24
- </div>
25
- <div class="col-sm-6 col-xs-12 q-pa-md">
26
- <q-select stack-label
27
- label ="Status da fatura"
28
- v-model ="filters.status"
29
- :options="statuses"
30
- class ="full-width"
31
- :loading="loadingStatuses"
32
- >
33
- <template v-slot:no-option>
34
- <q-item>
35
- <q-item-section class="text-grey">
36
- Sem resultados
37
- </q-item-section>
38
- </q-item>
39
- </template>
40
- </q-select>
41
- </div>
42
- </template>
43
-
44
- <template v-slot:body="props">
45
- <q-tr :props="props">
46
- <q-td key="id" :props="props">
47
- <q-btn outline dense
48
- :to ="{ name: 'ClientInvoiceDetails', params: { id: props.row.id } }"
49
- :label="props.cols[0].value"
50
- :style="{color:props.row.color_status}"
51
- class ="full-width"
52
- />
53
- </q-td>
54
- <q-td key="pedidos" :props="props">
55
- <q-btn outline dense
56
- :label="props.row.pedidos.length > 1 ? `${props.row.pedidos.length} Pedidos` : '1 Pedido'"
57
- color ="primary"
58
- @click="seeOrdersList(props.row.pedidos, props.row.id)"
59
- class ="full-width"
60
- />
61
- </q-td>
62
- <q-td key="dataVencimento" :props="props">{{ props.cols[2].value }}</q-td>
63
- <q-td key="fornecedor" :props="props">{{ props.cols[3].value }}</q-td>
64
- <q-td key="status" :props="props" :style="{color:props.row.color_status}">
65
- {{ $t(`invoice.statuses.${props.row.status}`) }}
66
- </q-td>
67
- <q-td key="preco" :props="props">{{ props.cols[5].value }}</q-td>
68
- </q-tr>
69
- </template>
70
- </q-table>
71
-
72
- <q-dialog v-model="dialogs.orders.visible" transition-show="scale" transition-hide="scale">
73
- <q-card class="text-white" style="background-color: #00519b; width: 300px">
74
- <q-card-section>
75
- <div class="row items-center">
76
- <div class="text-h6">Pedidos da Fatura #{{ dialogs.orders.invoice }}</div>
77
- <q-space />
78
- <q-btn icon="close" color="white" flat round dense v-close-popup />
79
- </div>
80
- </q-card-section>
81
-
82
- <q-card-section class="q-pt-none">
83
- <q-markup-table>
84
- <tbody>
85
- <tr
86
- v-for="(orderId, index) in dialogs.orders.items"
87
- :key ="index"
88
- >
89
- <td class="text-center">
90
- <q-btn flat
91
- color ="primary"
92
- :label="`Ver pedido #${orderId}`"
93
- :to ="{ name: 'ClientOrderDetails', params: { id: orderId } }"
94
- />
95
- </td>
96
- </tr>
97
- </tbody>
98
- </q-markup-table>
99
- </q-card-section>
100
- </q-card>
101
- </q-dialog>
102
- </div>
103
- </template>
104
-
105
- <script>
106
- import { mapActions, mapGetters } from 'vuex';
107
- import { formatMoney } from '@freteclick/quasar-common-ui/src/utils/formatter';
108
- import { date } from 'quasar';
109
-
110
- const SETTINGS = {
111
- visibleColumns: [
112
- 'id' ,
113
- 'pedidos' ,
114
- 'dataVencimento',
115
- 'fornecedor' ,
116
- 'status' ,
117
- 'preco' ,
118
- ],
119
- columns : [
120
- {
121
- name : 'id',
122
- field : 'id',
123
- align : 'left',
124
- format: (val, row) => {
125
- return `#${val}`;
126
- },
127
- label : 'ID'
128
- },
129
- {
130
- name : 'pedidos',
131
- align: 'left',
132
- field: 'pedidos',
133
- label: 'Pedidos'
134
- },
135
- {
136
- name : 'dataVencimento',
137
- field : 'dataVencimento',
138
- align : 'left',
139
- format: (val, row) => {
140
- return date.formatDate(val + 'T23:59:00', 'DD/MM/YYYY')
141
- },
142
- label : 'Data vencimento'
143
- },
144
- {
145
- name : 'fornecedor',
146
- field: 'fornecedor',
147
- align: 'left',
148
- label: 'Fornecedor'
149
- },
150
- {
151
- name : 'status',
152
- field : 'status',
153
- align : 'left',
154
- label : 'Status'
155
- },
156
- {
157
- name : 'preco',
158
- field : 'preco',
159
- align : 'left',
160
- format: (val, row) => {
161
- return formatMoney(val, 'BRL', 'pt-br');
162
- },
163
- label : 'Preço'
164
- },
165
- ],
166
- };
167
-
168
- Object.freeze(SETTINGS);
169
-
170
- export default {
171
- props: {
172
- search : {
173
- type : Boolean,
174
- required: false,
175
- default : true,
176
- },
177
- orderId: {
178
- type : String,
179
- required: false,
180
- default : null,
181
- },
182
- },
183
-
184
- created() {
185
- if (this.myCompany !== null) {
186
- this.filters.company = this.myCompany;
187
- this.onRequest({
188
- pagination: this.pagination,
189
- filter : this.filters,
190
- });
191
- }
192
- this.requestStatuses();
193
- },
194
-
195
- beforeDestroy() {
196
- this.reset();
197
- },
198
-
199
- data() {
200
- let statuses = [
201
- { 'label': 'Todos', 'value': -1 },
202
- ];
203
-
204
- return {
205
- settings : SETTINGS,
206
- statuses : statuses,
207
- loadingStatuses: false,
208
- dialogs : {
209
- orders: {
210
- visible: false,
211
- items : [],
212
- invoice: null,
213
- },
214
- },
215
- data : [],
216
- filters : {
217
- text : null,
218
- status : statuses[0],
219
- company: null,
220
- },
221
- pagination : {
222
- sortBy : 'dataVencimento',
223
- descending : false,
224
- page : 1,
225
- rowsPerPage: 10,
226
- rowsNumber : 10,
227
- },
228
- }
229
- },
230
-
231
- computed: {
232
- ...mapGetters({
233
- isLoading : 'payInvoice/isLoading' ,
234
- error : 'payInvoice/error' ,
235
- violations: 'payInvoice/violations',
236
- items : 'payInvoice/items' ,
237
- totalItems: 'payInvoice/totalItems',
238
- myCompany : 'people/currentCompany',
239
- }),
240
- },
241
-
242
- watch: {
243
- myCompany(company) {
244
- if (company !== null) {
245
- this.filters.company = company;
246
- this.onRequest({
247
- pagination: this.pagination,
248
- filter : this.filters,
249
- });
250
- }
251
- },
252
-
253
- totalItems(val) {
254
- this.pagination.rowsNumber = val;
255
- },
256
-
257
- items(items) {
258
- if (!items)
259
- return;
260
-
261
- let data = [];
262
-
263
- for (let i in items) {
264
- let item = items[i];
265
- let orders = [];
266
-
267
- for (let o in item.order) {
268
- orders.push(
269
- item.order[o].order['@id'].match(/^\/purchasing\/orders\/([a-z0-9-]*)$/)[1]
270
- );
271
- }
272
-
273
- data.push({
274
- '@id' : item['@id'],
275
- 'id' : item['@id'].match(/^\/finance\/pay\/([a-z0-9-]*)$/)[1],
276
- 'pedidos' : orders,
277
- 'color_status' : item.status.color,
278
- 'dataVencimento': item.dueDate,
279
- 'fornecedor' : item.order[0].order.provider.alias,
280
- 'status' : item.status.status,
281
- 'preco' : item.price,
282
- });
283
- }
284
-
285
- this.data = data;
286
- },
287
-
288
- 'filters.text'() {
289
- this.onRequest({
290
- pagination: this.pagination,
291
- filter : this.filters,
292
- });
293
- },
294
-
295
- 'filters.status'() {
296
- this.onRequest({
297
- pagination: this.pagination,
298
- filter : this.filters,
299
- });
300
- },
301
- },
302
-
303
- methods: {
304
- ...mapActions({
305
- getItems : 'payInvoice/getItems' ,
306
- reset : 'payInvoice/reset' ,
307
- getStatuses: 'payInvoice/getStatuses',
308
- }),
309
-
310
- seeOrdersList(ordersId, invoiceId) {
311
- this.dialogs.orders.items = ordersId;
312
- this.dialogs.orders.invoice = invoiceId;
313
- this.dialogs.orders.visible = true;
314
- },
315
-
316
- requestStatuses() {
317
- this.loadingStatuses = true;
318
- this.getStatuses({
319
- context: "invoice",
320
- 'visibility': 'public',
321
- 'realStatus': ['open', 'pending', 'canceled', 'closed'],
322
- })
323
- .then(statuses => {
324
- if (statuses.length) {
325
- let data = [];
326
- for (let index in statuses) {
327
- let item = statuses[index];
328
- this.statuses.push({
329
- 'label': this.$t(`invoice.statuses.${item.status}`),
330
- 'value': item['@id'].match(/^\/statuses\/([a-z0-9-]*)$/)[1],
331
- });
332
- }
333
- }
334
- this.loadingStatuses = false;
335
- });
336
- },
337
-
338
- onRequest(props) {
339
- let {
340
- page,
341
- rowsPerPage,
342
- rowsNumber,
343
- sortBy,
344
- descending
345
- } = props.pagination;
346
- let filter = props.filter;
347
- let params = { itemsPerPage: rowsPerPage, page };
348
-
349
- if (this.filters.text != null && this.filters.text.length > 0) {
350
- if (this.filters.text.length < 2)
351
- return;
352
-
353
- params['searchBy'] = this.filters.text;
354
- }
355
-
356
- if (this.filters.status != null && this.filters.status.value != -1) {
357
- params['status'] = this.filters.status.value;
358
- }
359
- else {
360
- params['status.realStatus'] = ['open', 'pending'];
361
- }
362
-
363
- if (this.filters.company != null) {
364
- params['myCompany'] = this.filters.company.id;
365
- }
366
-
367
- if (this.orderId !== null) {
368
- params['order.order'] = this.orderId;
369
- }
370
-
371
- params['invoice[dueDate]'] = 'desc';
372
-
373
- this.getItems(params)
374
- .then(() => {
375
- this.pagination.page = page;
376
- this.pagination.rowsPerPage = rowsPerPage;
377
- this.pagination.sortBy = sortBy;
378
- this.pagination.descending = descending;
379
- });
380
- },
381
- },
382
- };
1
+ <template>
2
+ <div>
3
+ <q-table
4
+ :loading ="isLoading"
5
+ :data ="data"
6
+ :columns ="settings.columns"
7
+ :pagination.sync="pagination"
8
+ @request ="onRequest"
9
+ row-key ="id"
10
+ :visible-columns="settings.visibleColumns"
11
+ style ="min-height: 90vh;"
12
+ >
13
+ <template v-slot:top v-if="search === true">
14
+ <div class="col-xs-12 q-pb-md text-h6">
15
+ Faturas
16
+ </div>
17
+ <div class="col-sm-6 col-xs-12 q-pa-md">
18
+ <q-input stack-label
19
+ label ="Buscar por"
20
+ debounce="1000"
21
+ v-model ="filters.text"
22
+ class ="full-width"
23
+ />
24
+ </div>
25
+ <div class="col-sm-6 col-xs-12 q-pa-md">
26
+ <q-select stack-label
27
+ label ="Status da fatura"
28
+ v-model ="filters.status"
29
+ :options="statuses"
30
+ class ="full-width"
31
+ :loading="loadingStatuses"
32
+ >
33
+ <template v-slot:no-option>
34
+ <q-item>
35
+ <q-item-section class="text-grey">
36
+ Sem resultados
37
+ </q-item-section>
38
+ </q-item>
39
+ </template>
40
+ </q-select>
41
+ </div>
42
+ </template>
43
+
44
+ <template v-slot:body="props">
45
+ <q-tr :props="props">
46
+ <q-td key="id" :props="props">
47
+ <q-btn outline dense
48
+ :to ="{ name: 'ClientInvoiceDetails', params: { id: props.row.id } }"
49
+ :label="props.cols[0].value"
50
+ :style="{color:props.row.color_status}"
51
+ class ="full-width"
52
+ />
53
+ </q-td>
54
+ <q-td key="pedidos" :props="props">
55
+ <q-btn outline dense
56
+ :label="props.row.pedidos.length > 1 ? `${props.row.pedidos.length} Pedidos` : '1 Pedido'"
57
+ color ="primary"
58
+ @click="seeOrdersList(props.row.pedidos, props.row.id)"
59
+ class ="full-width"
60
+ />
61
+ </q-td>
62
+ <q-td key="dataVencimento" :props="props">{{ props.cols[2].value }}</q-td>
63
+ <q-td key="fornecedor" :props="props">{{ props.cols[3].value }}</q-td>
64
+ <q-td key="status" :props="props" :style="{color:props.row.color_status}">
65
+ {{ $t(`invoice.statuses.${props.row.status}`) }}
66
+ </q-td>
67
+ <q-td key="preco" :props="props">{{ props.cols[5].value }}</q-td>
68
+ </q-tr>
69
+ </template>
70
+ </q-table>
71
+
72
+ <q-dialog v-model="dialogs.orders.visible" transition-show="scale" transition-hide="scale">
73
+ <q-card class="text-white" style="background-color: #00519b; width: 300px">
74
+ <q-card-section>
75
+ <div class="row items-center">
76
+ <div class="text-h6">Pedidos da Fatura #{{ dialogs.orders.invoice }}</div>
77
+ <q-space />
78
+ <q-btn icon="close" color="white" flat round dense v-close-popup />
79
+ </div>
80
+ </q-card-section>
81
+
82
+ <q-card-section class="q-pt-none">
83
+ <q-markup-table>
84
+ <tbody>
85
+ <tr
86
+ v-for="(orderId, index) in dialogs.orders.items"
87
+ :key ="index"
88
+ >
89
+ <td class="text-center">
90
+ <q-btn flat
91
+ color ="primary"
92
+ :label="`Ver pedido #${orderId}`"
93
+ :to ="{ name: 'ClientOrderDetails', params: { id: orderId } }"
94
+ />
95
+ </td>
96
+ </tr>
97
+ </tbody>
98
+ </q-markup-table>
99
+ </q-card-section>
100
+ </q-card>
101
+ </q-dialog>
102
+ </div>
103
+ </template>
104
+
105
+ <script>
106
+ import { mapActions, mapGetters } from 'vuex';
107
+ import { formatMoney } from '@freteclick/quasar-common-ui/src/utils/formatter';
108
+ import { date } from 'quasar';
109
+
110
+ const SETTINGS = {
111
+ visibleColumns: [
112
+ 'id' ,
113
+ 'pedidos' ,
114
+ 'dataVencimento',
115
+ 'fornecedor' ,
116
+ 'status' ,
117
+ 'preco' ,
118
+ ],
119
+ columns : [
120
+ {
121
+ name : 'id',
122
+ field : 'id',
123
+ align : 'left',
124
+ format: (val, row) => {
125
+ return `#${val}`;
126
+ },
127
+ label : 'ID'
128
+ },
129
+ {
130
+ name : 'pedidos',
131
+ align: 'left',
132
+ field: 'pedidos',
133
+ label: 'Pedidos'
134
+ },
135
+ {
136
+ name : 'dataVencimento',
137
+ field : 'dataVencimento',
138
+ align : 'left',
139
+ format: (val, row) => {
140
+ return date.formatDate(val + 'T23:59:00', 'DD/MM/YYYY')
141
+ },
142
+ label : 'Data vencimento'
143
+ },
144
+ {
145
+ name : 'fornecedor',
146
+ field: 'fornecedor',
147
+ align: 'left',
148
+ label: 'Fornecedor'
149
+ },
150
+ {
151
+ name : 'status',
152
+ field : 'status',
153
+ align : 'left',
154
+ label : 'Status'
155
+ },
156
+ {
157
+ name : 'preco',
158
+ field : 'preco',
159
+ align : 'left',
160
+ format: (val, row) => {
161
+ return formatMoney(val, 'BRL', 'pt-br');
162
+ },
163
+ label : 'Preço'
164
+ },
165
+ ],
166
+ };
167
+
168
+ Object.freeze(SETTINGS);
169
+
170
+ export default {
171
+ props: {
172
+ search : {
173
+ type : Boolean,
174
+ required: false,
175
+ default : true,
176
+ },
177
+ orderId: {
178
+ type : String,
179
+ required: false,
180
+ default : null,
181
+ },
182
+ },
183
+
184
+ created() {
185
+ if (this.myCompany !== null) {
186
+ this.filters.company = this.myCompany;
187
+ this.onRequest({
188
+ pagination: this.pagination,
189
+ filter : this.filters,
190
+ });
191
+ }
192
+ this.requestStatuses();
193
+ },
194
+
195
+ beforeDestroy() {
196
+ this.reset();
197
+ },
198
+
199
+ data() {
200
+ let statuses = [
201
+ { 'label': 'Todos', 'value': -1 },
202
+ ];
203
+
204
+ return {
205
+ settings : SETTINGS,
206
+ statuses : statuses,
207
+ loadingStatuses: false,
208
+ dialogs : {
209
+ orders: {
210
+ visible: false,
211
+ items : [],
212
+ invoice: null,
213
+ },
214
+ },
215
+ data : [],
216
+ filters : {
217
+ text : null,
218
+ status : statuses[0],
219
+ company: null,
220
+ },
221
+ pagination : {
222
+ sortBy : 'dataVencimento',
223
+ descending : false,
224
+ page : 1,
225
+ rowsPerPage: 10,
226
+ rowsNumber : 10,
227
+ },
228
+ }
229
+ },
230
+
231
+ computed: {
232
+ ...mapGetters({
233
+ isLoading : 'payInvoice/isLoading' ,
234
+ error : 'payInvoice/error' ,
235
+ violations: 'payInvoice/violations',
236
+ items : 'payInvoice/items' ,
237
+ totalItems: 'payInvoice/totalItems',
238
+ myCompany : 'people/currentCompany',
239
+ }),
240
+ },
241
+
242
+ watch: {
243
+ myCompany(company) {
244
+ if (company !== null) {
245
+ this.filters.company = company;
246
+ this.onRequest({
247
+ pagination: this.pagination,
248
+ filter : this.filters,
249
+ });
250
+ }
251
+ },
252
+
253
+ totalItems(val) {
254
+ this.pagination.rowsNumber = val;
255
+ },
256
+
257
+ items(items) {
258
+ if (!items)
259
+ return;
260
+
261
+ let data = [];
262
+
263
+ for (let i in items) {
264
+ let item = items[i];
265
+ let orders = [];
266
+
267
+ for (let o in item.order) {
268
+ orders.push(
269
+ item.order[o].order['@id'].match(/^\/purchasing\/orders\/([a-z0-9-]*)$/)[1]
270
+ );
271
+ }
272
+
273
+ data.push({
274
+ '@id' : item['@id'],
275
+ 'id' : item['@id'].match(/^\/finance\/pay\/([a-z0-9-]*)$/)[1],
276
+ 'pedidos' : orders,
277
+ 'color_status' : item.status.color,
278
+ 'dataVencimento': item.dueDate,
279
+ 'fornecedor' : item.order[0].order.provider.alias,
280
+ 'status' : item.status.status,
281
+ 'preco' : item.price,
282
+ });
283
+ }
284
+
285
+ this.data = data;
286
+ },
287
+
288
+ 'filters.text'() {
289
+ this.onRequest({
290
+ pagination: this.pagination,
291
+ filter : this.filters,
292
+ });
293
+ },
294
+
295
+ 'filters.status'() {
296
+ this.onRequest({
297
+ pagination: this.pagination,
298
+ filter : this.filters,
299
+ });
300
+ },
301
+ },
302
+
303
+ methods: {
304
+ ...mapActions({
305
+ getItems : 'payInvoice/getItems' ,
306
+ reset : 'payInvoice/reset' ,
307
+ getStatuses: 'payInvoice/getStatuses',
308
+ }),
309
+
310
+ seeOrdersList(ordersId, invoiceId) {
311
+ this.dialogs.orders.items = ordersId;
312
+ this.dialogs.orders.invoice = invoiceId;
313
+ this.dialogs.orders.visible = true;
314
+ },
315
+
316
+ requestStatuses() {
317
+ this.loadingStatuses = true;
318
+ this.getStatuses({
319
+ context: "invoice",
320
+ 'visibility': 'public',
321
+ 'realStatus': ['open', 'pending', 'canceled', 'closed'],
322
+ })
323
+ .then(statuses => {
324
+ if (statuses.length) {
325
+ let data = [];
326
+ for (let index in statuses) {
327
+ let item = statuses[index];
328
+ this.statuses.push({
329
+ 'label': this.$t(`invoice.statuses.${item.status}`),
330
+ 'value': item['@id'].match(/^\/statuses\/([a-z0-9-]*)$/)[1],
331
+ });
332
+ }
333
+ }
334
+ this.loadingStatuses = false;
335
+ });
336
+ },
337
+
338
+ onRequest(props) {
339
+ let {
340
+ page,
341
+ rowsPerPage,
342
+ rowsNumber,
343
+ sortBy,
344
+ descending
345
+ } = props.pagination;
346
+ let filter = props.filter;
347
+ let params = { itemsPerPage: rowsPerPage, page };
348
+
349
+ if (this.filters.text != null && this.filters.text.length > 0) {
350
+ if (this.filters.text.length < 2)
351
+ return;
352
+
353
+ params['searchBy'] = this.filters.text;
354
+ }
355
+
356
+ if (this.filters.status != null && this.filters.status.value != -1) {
357
+ params['status'] = this.filters.status.value;
358
+ }
359
+ else {
360
+ params['status.realStatus'] = ['open', 'pending'];
361
+ }
362
+
363
+ if (this.filters.company != null) {
364
+ params['myCompany'] = this.filters.company.id;
365
+ }
366
+
367
+ if (this.orderId !== null) {
368
+ params['order.order'] = this.orderId;
369
+ }
370
+
371
+ params['invoice[dueDate]'] = 'desc';
372
+
373
+ this.getItems(params)
374
+ .then(() => {
375
+ this.pagination.page = page;
376
+ this.pagination.rowsPerPage = rowsPerPage;
377
+ this.pagination.sortBy = sortBy;
378
+ this.pagination.descending = descending;
379
+ });
380
+ },
381
+ },
382
+ };
383
383
  </script>