@freteclick/quasar-financial-ui 1.0.85
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 +18 -0
- package/src/components/common/Filters.vue +141 -0
- package/src/components/expense/FormExpense.vue +309 -0
- package/src/components/expense/TableExpenses.vue +305 -0
- package/src/components/invoice/client/ClientInvoiceDetails.vue +213 -0
- package/src/components/invoice/client/InvoiceSearching.vue +383 -0
- package/src/components/invoice/client/details/InvoiceInvoice.vue +249 -0
- package/src/components/invoice/client/details/InvoiceOrders.vue +328 -0
- package/src/components/invoice/expense/CreateExpense.vue +539 -0
- package/src/components/invoice/expense/DetailExpense.vue +393 -0
- package/src/components/invoice/pay/InvoiceDetails.vue +210 -0
- package/src/components/invoice/pay/InvoiceSearching.vue +388 -0
- package/src/components/invoice/pay/details/InvoiceInvoice.vue +47 -0
- package/src/components/invoice/pay/details/InvoiceOrders.vue +342 -0
- package/src/components/invoice/receive/InvoiceDetails.vue +281 -0
- package/src/components/invoice/receive/InvoiceSearching.vue +359 -0
- package/src/components/invoice/receive/details/InvoiceInvoice.vue +371 -0
- package/src/components/invoice/receive/details/InvoiceInvoiceBkp.vue +260 -0
- package/src/components/invoice/receive/details/InvoiceOrders.vue +370 -0
- package/src/i18n/en-us/index.js +8 -0
- package/src/i18n/index.js +5 -0
- package/src/i18n/pt-br/index.js +30 -0
- package/src/pages/Invoice/Client/Details.vue +23 -0
- package/src/pages/Invoice/Client/Index.vue +27 -0
- package/src/pages/Invoice/Pay/Details.vue +23 -0
- package/src/pages/Invoice/Pay/Index.vue +53 -0
- package/src/pages/Invoice/Receive/Details.vue +23 -0
- package/src/pages/Invoice/Receive/Index.vue +27 -0
- package/src/router/routes.js +32 -0
- package/src/store/modules/invoice/comission/actions.js +66 -0
- package/src/store/modules/invoice/comission/getters.js +7 -0
- package/src/store/modules/invoice/comission/index.js +19 -0
- package/src/store/modules/invoice/comission/mutation_types.js +8 -0
- package/src/store/modules/invoice/comission/mutations.js +42 -0
- package/src/store/modules/invoice/expense/actions.js +98 -0
- package/src/store/modules/invoice/expense/getters.js +1 -0
- package/src/store/modules/invoice/expense/index.js +12 -0
- package/src/store/modules/invoice/expense/mutations.js +3 -0
- package/src/store/modules/invoice/expense/state.js +5 -0
- package/src/store/modules/invoice/pay/actions.js +114 -0
- package/src/store/modules/invoice/pay/getters.js +7 -0
- package/src/store/modules/invoice/pay/index.js +19 -0
- package/src/store/modules/invoice/pay/mutation_types.js +8 -0
- package/src/store/modules/invoice/pay/mutations.js +42 -0
- package/src/store/modules/invoice/receive/actions.js +152 -0
- package/src/store/modules/invoice/receive/actionsBkp.js +77 -0
- package/src/store/modules/invoice/receive/getters.js +7 -0
- package/src/store/modules/invoice/receive/index.js +19 -0
- package/src/store/modules/invoice/receive/mutation_types.js +8 -0
- package/src/store/modules/invoice/receive/mutations.js +42 -0
- package/src/store/store-flag.d.ts +9 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-table
|
|
3
|
+
:loading="isLoading"
|
|
4
|
+
:data="data"
|
|
5
|
+
:columns="settings.columns"
|
|
6
|
+
:pagination.sync="pagination"
|
|
7
|
+
@request="onRequest"
|
|
8
|
+
row-key="id"
|
|
9
|
+
style="min-height: 90vh"
|
|
10
|
+
:rows-per-page-options="[5, 10, 15, 20, 25, 50]"
|
|
11
|
+
>
|
|
12
|
+
<template v-slot:body="props">
|
|
13
|
+
<q-tr :props="props">
|
|
14
|
+
<q-td key="id" :props="props">
|
|
15
|
+
<q-btn
|
|
16
|
+
outline
|
|
17
|
+
dense
|
|
18
|
+
:to="{
|
|
19
|
+
name: 'PurchasingOrderDetails',
|
|
20
|
+
params: { id: props.row.id },
|
|
21
|
+
}"
|
|
22
|
+
:label="`#${props.row.id}`"
|
|
23
|
+
:style="{ color: props.row.color_status }"
|
|
24
|
+
class="full-width"
|
|
25
|
+
/>
|
|
26
|
+
</q-td>
|
|
27
|
+
<q-td key="mainOrder" :props="props">
|
|
28
|
+
<q-btn
|
|
29
|
+
v-if="props.row.mainOrder"
|
|
30
|
+
outline
|
|
31
|
+
dense
|
|
32
|
+
:to="{
|
|
33
|
+
name: 'OrderDetails',
|
|
34
|
+
params: { id: props.row.mainOrder },
|
|
35
|
+
}"
|
|
36
|
+
:label="`#${props.row.mainOrder}`"
|
|
37
|
+
:style="{ color: 'grey' }"
|
|
38
|
+
class="full-width"
|
|
39
|
+
/>
|
|
40
|
+
</q-td>
|
|
41
|
+
<q-td key="client" :props="props">{{ props.row.client }}</q-td>
|
|
42
|
+
<q-td key="notaFiscal" :props="props">{{ props.row.notaFiscal }}</q-td>
|
|
43
|
+
<q-td key="dataPedido" :props="props">{{ props.cols[4].value }}</q-td>
|
|
44
|
+
<q-td key="ultimaModificacao" :props="props">{{
|
|
45
|
+
props.cols[5].value
|
|
46
|
+
}}</q-td>
|
|
47
|
+
<q-td
|
|
48
|
+
key="status"
|
|
49
|
+
:props="props"
|
|
50
|
+
:style="{ color: props.row.color_status }"
|
|
51
|
+
>
|
|
52
|
+
{{ $t(`order.statuses.${props.row.status}`) }}
|
|
53
|
+
</q-td>
|
|
54
|
+
<q-td key="preco" :props="props">{{ props.cols[7].value }}</q-td>
|
|
55
|
+
</q-tr>
|
|
56
|
+
</template>
|
|
57
|
+
</q-table>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
import { mapActions, mapGetters } from "vuex";
|
|
62
|
+
import { date } from "quasar";
|
|
63
|
+
import { formatMoney } from "@freteclick/quasar-common-ui/src/utils/formatter";
|
|
64
|
+
|
|
65
|
+
const SETTINGS = {
|
|
66
|
+
columns: [
|
|
67
|
+
{
|
|
68
|
+
name: "id",
|
|
69
|
+
field: "id",
|
|
70
|
+
align: "left",
|
|
71
|
+
label: "ID",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "mainOrder",
|
|
75
|
+
field: "mainOrder",
|
|
76
|
+
align: "left",
|
|
77
|
+
label: "Pedido Principal",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "client",
|
|
81
|
+
field: "client",
|
|
82
|
+
align: "left",
|
|
83
|
+
label: "Cliente",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "notaFiscal",
|
|
87
|
+
field: "notaFiscal",
|
|
88
|
+
align: "left",
|
|
89
|
+
label: "Nota Fiscal",
|
|
90
|
+
format: (val, row) => {
|
|
91
|
+
return val ? "#" + val : "";
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "dataPedido",
|
|
96
|
+
field: "dataPedido",
|
|
97
|
+
align: "left",
|
|
98
|
+
format: (val, row) => {
|
|
99
|
+
return date.formatDate(val, "DD/MM/YYYY");
|
|
100
|
+
},
|
|
101
|
+
label: "Data",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "ultimaModificacao",
|
|
105
|
+
field: "ultimaModificacao",
|
|
106
|
+
align: "left",
|
|
107
|
+
format: (val, row) => {
|
|
108
|
+
return date.formatDate(val, "DD/MM/YYYY HH:mm:ss");
|
|
109
|
+
},
|
|
110
|
+
label: "Ultima alteração",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "status",
|
|
114
|
+
field: "status",
|
|
115
|
+
align: "left",
|
|
116
|
+
label: "Status",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "preco",
|
|
120
|
+
field: "preco",
|
|
121
|
+
align: "left",
|
|
122
|
+
format: (val, row) => {
|
|
123
|
+
return formatMoney(val, "BRL", "pt-br");
|
|
124
|
+
},
|
|
125
|
+
label: "Preço",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
Object.freeze(SETTINGS);
|
|
131
|
+
|
|
132
|
+
export default {
|
|
133
|
+
props: {
|
|
134
|
+
search: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
required: false,
|
|
137
|
+
default: true,
|
|
138
|
+
},
|
|
139
|
+
invoiceId: {
|
|
140
|
+
type: String,
|
|
141
|
+
required: false,
|
|
142
|
+
default: null,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
created() {
|
|
147
|
+
if (this.myCompany !== null) {
|
|
148
|
+
this.filters.company = this.myCompany;
|
|
149
|
+
this.onRequest({
|
|
150
|
+
pagination: this.pagination,
|
|
151
|
+
filter: this.filters,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
this.requestStatuses();
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
beforeDestroy() {
|
|
158
|
+
this.reset();
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
data() {
|
|
162
|
+
let statuses = [{ label: "Todos", value: -1 }];
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
settings: SETTINGS,
|
|
166
|
+
data: [],
|
|
167
|
+
statuses: statuses,
|
|
168
|
+
filters: {
|
|
169
|
+
text: null,
|
|
170
|
+
status: statuses[0],
|
|
171
|
+
company: null,
|
|
172
|
+
},
|
|
173
|
+
pagination: {
|
|
174
|
+
sortBy: "ultimaModificacao",
|
|
175
|
+
descending: false,
|
|
176
|
+
page: 1,
|
|
177
|
+
rowsPerPage: 10,
|
|
178
|
+
rowsNumber: 10,
|
|
179
|
+
},
|
|
180
|
+
loadingStatuses: false,
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
computed: {
|
|
185
|
+
...mapGetters({
|
|
186
|
+
isLoading: "purchasingOrder/isLoading",
|
|
187
|
+
error: "purchasingOrder/error",
|
|
188
|
+
violations: "purchasingOrder/violations",
|
|
189
|
+
items: "purchasingOrder/items",
|
|
190
|
+
totalItems: "purchasingOrder/totalItems",
|
|
191
|
+
myCompany: "people/currentCompany",
|
|
192
|
+
}),
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
watch: {
|
|
196
|
+
myCompany(company) {
|
|
197
|
+
if (company !== null) {
|
|
198
|
+
this.filters.company = company;
|
|
199
|
+
this.onRequest({
|
|
200
|
+
pagination: this.pagination,
|
|
201
|
+
filter: this.filters,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
totalItems(val) {
|
|
207
|
+
this.pagination.rowsNumber = val;
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
items(items) {
|
|
211
|
+
if (!items) return;
|
|
212
|
+
|
|
213
|
+
let data = [];
|
|
214
|
+
|
|
215
|
+
for (let index in items) {
|
|
216
|
+
let item = items[index];
|
|
217
|
+
|
|
218
|
+
var clientName = "--";
|
|
219
|
+
|
|
220
|
+
if (item.mainOrder && item.mainOrder.client) {
|
|
221
|
+
clientName = item.mainOrder.client.name;
|
|
222
|
+
|
|
223
|
+
if (!clientName) {
|
|
224
|
+
clientName = item.mainOrder.client.alias;
|
|
225
|
+
} else if (
|
|
226
|
+
clientName.toLowerCase().indexOf(" ltda") == -1 &&
|
|
227
|
+
clientName.toLowerCase().indexOf(" eireli") == -1 &&
|
|
228
|
+
clientName.toLowerCase().indexOf(" comercio") == -1 &&
|
|
229
|
+
clientName.toLowerCase().indexOf(" comércio") == -1 &&
|
|
230
|
+
clientName.toLowerCase().indexOf(" comercial") == -1 &&
|
|
231
|
+
clientName.toLowerCase().indexOf(" industria") == -1 &&
|
|
232
|
+
clientName.toLowerCase().indexOf(" indústria") == -1 &&
|
|
233
|
+
clientName.toLowerCase().indexOf(" soluções") == -1 &&
|
|
234
|
+
clientName.toLowerCase().indexOf(" importação") == -1 &&
|
|
235
|
+
clientName.toLowerCase().indexOf(" solutions") == -1 &&
|
|
236
|
+
clientName.toLowerCase().indexOf(" me") == -1 &&
|
|
237
|
+
clientName.toLowerCase().trim() !=
|
|
238
|
+
item.mainOrder.client.alias.toLowerCase().trim()
|
|
239
|
+
) {
|
|
240
|
+
clientName += " " + item.mainOrder.client.alias;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
data.push({
|
|
245
|
+
"@id": item["@id"],
|
|
246
|
+
id: item["@id"].match(/^\/purchasing\/orders\/([a-z0-9-]*)$/)[1],
|
|
247
|
+
mainOrder: item.mainOrderId,
|
|
248
|
+
client: clientName,
|
|
249
|
+
notaFiscal:
|
|
250
|
+
item.invoiceTax.length > 0
|
|
251
|
+
? "#" + item.invoiceTax[0].invoiceTax.invoiceNumber
|
|
252
|
+
: "",
|
|
253
|
+
dataPedido: item.orderDate,
|
|
254
|
+
ultimaModificacao: item.alterDate,
|
|
255
|
+
status: item.status.status,
|
|
256
|
+
color_status: item.status.color,
|
|
257
|
+
preco: item.price,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
this.data = data;
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
"filters.text"() {
|
|
265
|
+
this.onRequest({
|
|
266
|
+
pagination: this.pagination,
|
|
267
|
+
filter: this.filters,
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
"filters.status"() {
|
|
272
|
+
this.onRequest({
|
|
273
|
+
pagination: this.pagination,
|
|
274
|
+
filter: this.filters,
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
methods: {
|
|
280
|
+
...mapActions({
|
|
281
|
+
getItems: "purchasingOrder/getItems",
|
|
282
|
+
reset: "purchasingOrder/reset",
|
|
283
|
+
getStatuses: "purchasingOrder/getStatuses",
|
|
284
|
+
}),
|
|
285
|
+
|
|
286
|
+
requestStatuses() {
|
|
287
|
+
this.loadingStatuses = true;
|
|
288
|
+
this.getStatuses({
|
|
289
|
+
visibility: "public",
|
|
290
|
+
realStatus: ["open", "pending", "closed"],
|
|
291
|
+
context:'order'
|
|
292
|
+
}).then((statuses) => {
|
|
293
|
+
if (statuses.length) {
|
|
294
|
+
let data = [];
|
|
295
|
+
for (let index in statuses) {
|
|
296
|
+
let item = statuses[index];
|
|
297
|
+
this.statuses.push({
|
|
298
|
+
label: this.$t(`order.statuses.${item.status}`),
|
|
299
|
+
value: item["@id"].match(/^\/statuses\/([a-z0-9-]*)$/)[1],
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
this.loadingStatuses = false;
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
onRequest(props) {
|
|
308
|
+
let { page, rowsPerPage, rowsNumber, sortBy, descending } =
|
|
309
|
+
props.pagination;
|
|
310
|
+
let filter = props.filter;
|
|
311
|
+
let params = { itemsPerPage: rowsPerPage, page };
|
|
312
|
+
|
|
313
|
+
if (this.filters.text != null && this.filters.text.length > 0) {
|
|
314
|
+
if (this.filters.text.length < 2) return;
|
|
315
|
+
|
|
316
|
+
params["searchBy"] = this.filters.text;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (this.filters.status != null && this.filters.status.value != -1) {
|
|
320
|
+
params["status"] = this.filters.status.value;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (this.filters.company != null) {
|
|
324
|
+
params["myCompany"] = this.filters.company.id;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (this.invoiceId !== null) {
|
|
328
|
+
params["invoice.invoice"] = this.invoiceId;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
params["order[alterDate]"] = "desc";
|
|
332
|
+
|
|
333
|
+
this.getItems(params).then(() => {
|
|
334
|
+
this.pagination.page = page;
|
|
335
|
+
this.pagination.rowsPerPage = rowsPerPage;
|
|
336
|
+
this.pagination.sortBy = sortBy;
|
|
337
|
+
this.pagination.descending = descending;
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
</script>
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-card style="min-height: 90vh">
|
|
3
|
+
<q-dialog v-model="confirm" persistent>
|
|
4
|
+
<q-card>
|
|
5
|
+
<q-card-section class="row items-center">
|
|
6
|
+
<q-avatar icon="receipt" color="primary" text-color="white" />
|
|
7
|
+
<span class="q-ml-sm">Deseja gerar um novo número de fatura?</span>
|
|
8
|
+
</q-card-section>
|
|
9
|
+
|
|
10
|
+
<q-card-actions align="right">
|
|
11
|
+
<q-btn flat label="Cancelar" color="primary" v-close-popup />
|
|
12
|
+
<q-btn flat label="Alterar" color="primary" @click="renew(invoice)" v-close-popup />
|
|
13
|
+
</q-card-actions>
|
|
14
|
+
</q-card>
|
|
15
|
+
</q-dialog>
|
|
16
|
+
|
|
17
|
+
<q-inner-loading :showing="isLoading">
|
|
18
|
+
<q-spinner-gears size="50px" color="primary" />
|
|
19
|
+
</q-inner-loading>
|
|
20
|
+
|
|
21
|
+
<transition-group appear enter-active-class="animated fadeIn" leave-active-class="animated fadeOut">
|
|
22
|
+
<div v-if="invoice !== null" class="row q-pa-sm q-col-gutter-sm" key="status">
|
|
23
|
+
<div class="col-xs-12">
|
|
24
|
+
<div class="text-h5 q-pt-sm q-pb-sm">{{ this.payer.name }}</div>
|
|
25
|
+
<div v-if="this.payer.id != this.client.id" class="text-h5 q-pt-sm q-pb-sm">{{ this.client.name }}</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="col-xs-12 col-sm-5">
|
|
29
|
+
<div class="row">
|
|
30
|
+
<div class="col-xs-12">
|
|
31
|
+
<q-markup-table flat dense square separator="none" class="bg-grey-4">
|
|
32
|
+
<tbody>
|
|
33
|
+
<tr>
|
|
34
|
+
<td class="text-left text-bold">Número da fatura</td>
|
|
35
|
+
<td class="text-left">
|
|
36
|
+
{{
|
|
37
|
+
`#${this.invoice["@id"].match(
|
|
38
|
+
/^\/finance\/receive\/([a-z0-9-]*)$/
|
|
39
|
+
)[1]
|
|
40
|
+
}`
|
|
41
|
+
}}
|
|
42
|
+
|
|
43
|
+
<q-btn flat round dense color="positive" icon="autorenew" @click="confirm = true" />
|
|
44
|
+
</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td class="text-left text-bold">Valor da fatura</td>
|
|
48
|
+
<td class="text-left">
|
|
49
|
+
{{ formatMoney(this.invoice.price) }}
|
|
50
|
+
</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td class="text-left text-bold">Vencimento</td>
|
|
54
|
+
<td class="text-left">
|
|
55
|
+
<EditInvoiceDuedate v-if="editDueDate" :dueDate="invoice.dueDate"
|
|
56
|
+
:invoiceId="invoice['@id'] || ''" @saved="(data) => (invoice = data)" />
|
|
57
|
+
<div v-else>
|
|
58
|
+
{{ invoice.dueDate }}
|
|
59
|
+
</div>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
</tbody>
|
|
63
|
+
</q-markup-table>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="col-xs-12">
|
|
66
|
+
<InvoiceEditActions :invoice="invoice" @ready="(invoice) => (invoice = invoice)" />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="col-xs-12 col-sm-7">
|
|
72
|
+
<div class="row text-white full-height items-center justify-center"
|
|
73
|
+
:style="`background-color: ${this.invoice.status.color}`">
|
|
74
|
+
<div class="col-xs-12 text-h6 text-center">
|
|
75
|
+
{{ $t(`invoice.statuses.${invoice.status.status}`) }}
|
|
76
|
+
</div>
|
|
77
|
+
<InvoiceActions :invoice="invoice" @changed="
|
|
78
|
+
(newInvoice) => {
|
|
79
|
+
this.invoice = newInvoice;
|
|
80
|
+
this.$refs.invoiceBillet.refresh();
|
|
81
|
+
}
|
|
82
|
+
" />
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div v-if="invoice !== null" class="row" key="order_tabs">
|
|
88
|
+
<div class="col-12">
|
|
89
|
+
<q-tabs :horizontal="$q.screen.gt.xs" align="justify" v-model="currentTab" class="bg-white text-primary">
|
|
90
|
+
<q-tab name="invoice" label="Boleto" />
|
|
91
|
+
<q-tab name="orders" label="Pedidos" />
|
|
92
|
+
</q-tabs>
|
|
93
|
+
|
|
94
|
+
<q-separator />
|
|
95
|
+
|
|
96
|
+
<q-tab-panels v-model="currentTab">
|
|
97
|
+
<q-tab-panel name="invoice" class="q-pa-none">
|
|
98
|
+
<InvoiceInvoice ref="invoiceBillet" :invoiceId="invoiceId" :orderId="orderId" @billetStatus="
|
|
99
|
+
(status) => {
|
|
100
|
+
this.editDueDate = status.hasBillet === false;
|
|
101
|
+
}
|
|
102
|
+
" />
|
|
103
|
+
</q-tab-panel>
|
|
104
|
+
|
|
105
|
+
<q-tab-panel name="orders" class="q-pa-none">
|
|
106
|
+
<InvoiceOrders :invoiceId="invoiceId" :invoice="{
|
|
107
|
+
'@id': invoice ? invoice['@id'] : null,
|
|
108
|
+
status: invoice ? invoice.status.realStatus : null,
|
|
109
|
+
billet: editDueDate ? false : true,
|
|
110
|
+
}" />
|
|
111
|
+
</q-tab-panel>
|
|
112
|
+
</q-tab-panels>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</transition-group>
|
|
116
|
+
|
|
117
|
+
<div v-if="invoice === null && notFound" class="row items-center justify-center" style="min-height: 90vh">
|
|
118
|
+
<q-banner class="text-white bg-red text-center text-h3" rounded>
|
|
119
|
+
<template v-slot:avatar>
|
|
120
|
+
<q-icon name="error" color="white" />
|
|
121
|
+
</template>
|
|
122
|
+
A fatura não foi encontrada
|
|
123
|
+
</q-banner>
|
|
124
|
+
</div>
|
|
125
|
+
</q-card>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script>
|
|
129
|
+
import { mapActions, mapGetters } from "vuex";
|
|
130
|
+
import InvoiceInvoice from "./details/InvoiceInvoice";
|
|
131
|
+
import InvoiceOrders from "./details/InvoiceOrders";
|
|
132
|
+
import {
|
|
133
|
+
formatMoney,
|
|
134
|
+
formatDateYmdTodmY,
|
|
135
|
+
} from "@freteclick/quasar-common-ui/src/utils/formatter";
|
|
136
|
+
import EditInvoiceDuedate from "@freteclick/quasar-common-ui/src/components/common/EditInvoiceDuedate.vue";
|
|
137
|
+
import InvoiceActions from "@freteclick/quasar-common-ui/src/components/common/InvoiceActions.vue";
|
|
138
|
+
import InvoiceEditActions from "@freteclick/quasar-common-ui/src/components/common/InvoiceEditActions.vue";
|
|
139
|
+
|
|
140
|
+
export default {
|
|
141
|
+
components: {
|
|
142
|
+
InvoiceInvoice,
|
|
143
|
+
InvoiceOrders,
|
|
144
|
+
EditInvoiceDuedate,
|
|
145
|
+
InvoiceActions,
|
|
146
|
+
InvoiceEditActions,
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
created() {
|
|
150
|
+
if (this.$route.params.id)
|
|
151
|
+
this.invoiceId = decodeURIComponent(this.$route.params.id);
|
|
152
|
+
|
|
153
|
+
if (this.myCompany !== null && this.invoiceId !== null) {
|
|
154
|
+
this.requestInvoice(this.invoiceId);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
data() {
|
|
159
|
+
return {
|
|
160
|
+
confirm: false,
|
|
161
|
+
currentTab: "orders",
|
|
162
|
+
invoiceId: null,
|
|
163
|
+
orderId: null,
|
|
164
|
+
invoice: null,
|
|
165
|
+
isLoading: false,
|
|
166
|
+
editDueDate: false,
|
|
167
|
+
notFound: false,
|
|
168
|
+
client: {
|
|
169
|
+
name: "",
|
|
170
|
+
},
|
|
171
|
+
payer: {
|
|
172
|
+
name: "",
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
computed: {
|
|
178
|
+
...mapGetters({
|
|
179
|
+
myCompany: "people/currentCompany",
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
watch: {
|
|
184
|
+
myCompany(company) {
|
|
185
|
+
if (company !== null) {
|
|
186
|
+
this.requestInvoice(this.invoiceId);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
methods: {
|
|
192
|
+
...mapActions({
|
|
193
|
+
getInvoice: "receiveInvoice/getInvoice",
|
|
194
|
+
renewInvoice: "receiveInvoice/renewInvoice",
|
|
195
|
+
}),
|
|
196
|
+
|
|
197
|
+
formatMoney(value) {
|
|
198
|
+
return formatMoney(value, "BRL", "pt-br");
|
|
199
|
+
},
|
|
200
|
+
renew(invoice) {
|
|
201
|
+
let invoiceId = invoice["@id"].replace(/\D/g, "");
|
|
202
|
+
|
|
203
|
+
if (this.isLoading) return;
|
|
204
|
+
|
|
205
|
+
let params = {};
|
|
206
|
+
this.isLoading = true;
|
|
207
|
+
|
|
208
|
+
this.renewInvoice({ invoiceId, params })
|
|
209
|
+
.then((response) => {
|
|
210
|
+
this.isLoading = false;
|
|
211
|
+
if (response.data.id) {
|
|
212
|
+
this.$router.push({
|
|
213
|
+
name: "ReceiveDetails",
|
|
214
|
+
params: {
|
|
215
|
+
id: response.data.id,
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
location.reload();
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
.catch((error) => {
|
|
222
|
+
this.client.name = "";
|
|
223
|
+
this.payer.name = "";
|
|
224
|
+
this.isLoading = false;
|
|
225
|
+
this.invoice = null;
|
|
226
|
+
this.notFound = true;
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
requestInvoice(invoiceId) {
|
|
230
|
+
if (this.isLoading) return;
|
|
231
|
+
|
|
232
|
+
let params = {};
|
|
233
|
+
|
|
234
|
+
params["myCompany"] = this.myCompany.id;
|
|
235
|
+
|
|
236
|
+
this.isLoading = true;
|
|
237
|
+
|
|
238
|
+
this.getInvoice({ invoiceId, params })
|
|
239
|
+
.then((data) => {
|
|
240
|
+
this.isLoading = false;
|
|
241
|
+
|
|
242
|
+
if (data["@id"]) {
|
|
243
|
+
this.invoice = data;
|
|
244
|
+
this.notFound = false;
|
|
245
|
+
|
|
246
|
+
// format date
|
|
247
|
+
if (this.invoice.dueDate) {
|
|
248
|
+
this.invoice.dueDate = formatDateYmdTodmY(this.invoice.dueDate);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// set order
|
|
252
|
+
if (this.invoice.order.length > 0) {
|
|
253
|
+
this.orderId = this.invoice.order[0].order["@id"].replace(
|
|
254
|
+
/[^0-9]/g,
|
|
255
|
+
""
|
|
256
|
+
);
|
|
257
|
+
this.client.name = this.invoice.order[0].order.client.name;
|
|
258
|
+
this.payer.name = this.invoice.order[0].order.payer.name;
|
|
259
|
+
this.payer.id = this.invoice.order[0].order.payer["@id"].replace(
|
|
260
|
+
/[^0-9]/g,
|
|
261
|
+
""
|
|
262
|
+
);
|
|
263
|
+
this.client.id = this.invoice.order[0].order.client["@id"].replace(
|
|
264
|
+
/[^0-9]/g,
|
|
265
|
+
""
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
.catch((error) => {
|
|
272
|
+
this.client.name = "";
|
|
273
|
+
this.payer.name = "";
|
|
274
|
+
this.isLoading = false;
|
|
275
|
+
this.invoice = null;
|
|
276
|
+
this.notFound = true;
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
</script>
|