@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,383 @@
1
+ <template>
2
+ <div>
3
+ <q-table
4
+ :loading ="isLoading"
5
+ :data ="data"
6
+ :columns ="settings.columns"
7
+ :pagination.sync="pagination"
8
+ @request ="onRequest"
9
+ row-key ="id"
10
+ :visible-columns="settings.visibleColumns"
11
+ style ="min-height: 90vh;"
12
+ >
13
+ <template v-slot:top v-if="search === true">
14
+ <div class="col-xs-12 q-pb-md text-h6">
15
+ Faturas
16
+ </div>
17
+ <div class="col-sm-6 col-xs-12 q-pa-md">
18
+ <q-input stack-label
19
+ label ="Buscar por"
20
+ debounce="1000"
21
+ v-model ="filters.text"
22
+ class ="full-width"
23
+ />
24
+ </div>
25
+ <div class="col-sm-6 col-xs-12 q-pa-md">
26
+ <q-select stack-label
27
+ label ="Status da fatura"
28
+ v-model ="filters.status"
29
+ :options="statuses"
30
+ class ="full-width"
31
+ :loading="loadingStatuses"
32
+ >
33
+ <template v-slot:no-option>
34
+ <q-item>
35
+ <q-item-section class="text-grey">
36
+ Sem resultados
37
+ </q-item-section>
38
+ </q-item>
39
+ </template>
40
+ </q-select>
41
+ </div>
42
+ </template>
43
+
44
+ <template v-slot:body="props">
45
+ <q-tr :props="props">
46
+ <q-td key="id" :props="props">
47
+ <q-btn outline dense
48
+ :to ="{ name: 'ClientInvoiceDetails', params: { id: props.row.id } }"
49
+ :label="props.cols[0].value"
50
+ :style="{color:props.row.color_status}"
51
+ class ="full-width"
52
+ />
53
+ </q-td>
54
+ <q-td key="pedidos" :props="props">
55
+ <q-btn outline dense
56
+ :label="props.row.pedidos.length > 1 ? `${props.row.pedidos.length} Pedidos` : '1 Pedido'"
57
+ color ="primary"
58
+ @click="seeOrdersList(props.row.pedidos, props.row.id)"
59
+ class ="full-width"
60
+ />
61
+ </q-td>
62
+ <q-td key="dataVencimento" :props="props">{{ props.cols[2].value }}</q-td>
63
+ <q-td key="fornecedor" :props="props">{{ props.cols[3].value }}</q-td>
64
+ <q-td key="status" :props="props" :style="{color:props.row.color_status}">
65
+ {{ $t(`invoice.statuses.${props.row.status}`) }}
66
+ </q-td>
67
+ <q-td key="preco" :props="props">{{ props.cols[5].value }}</q-td>
68
+ </q-tr>
69
+ </template>
70
+ </q-table>
71
+
72
+ <q-dialog v-model="dialogs.orders.visible" transition-show="scale" transition-hide="scale">
73
+ <q-card class="text-white" style="background-color: #00519b; width: 300px">
74
+ <q-card-section>
75
+ <div class="row items-center">
76
+ <div class="text-h6">Pedidos da Fatura #{{ dialogs.orders.invoice }}</div>
77
+ <q-space />
78
+ <q-btn icon="close" color="white" flat round dense v-close-popup />
79
+ </div>
80
+ </q-card-section>
81
+
82
+ <q-card-section class="q-pt-none">
83
+ <q-markup-table>
84
+ <tbody>
85
+ <tr
86
+ v-for="(orderId, index) in dialogs.orders.items"
87
+ :key ="index"
88
+ >
89
+ <td class="text-center">
90
+ <q-btn flat
91
+ color ="primary"
92
+ :label="`Ver pedido #${orderId}`"
93
+ :to ="{ name: 'ClientOrderDetails', params: { id: orderId } }"
94
+ />
95
+ </td>
96
+ </tr>
97
+ </tbody>
98
+ </q-markup-table>
99
+ </q-card-section>
100
+ </q-card>
101
+ </q-dialog>
102
+ </div>
103
+ </template>
104
+
105
+ <script>
106
+ import { mapActions, mapGetters } from 'vuex';
107
+ import { formatMoney } from '@freteclick/quasar-common-ui/src/utils/formatter';
108
+ import { date } from 'quasar';
109
+
110
+ const SETTINGS = {
111
+ visibleColumns: [
112
+ 'id' ,
113
+ 'pedidos' ,
114
+ 'dataVencimento',
115
+ 'fornecedor' ,
116
+ 'status' ,
117
+ 'preco' ,
118
+ ],
119
+ columns : [
120
+ {
121
+ name : 'id',
122
+ field : 'id',
123
+ align : 'left',
124
+ format: (val, row) => {
125
+ return `#${val}`;
126
+ },
127
+ label : 'ID'
128
+ },
129
+ {
130
+ name : 'pedidos',
131
+ align: 'left',
132
+ field: 'pedidos',
133
+ label: 'Pedidos'
134
+ },
135
+ {
136
+ name : 'dataVencimento',
137
+ field : 'dataVencimento',
138
+ align : 'left',
139
+ format: (val, row) => {
140
+ return date.formatDate(val + 'T23:59:00', 'DD/MM/YYYY')
141
+ },
142
+ label : 'Data vencimento'
143
+ },
144
+ {
145
+ name : 'fornecedor',
146
+ field: 'fornecedor',
147
+ align: 'left',
148
+ label: 'Fornecedor'
149
+ },
150
+ {
151
+ name : 'status',
152
+ field : 'status',
153
+ align : 'left',
154
+ label : 'Status'
155
+ },
156
+ {
157
+ name : 'preco',
158
+ field : 'preco',
159
+ align : 'left',
160
+ format: (val, row) => {
161
+ return formatMoney(val, 'BRL', 'pt-br');
162
+ },
163
+ label : 'Preço'
164
+ },
165
+ ],
166
+ };
167
+
168
+ Object.freeze(SETTINGS);
169
+
170
+ export default {
171
+ props: {
172
+ search : {
173
+ type : Boolean,
174
+ required: false,
175
+ default : true,
176
+ },
177
+ orderId: {
178
+ type : String,
179
+ required: false,
180
+ default : null,
181
+ },
182
+ },
183
+
184
+ created() {
185
+ if (this.myCompany !== null) {
186
+ this.filters.company = this.myCompany;
187
+ this.onRequest({
188
+ pagination: this.pagination,
189
+ filter : this.filters,
190
+ });
191
+ }
192
+ this.requestStatuses();
193
+ },
194
+
195
+ beforeDestroy() {
196
+ this.reset();
197
+ },
198
+
199
+ data() {
200
+ let statuses = [
201
+ { 'label': 'Todos', 'value': -1 },
202
+ ];
203
+
204
+ return {
205
+ settings : SETTINGS,
206
+ statuses : statuses,
207
+ loadingStatuses: false,
208
+ dialogs : {
209
+ orders: {
210
+ visible: false,
211
+ items : [],
212
+ invoice: null,
213
+ },
214
+ },
215
+ data : [],
216
+ filters : {
217
+ text : null,
218
+ status : statuses[0],
219
+ company: null,
220
+ },
221
+ pagination : {
222
+ sortBy : 'dataVencimento',
223
+ descending : false,
224
+ page : 1,
225
+ rowsPerPage: 10,
226
+ rowsNumber : 10,
227
+ },
228
+ }
229
+ },
230
+
231
+ computed: {
232
+ ...mapGetters({
233
+ isLoading : 'payInvoice/isLoading' ,
234
+ error : 'payInvoice/error' ,
235
+ violations: 'payInvoice/violations',
236
+ items : 'payInvoice/items' ,
237
+ totalItems: 'payInvoice/totalItems',
238
+ myCompany : 'people/currentCompany',
239
+ }),
240
+ },
241
+
242
+ watch: {
243
+ myCompany(company) {
244
+ if (company !== null) {
245
+ this.filters.company = company;
246
+ this.onRequest({
247
+ pagination: this.pagination,
248
+ filter : this.filters,
249
+ });
250
+ }
251
+ },
252
+
253
+ totalItems(val) {
254
+ this.pagination.rowsNumber = val;
255
+ },
256
+
257
+ items(items) {
258
+ if (!items)
259
+ return;
260
+
261
+ let data = [];
262
+
263
+ for (let i in items) {
264
+ let item = items[i];
265
+ let orders = [];
266
+
267
+ for (let o in item.order) {
268
+ orders.push(
269
+ item.order[o].order['@id'].match(/^\/purchasing\/orders\/([a-z0-9-]*)$/)[1]
270
+ );
271
+ }
272
+
273
+ data.push({
274
+ '@id' : item['@id'],
275
+ 'id' : item['@id'].match(/^\/finance\/pay\/([a-z0-9-]*)$/)[1],
276
+ 'pedidos' : orders,
277
+ 'color_status' : item.status.color,
278
+ 'dataVencimento': item.dueDate,
279
+ 'fornecedor' : item.order[0].order.provider.alias,
280
+ 'status' : item.status.status,
281
+ 'preco' : item.price,
282
+ });
283
+ }
284
+
285
+ this.data = data;
286
+ },
287
+
288
+ 'filters.text'() {
289
+ this.onRequest({
290
+ pagination: this.pagination,
291
+ filter : this.filters,
292
+ });
293
+ },
294
+
295
+ 'filters.status'() {
296
+ this.onRequest({
297
+ pagination: this.pagination,
298
+ filter : this.filters,
299
+ });
300
+ },
301
+ },
302
+
303
+ methods: {
304
+ ...mapActions({
305
+ getItems : 'payInvoice/getItems' ,
306
+ reset : 'payInvoice/reset' ,
307
+ getStatuses: 'payInvoice/getStatuses',
308
+ }),
309
+
310
+ seeOrdersList(ordersId, invoiceId) {
311
+ this.dialogs.orders.items = ordersId;
312
+ this.dialogs.orders.invoice = invoiceId;
313
+ this.dialogs.orders.visible = true;
314
+ },
315
+
316
+ requestStatuses() {
317
+ this.loadingStatuses = true;
318
+ this.getStatuses({
319
+ context: "invoice",
320
+ 'visibility': 'public',
321
+ 'realStatus': ['open', 'pending', 'canceled', 'closed'],
322
+ })
323
+ .then(statuses => {
324
+ if (statuses.length) {
325
+ let data = [];
326
+ for (let index in statuses) {
327
+ let item = statuses[index];
328
+ this.statuses.push({
329
+ 'label': this.$t(`invoice.statuses.${item.status}`),
330
+ 'value': item['@id'].match(/^\/statuses\/([a-z0-9-]*)$/)[1],
331
+ });
332
+ }
333
+ }
334
+ this.loadingStatuses = false;
335
+ });
336
+ },
337
+
338
+ onRequest(props) {
339
+ let {
340
+ page,
341
+ rowsPerPage,
342
+ rowsNumber,
343
+ sortBy,
344
+ descending
345
+ } = props.pagination;
346
+ let filter = props.filter;
347
+ let params = { itemsPerPage: rowsPerPage, page };
348
+
349
+ if (this.filters.text != null && this.filters.text.length > 0) {
350
+ if (this.filters.text.length < 2)
351
+ return;
352
+
353
+ params['searchBy'] = this.filters.text;
354
+ }
355
+
356
+ if (this.filters.status != null && this.filters.status.value != -1) {
357
+ params['status'] = this.filters.status.value;
358
+ }
359
+ else {
360
+ params['status.realStatus'] = ['open', 'pending'];
361
+ }
362
+
363
+ if (this.filters.company != null) {
364
+ params['myCompany'] = this.filters.company.id;
365
+ }
366
+
367
+ if (this.orderId !== null) {
368
+ params['order.order'] = this.orderId;
369
+ }
370
+
371
+ params['invoice[dueDate]'] = 'desc';
372
+
373
+ this.getItems(params)
374
+ .then(() => {
375
+ this.pagination.page = page;
376
+ this.pagination.rowsPerPage = rowsPerPage;
377
+ this.pagination.sortBy = sortBy;
378
+ this.pagination.descending = descending;
379
+ });
380
+ },
381
+ },
382
+ };
383
+ </script>
@@ -0,0 +1,249 @@
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-form
40
+ :action="payment ? payment.invoiceUrl : ''"
41
+ method ="post"
42
+ target ="_blank"
43
+ >
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
+ />
54
+ </q-form>
55
+ </div>
56
+ </div>
57
+
58
+ <!-- PAID MESSAGE -->
59
+
60
+ <div class="col-12" v-if="payment !== null && isPaid">
61
+ <div
62
+ class="row items-center justify-center"
63
+ style="min-height: 90vh;"
64
+ >
65
+ <q-banner class="text-white bg-positive text-center text-h3" rounded>
66
+ <template v-slot:avatar>
67
+ <q-icon name="thumb_up" color="white" />
68
+ </template>
69
+ O boleto foi pago
70
+ </q-banner>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </template>
75
+
76
+ <script>
77
+ import { date, extend } from 'quasar';
78
+ import { mapActions, mapGetters } from 'vuex';
79
+
80
+ export default {
81
+ props: {
82
+ invoiceId: {
83
+ type : String,
84
+ required: true,
85
+ },
86
+ orderId : {
87
+ type : String,
88
+ required: true,
89
+ },
90
+ },
91
+
92
+ mounted() {
93
+ window.addEventListener ('focus', this.loadItauDataOnFocus);
94
+ },
95
+
96
+ beforeDestroy() {
97
+ window.removeEventListener('focus', this.loadItauDataOnFocus);
98
+ },
99
+
100
+ created() {
101
+ this.getPaymentStatus();
102
+ },
103
+
104
+ data() {
105
+ return {
106
+ isLoading : false,
107
+ payment : null,
108
+ isPaid : false,
109
+ itauHash : null,
110
+ showBillet : false,
111
+ loadOnFocus: false,
112
+ };
113
+ },
114
+
115
+ computed: {
116
+ ...mapGetters({
117
+ myCompany: 'people/currentCompany',
118
+ }),
119
+
120
+ paymentIsPending() {
121
+ if (this.payment === null)
122
+ return false;
123
+
124
+ return ['waiting payment', 'outdated billing']
125
+ .includes(this.payment.status);
126
+ },
127
+
128
+ billetMustBeCreated() {
129
+ if (this.payment === null)
130
+ return false;
131
+
132
+ return this.payment.paymentType == 'choose_pending';
133
+ },
134
+ },
135
+
136
+ watch: {
137
+ myCompany(company) {
138
+ if (company !== null) {
139
+ this.getPaymentStatus();
140
+ }
141
+ },
142
+
143
+ payment(data) {
144
+ if (!data)
145
+ return;
146
+
147
+ if (data.paymentType == 'choose_pending' || data.paymentStatus == 'no_finished') {
148
+ this.isPaid = false;
149
+ this.getItauHash();
150
+ }
151
+ else {
152
+ if (data.paymentType == 'billet') {
153
+ if (data.paymentStatus == 'paid')
154
+ this.isPaid = true;
155
+ else {
156
+ this.isPaid = false;
157
+
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
+ }
167
+ }
168
+ }
169
+ },
170
+
171
+ showBillet(show) {
172
+ if (show == true) {
173
+ this.$refs.myForm.$el.submit();
174
+ }
175
+ },
176
+ },
177
+
178
+ methods: {
179
+ ...mapActions({
180
+ getItauData: 'payInvoice/bankItau',
181
+ }),
182
+
183
+ loadItauDataOnFocus() {
184
+ if (this.loadOnFocus) {
185
+ this.getPaymentStatus()
186
+ .then(data => {
187
+ this.loadOnFocus = false;
188
+ });
189
+ }
190
+ },
191
+
192
+ getItauHash() {
193
+ let params = {};
194
+
195
+ this.isLoading = true;
196
+
197
+ if (this.myCompany !== null)
198
+ params['myCompany'] = this.myCompany.id;
199
+
200
+ return this.getItauData({
201
+ invoiceId: this.invoiceId,
202
+ operation: 'itauhash',
203
+ params : params
204
+ })
205
+ .then(data => {
206
+ if (data !== null) {
207
+ return this.itauHash = data;
208
+ }
209
+
210
+ return null;
211
+ })
212
+ .catch(error => {
213
+
214
+ })
215
+ .finally(() => {
216
+ this.isLoading = false;
217
+ });
218
+ },
219
+
220
+ getPaymentStatus() {
221
+ let params = {};
222
+
223
+ this.isLoading = true;
224
+
225
+ if (this.myCompany !== null)
226
+ params['myCompany'] = this.myCompany.id;
227
+
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
+ }
237
+
238
+ return null;
239
+ })
240
+ .catch(error => {
241
+
242
+ })
243
+ .finally(() => {
244
+ this.isLoading = false;
245
+ });
246
+ },
247
+ },
248
+ };
249
+ </script>