@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,309 +1,309 @@
1
- <template>
2
- <q-form @submit="onSubmit">
3
- <div class="row items-center q-mb-md">
4
- <div class="text-h6">
5
- {{ item.id === null ? $t('Nova despesa') : $t('Edição despesa') }}
6
- </div>
7
- </div>
8
- <div class="row">
9
- <div class="col-xs-12 q-mb-md">
10
- <q-select stack-label emit-value map-options lazy-rules
11
- v-model ="item.category"
12
- :label ="$t('Categoria da despesa')"
13
- :options="categories"
14
- :rules ="[val => val !== null || 'Selecione uma categoria']"
15
- />
16
- </div>
17
- <div class="col-xs-12 q-mb-md">
18
- <q-input lazy-rules stack-label
19
- v-model="item.description"
20
- type ="text"
21
- :label ="$t('Descrição da despesa')"
22
- class ="q-mt-md"
23
- :rules ="[isInvalid()]"
24
- />
25
- </div>
26
- <div class="col-xs-12 q-mb-md">
27
- <PeopleAutocomplete
28
- :source="searchPeople"
29
- :isLoading="isSearching"
30
- label="Definir o fornecedor"
31
- @selected="onSelectClient"
32
- placeholder="Pesquisar..."
33
- />
34
- </div>
35
- <div class="col-xs-12 q-mb-md">
36
- <q-input lazy-rules stack-label reverse-fill-mask
37
- v-model ="item.amount"
38
- prefix ="R$"
39
- type ="text"
40
- :label ="$t('Valor')"
41
- class ="q-mt-md"
42
- :rules ="[isInvalid()]"
43
- mask ="#,##"
44
- fill-mask="0"
45
- />
46
- </div>
47
- <div class="col-xs-12 q-mb-md text-center">
48
- <q-radio v-model="item.recurrence" val="single" :label="$t('Pagamento único')" />
49
- <q-radio v-model="item.recurrence" val="monthly" :label="$t('Pagamento recorrente')" />
50
- </div>
51
- <div v-if="item.recurrence == 'single'"
52
- class="col-xs-12 q-mb-md"
53
- >
54
- <q-select stack-label emit-value map-options lazy-rules
55
- v-model ="item.parcels"
56
- :label ="$t('Número de parcelas')"
57
- :options="parcels"
58
- class ="q-mb-sm"
59
- :rules ="[val => val !== null || 'Selecione um número']"
60
- />
61
- </div>
62
- <div class="col-xs-12 q-mb-md">
63
- <q-input stack-label
64
- v-model="item.dueDate"
65
- :label ="$t('Data primeiro vencimento')"
66
- mask ="##/##/####"
67
- class ="q-mb-sm"
68
- :rules ="[isInvalid('date')]"
69
- >
70
- <template v-slot:append>
71
- <q-icon name="event" class="cursor-pointer">
72
- <q-popup-proxy ref="qDateProxy1" transition-show="scale" transition-hide="scale">
73
- <q-date
74
- v-model ="item.dueDate"
75
- mask ="DD/MM/YYYY"
76
- @input ="() => $refs.qDateProxy1.hide()"
77
- />
78
- </q-popup-proxy>
79
- </q-icon>
80
- </template>
81
- </q-input>
82
- </div>
83
- </div>
84
- <div class="row justify-end">
85
- <q-btn
86
- :loading="saving"
87
- icon ="save"
88
- type ="submit"
89
- :label ="$t('Salvar')"
90
- size ="md"
91
- color ="primary"
92
- class ="q-mt-md"
93
- />
94
- </div>
95
- </q-form>
96
- </template>
97
-
98
- <script>
99
- import { mapActions, mapGetters } from 'vuex';
100
- import { formatDateYmdTodmY } from '@freteclick/quasar-common-ui/src/utils/formatter';
101
- import Api from '@freteclick/quasar-common-ui/src/utils/api';
102
-
103
- export default {
104
- props: {
105
- id : {
106
- required: false,
107
- default : null
108
- },
109
- api: {
110
- type : Api,
111
- required: true
112
- },
113
- context:{
114
- type: String,
115
- required: true
116
- }
117
- },
118
-
119
- created() {
120
- this.loadSelectableOptions();
121
-
122
- if (this.id !== null) {
123
- this.getItem(this.id)
124
- .then(item => {
125
- this.item.category = item.category['@id'];
126
- this.item.description = item.description;
127
- this.item.provider = item.provider['@id'];
128
- this.item.amount = (parseFloat(item.amount) + 0.001).toFixed(2);
129
- this.item.parcels = item.parcels;
130
- this.item.dueDate = formatDateYmdTodmY(item.dueDate);
131
- this.item.recurrence = item.parcels == null ? 'monthly' : 'single';
132
- });
133
- }
134
- },
135
-
136
- data() {
137
- return {
138
- saving: false,
139
- item : {
140
- "id" : this.id,
141
- "category" : null,
142
- "description": null,
143
- "provider" : null,
144
- "amount" : null,
145
- "parcels" : null,
146
- "dueDate" : null,
147
- "recurrence" : 'single',
148
- },
149
- categories: [],
150
- providers : [],
151
- parcels : [],
152
- }
153
- },
154
-
155
- computed: {
156
- ...mapGetters({
157
- myCompany: 'people/currentCompany',
158
- }),
159
- },
160
-
161
- methods: {
162
- ...mapActions({
163
- getStatuses : 'payInvoice/getStatuses',
164
- getCategories : 'categories/getCategories',
165
- getProviders : 'expense/getProviders',
166
- }),
167
-
168
- // store method
169
- getItem(id) {
170
- return this.api.private(`company_expenses/${id}`)
171
- .then(response => response.json())
172
- .then(response => {
173
- return response;
174
- });
175
- },
176
-
177
- // store method
178
- save(values, params = {}) {
179
- let options = {
180
- method : this.id === null ? 'POST' : 'PUT',
181
- headers: new Headers({ 'Content-Type': 'application/ld+json' }),
182
- body : JSON.stringify(values),
183
- params : params,
184
- };
185
-
186
- let endpoint = this.id === null ?
187
- 'company_expenses' : `company_expenses/${this.id}`;
188
-
189
- return this.api.private(endpoint, options)
190
- .then(response => response.json())
191
- .then(data => {
192
- this.$q.notify({
193
- message : this.$t('Dados salvos com sucesso!'),
194
- position: 'bottom',
195
- type : 'positive',
196
- });
197
-
198
- return data;
199
- })
200
- .catch(error => {
201
- this.$q.notify({
202
- message : this.$t(error.message),
203
- position: 'bottom',
204
- type : 'negative',
205
- });
206
- });
207
- },
208
-
209
- loadProviders() {
210
- this.getProviders({
211
- params: {
212
- 'myCompany': this.myCompany.id
213
- }
214
- }).then(members => {
215
- if (members.length) {
216
- let items = [];
217
- members.forEach((item, i) => {
218
- items.push({
219
- label: item.name,
220
- value: item['@id']
221
- });
222
- });
223
- this.providers = items;
224
- }
225
- });
226
- },
227
-
228
- loadSelectableOptions() {
229
- // load parcels
230
- for (let num = 1; num <= 12; num++) {
231
- this.parcels.push({
232
- label: `${num}x`,
233
- value: num,
234
- });
235
- }
236
- this.item.parcels = this.parcels[0].value;
237
-
238
- // load categories
239
- this.loadCategories();
240
-
241
- // load providers
242
- this.loadProviders();
243
- },
244
-
245
- loadCategories() {
246
- this.getCategories({
247
- params: {
248
- 'context': this.context,
249
- 'company': this.myCompany.id,
250
- }
251
- }).then(members => {
252
- if (members.length) {
253
- let items = [];
254
-
255
- items.push({
256
- label: null,
257
- value: null
258
- });
259
-
260
- members.forEach((item, i) => {
261
- items.push({
262
- label: item.name,
263
- value: item['@id']
264
- });
265
- });
266
- this.categories = items;
267
- }
268
- });
269
- },
270
-
271
- onSubmit() {
272
- this.saving = true;
273
-
274
- this.save(
275
- {
276
- "company" : `/people/${this.myCompany.id}`,
277
- "category" : this.item.category,
278
- "description": this.item.description,
279
- "provider" : this.item.provider,
280
- "amount" : parseFloat(this.item.amount.replace(',', '.')),
281
- "parcels" : this.item.recurrence == 'monthly' ? null : this.item.parcels,
282
- "dueDate" : this.item.dueDate ? this.item.dueDate.replace(/^(\d{2})\/(\d{2})\/(\d{4})$/g, "\$3\-\$2\-\$1") : null,
283
- "paymentDay" : parseInt(this.item.dueDate.replace(/^(\d{2})\/(\d{2})\/(\d{4})$/g, "\$1")),
284
- },
285
- {
286
- "myCompany" : this.myCompany.id
287
- }
288
- )
289
- .finally(() => {
290
- this.saving = false;
291
- });
292
- },
293
-
294
- isInvalid(field) {
295
- return val => {
296
- if (field == 'date') {
297
- if (!/^\d{2}\/\d{2}\/\d{4}$/g.test(val))
298
- return this.$t('A data não é válida');
299
- }
300
-
301
- if (!(val && val.length > 0))
302
- return this.$t('Este campo é obrigatório');
303
-
304
- return true;
305
- };
306
- },
307
- },
308
- };
309
- </script>
1
+ <template>
2
+ <q-form @submit="onSubmit">
3
+ <div class="row items-center q-mb-md">
4
+ <div class="text-h6">
5
+ {{ item.id === null ? $t('Nova despesa') : $t('Edição despesa') }}
6
+ </div>
7
+ </div>
8
+ <div class="row">
9
+ <div class="col-xs-12 q-mb-md">
10
+ <q-select stack-label emit-value map-options lazy-rules
11
+ v-model ="item.category"
12
+ :label ="$t('Categoria da despesa')"
13
+ :options="categories"
14
+ :rules ="[val => val !== null || 'Selecione uma categoria']"
15
+ />
16
+ </div>
17
+ <div class="col-xs-12 q-mb-md">
18
+ <q-input lazy-rules stack-label
19
+ v-model="item.description"
20
+ type ="text"
21
+ :label ="$t('Descrição da despesa')"
22
+ class ="q-mt-md"
23
+ :rules ="[isInvalid()]"
24
+ />
25
+ </div>
26
+ <div class="col-xs-12 q-mb-md">
27
+ <PeopleAutocomplete
28
+ :source="searchPeople"
29
+ :isLoading="isSearching"
30
+ label="Definir o fornecedor"
31
+ @selected="onSelectClient"
32
+ placeholder="Pesquisar..."
33
+ />
34
+ </div>
35
+ <div class="col-xs-12 q-mb-md">
36
+ <q-input lazy-rules stack-label reverse-fill-mask
37
+ v-model ="item.amount"
38
+ prefix ="R$"
39
+ type ="text"
40
+ :label ="$t('Valor')"
41
+ class ="q-mt-md"
42
+ :rules ="[isInvalid()]"
43
+ mask ="#,##"
44
+ fill-mask="0"
45
+ />
46
+ </div>
47
+ <div class="col-xs-12 q-mb-md text-center">
48
+ <q-radio v-model="item.recurrence" val="single" :label="$t('Pagamento único')" />
49
+ <q-radio v-model="item.recurrence" val="monthly" :label="$t('Pagamento recorrente')" />
50
+ </div>
51
+ <div v-if="item.recurrence == 'single'"
52
+ class="col-xs-12 q-mb-md"
53
+ >
54
+ <q-select stack-label emit-value map-options lazy-rules
55
+ v-model ="item.parcels"
56
+ :label ="$t('Número de parcelas')"
57
+ :options="parcels"
58
+ class ="q-mb-sm"
59
+ :rules ="[val => val !== null || 'Selecione um número']"
60
+ />
61
+ </div>
62
+ <div class="col-xs-12 q-mb-md">
63
+ <q-input stack-label
64
+ v-model="item.dueDate"
65
+ :label ="$t('Data primeiro vencimento')"
66
+ mask ="##/##/####"
67
+ class ="q-mb-sm"
68
+ :rules ="[isInvalid('date')]"
69
+ >
70
+ <template v-slot:append>
71
+ <q-icon name="event" class="cursor-pointer">
72
+ <q-popup-proxy ref="qDateProxy1" transition-show="scale" transition-hide="scale">
73
+ <q-date
74
+ v-model ="item.dueDate"
75
+ mask ="DD/MM/YYYY"
76
+ @input ="() => $refs.qDateProxy1.hide()"
77
+ />
78
+ </q-popup-proxy>
79
+ </q-icon>
80
+ </template>
81
+ </q-input>
82
+ </div>
83
+ </div>
84
+ <div class="row justify-end">
85
+ <q-btn
86
+ :loading="saving"
87
+ icon ="save"
88
+ type ="submit"
89
+ :label ="$t('Salvar')"
90
+ size ="md"
91
+ color ="primary"
92
+ class ="q-mt-md"
93
+ />
94
+ </div>
95
+ </q-form>
96
+ </template>
97
+
98
+ <script>
99
+ import { mapActions, mapGetters } from 'vuex';
100
+ import { formatDateYmdTodmY } from '@freteclick/quasar-common-ui/src/utils/formatter';
101
+ import Api from '@freteclick/quasar-common-ui/src/utils/api';
102
+
103
+ export default {
104
+ props: {
105
+ id : {
106
+ required: false,
107
+ default : null
108
+ },
109
+ api: {
110
+ type : Api,
111
+ required: true
112
+ },
113
+ context:{
114
+ type: String,
115
+ required: true
116
+ }
117
+ },
118
+
119
+ created() {
120
+ this.loadSelectableOptions();
121
+
122
+ if (this.id !== null) {
123
+ this.getItem(this.id)
124
+ .then(item => {
125
+ this.item.category = item.category['@id'];
126
+ this.item.description = item.description;
127
+ this.item.provider = item.provider['@id'];
128
+ this.item.amount = (parseFloat(item.amount) + 0.001).toFixed(2);
129
+ this.item.parcels = item.parcels;
130
+ this.item.dueDate = formatDateYmdTodmY(item.dueDate);
131
+ this.item.recurrence = item.parcels == null ? 'monthly' : 'single';
132
+ });
133
+ }
134
+ },
135
+
136
+ data() {
137
+ return {
138
+ saving: false,
139
+ item : {
140
+ "id" : this.id,
141
+ "category" : null,
142
+ "description": null,
143
+ "provider" : null,
144
+ "amount" : null,
145
+ "parcels" : null,
146
+ "dueDate" : null,
147
+ "recurrence" : 'single',
148
+ },
149
+ categories: [],
150
+ providers : [],
151
+ parcels : [],
152
+ }
153
+ },
154
+
155
+ computed: {
156
+ ...mapGetters({
157
+ myCompany: 'people/currentCompany',
158
+ }),
159
+ },
160
+
161
+ methods: {
162
+ ...mapActions({
163
+ getStatuses : 'payInvoice/getStatuses',
164
+ getCategories : 'categories/getCategories',
165
+ getProviders : 'expense/getProviders',
166
+ }),
167
+
168
+ // store method
169
+ getItem(id) {
170
+ return this.api.private(`company_expenses/${id}`)
171
+ .then(response => response.json())
172
+ .then(response => {
173
+ return response;
174
+ });
175
+ },
176
+
177
+ // store method
178
+ save(values, params = {}) {
179
+ let options = {
180
+ method : this.id === null ? 'POST' : 'PUT',
181
+ headers: new Headers({ 'Content-Type': 'application/ld+json' }),
182
+ body : JSON.stringify(values),
183
+ params : params,
184
+ };
185
+
186
+ let endpoint = this.id === null ?
187
+ 'company_expenses' : `company_expenses/${this.id}`;
188
+
189
+ return this.api.private(endpoint, options)
190
+ .then(response => response.json())
191
+ .then(data => {
192
+ this.$q.notify({
193
+ message : this.$t('Dados salvos com sucesso!'),
194
+ position: 'bottom',
195
+ type : 'positive',
196
+ });
197
+
198
+ return data;
199
+ })
200
+ .catch(error => {
201
+ this.$q.notify({
202
+ message : this.$t(error.message),
203
+ position: 'bottom',
204
+ type : 'negative',
205
+ });
206
+ });
207
+ },
208
+
209
+ loadProviders() {
210
+ this.getProviders({
211
+ params: {
212
+ 'myCompany': this.myCompany.id
213
+ }
214
+ }).then(members => {
215
+ if (members.length) {
216
+ let items = [];
217
+ members.forEach((item, i) => {
218
+ items.push({
219
+ label: item.name,
220
+ value: item['@id']
221
+ });
222
+ });
223
+ this.providers = items;
224
+ }
225
+ });
226
+ },
227
+
228
+ loadSelectableOptions() {
229
+ // load parcels
230
+ for (let num = 1; num <= 12; num++) {
231
+ this.parcels.push({
232
+ label: `${num}x`,
233
+ value: num,
234
+ });
235
+ }
236
+ this.item.parcels = this.parcels[0].value;
237
+
238
+ // load categories
239
+ this.loadCategories();
240
+
241
+ // load providers
242
+ this.loadProviders();
243
+ },
244
+
245
+ loadCategories() {
246
+ this.getCategories({
247
+ params: {
248
+ 'context': this.context,
249
+ 'company': this.myCompany.id,
250
+ }
251
+ }).then(members => {
252
+ if (members.length) {
253
+ let items = [];
254
+
255
+ items.push({
256
+ label: null,
257
+ value: null
258
+ });
259
+
260
+ members.forEach((item, i) => {
261
+ items.push({
262
+ label: item.name,
263
+ value: item['@id']
264
+ });
265
+ });
266
+ this.categories = items;
267
+ }
268
+ });
269
+ },
270
+
271
+ onSubmit() {
272
+ this.saving = true;
273
+
274
+ this.save(
275
+ {
276
+ "company" : `/people/${this.myCompany.id}`,
277
+ "category" : this.item.category,
278
+ "description": this.item.description,
279
+ "provider" : this.item.provider,
280
+ "amount" : parseFloat(this.item.amount.replace(',', '.')),
281
+ "parcels" : this.item.recurrence == 'monthly' ? null : this.item.parcels,
282
+ "dueDate" : this.item.dueDate ? this.item.dueDate.replace(/^(\d{2})\/(\d{2})\/(\d{4})$/g, "\$3\-\$2\-\$1") : null,
283
+ "paymentDay" : parseInt(this.item.dueDate.replace(/^(\d{2})\/(\d{2})\/(\d{4})$/g, "\$1")),
284
+ },
285
+ {
286
+ "myCompany" : this.myCompany.id
287
+ }
288
+ )
289
+ .finally(() => {
290
+ this.saving = false;
291
+ });
292
+ },
293
+
294
+ isInvalid(field) {
295
+ return val => {
296
+ if (field == 'date') {
297
+ if (!/^\d{2}\/\d{2}\/\d{4}$/g.test(val))
298
+ return this.$t('A data não é válida');
299
+ }
300
+
301
+ if (!(val && val.length > 0))
302
+ return this.$t('Este campo é obrigatório');
303
+
304
+ return true;
305
+ };
306
+ },
307
+ },
308
+ };
309
+ </script>