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