@freteclick/quasar-financial-ui 1.0.94 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freteclick/quasar-financial-ui",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "author": "FreteClick",
5
5
  "description": "FreteClick financial Quasar UI Component",
6
6
  "license": "MIT",
@@ -66,15 +66,23 @@
66
66
  <td class="text-left text-bold">Desconto</td>
67
67
  <td class="text-left">
68
68
 
69
- <EditInvoiceDiscount :discount="discount" :invoiceId="invoice['@id'] || ''"
70
- @saved="(data) => (discount = data)" />
69
+ <EditInvoiceDiscount v-if="discount" :discount="discount" :invoiceId="invoice['@id'] || ''"
70
+ @saved="requestInvoice(invoiceId)" />
71
+
72
+ <div v-else>
73
+ <EditInvoiceDiscount :discount="discount" :invoiceId="invoice['@id'] || ''"
74
+ @saved="requestInvoice(invoiceId)" />
75
+ </div>
71
76
 
72
77
  </td>
73
78
  </tr>
74
79
 
75
80
  <tr>
76
81
  <td class="text-left text-bold">Total a Pagar</td>
77
- <td class="text-left">
82
+ <td class="text-left" v-if="discount">
83
+ {{ formatMoney(this.invoice.realPrice) }}
84
+ </td>
85
+ <td class="text-left" v-else>
78
86
  {{ formatMoney(this.invoice.price) }}
79
87
  </td>
80
88
  </tr>
@@ -121,11 +129,11 @@
121
129
  </q-tab-panel>
122
130
 
123
131
  <q-tab-panel name="orders" class="q-pa-none">
124
- <InvoiceOrders :invoiceId="invoiceId" :invoice="{
132
+ <!-- <InvoiceOrders :invoiceId="invoiceId" :invoice="{
125
133
  '@id': invoice ? invoice['@id'] : null,
126
134
  status: invoice ? invoice.status.realStatus : null,
127
135
  billet: editDueDate = true,
128
- }" />
136
+ }" /> -->
129
137
  </q-tab-panel>
130
138
  </q-tab-panels>
131
139
  </div>
@@ -173,7 +181,7 @@ export default {
173
181
 
174
182
  if (this.myCompany !== null && this.invoiceId !== null) {
175
183
  this.requestInvoice(this.invoiceId);
176
- this.requestInvoiceDiscount(this.invoiceId);
184
+ // this.requestInvoiceDiscount(this.invoiceId);
177
185
  }
178
186
  },
179
187
 
@@ -207,15 +215,15 @@ export default {
207
215
  myCompany(company) {
208
216
  if (company !== null) {
209
217
  this.requestInvoice(this.invoiceId);
210
- this.requestInvoiceDiscount(this.invoiceId);
218
+ // this.requestInvoiceDiscount(this.invoiceId);
211
219
  }
212
220
  },
213
221
  },
214
222
 
215
223
  methods: {
216
224
  ...mapActions({
217
- getInvoice: "receiveInvoice/getInvoice",
218
225
  getInvoiceDiscount: "receiveInvoice/getInvoiceDiscount",
226
+ getInvoice: "receiveInvoice/getInvoice",
219
227
  renewInvoice: "receiveInvoice/renewInvoice",
220
228
  }),
221
229
 
@@ -252,26 +260,6 @@ export default {
252
260
  });
253
261
  },
254
262
 
255
-
256
- async requestInvoiceDiscount(invoiceId) {
257
- try {
258
- this.isLoading = true;
259
-
260
- const data = await this.getInvoiceDiscount({ invoiceId });
261
-
262
- this.isLoading = false;
263
-
264
- if (data["hydra:member"]) {
265
- this.discount = data["hydra:member"][0];
266
- }
267
- } catch (error) {
268
- this.isLoading = false;
269
- this.discount = null;
270
- }
271
- },
272
-
273
-
274
-
275
263
  requestInvoice(invoiceId) {
276
264
  if (this.isLoading) return;
277
265
 
@@ -285,6 +273,8 @@ export default {
285
273
  .then((data) => {
286
274
  this.isLoading = false;
287
275
 
276
+ this.requestInvoiceDiscount(invoiceId);
277
+
288
278
  if (data["@id"]) {
289
279
  this.invoice = data;
290
280
  this.notFound = false;
@@ -322,6 +312,29 @@ export default {
322
312
  this.notFound = true;
323
313
  });
324
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
+
325
338
  },
326
339
  };
327
340
  </script>