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