@freteclick/quasar-financial-ui 1.0.85

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 +18 -0
  2. package/src/components/common/Filters.vue +141 -0
  3. package/src/components/expense/FormExpense.vue +309 -0
  4. package/src/components/expense/TableExpenses.vue +305 -0
  5. package/src/components/invoice/client/ClientInvoiceDetails.vue +213 -0
  6. package/src/components/invoice/client/InvoiceSearching.vue +383 -0
  7. package/src/components/invoice/client/details/InvoiceInvoice.vue +249 -0
  8. package/src/components/invoice/client/details/InvoiceOrders.vue +328 -0
  9. package/src/components/invoice/expense/CreateExpense.vue +539 -0
  10. package/src/components/invoice/expense/DetailExpense.vue +393 -0
  11. package/src/components/invoice/pay/InvoiceDetails.vue +210 -0
  12. package/src/components/invoice/pay/InvoiceSearching.vue +388 -0
  13. package/src/components/invoice/pay/details/InvoiceInvoice.vue +47 -0
  14. package/src/components/invoice/pay/details/InvoiceOrders.vue +342 -0
  15. package/src/components/invoice/receive/InvoiceDetails.vue +281 -0
  16. package/src/components/invoice/receive/InvoiceSearching.vue +359 -0
  17. package/src/components/invoice/receive/details/InvoiceInvoice.vue +371 -0
  18. package/src/components/invoice/receive/details/InvoiceInvoiceBkp.vue +260 -0
  19. package/src/components/invoice/receive/details/InvoiceOrders.vue +370 -0
  20. package/src/i18n/en-us/index.js +8 -0
  21. package/src/i18n/index.js +5 -0
  22. package/src/i18n/pt-br/index.js +30 -0
  23. package/src/pages/Invoice/Client/Details.vue +23 -0
  24. package/src/pages/Invoice/Client/Index.vue +27 -0
  25. package/src/pages/Invoice/Pay/Details.vue +23 -0
  26. package/src/pages/Invoice/Pay/Index.vue +53 -0
  27. package/src/pages/Invoice/Receive/Details.vue +23 -0
  28. package/src/pages/Invoice/Receive/Index.vue +27 -0
  29. package/src/router/routes.js +32 -0
  30. package/src/store/modules/invoice/comission/actions.js +66 -0
  31. package/src/store/modules/invoice/comission/getters.js +7 -0
  32. package/src/store/modules/invoice/comission/index.js +19 -0
  33. package/src/store/modules/invoice/comission/mutation_types.js +8 -0
  34. package/src/store/modules/invoice/comission/mutations.js +42 -0
  35. package/src/store/modules/invoice/expense/actions.js +98 -0
  36. package/src/store/modules/invoice/expense/getters.js +1 -0
  37. package/src/store/modules/invoice/expense/index.js +12 -0
  38. package/src/store/modules/invoice/expense/mutations.js +3 -0
  39. package/src/store/modules/invoice/expense/state.js +5 -0
  40. package/src/store/modules/invoice/pay/actions.js +114 -0
  41. package/src/store/modules/invoice/pay/getters.js +7 -0
  42. package/src/store/modules/invoice/pay/index.js +19 -0
  43. package/src/store/modules/invoice/pay/mutation_types.js +8 -0
  44. package/src/store/modules/invoice/pay/mutations.js +42 -0
  45. package/src/store/modules/invoice/receive/actions.js +152 -0
  46. package/src/store/modules/invoice/receive/actionsBkp.js +77 -0
  47. package/src/store/modules/invoice/receive/getters.js +7 -0
  48. package/src/store/modules/invoice/receive/index.js +19 -0
  49. package/src/store/modules/invoice/receive/mutation_types.js +8 -0
  50. package/src/store/modules/invoice/receive/mutations.js +42 -0
  51. package/src/store/store-flag.d.ts +9 -0
@@ -0,0 +1,371 @@
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>
@@ -0,0 +1,260 @@
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 -->
13
+
14
+ <div :class="showBillet ? 'full-width q-pa-lg' : 'hidden'">
15
+ <q-form
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"
21
+ >
22
+ <input type="hidden" name="DC" :value="itauHash" />
23
+ </q-form>
24
+
25
+ <div style="height: 1200px">
26
+ <iframe name="BILLET" width="100%" height="100%" frameBorder="0">
27
+ <p>This browser does not support IFrame.</p>
28
+ </iframe>
29
+ </div>
30
+ </div>
31
+
32
+ <!-- BILLET GENERATOR TRIGGER -->
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
+ >
39
+ <q-btn
40
+ icon ="money"
41
+ size ="lg"
42
+ color ="primary"
43
+ label ="Gerar boleto"
44
+ :loading="retrievingHash"
45
+ @click ="() => {
46
+ this.retrievingHash = true;
47
+
48
+ this.getItauHash()
49
+ .then(hash => {
50
+ if (hash !== null) {
51
+ this.loadOnFocus = true;
52
+ this.$refs.billetForm.$el
53
+ .submit();
54
+ }
55
+ })
56
+ .finally(() => {
57
+ this.retrievingHash = false;
58
+ });
59
+ }"
60
+ :disable="isPaid"
61
+ />
62
+ <q-form
63
+ ref ="billetForm"
64
+ :action="payment ? payment.invoiceUrl : ''"
65
+ method ="post"
66
+ target ="_blank"
67
+ >
68
+ <input type="hidden" name="DC" :value="itauHash" />
69
+ </q-form>
70
+ </div>
71
+ </div>
72
+
73
+ <!-- PAID MESSAGE -->
74
+
75
+ <div class="col-12" v-if="payment !== null && isPaid">
76
+ <div
77
+ class="row items-center justify-center"
78
+ style="min-height: 90vh;"
79
+ >
80
+ <q-banner class="text-white bg-positive text-center text-h3" rounded>
81
+ <template v-slot:avatar>
82
+ <q-icon name="thumb_up" color="white" />
83
+ </template>
84
+ O boleto foi pago
85
+ </q-banner>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </template>
90
+
91
+ <script>
92
+ import { mapActions, mapGetters } from 'vuex';
93
+
94
+ export default {
95
+ props: {
96
+ invoiceId: {
97
+ type : String,
98
+ required: true,
99
+ },
100
+ orderId : {
101
+ type : String,
102
+ required: true,
103
+ },
104
+ },
105
+
106
+ mounted() {
107
+ window.addEventListener ('focus', this.loadItauDataOnFocus);
108
+ },
109
+
110
+ beforeDestroy() {
111
+ window.removeEventListener('focus', this.loadItauDataOnFocus);
112
+ },
113
+
114
+ created() {
115
+ this.getPaymentStatus();
116
+ },
117
+
118
+ data() {
119
+ return {
120
+ isLoading : false,
121
+ payment : null,
122
+ isPaid : false,
123
+ itauHash : null,
124
+ showBillet : false,
125
+ loadOnFocus : false,
126
+ retrievingHash: false,
127
+ };
128
+ },
129
+
130
+ computed: {
131
+ ...mapGetters({
132
+ myCompany: 'people/currentCompany',
133
+ }),
134
+
135
+ paymentIsPending() {
136
+ if (this.payment === null)
137
+ return false;
138
+
139
+ return this.payment.invoiceRealStatus === 'pending';
140
+ },
141
+
142
+ billetMustBeCreated() {
143
+ if (this.payment === null)
144
+ return false;
145
+
146
+ return this.payment.paymentType === 'choose_pending' || this.payment.paymentStatus !== 'paid';
147
+ },
148
+ },
149
+
150
+ watch: {
151
+ myCompany(company) {
152
+ if (company !== null) {
153
+ this.getPaymentStatus();
154
+ }
155
+ },
156
+
157
+ payment(data) {
158
+ if (!data)
159
+ return;
160
+
161
+ this.isPaid = data.paymentStatus === 'paid';
162
+
163
+ if (data.paymentType == 'billet') {
164
+ if (data.paymentStatus == 'created' && this.isPaid === false)
165
+ this.getItauHash()
166
+ .then(hash => {
167
+ if (hash !== null)
168
+ this.showBillet = true;
169
+ });
170
+ else
171
+ this.showBillet = false;
172
+ }
173
+
174
+ this.$emit(
175
+ 'billetStatus',
176
+ {
177
+ hasBillet: data.paymentType === 'billet' && data.paymentStatus === 'created',
178
+ isPaid : data.paymentStatus === 'paid'
179
+ }
180
+ );
181
+ },
182
+
183
+ showBillet(show) {
184
+ if (show == true) {
185
+ this.$refs.myForm.$el.submit();
186
+ }
187
+ },
188
+ },
189
+
190
+ methods: {
191
+ ...mapActions({
192
+ getItauData: 'receiveInvoice/bankItau',
193
+ }),
194
+
195
+ refresh() {
196
+ this.getPaymentStatus();
197
+ },
198
+
199
+ loadItauDataOnFocus() {
200
+ if (this.loadOnFocus) {
201
+ this.getPaymentStatus()
202
+ .then(data => {
203
+ this.loadOnFocus = false;
204
+ });
205
+ }
206
+ },
207
+
208
+ getItauHash() {
209
+ let params = {};
210
+
211
+ if (this.myCompany !== null)
212
+ params['myCompany'] = this.myCompany.id;
213
+
214
+ return this.getItauData({
215
+ invoiceId: this.invoiceId,
216
+ operation: 'itauhash',
217
+ params : params
218
+ })
219
+ .then(data => {
220
+ if (data !== null) {
221
+ return this.itauHash = data;
222
+ }
223
+
224
+ return null;
225
+ })
226
+ .catch(error => {
227
+
228
+ });
229
+ },
230
+
231
+ getPaymentStatus() {
232
+ let params = {};
233
+
234
+ this.isLoading = true;
235
+
236
+ if (this.myCompany !== null)
237
+ params['myCompany'] = this.myCompany.id;
238
+
239
+ return this.getItauData({
240
+ invoiceId: this.invoiceId,
241
+ operation: 'payment',
242
+ params : params
243
+ })
244
+ .then(data => {
245
+ if (data !== null) {
246
+ return this.payment = data;
247
+ }
248
+
249
+ return null;
250
+ })
251
+ .catch(error => {
252
+
253
+ })
254
+ .finally(() => {
255
+ this.isLoading = false;
256
+ });
257
+ },
258
+ },
259
+ };
260
+ </script>