@freteclick/quasar-financial-ui 1.0.95 → 1.0.97

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.95",
3
+ "version": "1.0.97",
4
4
  "author": "FreteClick",
5
5
  "description": "FreteClick financial Quasar UI Component",
6
6
  "license": "MIT",
@@ -15,4 +15,4 @@
15
15
  "browserslist": [
16
16
  "last 1 version, not dead, ie >= 11"
17
17
  ]
18
- }
18
+ }
@@ -1,70 +1,27 @@
1
1
  <template>
2
2
  <div class="row items-center justify-center">
3
3
  <div class="flex flex-center" v-if="isLoading">
4
- <q-circular-progress
5
- :indeterminate="isLoading"
6
- size="sm"
4
+ <q-circular-progress :indeterminate="isLoading"
5
+ size ="sm"
7
6
  color="primary"
8
7
  class="q-ma-md"
9
8
  />
10
9
  Carregando...
11
10
  </div>
12
11
 
13
- <div :class="showInfoBox ? 'full-width q-pa-lg' : 'hidden'">
14
- <div class="q-pa-md q-gutter-sm">
15
- <q-banner inline-actions rounded class="bg-primary text-white text-center">
16
- <h6>Este boleto não pode ser gerado agora, pois a fatura está em aberto.</h6>
17
- </q-banner>
18
- </div>
19
- </div>
20
-
21
- <!-- BILLET VIEWER SICRED -->
22
- <div :class="showBilletSicred ? 'full-width q-pa-lg' : 'hidden'">
23
- <div class="col-12 q-pt-lg" v-if="paymentInstitution === 'sicred'">
24
- <!-- <div class="row justify-center items-center">
25
- <q-btn
26
- icon="money"
27
- size="lg"
28
- color="primary"
29
- label="Abrir Boleto Pix"
30
- :loading="isLoadingDownload"
31
- @click="clickDownloadBilletSicred()"
32
- :disable="isPaid"
33
- />
34
- </div> -->
35
-
36
- <div style="height: 1200px">
37
- <iframe
38
- :src="invoiceUrlSicred"
39
- name="BILLETINTER" id="billet_sicred" width="100%" height="100%" frameBorder="0">
40
- <p>This browser does not support IFrame.</p>
41
- </iframe>
42
- </div>
43
- </div>
44
- </div>
45
-
46
- <!-- BILLET VIEWER INTER -->
47
- <div :class="showBilletInter ? 'full-width q-pa-lg' : 'hidden'">
48
- <div style="height: 1200px">
49
- <iframe
50
- :src="invoiceUrlInter"
51
- name="BILLETINTER" id="billet_inter" width="100%" height="100%" frameBorder="0">
52
- <p>This browser does not support IFrame.</p>
53
- </iframe>
54
- </div>
55
- </div>
12
+ <!-- BILLET VIEWER -->
56
13
 
57
- <!-- BILLET VIEWER ITAU -->
58
14
  <div :class="showBillet ? 'full-width q-pa-lg' : 'hidden'">
59
15
  <q-form
60
- ref="myForm"
61
- :action="payment !== null ? payment.invoiceUrl : ''"
62
- method="post"
63
- class="q-mt-sm row justify-center items-center"
64
- target="BILLET"
16
+ ref ="myForm"
17
+ :action="payment !== null ? payment.invoiceUrl : ''"
18
+ method ="post"
19
+ class ="q-mt-sm row justify-center items-center"
20
+ target ="BILLET"
65
21
  >
66
- <input type="hidden" name="DC" :value="itauHash"/>
22
+ <input type="hidden" name="DC" :value="itauHash" />
67
23
  </q-form>
24
+
68
25
  <div style="height: 1200px">
69
26
  <iframe name="BILLET" width="100%" height="100%" frameBorder="0">
70
27
  <p>This browser does not support IFrame.</p>
@@ -73,44 +30,41 @@
73
30
  </div>
74
31
 
75
32
  <!-- BILLET GENERATOR TRIGGER -->
76
- <div class="col-12 q-pt-lg" v-if="paymentIsPending && billetMustBeCreated && paymentInstitution === 'itau'">
77
- <div style="min-height: 80vh;" class="row justify-center items-center">
78
- <q-btn
79
- icon="money"
80
- size="lg"
81
- color="primary"
82
- label="Gerar boleto"
83
- :loading="retrievingHash"
84
- @click="() => {
85
- this.retrievingHash = true;
86
- this.getItauHash().then(hash => {
87
- if (hash !== null) {
88
- this.loadOnFocus = true;
89
- this.$refs.billetForm.$el.submit();
90
- }
91
- }).finally(() => {
92
- this.retrievingHash = false;
93
- });
94
- }"
95
- :disable="isPaid"
96
- />
33
+
34
+ <div class="col-12 q-pt-lg" v-if="paymentIsPending && billetMustBeCreated">
35
+ <div
36
+ style="min-height: 80vh;"
37
+ class="row justify-center items-center"
38
+ >
97
39
  <q-form
98
- ref="billetForm"
99
- :action="payment ? payment.invoiceUrl : ''"
100
- method="post"
101
- target="_blank"
40
+ :action="payment ? payment.invoiceUrl : ''"
41
+ method ="post"
42
+ target ="_blank"
102
43
  >
103
- <input type="hidden" name="DC" :value="itauHash"/>
44
+ <input type="hidden" name="DC" :value="itauHash" />
45
+ <q-btn
46
+ type ="submit"
47
+ icon ="money"
48
+ size ="lg"
49
+ color ="primary"
50
+ label ="Gerar boleto"
51
+ @click ="loadOnFocus = true"
52
+ :disable="isPaid"
53
+ />
104
54
  </q-form>
105
55
  </div>
106
56
  </div>
107
57
 
108
58
  <!-- PAID MESSAGE -->
59
+
109
60
  <div class="col-12" v-if="payment !== null && isPaid">
110
- <div class="row items-center justify-center" style="min-height: 90vh;">
61
+ <div
62
+ class="row items-center justify-center"
63
+ style="min-height: 90vh;"
64
+ >
111
65
  <q-banner class="text-white bg-positive text-center text-h3" rounded>
112
66
  <template v-slot:avatar>
113
- <q-icon name="thumb_up" color="white"/>
67
+ <q-icon name="thumb_up" color="white" />
114
68
  </template>
115
69
  O boleto foi pago
116
70
  </q-banner>
@@ -120,26 +74,23 @@
120
74
  </template>
121
75
 
122
76
  <script>
123
- import {mapActions, mapGetters} from 'vuex';
124
- import axios from 'axios';
125
- import {ENTRYPOINT} from '../../../../../../../../src/config/entrypoint';
77
+ import { date, extend } from 'quasar';
78
+ import { mapActions, mapGetters } from 'vuex';
126
79
 
127
80
  export default {
128
81
  props: {
129
82
  invoiceId: {
130
- type: String,
83
+ type : String,
131
84
  required: true,
132
85
  },
133
- orderId: {
134
- type: String,
86
+ orderId : {
87
+ type : String,
135
88
  required: true,
136
89
  },
137
90
  },
138
91
 
139
- components: {},
140
-
141
92
  mounted() {
142
- window.addEventListener('focus', this.loadItauDataOnFocus);
93
+ window.addEventListener ('focus', this.loadItauDataOnFocus);
143
94
  },
144
95
 
145
96
  beforeDestroy() {
@@ -152,20 +103,12 @@ export default {
152
103
 
153
104
  data() {
154
105
  return {
155
- invoiceUrlInter: null,
156
- invoiceUrlSicred: null,
157
- showBilletInter: null,
158
- showBilletSicred: null,
159
- showInfoBox: null,
160
- isLoadingDownload: false,
161
- isLoading: false,
162
- payment: null,
163
- isPaid: false,
164
- itauHash: null,
165
- showBillet: false,
106
+ isLoading : false,
107
+ payment : null,
108
+ isPaid : false,
109
+ itauHash : null,
110
+ showBillet : false,
166
111
  loadOnFocus: false,
167
- retrievingHash: false,
168
- paymentInstitution: null
169
112
  };
170
113
  },
171
114
 
@@ -173,24 +116,27 @@ export default {
173
116
  ...mapGetters({
174
117
  myCompany: 'people/currentCompany',
175
118
  }),
119
+
176
120
  paymentIsPending() {
177
121
  if (this.payment === null)
178
122
  return false;
179
123
 
180
- return this.payment.invoiceRealStatus === 'pending';
124
+ return ['waiting payment', 'outdated billing']
125
+ .includes(this.payment.status);
181
126
  },
127
+
182
128
  billetMustBeCreated() {
183
129
  if (this.payment === null)
184
130
  return false;
185
131
 
186
- return this.payment.paymentType === 'choose_pending' || this.payment.paymentStatus !== 'paid';
132
+ return this.payment.paymentType == 'choose_pending';
187
133
  },
188
134
  },
189
135
 
190
136
  watch: {
191
137
  myCompany(company) {
192
138
  if (company !== null) {
193
- this.$router.push("/finance/receive");
139
+ this.getPaymentStatus();
194
140
  }
195
141
  },
196
142
 
@@ -198,57 +144,28 @@ export default {
198
144
  if (!data)
199
145
  return;
200
146
 
201
- this.isPaid = data.paymentStatus === 'paid';
202
-
203
- if(this.payment.paymentStatus === 'open')
204
- {
205
- this.showInfoBox = true;
147
+ if (data.paymentType == 'choose_pending' || data.paymentStatus == 'no_finished') {
148
+ this.isPaid = false;
149
+ this.getItauHash();
206
150
  }
207
-
208
- if (data.paymentType == 'billet') {
209
-
210
- if (data.paymentStatus !== 'open') {
211
-
212
- this.showInfoBox = false;
213
-
214
- if (this.paymentInstitution === 'itau') {
215
- this.getItauHash().then(hash => {
216
- if (hash !== null) {
217
- this.showBillet = true;
218
- }
219
- });
220
-
221
- } else if(this.paymentInstitution === 'inter') {
222
-
223
- this.showBillet = false;
224
- let urlTmp = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/download?timestamp${new Date().getTime()}`;
225
- this.invoiceUrlInter = urlTmp;
226
- this.isLoading = false;
227
- this.showBilletInter = true;
228
-
229
- }
151
+ else {
152
+ if (data.paymentType == 'billet') {
153
+ if (data.paymentStatus == 'paid')
154
+ this.isPaid = true;
230
155
  else {
156
+ this.isPaid = false;
231
157
 
232
- this.showBillet = false;
233
- let urlTmp = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/bank/sicred/download?timestamp${new Date().getTime()}`;
234
- // let urlTmp = ENTRYPOINT + `/download?invoiceUrl=${this.payment.invoiceUrl}`;
235
- this.invoiceUrlSicred = urlTmp;
236
- this.isLoading = false;
237
- this.showBilletSicred = true;
238
-
239
- }
158
+ if (data.paymentStatus == 'created')
159
+ this.getItauHash()
160
+ .then(hash => {
161
+ if (hash !== null)
162
+ this.showBillet = true;
163
+ });
164
+ else
165
+ this.showBillet = false;
166
+ }
240
167
  }
241
-
242
168
  }
243
-
244
- this.$emit(
245
- 'billetStatus',
246
- {
247
- hasBillet: data.paymentType === 'billet' && data.paymentStatus === 'created',
248
- isPaid: data.paymentStatus === 'paid'
249
- }
250
- );
251
-
252
169
  },
253
170
 
254
171
  showBillet(show) {
@@ -260,198 +177,73 @@ export default {
260
177
 
261
178
  methods: {
262
179
  ...mapActions({
263
- getItauData: 'receiveInvoice/bankItau',
264
- getInterData: 'receiveInvoice/bankInter',
265
- getSicredData: 'receiveInvoice/bankSicred',
266
- getBankPerInvoiceId: 'receiveInvoice/getBankPerInvoiceId',
180
+ getItauData: 'payInvoice/bankItau',
267
181
  }),
268
182
 
269
- mountInvoiceUrlInter() {
270
- let invoiceUrl = encodeURIComponent(this.payment.invoiceUrl);
271
- return axios({
272
- url: ENTRYPOINT + `/download?invoiceUrl=${invoiceUrl}&timestamp=${new Date().getTime()}`,
273
- method: 'get',
274
- responseType: 'blob'
275
- }).then((response) => {
276
- let blob = new Blob([response.data], {type: 'application/pdf'}), url = window.URL.createObjectURL(blob);
277
- return url;
278
- });
279
- },
280
-
281
- clickDownloadBilletInter() {
282
- let urlTmp = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/download?timestamp${new Date().getTime()}`;
283
- window.open(urlTmp);
284
- },
285
-
286
- mountInvoiceUrlSicred() {
287
- let invoiceUrl = encodeURIComponent(this.payment.invoiceUrl);
288
- return axios({
289
- url: ENTRYPOINT + `/download?invoiceUrl=${invoiceUrl}&timestamp=${new Date().getTime()}`,
290
- method: 'get',
291
- responseType: 'blob'
292
- }).then((response) => {
293
- let blob = new Blob([response.data], {type: 'application/pdf'}), url = window.URL.createObjectURL(blob);
294
-
295
- console.log(url);
296
-
297
- return url;
298
- });
299
- },
300
-
301
- clickDownloadBilletSicred() {
302
- let urlTmp = ENTRYPOINT + `/download?invoiceUrl=${this.payment.invoiceUrl}`;
303
- window.open(urlTmp);
304
- },
305
-
306
- getBank() {
307
- return this.getBankPerInvoiceId({
308
- invoiceId: this.invoiceId
309
- }).then(data => {
310
- if (data !== null) {
311
- this.paymentInstitution = data.config_value;
312
- this.getPaymentStatus();
313
- return data;
314
- }
315
- return null;
316
- }).catch(error => {
317
- });
318
- },
319
-
320
- refresh() {
321
- this.getPaymentStatus();
322
- },
323
-
324
183
  loadItauDataOnFocus() {
325
184
  if (this.loadOnFocus) {
326
- this.getPaymentStatus().then(data => {
327
- this.loadOnFocus = false;
328
- });
185
+ this.getPaymentStatus()
186
+ .then(data => {
187
+ this.loadOnFocus = false;
188
+ });
329
189
  }
330
190
  },
331
191
 
332
192
  getItauHash() {
333
193
  let params = {};
334
194
 
195
+ this.isLoading = true;
196
+
335
197
  if (this.myCompany !== null)
336
198
  params['myCompany'] = this.myCompany.id;
337
199
 
338
200
  return this.getItauData({
339
201
  invoiceId: this.invoiceId,
340
202
  operation: 'itauhash',
341
- params: params
342
- }).then(data => {
343
- if (data !== null) {
344
- return this.itauHash = data;
345
- }
346
- return null;
347
- }).catch(error => {
203
+ params : params
204
+ })
205
+ .then(data => {
206
+ if (data !== null) {
207
+ return this.itauHash = data;
208
+ }
348
209
 
349
- });
210
+ return null;
211
+ })
212
+ .catch(error => {
213
+
214
+ })
215
+ .finally(() => {
216
+ this.isLoading = false;
217
+ });
350
218
  },
351
219
 
352
220
  getPaymentStatus() {
353
-
354
- if (this.isLoading) {
355
- return null;
356
- }
357
-
358
221
  let params = {};
359
222
 
360
223
  this.isLoading = true;
361
224
 
362
- if (this.myCompany !== null) {
225
+ if (this.myCompany !== null)
363
226
  params['myCompany'] = this.myCompany.id;
364
- }
365
-
366
- return this.getBank().then(data2 => {
367
-
368
- if (this.paymentInstitution === 'itau') {
369
227
 
370
- this.getItauData({
371
- invoiceId: this.invoiceId,
372
- operation: 'payment',
373
- params: params
374
- }).then(data => {
375
- if (data !== null) {
376
- return this.payment = data;
377
- }
378
- return null;
379
- }).catch(error => {
380
-
381
- }).finally(() => {
382
- this.isLoading = false;
383
- // this.isLoading = false;
384
- });
385
-
386
- } else if(this.paymentInstitution === 'inter'){
387
-
388
- this.getInterData({
389
- invoiceId: this.invoiceId,
390
- operation: 'payment',
391
- params: params
392
- }).then(data => {
393
- if (data !== null) {
394
- if (!data.response.success) {
395
- let msgErro = data.response.error;
396
- this.$q.notify({
397
- message: msgErro,
398
- html: true,
399
- group: false,
400
- multiLine: true,
401
- position: 'bottom',
402
- type: 'negative',
403
- });
404
- return this.payment = null;
405
- } else {
406
- return this.payment = data.response.data;
407
- }
408
- } else {
409
- return this.payment = null;
410
- }
411
- return null;
412
- }).catch(error => {
413
- console.table(error);
414
- }).finally(() => {
415
- this.isLoading = false;
416
- });
417
-
418
- }
419
- else {
420
-
421
- this.getSicredData({
422
- invoiceId: this.invoiceId,
423
- operation: 'payment',
424
- params: params
425
- }).then(data => {
426
- if (data !== null) {
427
- if (!data.response.success) {
428
- let msgErro = data.response.error;
429
- this.$q.notify({
430
- message: msgErro,
431
- html: true,
432
- group: false,
433
- multiLine: true,
434
- position: 'bottom',
435
- type: 'negative',
436
- });
437
- return this.payment = null;
438
- } else {
439
- return this.payment = data.response.data;
440
- }
441
- } else {
442
- return this.payment = null;
443
- }
444
- return null;
445
- }).catch(error => {
446
- console.table(error);
447
- }).finally(() => {
448
- this.isLoading = false;
449
- });
450
-
451
- }
228
+ return this.getItauData({
229
+ invoiceId: this.invoiceId,
230
+ operation: 'payment',
231
+ params : params
232
+ })
233
+ .then(data => {
234
+ if (data !== null) {
235
+ return this.payment = data;
236
+ }
452
237
 
453
- });
238
+ return null;
239
+ })
240
+ .catch(error => {
241
+
242
+ })
243
+ .finally(() => {
244
+ this.isLoading = false;
245
+ });
454
246
  },
455
247
  },
456
248
  };
457
- </script>
249
+ </script>
@@ -34,59 +34,31 @@
34
34
  <td class="text-left text-bold">Número da fatura</td>
35
35
  <td class="text-left">
36
36
  {{
37
- `#${this.invoice["@id"].match(
38
- /^\/finance\/receive\/([a-z0-9-]*)$/
39
- )[1]
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
-
58
46
  <tr>
59
47
  <td class="text-left text-bold">Valor da fatura</td>
60
48
  <td class="text-left">
61
49
  {{ formatMoney(this.invoice.price) }}
62
50
  </td>
63
51
  </tr>
64
-
65
52
  <tr>
66
- <td class="text-left text-bold">Desconto</td>
53
+ <td class="text-left text-bold">Vencimento</td>
67
54
  <td class="text-left">
68
-
69
- <EditInvoiceDiscount v-if="discount" :discount="discount" :invoiceId="invoice['@id'] || ''"
70
- @saved="requestInvoice(invoiceId)" />
71
-
55
+ <EditInvoiceDuedate v-if="editDueDate" :dueDate="invoice.dueDate"
56
+ :invoiceId="invoice['@id'] || ''" @saved="(data) => (invoice = data)" />
72
57
  <div v-else>
73
- <EditInvoiceDiscount :discount="discount" :invoiceId="invoice['@id'] || ''"
74
- @saved="requestInvoice(invoiceId)" />
58
+ {{ invoice.dueDate }}
75
59
  </div>
76
-
77
60
  </td>
78
61
  </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
-
90
62
  </tbody>
91
63
  </q-markup-table>
92
64
  </div>
@@ -102,11 +74,12 @@
102
74
  <div class="col-xs-12 text-h6 text-center">
103
75
  {{ $t(`invoice.statuses.${invoice.status.status}`) }}
104
76
  </div>
105
- <InvoiceActions :invoice="invoice" @changed="(newInvoice) => {
106
- this.invoice = newInvoice;
107
- this.$refs.invoiceBillet.refresh();
108
- }
109
- " />
77
+ <InvoiceActions :invoice="invoice" @changed="
78
+ (newInvoice) => {
79
+ this.invoice = newInvoice;
80
+ this.$refs.invoiceBillet.refresh();
81
+ }
82
+ " />
110
83
  </div>
111
84
  </div>
112
85
  </div>
@@ -122,18 +95,19 @@
122
95
 
123
96
  <q-tab-panels v-model="currentTab">
124
97
  <q-tab-panel name="invoice" class="q-pa-none">
125
- <InvoiceInvoice ref="invoiceBillet" :invoiceId="invoiceId" :orderId="orderId" @billetStatus="(status) => {
126
- this.editDueDate = status.hasBillet === false;
127
- }
128
- " />
98
+ <InvoiceInvoice ref="invoiceBillet" :invoiceId="invoiceId" :orderId="orderId" @billetStatus="
99
+ (status) => {
100
+ this.editDueDate = status.hasBillet === false;
101
+ }
102
+ " />
129
103
  </q-tab-panel>
130
104
 
131
105
  <q-tab-panel name="orders" class="q-pa-none">
132
- <!-- <InvoiceOrders :invoiceId="invoiceId" :invoice="{
106
+ <InvoiceOrders :invoiceId="invoiceId" :invoice="{
133
107
  '@id': invoice ? invoice['@id'] : null,
134
108
  status: invoice ? invoice.status.realStatus : null,
135
- billet: editDueDate = true,
136
- }" /> -->
109
+ billet: editDueDate ? false : true,
110
+ }" />
137
111
  </q-tab-panel>
138
112
  </q-tab-panels>
139
113
  </div>
@@ -162,8 +136,6 @@ import {
162
136
  import EditInvoiceDuedate from "@freteclick/quasar-common-ui/src/components/common/EditInvoiceDuedate.vue";
163
137
  import InvoiceActions from "@freteclick/quasar-common-ui/src/components/common/InvoiceActions.vue";
164
138
  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
-
167
139
 
168
140
  export default {
169
141
  components: {
@@ -172,7 +144,6 @@ export default {
172
144
  EditInvoiceDuedate,
173
145
  InvoiceActions,
174
146
  InvoiceEditActions,
175
- EditInvoiceDiscount,
176
147
  },
177
148
 
178
149
  created() {
@@ -181,7 +152,6 @@ export default {
181
152
 
182
153
  if (this.myCompany !== null && this.invoiceId !== null) {
183
154
  this.requestInvoice(this.invoiceId);
184
- // this.requestInvoiceDiscount(this.invoiceId);
185
155
  }
186
156
  },
187
157
 
@@ -192,7 +162,6 @@ export default {
192
162
  invoiceId: null,
193
163
  orderId: null,
194
164
  invoice: null,
195
- discount: null,
196
165
  isLoading: false,
197
166
  editDueDate: false,
198
167
  notFound: false,
@@ -215,14 +184,12 @@ export default {
215
184
  myCompany(company) {
216
185
  if (company !== null) {
217
186
  this.requestInvoice(this.invoiceId);
218
- // this.requestInvoiceDiscount(this.invoiceId);
219
187
  }
220
188
  },
221
189
  },
222
190
 
223
191
  methods: {
224
192
  ...mapActions({
225
- getInvoiceDiscount: "receiveInvoice/getInvoiceDiscount",
226
193
  getInvoice: "receiveInvoice/getInvoice",
227
194
  renewInvoice: "receiveInvoice/renewInvoice",
228
195
  }),
@@ -259,7 +226,6 @@ export default {
259
226
  this.notFound = true;
260
227
  });
261
228
  },
262
-
263
229
  requestInvoice(invoiceId) {
264
230
  if (this.isLoading) return;
265
231
 
@@ -273,8 +239,6 @@ export default {
273
239
  .then((data) => {
274
240
  this.isLoading = false;
275
241
 
276
- this.requestInvoiceDiscount(invoiceId);
277
-
278
242
  if (data["@id"]) {
279
243
  this.invoice = data;
280
244
  this.notFound = false;
@@ -312,29 +276,6 @@ export default {
312
276
  this.notFound = true;
313
277
  });
314
278
  },
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
-
338
279
  },
339
280
  };
340
- </script>
281
+ </script>
@@ -206,8 +206,8 @@ export default {
206
206
  data: [],
207
207
  filters: {
208
208
  orderType: {
209
- label: "Venda",
210
- value: "sale",
209
+ label: "Todos",
210
+ value: null,
211
211
  },
212
212
  date: {
213
213
  from: "",
@@ -1,49 +1,16 @@
1
1
  <template>
2
2
  <div class="row items-center justify-center">
3
3
  <div class="flex flex-center" v-if="isLoading">
4
- <q-circular-progress
5
- :indeterminate="isLoading"
6
- size="sm"
7
- color="primary"
8
- class="q-ma-md"
4
+ <q-circular-progress :indeterminate="isLoading"
5
+ size="sm"
6
+ color="primary"
7
+ class="q-ma-md"
9
8
  />
10
9
  Carregando...
11
10
  </div>
12
11
 
13
- <div :class="showInfoBox ? 'full-width q-pa-lg' : 'hidden'">
14
- <div class="q-pa-md q-gutter-sm">
15
- <q-banner inline-actions rounded class="bg-primary text-white text-center">
16
- <h6>Este boleto não pode ser gerado agora, pois a fatura está em aberto.</h6>
17
- </q-banner>
18
- </div>
19
- </div>
20
-
21
- <!-- BILLET VIEWER SICRED -->
22
- <div :class="showBilletSicred ? 'full-width q-pa-lg' : 'hidden'">
23
- <div class="col-12 q-pt-lg" v-if="paymentInstitution === 'sicred'">
24
- <!-- <div class="row justify-center items-center">
25
- <q-btn
26
- icon="money"
27
- size="lg"
28
- color="primary"
29
- label="Abrir Boleto Pix"
30
- :loading="isLoadingDownload"
31
- @click="clickDownloadBilletSicred()"
32
- :disable="isPaid"
33
- />
34
- </div> -->
35
-
36
- <div style="height: 1200px">
37
- <iframe
38
- :src="invoiceUrlSicred"
39
- name="BILLETINTER" id="billet_sicred" width="100%" height="100%" frameBorder="0">
40
- <p>This browser does not support IFrame.</p>
41
- </iframe>
42
- </div>
43
- </div>
44
- </div>
45
-
46
12
  <!-- BILLET VIEWER INTER -->
13
+
47
14
  <div :class="showBilletInter ? 'full-width q-pa-lg' : 'hidden'">
48
15
  <div style="height: 1200px">
49
16
  <iframe
@@ -55,6 +22,7 @@
55
22
  </div>
56
23
 
57
24
  <!-- BILLET VIEWER ITAU -->
25
+
58
26
  <div :class="showBillet ? 'full-width q-pa-lg' : 'hidden'">
59
27
  <q-form
60
28
  ref="myForm"
@@ -65,6 +33,7 @@
65
33
  >
66
34
  <input type="hidden" name="DC" :value="itauHash"/>
67
35
  </q-form>
36
+
68
37
  <div style="height: 1200px">
69
38
  <iframe name="BILLET" width="100%" height="100%" frameBorder="0">
70
39
  <p>This browser does not support IFrame.</p>
@@ -73,6 +42,7 @@
73
42
  </div>
74
43
 
75
44
  <!-- BILLET GENERATOR TRIGGER -->
45
+
76
46
  <div class="col-12 q-pt-lg" v-if="paymentIsPending && billetMustBeCreated && paymentInstitution === 'itau'">
77
47
  <div style="min-height: 80vh;" class="row justify-center items-center">
78
48
  <q-btn
@@ -105,7 +75,22 @@
105
75
  </div>
106
76
  </div>
107
77
 
78
+ <div class="col-12 q-pt-lg" v-if="paymentIsPending && paymentInstitution === 'inter'">
79
+ <div style="min-height: 80vh;" class="row justify-center items-center">
80
+ <q-btn
81
+ icon="money"
82
+ size="lg"
83
+ color="primary"
84
+ label="Abrir Boleto"
85
+ :loading="isLoadingDownload"
86
+ @click="clickDownloadBilletInter()"
87
+ :disable="isPaid"
88
+ />
89
+ </div>
90
+ </div>
91
+
108
92
  <!-- PAID MESSAGE -->
93
+
109
94
  <div class="col-12" v-if="payment !== null && isPaid">
110
95
  <div class="row items-center justify-center" style="min-height: 90vh;">
111
96
  <q-banner class="text-white bg-positive text-center text-h3" rounded>
@@ -122,7 +107,7 @@
122
107
  <script>
123
108
  import {mapActions, mapGetters} from 'vuex';
124
109
  import axios from 'axios';
125
- import {ENTRYPOINT} from '../../../../../../../../src/config/entrypoint';
110
+ import {ENTRYPOINT} from '@app/src/config/entrypoint';
126
111
 
127
112
  export default {
128
113
  props: {
@@ -136,8 +121,6 @@ export default {
136
121
  },
137
122
  },
138
123
 
139
- components: {},
140
-
141
124
  mounted() {
142
125
  window.addEventListener('focus', this.loadItauDataOnFocus);
143
126
  },
@@ -153,10 +136,7 @@ export default {
153
136
  data() {
154
137
  return {
155
138
  invoiceUrlInter: null,
156
- invoiceUrlSicred: null,
157
139
  showBilletInter: null,
158
- showBilletSicred: null,
159
- showInfoBox: null,
160
140
  isLoadingDownload: false,
161
141
  isLoading: false,
162
142
  payment: null,
@@ -165,7 +145,7 @@ export default {
165
145
  showBillet: false,
166
146
  loadOnFocus: false,
167
147
  retrievingHash: false,
168
- paymentInstitution: null
148
+ paymentInstitution: null // 'itau','inter'
169
149
  };
170
150
  },
171
151
 
@@ -200,16 +180,9 @@ export default {
200
180
 
201
181
  this.isPaid = data.paymentStatus === 'paid';
202
182
 
203
- if(this.payment.paymentStatus === 'open')
204
- {
205
- this.showInfoBox = true;
206
- }
207
-
208
183
  if (data.paymentType == 'billet') {
209
184
 
210
- if (data.paymentStatus !== 'open') {
211
-
212
- this.showInfoBox = false;
185
+ if (data.paymentStatus == 'created' && this.isPaid === false) {
213
186
 
214
187
  if (this.paymentInstitution === 'itau') {
215
188
  this.getItauHash().then(hash => {
@@ -218,7 +191,7 @@ export default {
218
191
  }
219
192
  });
220
193
 
221
- } else if(this.paymentInstitution === 'inter') {
194
+ } else { // -------------------------------------- Banco Inter
222
195
 
223
196
  this.showBillet = false;
224
197
  let urlTmp = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/download?timestamp${new Date().getTime()}`;
@@ -227,16 +200,11 @@ export default {
227
200
  this.showBilletInter = true;
228
201
 
229
202
  }
230
- else {
231
-
232
- this.showBillet = false;
233
- let urlTmp = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/bank/sicred/download?timestamp${new Date().getTime()}`;
234
- // let urlTmp = ENTRYPOINT + `/download?invoiceUrl=${this.payment.invoiceUrl}`;
235
- this.invoiceUrlSicred = urlTmp;
236
- this.isLoading = false;
237
- this.showBilletSicred = true;
238
-
239
- }
203
+ } else {
204
+ this.showBillet = false;
205
+ if (this.paymentInstitution === 'inter') {
206
+ this.isPaid = data.status === 'paid';
207
+ }
240
208
  }
241
209
 
242
210
  }
@@ -262,7 +230,6 @@ export default {
262
230
  ...mapActions({
263
231
  getItauData: 'receiveInvoice/bankItau',
264
232
  getInterData: 'receiveInvoice/bankInter',
265
- getSicredData: 'receiveInvoice/bankSicred',
266
233
  getBankPerInvoiceId: 'receiveInvoice/getBankPerInvoiceId',
267
234
  }),
268
235
 
@@ -283,26 +250,6 @@ export default {
283
250
  window.open(urlTmp);
284
251
  },
285
252
 
286
- mountInvoiceUrlSicred() {
287
- let invoiceUrl = encodeURIComponent(this.payment.invoiceUrl);
288
- return axios({
289
- url: ENTRYPOINT + `/download?invoiceUrl=${invoiceUrl}&timestamp=${new Date().getTime()}`,
290
- method: 'get',
291
- responseType: 'blob'
292
- }).then((response) => {
293
- let blob = new Blob([response.data], {type: 'application/pdf'}), url = window.URL.createObjectURL(blob);
294
-
295
- console.log(url);
296
-
297
- return url;
298
- });
299
- },
300
-
301
- clickDownloadBilletSicred() {
302
- let urlTmp = ENTRYPOINT + `/download?invoiceUrl=${this.payment.invoiceUrl}`;
303
- window.open(urlTmp);
304
- },
305
-
306
253
  getBank() {
307
254
  return this.getBankPerInvoiceId({
308
255
  invoiceId: this.invoiceId
@@ -365,7 +312,7 @@ export default {
365
312
 
366
313
  return this.getBank().then(data2 => {
367
314
 
368
- if (this.paymentInstitution === 'itau') {
315
+ if (this.paymentInstitution === 'itau') { // ------------------------------ Banco 'itau'
369
316
 
370
317
  this.getItauData({
371
318
  invoiceId: this.invoiceId,
@@ -383,7 +330,7 @@ export default {
383
330
  // this.isLoading = false;
384
331
  });
385
332
 
386
- } else if(this.paymentInstitution === 'inter'){
333
+ } else { // ------------------------------ Banco 'inter'
387
334
 
388
335
  this.getInterData({
389
336
  invoiceId: this.invoiceId,
@@ -416,39 +363,6 @@ export default {
416
363
  });
417
364
 
418
365
  }
419
- else {
420
-
421
- this.getSicredData({
422
- invoiceId: this.invoiceId,
423
- operation: 'payment',
424
- params: params
425
- }).then(data => {
426
- if (data !== null) {
427
- if (!data.response.success) {
428
- let msgErro = data.response.error;
429
- this.$q.notify({
430
- message: msgErro,
431
- html: true,
432
- group: false,
433
- multiLine: true,
434
- position: 'bottom',
435
- type: 'negative',
436
- });
437
- return this.payment = null;
438
- } else {
439
- return this.payment = data.response.data;
440
- }
441
- } else {
442
- return this.payment = null;
443
- }
444
- return null;
445
- }).catch(error => {
446
- console.table(error);
447
- }).finally(() => {
448
- this.isLoading = false;
449
- });
450
-
451
- }
452
366
 
453
367
  });
454
368
  },
@@ -2,29 +2,29 @@
2
2
  export const routes = [
3
3
  {
4
4
  path : '/finance/',
5
- component: () => import('../../../../../src/layouts/AdminLayout.vue'),
5
+ component: () => import('@app/src/layouts/AdminLayout.vue'),
6
6
  children : [
7
7
  { name: 'ClientInvoiceIndex', path: 'client', component: () => import('../pages/Invoice/Client/Index.vue') },
8
8
  { name: 'ClientInvoiceDetails', path: 'client/id/:id', component: () => import('../pages/Invoice/Client/Details.vue') },
9
-
10
- {
11
- name: 'FinancePayIndex',
12
- path: 'pay',
9
+
10
+ {
11
+ name: 'FinancePayIndex',
12
+ path: 'pay',
13
13
  component: () => import('../pages/Invoice/Pay/Index.vue')
14
14
  },
15
- {
16
- name: 'PayDetails',
17
- path: 'pay/id/:id',
18
- component: () => import('../pages/Invoice/Pay/Details.vue')
15
+ {
16
+ name: 'PayDetails',
17
+ path: 'pay/id/:id',
18
+ component: () => import('../pages/Invoice/Pay/Details.vue')
19
19
  },
20
- {
21
- name: 'FinanceReceiveIndex',
22
- path: 'receive',
20
+ {
21
+ name: 'FinanceReceiveIndex',
22
+ path: 'receive',
23
23
  component: () => import('../pages/Invoice/Receive/Index.vue')
24
24
  },
25
- {
26
- name: 'ReceiveDetails',
27
- path: 'receive/id/:id',
25
+ {
26
+ name: 'ReceiveDetails',
27
+ path: 'receive/id/:id',
28
28
  component: () => import('../pages/Invoice/Receive/Details.vue')
29
29
  },
30
30
  ]
@@ -1,5 +1,5 @@
1
1
  import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
2
- import { fetch } from '../../../../../../../../src/boot/myapi';
2
+ import { fetch } from '@app/src/boot/myapi';
3
3
  import * as types from './mutation_types';
4
4
 
5
5
  const RESOURCE_ENDPOINT = '/finance/comission';
@@ -1,5 +1,5 @@
1
1
  import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
2
- import { fetch } from '../../../../../../../../src/boot/myapi';
2
+ import { fetch } from '@app/src/boot/myapi';
3
3
 
4
4
 
5
5
 
@@ -1,5 +1,5 @@
1
1
  import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
2
- import { fetch } from '../../../../../../../../src/boot/myapi';
2
+ import { fetch } from '@app/src/boot/myapi';
3
3
  import * as types from './mutation_types';
4
4
 
5
5
  const RESOURCE_ENDPOINT = '/finance/pay';
@@ -1,5 +1,5 @@
1
1
  import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
2
- import { fetch } from '../../../../../../../../src/boot/myapi';
2
+ import { fetch } from '@app/src/boot/myapi';
3
3
  import * as types from './mutation_types';
4
4
 
5
5
  const RESOURCE_ENDPOINT = '/finance/receive';
@@ -63,13 +63,6 @@ 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
- };
73
66
 
74
67
  export const renewInvoice = ({ commit }, { invoiceId, params }) => {
75
68
 
@@ -111,17 +104,6 @@ export const bankInter = ({ commit }, { invoiceId, operation, params = {} }) =>
111
104
  });
112
105
  };
113
106
 
114
- export const bankSicred = ({ commit }, { invoiceId, operation, params = {} }) => {
115
- return fetch(`/finance/receive/${invoiceId}/bank/sicred/${operation}`, { params })
116
- .then(response => response.json())
117
- .then(data => {
118
- if (data.response) {
119
- return data;
120
- }
121
- return null;
122
- });
123
- };
124
-
125
107
  export const getBankPerInvoiceId = ({ commit }, { invoiceId, params = {} }) => {
126
108
  return fetch(`/finance/receive/${invoiceId}/bank`, { params })
127
109
  .then(response => response.json())
@@ -150,23 +132,6 @@ export const updateInvoiceDuedate = ({ commit }, { id, dueDate, params }) => {
150
132
  });
151
133
  };
152
134
 
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
-
170
135
  export const deleteInvoiceOrder = ({ commit }, { invoiceId, orderId, params }) => {
171
136
  let options = {
172
137
  method: 'PUT',
@@ -1,5 +1,5 @@
1
1
  import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
2
- import { fetch } from '../../../../../../../../src/boot/myapi';
2
+ import { fetch } from '@app/src/boot/myapi';
3
3
  import * as types from './mutation_types';
4
4
 
5
5
  const RESOURCE_ENDPOINT = '/finance/receive';