@freteclick/quasar-financial-ui 1.0.85 → 1.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/components/common/Filters.vue +140 -140
- package/src/components/expense/FormExpense.vue +309 -309
- package/src/components/expense/TableExpenses.vue +305 -305
- package/src/components/invoice/client/ClientInvoiceDetails.vue +212 -212
- package/src/components/invoice/client/InvoiceSearching.vue +382 -382
- package/src/components/invoice/client/details/InvoiceInvoice.vue +248 -248
- package/src/components/invoice/client/details/InvoiceOrders.vue +327 -327
- package/src/components/invoice/expense/CreateExpense.vue +539 -539
- package/src/components/invoice/expense/DetailExpense.vue +393 -393
- package/src/components/invoice/pay/InvoiceDetails.vue +210 -210
- package/src/components/invoice/pay/InvoiceSearching.vue +388 -388
- package/src/components/invoice/pay/details/InvoiceInvoice.vue +47 -47
- package/src/components/invoice/pay/details/InvoiceOrders.vue +342 -342
- package/src/components/invoice/receive/InvoiceDetails.vue +280 -280
- package/src/components/invoice/receive/InvoiceSearching.vue +359 -359
- package/src/components/invoice/receive/details/InvoiceInvoice.vue +453 -371
- package/src/components/invoice/receive/details/InvoiceInvoiceBkp.vue +259 -259
- package/src/components/invoice/receive/details/InvoiceOrders.vue +369 -369
- package/src/i18n/en-us/index.js +8 -8
- package/src/i18n/index.js +5 -5
- package/src/i18n/pt-br/index.js +30 -30
- package/src/pages/Invoice/Client/Details.vue +23 -23
- package/src/pages/Invoice/Client/Index.vue +26 -26
- package/src/pages/Invoice/Pay/Details.vue +23 -23
- package/src/pages/Invoice/Pay/Index.vue +53 -53
- package/src/pages/Invoice/Receive/Details.vue +23 -23
- package/src/pages/Invoice/Receive/Index.vue +26 -26
- package/src/router/routes.js +32 -32
- package/src/store/modules/invoice/comission/actions.js +66 -66
- package/src/store/modules/invoice/comission/getters.js +6 -6
- package/src/store/modules/invoice/comission/index.js +19 -19
- package/src/store/modules/invoice/comission/mutation_types.js +7 -7
- package/src/store/modules/invoice/comission/mutations.js +42 -42
- package/src/store/modules/invoice/expense/actions.js +98 -98
- package/src/store/modules/invoice/expense/getters.js +1 -1
- package/src/store/modules/invoice/expense/index.js +12 -12
- package/src/store/modules/invoice/expense/mutations.js +3 -3
- package/src/store/modules/invoice/expense/state.js +5 -5
- package/src/store/modules/invoice/pay/actions.js +114 -114
- package/src/store/modules/invoice/pay/getters.js +6 -6
- package/src/store/modules/invoice/pay/index.js +19 -19
- package/src/store/modules/invoice/pay/mutation_types.js +7 -7
- package/src/store/modules/invoice/pay/mutations.js +42 -42
- package/src/store/modules/invoice/receive/actions.js +163 -152
- package/src/store/modules/invoice/receive/actionsBkp.js +77 -77
- package/src/store/modules/invoice/receive/getters.js +6 -6
- package/src/store/modules/invoice/receive/index.js +19 -19
- package/src/store/modules/invoice/receive/mutation_types.js +7 -7
- package/src/store/modules/invoice/receive/mutations.js +42 -42
- package/src/store/store-flag.d.ts +9 -9
|
@@ -1,305 +1,305 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<q-table
|
|
4
|
-
:loading ="isLoading"
|
|
5
|
-
:data ="items"
|
|
6
|
-
:columns ="settings.columns"
|
|
7
|
-
:pagination.sync="pagination"
|
|
8
|
-
@request ="onRequest"
|
|
9
|
-
row-key ="id"
|
|
10
|
-
style ="min-height: 90vh;"
|
|
11
|
-
:rows-per-page-options="[5, 10, 15, 20, 25, 50]"
|
|
12
|
-
>
|
|
13
|
-
<template v-slot:top>
|
|
14
|
-
<div class="col-xs-12 q-mb-md">
|
|
15
|
-
<div class="row justify-end">
|
|
16
|
-
<q-btn
|
|
17
|
-
:label="$t('Adicionar despesa')"
|
|
18
|
-
icon ="add"
|
|
19
|
-
size ="md"
|
|
20
|
-
color ="primary"
|
|
21
|
-
class ="q-ml-sm"
|
|
22
|
-
@click="() => {
|
|
23
|
-
dialogs.expense.id = null;
|
|
24
|
-
dialogs.expense.visible = true;
|
|
25
|
-
}"
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
<template v-slot:body="props">
|
|
31
|
-
<q-tr :props="props">
|
|
32
|
-
<q-td key="id" :props="props">
|
|
33
|
-
<q-btn outline dense
|
|
34
|
-
:label="`#${props.row.id}`"
|
|
35
|
-
:style="{color:props.row.color_status}"
|
|
36
|
-
class ="full-width"
|
|
37
|
-
@click="() => {
|
|
38
|
-
dialogs.expense.id = props.row.id;
|
|
39
|
-
dialogs.expense.visible = true;
|
|
40
|
-
}"
|
|
41
|
-
/>
|
|
42
|
-
</q-td>
|
|
43
|
-
<q-td key="category" :props="props">{{ props.row.category }}</q-td>
|
|
44
|
-
<q-td key="provider" :props="props">{{ props.row.provider }}</q-td>
|
|
45
|
-
<q-td key="parcels" :props="props">{{ props.row.parcels }}</q-td>
|
|
46
|
-
<q-td key="amount" :props="props">{{ props.row.amount }}</q-td>
|
|
47
|
-
<q-td key="dueDate" :props="props">{{ props.row.dueDate }}</q-td>
|
|
48
|
-
<q-td key="description" :props="props">{{ props.row.description }}</q-td>
|
|
49
|
-
<q-td key="paymentDay" :props="props">{{ props.row.paymentDay }}</q-td>
|
|
50
|
-
</q-tr>
|
|
51
|
-
</template>
|
|
52
|
-
</q-table>
|
|
53
|
-
|
|
54
|
-
<q-dialog v-model="dialogs.expense.visible" @before-hide="reload">
|
|
55
|
-
<q-card style="width: 700px; max-width: 80vw;">
|
|
56
|
-
<q-card-section class="row items-center justify-end">
|
|
57
|
-
<q-btn icon="close" flat round dense v-close-popup />
|
|
58
|
-
</q-card-section>
|
|
59
|
-
<q-card-section>
|
|
60
|
-
<FormExpense
|
|
61
|
-
:id ="dialogs.expense.id"
|
|
62
|
-
:api="api"
|
|
63
|
-
/>
|
|
64
|
-
</q-card-section>
|
|
65
|
-
</q-card>
|
|
66
|
-
</q-dialog>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
|
|
70
|
-
<script>
|
|
71
|
-
import { mapGetters } from 'vuex';
|
|
72
|
-
import Api from '@freteclick/quasar-common-ui/src/utils/api';
|
|
73
|
-
import { formatDateYmdTodmY, formatMoney } from '@freteclick/quasar-common-ui/src/utils/formatter';
|
|
74
|
-
import FormExpense from './FormExpense';
|
|
75
|
-
|
|
76
|
-
const SETTINGS = {
|
|
77
|
-
columns : [
|
|
78
|
-
{
|
|
79
|
-
name : 'id',
|
|
80
|
-
field : 'id',
|
|
81
|
-
align : 'left',
|
|
82
|
-
label : 'ID'
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name : 'category',
|
|
86
|
-
align : 'left',
|
|
87
|
-
label : 'Categoria'
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name : 'provider',
|
|
91
|
-
align : 'left',
|
|
92
|
-
label : 'Fornecedor'
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name : 'parcels',
|
|
96
|
-
align : 'left',
|
|
97
|
-
label : 'Parcelas'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name : 'amount',
|
|
101
|
-
align : 'left',
|
|
102
|
-
label : 'Valor'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name : 'dueDate',
|
|
106
|
-
align : 'left',
|
|
107
|
-
label : 'Data vencimento'
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name : 'description',
|
|
111
|
-
align : 'left',
|
|
112
|
-
label : 'Descrição'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name : 'paymentDay',
|
|
116
|
-
align : 'left',
|
|
117
|
-
label : 'Dia pagamento'
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
Object.freeze(SETTINGS);
|
|
123
|
-
|
|
124
|
-
export default {
|
|
125
|
-
props: {
|
|
126
|
-
api: {
|
|
127
|
-
type : Api,
|
|
128
|
-
required: true
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
components: {
|
|
133
|
-
FormExpense,
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
created() {
|
|
137
|
-
if (this.myCompany !== null)
|
|
138
|
-
this.onRequest({
|
|
139
|
-
pagination: this.pagination
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
data() {
|
|
144
|
-
return {
|
|
145
|
-
settings : SETTINGS,
|
|
146
|
-
items : [],
|
|
147
|
-
pagination : {
|
|
148
|
-
sortBy : 'dueDate',
|
|
149
|
-
descending : false,
|
|
150
|
-
page : 1,
|
|
151
|
-
rowsPerPage: 30,
|
|
152
|
-
rowsNumber : 10,
|
|
153
|
-
},
|
|
154
|
-
isLoading : false,
|
|
155
|
-
dialogs : {
|
|
156
|
-
expense: {
|
|
157
|
-
id : null,
|
|
158
|
-
visible: false,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
computed: {
|
|
165
|
-
...mapGetters({
|
|
166
|
-
myCompany: 'people/currentCompany',
|
|
167
|
-
}),
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
watch: {
|
|
171
|
-
myCompany(company) {
|
|
172
|
-
if (company !== null) {
|
|
173
|
-
this.onRequest({
|
|
174
|
-
pagination: this.pagination
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
methods: {
|
|
181
|
-
// store method
|
|
182
|
-
getItems(params) {
|
|
183
|
-
return this.api.private('company_expenses', { params })
|
|
184
|
-
.then(response => response.json())
|
|
185
|
-
.then(response => {
|
|
186
|
-
return {
|
|
187
|
-
members: response['hydra:member'],
|
|
188
|
-
total : response['hydra:totalItems'],
|
|
189
|
-
};
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
// store method
|
|
194
|
-
delete(id) {
|
|
195
|
-
/*
|
|
196
|
-
let options = {
|
|
197
|
-
method : 'DELETE',
|
|
198
|
-
headers: new Headers({ 'Content-Type': 'application/ld+json' }),
|
|
199
|
-
body : JSON.stringify({ id }),
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
let endpoint = `customers/${this.id}/addresses`;
|
|
203
|
-
return this.api.private(endpoint, options)
|
|
204
|
-
.then(response => response.json())
|
|
205
|
-
.then(data => {
|
|
206
|
-
if (data.response) {
|
|
207
|
-
if (data.response.success === false)
|
|
208
|
-
throw new Error(data.response.error);
|
|
209
|
-
|
|
210
|
-
return data.response.data;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return null;
|
|
214
|
-
});
|
|
215
|
-
*/
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
removeItem(item) {
|
|
219
|
-
/*
|
|
220
|
-
if (window.confirm(this.$t('Are you sure about to remove this element?'))) {
|
|
221
|
-
item._bussy = true;
|
|
222
|
-
|
|
223
|
-
this.delete(item.id)
|
|
224
|
-
.then (data => {
|
|
225
|
-
if (data) {
|
|
226
|
-
this.cleanItem(item.id);
|
|
227
|
-
}
|
|
228
|
-
})
|
|
229
|
-
.catch(error => {
|
|
230
|
-
this.$emit('error', { message: error.message });
|
|
231
|
-
})
|
|
232
|
-
.finally(() => {
|
|
233
|
-
item._bussy = false;
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
*/
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
cleanItem(id) {
|
|
240
|
-
/*
|
|
241
|
-
let item = this.items.find(obj => obj['id'] == id);
|
|
242
|
-
let indx = this.items.indexOf(item);
|
|
243
|
-
this.items = [...this.items.slice(0, indx), ...this.items.slice(indx + 1)];
|
|
244
|
-
*/
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
reload() {
|
|
248
|
-
this.onRequest({
|
|
249
|
-
pagination: this.pagination
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
onRequest(props) {
|
|
254
|
-
if (this.isLoading)
|
|
255
|
-
return;
|
|
256
|
-
|
|
257
|
-
let {
|
|
258
|
-
page,
|
|
259
|
-
rowsPerPage,
|
|
260
|
-
rowsNumber,
|
|
261
|
-
sortBy,
|
|
262
|
-
descending
|
|
263
|
-
} = props.pagination;
|
|
264
|
-
let params = { itemsPerPage: rowsPerPage, page };
|
|
265
|
-
if (this.myCompany != null) {
|
|
266
|
-
params.company = this.myCompany.id;
|
|
267
|
-
}
|
|
268
|
-
params['order[dueDate]'] = 'ASC';
|
|
269
|
-
|
|
270
|
-
this.isLoading = true;
|
|
271
|
-
this.getItems(params)
|
|
272
|
-
.then(data => {
|
|
273
|
-
let _items = [];
|
|
274
|
-
|
|
275
|
-
if (data.members.length) {
|
|
276
|
-
for (let index in data.members) {
|
|
277
|
-
_items.push({
|
|
278
|
-
id : data.members[index].id,
|
|
279
|
-
category : data.members[index].category.name,
|
|
280
|
-
provider : data.members[index].provider.name,
|
|
281
|
-
order : data.members[index].order.id,
|
|
282
|
-
parcels : data.members[index].parcels === null ? 'Recorrente' : data.members[index].parcels,
|
|
283
|
-
amount : formatMoney(data.members[index].amount, 'BRL'),
|
|
284
|
-
dueDate : formatDateYmdTodmY(data.members[index].dueDate),
|
|
285
|
-
description: data.members[index].description,
|
|
286
|
-
paymentDay : data.members[index].paymentDay,
|
|
287
|
-
_bussy : false,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
this.items = _items;
|
|
293
|
-
this.pagination.rowsNumber = data.total;
|
|
294
|
-
this.pagination.page = page;
|
|
295
|
-
this.pagination.rowsPerPage = rowsPerPage;
|
|
296
|
-
this.pagination.sortBy = sortBy;
|
|
297
|
-
this.pagination.descending = descending;
|
|
298
|
-
})
|
|
299
|
-
.finally(() => {
|
|
300
|
-
this.isLoading = false;
|
|
301
|
-
});
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<q-table
|
|
4
|
+
:loading ="isLoading"
|
|
5
|
+
:data ="items"
|
|
6
|
+
:columns ="settings.columns"
|
|
7
|
+
:pagination.sync="pagination"
|
|
8
|
+
@request ="onRequest"
|
|
9
|
+
row-key ="id"
|
|
10
|
+
style ="min-height: 90vh;"
|
|
11
|
+
:rows-per-page-options="[5, 10, 15, 20, 25, 50]"
|
|
12
|
+
>
|
|
13
|
+
<template v-slot:top>
|
|
14
|
+
<div class="col-xs-12 q-mb-md">
|
|
15
|
+
<div class="row justify-end">
|
|
16
|
+
<q-btn
|
|
17
|
+
:label="$t('Adicionar despesa')"
|
|
18
|
+
icon ="add"
|
|
19
|
+
size ="md"
|
|
20
|
+
color ="primary"
|
|
21
|
+
class ="q-ml-sm"
|
|
22
|
+
@click="() => {
|
|
23
|
+
dialogs.expense.id = null;
|
|
24
|
+
dialogs.expense.visible = true;
|
|
25
|
+
}"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
<template v-slot:body="props">
|
|
31
|
+
<q-tr :props="props">
|
|
32
|
+
<q-td key="id" :props="props">
|
|
33
|
+
<q-btn outline dense
|
|
34
|
+
:label="`#${props.row.id}`"
|
|
35
|
+
:style="{color:props.row.color_status}"
|
|
36
|
+
class ="full-width"
|
|
37
|
+
@click="() => {
|
|
38
|
+
dialogs.expense.id = props.row.id;
|
|
39
|
+
dialogs.expense.visible = true;
|
|
40
|
+
}"
|
|
41
|
+
/>
|
|
42
|
+
</q-td>
|
|
43
|
+
<q-td key="category" :props="props">{{ props.row.category }}</q-td>
|
|
44
|
+
<q-td key="provider" :props="props">{{ props.row.provider }}</q-td>
|
|
45
|
+
<q-td key="parcels" :props="props">{{ props.row.parcels }}</q-td>
|
|
46
|
+
<q-td key="amount" :props="props">{{ props.row.amount }}</q-td>
|
|
47
|
+
<q-td key="dueDate" :props="props">{{ props.row.dueDate }}</q-td>
|
|
48
|
+
<q-td key="description" :props="props">{{ props.row.description }}</q-td>
|
|
49
|
+
<q-td key="paymentDay" :props="props">{{ props.row.paymentDay }}</q-td>
|
|
50
|
+
</q-tr>
|
|
51
|
+
</template>
|
|
52
|
+
</q-table>
|
|
53
|
+
|
|
54
|
+
<q-dialog v-model="dialogs.expense.visible" @before-hide="reload">
|
|
55
|
+
<q-card style="width: 700px; max-width: 80vw;">
|
|
56
|
+
<q-card-section class="row items-center justify-end">
|
|
57
|
+
<q-btn icon="close" flat round dense v-close-popup />
|
|
58
|
+
</q-card-section>
|
|
59
|
+
<q-card-section>
|
|
60
|
+
<FormExpense
|
|
61
|
+
:id ="dialogs.expense.id"
|
|
62
|
+
:api="api"
|
|
63
|
+
/>
|
|
64
|
+
</q-card-section>
|
|
65
|
+
</q-card>
|
|
66
|
+
</q-dialog>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import { mapGetters } from 'vuex';
|
|
72
|
+
import Api from '@freteclick/quasar-common-ui/src/utils/api';
|
|
73
|
+
import { formatDateYmdTodmY, formatMoney } from '@freteclick/quasar-common-ui/src/utils/formatter';
|
|
74
|
+
import FormExpense from './FormExpense';
|
|
75
|
+
|
|
76
|
+
const SETTINGS = {
|
|
77
|
+
columns : [
|
|
78
|
+
{
|
|
79
|
+
name : 'id',
|
|
80
|
+
field : 'id',
|
|
81
|
+
align : 'left',
|
|
82
|
+
label : 'ID'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name : 'category',
|
|
86
|
+
align : 'left',
|
|
87
|
+
label : 'Categoria'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name : 'provider',
|
|
91
|
+
align : 'left',
|
|
92
|
+
label : 'Fornecedor'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name : 'parcels',
|
|
96
|
+
align : 'left',
|
|
97
|
+
label : 'Parcelas'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name : 'amount',
|
|
101
|
+
align : 'left',
|
|
102
|
+
label : 'Valor'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name : 'dueDate',
|
|
106
|
+
align : 'left',
|
|
107
|
+
label : 'Data vencimento'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name : 'description',
|
|
111
|
+
align : 'left',
|
|
112
|
+
label : 'Descrição'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name : 'paymentDay',
|
|
116
|
+
align : 'left',
|
|
117
|
+
label : 'Dia pagamento'
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
Object.freeze(SETTINGS);
|
|
123
|
+
|
|
124
|
+
export default {
|
|
125
|
+
props: {
|
|
126
|
+
api: {
|
|
127
|
+
type : Api,
|
|
128
|
+
required: true
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
components: {
|
|
133
|
+
FormExpense,
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
created() {
|
|
137
|
+
if (this.myCompany !== null)
|
|
138
|
+
this.onRequest({
|
|
139
|
+
pagination: this.pagination
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
data() {
|
|
144
|
+
return {
|
|
145
|
+
settings : SETTINGS,
|
|
146
|
+
items : [],
|
|
147
|
+
pagination : {
|
|
148
|
+
sortBy : 'dueDate',
|
|
149
|
+
descending : false,
|
|
150
|
+
page : 1,
|
|
151
|
+
rowsPerPage: 30,
|
|
152
|
+
rowsNumber : 10,
|
|
153
|
+
},
|
|
154
|
+
isLoading : false,
|
|
155
|
+
dialogs : {
|
|
156
|
+
expense: {
|
|
157
|
+
id : null,
|
|
158
|
+
visible: false,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
computed: {
|
|
165
|
+
...mapGetters({
|
|
166
|
+
myCompany: 'people/currentCompany',
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
watch: {
|
|
171
|
+
myCompany(company) {
|
|
172
|
+
if (company !== null) {
|
|
173
|
+
this.onRequest({
|
|
174
|
+
pagination: this.pagination
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
methods: {
|
|
181
|
+
// store method
|
|
182
|
+
getItems(params) {
|
|
183
|
+
return this.api.private('company_expenses', { params })
|
|
184
|
+
.then(response => response.json())
|
|
185
|
+
.then(response => {
|
|
186
|
+
return {
|
|
187
|
+
members: response['hydra:member'],
|
|
188
|
+
total : response['hydra:totalItems'],
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
// store method
|
|
194
|
+
delete(id) {
|
|
195
|
+
/*
|
|
196
|
+
let options = {
|
|
197
|
+
method : 'DELETE',
|
|
198
|
+
headers: new Headers({ 'Content-Type': 'application/ld+json' }),
|
|
199
|
+
body : JSON.stringify({ id }),
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
let endpoint = `customers/${this.id}/addresses`;
|
|
203
|
+
return this.api.private(endpoint, options)
|
|
204
|
+
.then(response => response.json())
|
|
205
|
+
.then(data => {
|
|
206
|
+
if (data.response) {
|
|
207
|
+
if (data.response.success === false)
|
|
208
|
+
throw new Error(data.response.error);
|
|
209
|
+
|
|
210
|
+
return data.response.data;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return null;
|
|
214
|
+
});
|
|
215
|
+
*/
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
removeItem(item) {
|
|
219
|
+
/*
|
|
220
|
+
if (window.confirm(this.$t('Are you sure about to remove this element?'))) {
|
|
221
|
+
item._bussy = true;
|
|
222
|
+
|
|
223
|
+
this.delete(item.id)
|
|
224
|
+
.then (data => {
|
|
225
|
+
if (data) {
|
|
226
|
+
this.cleanItem(item.id);
|
|
227
|
+
}
|
|
228
|
+
})
|
|
229
|
+
.catch(error => {
|
|
230
|
+
this.$emit('error', { message: error.message });
|
|
231
|
+
})
|
|
232
|
+
.finally(() => {
|
|
233
|
+
item._bussy = false;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
*/
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
cleanItem(id) {
|
|
240
|
+
/*
|
|
241
|
+
let item = this.items.find(obj => obj['id'] == id);
|
|
242
|
+
let indx = this.items.indexOf(item);
|
|
243
|
+
this.items = [...this.items.slice(0, indx), ...this.items.slice(indx + 1)];
|
|
244
|
+
*/
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
reload() {
|
|
248
|
+
this.onRequest({
|
|
249
|
+
pagination: this.pagination
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
onRequest(props) {
|
|
254
|
+
if (this.isLoading)
|
|
255
|
+
return;
|
|
256
|
+
|
|
257
|
+
let {
|
|
258
|
+
page,
|
|
259
|
+
rowsPerPage,
|
|
260
|
+
rowsNumber,
|
|
261
|
+
sortBy,
|
|
262
|
+
descending
|
|
263
|
+
} = props.pagination;
|
|
264
|
+
let params = { itemsPerPage: rowsPerPage, page };
|
|
265
|
+
if (this.myCompany != null) {
|
|
266
|
+
params.company = this.myCompany.id;
|
|
267
|
+
}
|
|
268
|
+
params['order[dueDate]'] = 'ASC';
|
|
269
|
+
|
|
270
|
+
this.isLoading = true;
|
|
271
|
+
this.getItems(params)
|
|
272
|
+
.then(data => {
|
|
273
|
+
let _items = [];
|
|
274
|
+
|
|
275
|
+
if (data.members.length) {
|
|
276
|
+
for (let index in data.members) {
|
|
277
|
+
_items.push({
|
|
278
|
+
id : data.members[index].id,
|
|
279
|
+
category : data.members[index].category.name,
|
|
280
|
+
provider : data.members[index].provider.name,
|
|
281
|
+
order : data.members[index].order.id,
|
|
282
|
+
parcels : data.members[index].parcels === null ? 'Recorrente' : data.members[index].parcels,
|
|
283
|
+
amount : formatMoney(data.members[index].amount, 'BRL'),
|
|
284
|
+
dueDate : formatDateYmdTodmY(data.members[index].dueDate),
|
|
285
|
+
description: data.members[index].description,
|
|
286
|
+
paymentDay : data.members[index].paymentDay,
|
|
287
|
+
_bussy : false,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
this.items = _items;
|
|
293
|
+
this.pagination.rowsNumber = data.total;
|
|
294
|
+
this.pagination.page = page;
|
|
295
|
+
this.pagination.rowsPerPage = rowsPerPage;
|
|
296
|
+
this.pagination.sortBy = sortBy;
|
|
297
|
+
this.pagination.descending = descending;
|
|
298
|
+
})
|
|
299
|
+
.finally(() => {
|
|
300
|
+
this.isLoading = false;
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
</script>
|