@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,539 @@
1
+ <template>
2
+ <div>
3
+ <div class="row q-mb-md q-gutter-sm justify-end">
4
+ <q-btn
5
+ label="Cadastrar fornecedor"
6
+ icon="add"
7
+ size="sm"
8
+ color="secondary"
9
+ @click="dialogs.provider.visible = true"
10
+ />
11
+ <q-btn
12
+ label="Cadastrar categoria"
13
+ icon="add"
14
+ size="sm"
15
+ color="secondary"
16
+ @click="dialogs.category.visible = true"
17
+ />
18
+ </div>
19
+ <q-form @submit="addExpense">
20
+ <div class="row">
21
+ <div class="col-xs-12 q-mb-md">
22
+ <q-select
23
+ stack-label
24
+ emit-value
25
+ map-options
26
+ lazy-rules
27
+ v-model="item.category"
28
+ :label="$t('Categoria da despesa')"
29
+ :options="categories"
30
+ :rules="[(val) => val !== null || 'Selecione uma categoria']"
31
+ />
32
+ </div>
33
+ <div class="col-xs-12 q-mb-md">
34
+ <q-input
35
+ lazy-rules
36
+ stack-label
37
+ v-model="item.description"
38
+ type="text"
39
+ :label="$t('Descrição da despesa')"
40
+ class="q-mt-md"
41
+ :rules="[isInvalid()]"
42
+ />
43
+ </div>
44
+ <div class="col-xs-12 q-mb-md">
45
+ <PeopleAutocomplete
46
+ :source="searchPeople"
47
+ :isLoading="isSearching"
48
+ label="Definir o fornecedor"
49
+ @selected="onSelectClient"
50
+ placeholder="Pesquisar..."
51
+ />
52
+ </div>
53
+ <div class="col-xs-12 q-mb-md">
54
+ <q-input
55
+ lazy-rules
56
+ stack-label
57
+ reverse-fill-mask
58
+ v-model="item.amount"
59
+ prefix="R$"
60
+ type="text"
61
+ :label="$t('Valor')"
62
+ class="q-mt-md"
63
+ :rules="[isInvalid()]"
64
+ mask="#,##"
65
+ fill-mask="0"
66
+ />
67
+ </div>
68
+ <div class="col-xs-12 q-mb-md text-center">
69
+ <q-radio
70
+ v-model="item.recurrence"
71
+ val="single"
72
+ :label="$t('Pagamento único')"
73
+ />
74
+ <q-radio
75
+ v-model="item.recurrence"
76
+ val="monthly"
77
+ :label="$t('Pagamento recorrente')"
78
+ />
79
+ </div>
80
+ <div v-if="item.recurrence == 'single'" class="col-xs-12 q-mb-md">
81
+ <q-select
82
+ stack-label
83
+ emit-value
84
+ map-options
85
+ lazy-rules
86
+ v-model="item.parcels"
87
+ :label="$t('Número de parcelas')"
88
+ :options="parcels"
89
+ class="q-mb-sm"
90
+ :rules="[(val) => val !== null || 'Selecione um número']"
91
+ />
92
+ </div>
93
+ <div class="col-xs-12 q-mb-md">
94
+ <q-input
95
+ stack-label
96
+ v-model="item.dueDate"
97
+ :label="$t('Data primeiro vencimento')"
98
+ mask="##/##/####"
99
+ class="q-mb-sm"
100
+ :rules="[isInvalid('date')]"
101
+ >
102
+ <template v-slot:append>
103
+ <q-icon name="event" class="cursor-pointer">
104
+ <q-popup-proxy
105
+ ref="qDateProxy1"
106
+ transition-show="scale"
107
+ transition-hide="scale"
108
+ >
109
+ <q-date
110
+ v-model="item.dueDate"
111
+ mask="DD/MM/YYYY"
112
+ @input="() => $refs.qDateProxy1.hide()"
113
+ />
114
+ </q-popup-proxy>
115
+ </q-icon>
116
+ </template>
117
+ </q-input>
118
+ </div>
119
+ </div>
120
+ <div class="row justify-end">
121
+ <q-btn
122
+ :loading="saving"
123
+ icon="save"
124
+ type="submit"
125
+ :label="$t('Salvar')"
126
+ size="md"
127
+ color="primary"
128
+ class="q-mt-md"
129
+ />
130
+ </div>
131
+ </q-form>
132
+
133
+ <q-dialog v-model="dialogs.category.visible" @before-show="resetCategory">
134
+ <q-card style="width: 700px; max-width: 80vw">
135
+ <q-card-section class="row items-center">
136
+ <div class="text-h6">Cadastro de categoria</div>
137
+ <q-space />
138
+ <q-btn icon="close" flat round dense v-close-popup />
139
+ </q-card-section>
140
+ <q-card-section>
141
+ <q-form @submit="addCategory" class="q-mb-md">
142
+ <div class="row">
143
+ <div class="col-xs-12 q-mb-md">
144
+ <q-select
145
+ stack-label
146
+ emit-value
147
+ map-options
148
+ v-model="dialogs.category.expense.parent"
149
+ :label="$t('Categoria pai')"
150
+ :options="categories"
151
+ />
152
+ </div>
153
+ <div class="col-xs-12 q-mb-md">
154
+ <q-input
155
+ lazy-rules
156
+ stack-label
157
+ v-model="dialogs.category.expense.name"
158
+ type="text"
159
+ :label="$t('Nome sub-categoria')"
160
+ class="q-mt-md"
161
+ :rules="[isInvalid()]"
162
+ />
163
+ </div>
164
+ </div>
165
+ <div class="row justify-end">
166
+ <q-btn
167
+ :loading="dialogs.category.saving"
168
+ icon="save"
169
+ type="submit"
170
+ :label="$t('Salvar')"
171
+ size="md"
172
+ color="primary"
173
+ class="q-mt-md"
174
+ />
175
+ </div>
176
+ </q-form>
177
+ </q-card-section>
178
+ </q-card>
179
+ </q-dialog>
180
+
181
+ <q-dialog v-model="dialogs.provider.visible">
182
+ <q-card style="width: 700px; max-width: 80vw">
183
+ <q-card-section class="row items-center">
184
+ <div class="text-h6">Cadastro de fornecedor</div>
185
+ <q-space />
186
+ <q-btn icon="close" flat round dense v-close-popup />
187
+ </q-card-section>
188
+ <q-card-section>
189
+ <q-form @submit="addProvider" class="q-mb-md">
190
+ <div class="row">
191
+ <div class="col-xs-12 q-mb-md">
192
+ <div class="row justify-center">
193
+ <q-btn-toggle
194
+ no-caps
195
+ v-model="dialogs.provider.item.type"
196
+ toggle-color="primary"
197
+ :options="[
198
+ { label: 'Pessoa Jurídica', value: 'J' },
199
+ { label: 'Pessoa Física', value: 'F' },
200
+ ]"
201
+ />
202
+ </div>
203
+ </div>
204
+ <div class="col-xs-12">
205
+ <q-input
206
+ stack-label
207
+ lazy-rules
208
+ unmasked-value
209
+ v-model="dialogs.provider.item.document"
210
+ type="text"
211
+ :label="
212
+ dialogs.provider.item.type == 'J' ? $t('CNPJ') : $t('CPF')
213
+ "
214
+ :mask="
215
+ dialogs.provider.item.type == 'J'
216
+ ? '##.###.###/####-##'
217
+ : '###.###.###-##'
218
+ "
219
+ />
220
+ </div>
221
+ <div class="col-xs-12">
222
+ <q-input
223
+ stack-label
224
+ lazy-rules
225
+ v-model="dialogs.provider.item.name"
226
+ type="text"
227
+ class="q-mb-sm"
228
+ :label="
229
+ dialogs.provider.item.type == 'J'
230
+ ? $t('Razão social')
231
+ : $t('Nome')
232
+ "
233
+ :rules="[isInvalid('name')]"
234
+ />
235
+ </div>
236
+ <div class="col-xs-12">
237
+ <q-input
238
+ stack-label
239
+ lazy-rules
240
+ v-model="dialogs.provider.item.alias"
241
+ type="text"
242
+ class="q-mb-sm"
243
+ :label="
244
+ dialogs.provider.item.type == 'J'
245
+ ? $t('Nome Fantasia')
246
+ : $t('Sobrenome')
247
+ "
248
+ :rules="[isInvalid('alias')]"
249
+ />
250
+ </div>
251
+ </div>
252
+ <div class="row justify-end">
253
+ <q-btn
254
+ :loading="dialogs.provider.saving"
255
+ icon="save"
256
+ type="submit"
257
+ :label="$t('Salvar')"
258
+ size="md"
259
+ color="primary"
260
+ class="q-mt-md"
261
+ />
262
+ </div>
263
+ </q-form>
264
+ </q-card-section>
265
+ </q-card>
266
+ </q-dialog>
267
+ </div>
268
+ </template>
269
+
270
+ <script>
271
+ import { mapActions, mapGetters } from "vuex";
272
+ import PeopleAutocomplete from "@freteclick/quasar-common-ui/src/components/common/PeopleAutocomplete";
273
+
274
+ export default {
275
+ components: {
276
+ PeopleAutocomplete,
277
+ },
278
+ created() {
279
+ this.loadSelectableOptions();
280
+ },
281
+
282
+ data() {
283
+ return {
284
+ isSearching:false,
285
+ saving: false,
286
+ item: {
287
+ parent: null,
288
+ category: null,
289
+ description: null,
290
+ provider: null,
291
+ amount: null,
292
+ parcels: null,
293
+ dueDate: null,
294
+ recurrence: "single",
295
+ },
296
+ categories: [],
297
+ providers: [],
298
+ parcels: [],
299
+ dialogs: {
300
+ category: {
301
+ visible: false,
302
+ expense: {
303
+ name: null,
304
+ context: "expense",
305
+ parent: null,
306
+ },
307
+ saving: false,
308
+ },
309
+ provider: {
310
+ visible: false,
311
+ saving: false,
312
+ item: {
313
+ name: null,
314
+ alias: null,
315
+ type: "J",
316
+ document: null,
317
+ },
318
+ },
319
+ },
320
+ };
321
+ },
322
+
323
+ computed: {
324
+ ...mapGetters({
325
+ myCompany: "people/currentCompany",
326
+ }),
327
+ },
328
+
329
+ methods: {
330
+ ...mapActions({
331
+ getStatuses: "payInvoice/getStatuses",
332
+ getCategories : 'categories/getCategories',
333
+ getProviders: "expense/getProviders",
334
+ createExpense: "expense/createExpense",
335
+ createCategory: "expense/createCategory",
336
+ createProvider: "expense/createProvider",
337
+ search: "people/searchPeople",
338
+ }),
339
+ resetCategory() {
340
+ this.dialogs.category.expense.name = null;
341
+ this.dialogs.category.expense.context = "expense";
342
+ this.dialogs.category.expense.parent = null;
343
+ },
344
+
345
+
346
+ onSelectClient(item) {
347
+ this.item.provider = item.id;
348
+ },
349
+
350
+ searchPeople(input) {
351
+ this.isSearching = true;
352
+
353
+ return this.search(input).then((result) => {
354
+ this.isSearching = false;
355
+
356
+ if (result && result.success) {
357
+ let items = [];
358
+ for (let i = 0; i < result.data.length; i++) {
359
+ items.push({
360
+ label:
361
+ result.data[i].id +
362
+ " - " +
363
+ result.data[i].name +
364
+ " - " +
365
+ result.data[i].alias,
366
+ value: result.data[i],
367
+ });
368
+ }
369
+ return items;
370
+ } else {
371
+ this.isSearching = false;
372
+ this.$q.notify({
373
+ message: this.$t("messages.gmapsReqNoData"),
374
+ position: "bottom",
375
+ type: "negative",
376
+ });
377
+ }
378
+ });
379
+ },
380
+ loadSelectableOptions() {
381
+ // load parcels
382
+ for (let num = 1; num <= 12; num++) {
383
+ this.parcels.push({
384
+ label: `${num}x`,
385
+ value: num,
386
+ });
387
+ }
388
+ this.item.parcels = this.parcels[0].value;
389
+
390
+ // load categories
391
+ this.loadCategories();
392
+
393
+
394
+ },
395
+
396
+ addCategory() {
397
+ this.dialogs.category.saving = true;
398
+
399
+ this.createCategory({
400
+ values: {
401
+ name: this.dialogs.category.expense.name,
402
+ context: this.dialogs.category.expense.context,
403
+ parent: this.dialogs.category.expense.parent,
404
+ company: `/people/${this.myCompany.id}`,
405
+ },
406
+ })
407
+ .then((response) => {
408
+ this.$q.notify({
409
+ message: this.$t("Dados salvos com sucesso!"),
410
+ position: "bottom",
411
+ type: "positive",
412
+ });
413
+
414
+ this.loadCategories();
415
+ })
416
+ .finally(() => {
417
+ this.dialogs.category.saving = false;
418
+ });
419
+ },
420
+
421
+ addProvider() {
422
+ this.dialogs.provider.saving = true;
423
+
424
+ this.createProvider({
425
+ values: {
426
+ name: this.dialogs.provider.item.name,
427
+ alias: this.dialogs.provider.item.alias,
428
+ peopleType: this.dialogs.provider.item.type,
429
+ document: this.dialogs.provider.item.document,
430
+ },
431
+ params: {
432
+ myCompany: this.myCompany.id,
433
+ },
434
+ })
435
+ .then((response) => {
436
+ this.$q.notify({
437
+ message: this.$t("Dados salvos com sucesso!"),
438
+ position: "bottom",
439
+ type: "positive",
440
+ });
441
+ })
442
+ .catch((error) => {
443
+ this.$q.notify({
444
+ message: this.$t(error.message),
445
+ position: "bottom",
446
+ type: "negative",
447
+ });
448
+ })
449
+ .finally(() => {
450
+ this.dialogs.provider.saving = false;
451
+ });
452
+ },
453
+
454
+ loadCategories() {
455
+ this.getCategories({
456
+ params: {
457
+ context: "expense",
458
+ company: this.myCompany.id,
459
+ },
460
+ }).then((members) => {
461
+ if (members.length) {
462
+ let items = [];
463
+
464
+ items.push({
465
+ label: null,
466
+ value: null,
467
+ });
468
+
469
+ members.forEach((item, i) => {
470
+ items.push({
471
+ label: item.name,
472
+ value: item["@id"],
473
+ });
474
+ });
475
+ this.categories = items;
476
+ }
477
+ });
478
+ },
479
+
480
+ addExpense() {
481
+ this.saving = true;
482
+
483
+ this.createExpense({
484
+ values: {
485
+ company: this.myCompany.id,
486
+ category: parseInt(this.item.category.replace(/\D/g, "")),
487
+ provider: parseInt(this.item.provider),
488
+ paymentMode:
489
+ this.item.recurrence == "monthly" ? 0 : this.item.parcels,
490
+ amount: parseFloat(this.item.amount.replace(",", ".")),
491
+ dueDate: this.item.dueDate
492
+ ? this.item.dueDate.replace(
493
+ /^(\d{2})\/(\d{2})\/(\d{4})$/g,
494
+ "$3-$2-$1"
495
+ )
496
+ : null,
497
+ description: this.item.description,
498
+ },
499
+ params: {
500
+ myCompany: this.myCompany.id,
501
+ },
502
+ })
503
+ .then((data) => {
504
+ this.$q.notify({
505
+ message: this.$t("Dados salvos com sucesso!"),
506
+ position: "bottom",
507
+ type: "positive",
508
+ });
509
+
510
+ this.$emit("created", data);
511
+ })
512
+ .catch((error) => {
513
+ this.$q.notify({
514
+ message: this.$t(error.message),
515
+ position: "bottom",
516
+ type: "negative",
517
+ });
518
+ })
519
+ .finally(() => {
520
+ this.saving = false;
521
+ });
522
+ },
523
+
524
+ isInvalid(field) {
525
+ return (val) => {
526
+ if (field == "date") {
527
+ if (!/^\d{2}\/\d{2}\/\d{4}$/g.test(val))
528
+ return this.$t("A data não é válida");
529
+ }
530
+
531
+ if (!(val && val.length > 0))
532
+ return this.$t("Este campo é obrigatório");
533
+
534
+ return true;
535
+ };
536
+ },
537
+ },
538
+ };
539
+ </script>