@freteclick/quasar-financial-ui 1.0.85 → 1.0.86

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