@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,281 +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
|
-
};
|
|
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
281
|
</script>
|