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