@freteclick/quasar-financial-ui 1.0.93 → 1.0.95
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
CHANGED
|
@@ -34,34 +34,59 @@
|
|
|
34
34
|
<td class="text-left text-bold">Número da fatura</td>
|
|
35
35
|
<td class="text-left">
|
|
36
36
|
{{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
`#${this.invoice["@id"].match(
|
|
38
|
+
/^\/finance\/receive\/([a-z0-9-]*)$/
|
|
39
|
+
)[1]
|
|
40
|
+
}`
|
|
41
41
|
}}
|
|
42
42
|
|
|
43
43
|
<q-btn flat round dense color="positive" icon="autorenew" @click="confirm = true" />
|
|
44
44
|
</td>
|
|
45
45
|
</tr>
|
|
46
|
+
|
|
47
|
+
<tr>
|
|
48
|
+
<td class="text-left text-bold">Vencimento</td>
|
|
49
|
+
<td class="text-left">
|
|
50
|
+
<EditInvoiceDuedate v-if="editDueDate" :dueDate="invoice.dueDate"
|
|
51
|
+
:invoiceId="invoice['@id'] || ''" @saved="(data) => (invoice = data)" />
|
|
52
|
+
<div v-else>
|
|
53
|
+
{{ invoice.dueDate }}
|
|
54
|
+
</div>
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
|
|
46
58
|
<tr>
|
|
47
59
|
<td class="text-left text-bold">Valor da fatura</td>
|
|
48
60
|
<td class="text-left">
|
|
49
61
|
{{ formatMoney(this.invoice.price) }}
|
|
50
62
|
</td>
|
|
51
63
|
</tr>
|
|
64
|
+
|
|
52
65
|
<tr>
|
|
53
|
-
<td class="text-left text-bold">
|
|
66
|
+
<td class="text-left text-bold">Desconto</td>
|
|
54
67
|
<td class="text-left">
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/>
|
|
68
|
+
|
|
69
|
+
<EditInvoiceDiscount v-if="discount" :discount="discount" :invoiceId="invoice['@id'] || ''"
|
|
70
|
+
@saved="requestInvoice(invoiceId)" />
|
|
71
|
+
|
|
60
72
|
<div v-else>
|
|
61
|
-
|
|
73
|
+
<EditInvoiceDiscount :discount="discount" :invoiceId="invoice['@id'] || ''"
|
|
74
|
+
@saved="requestInvoice(invoiceId)" />
|
|
62
75
|
</div>
|
|
76
|
+
|
|
63
77
|
</td>
|
|
64
78
|
</tr>
|
|
79
|
+
|
|
80
|
+
<tr>
|
|
81
|
+
<td class="text-left text-bold">Total a Pagar</td>
|
|
82
|
+
<td class="text-left" v-if="discount">
|
|
83
|
+
{{ formatMoney(this.invoice.realPrice) }}
|
|
84
|
+
</td>
|
|
85
|
+
<td class="text-left" v-else>
|
|
86
|
+
{{ formatMoney(this.invoice.price) }}
|
|
87
|
+
</td>
|
|
88
|
+
</tr>
|
|
89
|
+
|
|
65
90
|
</tbody>
|
|
66
91
|
</q-markup-table>
|
|
67
92
|
</div>
|
|
@@ -77,12 +102,11 @@
|
|
|
77
102
|
<div class="col-xs-12 text-h6 text-center">
|
|
78
103
|
{{ $t(`invoice.statuses.${invoice.status.status}`) }}
|
|
79
104
|
</div>
|
|
80
|
-
<InvoiceActions :invoice="invoice" @changed="
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
" />
|
|
105
|
+
<InvoiceActions :invoice="invoice" @changed="(newInvoice) => {
|
|
106
|
+
this.invoice = newInvoice;
|
|
107
|
+
this.$refs.invoiceBillet.refresh();
|
|
108
|
+
}
|
|
109
|
+
" />
|
|
86
110
|
</div>
|
|
87
111
|
</div>
|
|
88
112
|
</div>
|
|
@@ -98,19 +122,18 @@
|
|
|
98
122
|
|
|
99
123
|
<q-tab-panels v-model="currentTab">
|
|
100
124
|
<q-tab-panel name="invoice" class="q-pa-none">
|
|
101
|
-
<InvoiceInvoice ref="invoiceBillet" :invoiceId="invoiceId" :orderId="orderId" @billetStatus="
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
" />
|
|
125
|
+
<InvoiceInvoice ref="invoiceBillet" :invoiceId="invoiceId" :orderId="orderId" @billetStatus="(status) => {
|
|
126
|
+
this.editDueDate = status.hasBillet === false;
|
|
127
|
+
}
|
|
128
|
+
" />
|
|
106
129
|
</q-tab-panel>
|
|
107
130
|
|
|
108
131
|
<q-tab-panel name="orders" class="q-pa-none">
|
|
109
|
-
<InvoiceOrders :invoiceId="invoiceId" :invoice="{
|
|
132
|
+
<!-- <InvoiceOrders :invoiceId="invoiceId" :invoice="{
|
|
110
133
|
'@id': invoice ? invoice['@id'] : null,
|
|
111
134
|
status: invoice ? invoice.status.realStatus : null,
|
|
112
135
|
billet: editDueDate = true,
|
|
113
|
-
}" />
|
|
136
|
+
}" /> -->
|
|
114
137
|
</q-tab-panel>
|
|
115
138
|
</q-tab-panels>
|
|
116
139
|
</div>
|
|
@@ -139,6 +162,8 @@ import {
|
|
|
139
162
|
import EditInvoiceDuedate from "@freteclick/quasar-common-ui/src/components/common/EditInvoiceDuedate.vue";
|
|
140
163
|
import InvoiceActions from "@freteclick/quasar-common-ui/src/components/common/InvoiceActions.vue";
|
|
141
164
|
import InvoiceEditActions from "@freteclick/quasar-common-ui/src/components/common/InvoiceEditActions.vue";
|
|
165
|
+
import EditInvoiceDiscount from "@freteclick/quasar-common-ui/src/components/common/EditInvoiceDiscount.vue";
|
|
166
|
+
|
|
142
167
|
|
|
143
168
|
export default {
|
|
144
169
|
components: {
|
|
@@ -147,6 +172,7 @@ export default {
|
|
|
147
172
|
EditInvoiceDuedate,
|
|
148
173
|
InvoiceActions,
|
|
149
174
|
InvoiceEditActions,
|
|
175
|
+
EditInvoiceDiscount,
|
|
150
176
|
},
|
|
151
177
|
|
|
152
178
|
created() {
|
|
@@ -155,6 +181,7 @@ export default {
|
|
|
155
181
|
|
|
156
182
|
if (this.myCompany !== null && this.invoiceId !== null) {
|
|
157
183
|
this.requestInvoice(this.invoiceId);
|
|
184
|
+
// this.requestInvoiceDiscount(this.invoiceId);
|
|
158
185
|
}
|
|
159
186
|
},
|
|
160
187
|
|
|
@@ -165,6 +192,7 @@ export default {
|
|
|
165
192
|
invoiceId: null,
|
|
166
193
|
orderId: null,
|
|
167
194
|
invoice: null,
|
|
195
|
+
discount: null,
|
|
168
196
|
isLoading: false,
|
|
169
197
|
editDueDate: false,
|
|
170
198
|
notFound: false,
|
|
@@ -187,12 +215,14 @@ export default {
|
|
|
187
215
|
myCompany(company) {
|
|
188
216
|
if (company !== null) {
|
|
189
217
|
this.requestInvoice(this.invoiceId);
|
|
218
|
+
// this.requestInvoiceDiscount(this.invoiceId);
|
|
190
219
|
}
|
|
191
220
|
},
|
|
192
221
|
},
|
|
193
222
|
|
|
194
223
|
methods: {
|
|
195
224
|
...mapActions({
|
|
225
|
+
getInvoiceDiscount: "receiveInvoice/getInvoiceDiscount",
|
|
196
226
|
getInvoice: "receiveInvoice/getInvoice",
|
|
197
227
|
renewInvoice: "receiveInvoice/renewInvoice",
|
|
198
228
|
}),
|
|
@@ -229,6 +259,7 @@ export default {
|
|
|
229
259
|
this.notFound = true;
|
|
230
260
|
});
|
|
231
261
|
},
|
|
262
|
+
|
|
232
263
|
requestInvoice(invoiceId) {
|
|
233
264
|
if (this.isLoading) return;
|
|
234
265
|
|
|
@@ -242,6 +273,8 @@ export default {
|
|
|
242
273
|
.then((data) => {
|
|
243
274
|
this.isLoading = false;
|
|
244
275
|
|
|
276
|
+
this.requestInvoiceDiscount(invoiceId);
|
|
277
|
+
|
|
245
278
|
if (data["@id"]) {
|
|
246
279
|
this.invoice = data;
|
|
247
280
|
this.notFound = false;
|
|
@@ -279,6 +312,29 @@ export default {
|
|
|
279
312
|
this.notFound = true;
|
|
280
313
|
});
|
|
281
314
|
},
|
|
315
|
+
|
|
316
|
+
// consulta descontos para esta fatura
|
|
317
|
+
requestInvoiceDiscount(invoiceId) {
|
|
318
|
+
// if (this.isLoading) return;
|
|
319
|
+
|
|
320
|
+
this.isLoading = true;
|
|
321
|
+
|
|
322
|
+
this.getInvoiceDiscount({ invoiceId })
|
|
323
|
+
.then((data) => {
|
|
324
|
+
|
|
325
|
+
this.isLoading = false;
|
|
326
|
+
|
|
327
|
+
if (data["hydra:member"]) {
|
|
328
|
+
this.discount = data["hydra:member"][0];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
})
|
|
332
|
+
.catch((error) => {
|
|
333
|
+
this.isLoading = false;
|
|
334
|
+
this.discount = null;
|
|
335
|
+
})
|
|
336
|
+
},
|
|
337
|
+
|
|
282
338
|
},
|
|
283
339
|
};
|
|
284
340
|
</script>
|
|
@@ -63,6 +63,13 @@ export const getInvoice = ({ commit }, { invoiceId, params }) => {
|
|
|
63
63
|
});
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
export const getInvoiceDiscount = ({ commit }, { invoiceId, params }) => {
|
|
67
|
+
return fetch(`/discounts?type=invoice&invoiceId=${invoiceId}`)
|
|
68
|
+
.then(response => response.json())
|
|
69
|
+
.then(data => {
|
|
70
|
+
return data;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
66
73
|
|
|
67
74
|
export const renewInvoice = ({ commit }, { invoiceId, params }) => {
|
|
68
75
|
|
|
@@ -143,6 +150,23 @@ export const updateInvoiceDuedate = ({ commit }, { id, dueDate, params }) => {
|
|
|
143
150
|
});
|
|
144
151
|
};
|
|
145
152
|
|
|
153
|
+
export const updateInvoiceDuedateApiSicred = ({commit}, {id, dueDate, params}) => {
|
|
154
|
+
let options = {
|
|
155
|
+
method: 'PUT',
|
|
156
|
+
body: JSON.stringify({ dueDate }),
|
|
157
|
+
params: params
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
return fetch(`${id}`, options)
|
|
161
|
+
.then(response => response.json())
|
|
162
|
+
.then(invoice => {
|
|
163
|
+
if (invoice['@id'])
|
|
164
|
+
return invoice;
|
|
165
|
+
|
|
166
|
+
return null;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
146
170
|
export const deleteInvoiceOrder = ({ commit }, { invoiceId, orderId, params }) => {
|
|
147
171
|
let options = {
|
|
148
172
|
method: 'PUT',
|