@freteclick/quasar-financial-ui 1.0.85 → 1.0.87
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.
- package/package.json +17 -17
- package/src/components/common/Filters.vue +140 -140
- package/src/components/expense/FormExpense.vue +309 -309
- package/src/components/expense/TableExpenses.vue +305 -305
- package/src/components/invoice/client/ClientInvoiceDetails.vue +212 -212
- package/src/components/invoice/client/InvoiceSearching.vue +382 -382
- package/src/components/invoice/client/details/InvoiceInvoice.vue +248 -248
- package/src/components/invoice/client/details/InvoiceOrders.vue +327 -327
- package/src/components/invoice/expense/CreateExpense.vue +539 -539
- package/src/components/invoice/expense/DetailExpense.vue +393 -393
- package/src/components/invoice/pay/InvoiceDetails.vue +210 -210
- package/src/components/invoice/pay/InvoiceSearching.vue +388 -388
- package/src/components/invoice/pay/details/InvoiceInvoice.vue +47 -47
- package/src/components/invoice/pay/details/InvoiceOrders.vue +342 -342
- package/src/components/invoice/receive/InvoiceDetails.vue +280 -280
- package/src/components/invoice/receive/InvoiceSearching.vue +359 -359
- package/src/components/invoice/receive/details/InvoiceInvoice.vue +453 -371
- package/src/components/invoice/receive/details/InvoiceInvoiceBkp.vue +259 -259
- package/src/components/invoice/receive/details/InvoiceOrders.vue +369 -369
- package/src/i18n/en-us/index.js +8 -8
- package/src/i18n/index.js +5 -5
- package/src/i18n/pt-br/index.js +30 -30
- package/src/pages/Invoice/Client/Details.vue +23 -23
- package/src/pages/Invoice/Client/Index.vue +26 -26
- package/src/pages/Invoice/Pay/Details.vue +23 -23
- package/src/pages/Invoice/Pay/Index.vue +53 -53
- package/src/pages/Invoice/Receive/Details.vue +23 -23
- package/src/pages/Invoice/Receive/Index.vue +26 -26
- package/src/router/routes.js +32 -32
- package/src/store/modules/invoice/comission/actions.js +66 -66
- package/src/store/modules/invoice/comission/getters.js +6 -6
- package/src/store/modules/invoice/comission/index.js +19 -19
- package/src/store/modules/invoice/comission/mutation_types.js +7 -7
- package/src/store/modules/invoice/comission/mutations.js +42 -42
- package/src/store/modules/invoice/expense/actions.js +98 -98
- package/src/store/modules/invoice/expense/getters.js +1 -1
- package/src/store/modules/invoice/expense/index.js +12 -12
- package/src/store/modules/invoice/expense/mutations.js +3 -3
- package/src/store/modules/invoice/expense/state.js +5 -5
- package/src/store/modules/invoice/pay/actions.js +114 -114
- package/src/store/modules/invoice/pay/getters.js +6 -6
- package/src/store/modules/invoice/pay/index.js +19 -19
- package/src/store/modules/invoice/pay/mutation_types.js +7 -7
- package/src/store/modules/invoice/pay/mutations.js +42 -42
- package/src/store/modules/invoice/receive/actions.js +163 -152
- package/src/store/modules/invoice/receive/actionsBkp.js +77 -77
- package/src/store/modules/invoice/receive/getters.js +6 -6
- package/src/store/modules/invoice/receive/index.js +19 -19
- package/src/store/modules/invoice/receive/mutation_types.js +7 -7
- package/src/store/modules/invoice/receive/mutations.js +42 -42
- package/src/store/store-flag.d.ts +9 -9
|
@@ -1,342 +1,342 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-table
|
|
3
|
-
:loading="isLoading"
|
|
4
|
-
:data="data"
|
|
5
|
-
:columns="settings.columns"
|
|
6
|
-
:pagination.sync="pagination"
|
|
7
|
-
@request="onRequest"
|
|
8
|
-
row-key="id"
|
|
9
|
-
style="min-height: 90vh"
|
|
10
|
-
:rows-per-page-options="[5, 10, 15, 20, 25, 50]"
|
|
11
|
-
>
|
|
12
|
-
<template v-slot:body="props">
|
|
13
|
-
<q-tr :props="props">
|
|
14
|
-
<q-td key="id" :props="props">
|
|
15
|
-
<q-btn
|
|
16
|
-
outline
|
|
17
|
-
dense
|
|
18
|
-
:to="{
|
|
19
|
-
name: 'PurchasingOrderDetails',
|
|
20
|
-
params: { id: props.row.id },
|
|
21
|
-
}"
|
|
22
|
-
:label="`#${props.row.id}`"
|
|
23
|
-
:style="{ color: props.row.color_status }"
|
|
24
|
-
class="full-width"
|
|
25
|
-
/>
|
|
26
|
-
</q-td>
|
|
27
|
-
<q-td key="mainOrder" :props="props">
|
|
28
|
-
<q-btn
|
|
29
|
-
v-if="props.row.mainOrder"
|
|
30
|
-
outline
|
|
31
|
-
dense
|
|
32
|
-
:to="{
|
|
33
|
-
name: 'OrderDetails',
|
|
34
|
-
params: { id: props.row.mainOrder },
|
|
35
|
-
}"
|
|
36
|
-
:label="`#${props.row.mainOrder}`"
|
|
37
|
-
:style="{ color: 'grey' }"
|
|
38
|
-
class="full-width"
|
|
39
|
-
/>
|
|
40
|
-
</q-td>
|
|
41
|
-
<q-td key="client" :props="props">{{ props.row.client }}</q-td>
|
|
42
|
-
<q-td key="notaFiscal" :props="props">{{ props.row.notaFiscal }}</q-td>
|
|
43
|
-
<q-td key="dataPedido" :props="props">{{ props.cols[4].value }}</q-td>
|
|
44
|
-
<q-td key="ultimaModificacao" :props="props">{{
|
|
45
|
-
props.cols[5].value
|
|
46
|
-
}}</q-td>
|
|
47
|
-
<q-td
|
|
48
|
-
key="status"
|
|
49
|
-
:props="props"
|
|
50
|
-
:style="{ color: props.row.color_status }"
|
|
51
|
-
>
|
|
52
|
-
{{ $t(`order.statuses.${props.row.status}`) }}
|
|
53
|
-
</q-td>
|
|
54
|
-
<q-td key="preco" :props="props">{{ props.cols[7].value }}</q-td>
|
|
55
|
-
</q-tr>
|
|
56
|
-
</template>
|
|
57
|
-
</q-table>
|
|
58
|
-
</template>
|
|
59
|
-
|
|
60
|
-
<script>
|
|
61
|
-
import { mapActions, mapGetters } from "vuex";
|
|
62
|
-
import { date } from "quasar";
|
|
63
|
-
import { formatMoney } from "@freteclick/quasar-common-ui/src/utils/formatter";
|
|
64
|
-
|
|
65
|
-
const SETTINGS = {
|
|
66
|
-
columns: [
|
|
67
|
-
{
|
|
68
|
-
name: "id",
|
|
69
|
-
field: "id",
|
|
70
|
-
align: "left",
|
|
71
|
-
label: "ID",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: "mainOrder",
|
|
75
|
-
field: "mainOrder",
|
|
76
|
-
align: "left",
|
|
77
|
-
label: "Pedido Principal",
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "client",
|
|
81
|
-
field: "client",
|
|
82
|
-
align: "left",
|
|
83
|
-
label: "Cliente",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: "notaFiscal",
|
|
87
|
-
field: "notaFiscal",
|
|
88
|
-
align: "left",
|
|
89
|
-
label: "Nota Fiscal",
|
|
90
|
-
format: (val, row) => {
|
|
91
|
-
return val ? "#" + val : "";
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "dataPedido",
|
|
96
|
-
field: "dataPedido",
|
|
97
|
-
align: "left",
|
|
98
|
-
format: (val, row) => {
|
|
99
|
-
return date.formatDate(val, "DD/MM/YYYY");
|
|
100
|
-
},
|
|
101
|
-
label: "Data",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "ultimaModificacao",
|
|
105
|
-
field: "ultimaModificacao",
|
|
106
|
-
align: "left",
|
|
107
|
-
format: (val, row) => {
|
|
108
|
-
return date.formatDate(val, "DD/MM/YYYY HH:mm:ss");
|
|
109
|
-
},
|
|
110
|
-
label: "Ultima alteração",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "status",
|
|
114
|
-
field: "status",
|
|
115
|
-
align: "left",
|
|
116
|
-
label: "Status",
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "preco",
|
|
120
|
-
field: "preco",
|
|
121
|
-
align: "left",
|
|
122
|
-
format: (val, row) => {
|
|
123
|
-
return formatMoney(val, "BRL", "pt-br");
|
|
124
|
-
},
|
|
125
|
-
label: "Preço",
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
Object.freeze(SETTINGS);
|
|
131
|
-
|
|
132
|
-
export default {
|
|
133
|
-
props: {
|
|
134
|
-
search: {
|
|
135
|
-
type: Boolean,
|
|
136
|
-
required: false,
|
|
137
|
-
default: true,
|
|
138
|
-
},
|
|
139
|
-
invoiceId: {
|
|
140
|
-
type: String,
|
|
141
|
-
required: false,
|
|
142
|
-
default: null,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
created() {
|
|
147
|
-
if (this.myCompany !== null) {
|
|
148
|
-
this.filters.company = this.myCompany;
|
|
149
|
-
this.onRequest({
|
|
150
|
-
pagination: this.pagination,
|
|
151
|
-
filter: this.filters,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
this.requestStatuses();
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
beforeDestroy() {
|
|
158
|
-
this.reset();
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
data() {
|
|
162
|
-
let statuses = [{ label: "Todos", value: -1 }];
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
settings: SETTINGS,
|
|
166
|
-
data: [],
|
|
167
|
-
statuses: statuses,
|
|
168
|
-
filters: {
|
|
169
|
-
text: null,
|
|
170
|
-
status: statuses[0],
|
|
171
|
-
company: null,
|
|
172
|
-
},
|
|
173
|
-
pagination: {
|
|
174
|
-
sortBy: "ultimaModificacao",
|
|
175
|
-
descending: false,
|
|
176
|
-
page: 1,
|
|
177
|
-
rowsPerPage: 10,
|
|
178
|
-
rowsNumber: 10,
|
|
179
|
-
},
|
|
180
|
-
loadingStatuses: false,
|
|
181
|
-
};
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
computed: {
|
|
185
|
-
...mapGetters({
|
|
186
|
-
isLoading: "purchasingOrder/isLoading",
|
|
187
|
-
error: "purchasingOrder/error",
|
|
188
|
-
violations: "purchasingOrder/violations",
|
|
189
|
-
items: "purchasingOrder/items",
|
|
190
|
-
totalItems: "purchasingOrder/totalItems",
|
|
191
|
-
myCompany: "people/currentCompany",
|
|
192
|
-
}),
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
watch: {
|
|
196
|
-
myCompany(company) {
|
|
197
|
-
if (company !== null) {
|
|
198
|
-
this.filters.company = company;
|
|
199
|
-
this.onRequest({
|
|
200
|
-
pagination: this.pagination,
|
|
201
|
-
filter: this.filters,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
totalItems(val) {
|
|
207
|
-
this.pagination.rowsNumber = val;
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
items(items) {
|
|
211
|
-
if (!items) return;
|
|
212
|
-
|
|
213
|
-
let data = [];
|
|
214
|
-
|
|
215
|
-
for (let index in items) {
|
|
216
|
-
let item = items[index];
|
|
217
|
-
|
|
218
|
-
var clientName = "--";
|
|
219
|
-
|
|
220
|
-
if (item.mainOrder && item.mainOrder.client) {
|
|
221
|
-
clientName = item.mainOrder.client.name;
|
|
222
|
-
|
|
223
|
-
if (!clientName) {
|
|
224
|
-
clientName = item.mainOrder.client.alias;
|
|
225
|
-
} else if (
|
|
226
|
-
clientName.toLowerCase().indexOf(" ltda") == -1 &&
|
|
227
|
-
clientName.toLowerCase().indexOf(" eireli") == -1 &&
|
|
228
|
-
clientName.toLowerCase().indexOf(" comercio") == -1 &&
|
|
229
|
-
clientName.toLowerCase().indexOf(" comércio") == -1 &&
|
|
230
|
-
clientName.toLowerCase().indexOf(" comercial") == -1 &&
|
|
231
|
-
clientName.toLowerCase().indexOf(" industria") == -1 &&
|
|
232
|
-
clientName.toLowerCase().indexOf(" indústria") == -1 &&
|
|
233
|
-
clientName.toLowerCase().indexOf(" soluções") == -1 &&
|
|
234
|
-
clientName.toLowerCase().indexOf(" importação") == -1 &&
|
|
235
|
-
clientName.toLowerCase().indexOf(" solutions") == -1 &&
|
|
236
|
-
clientName.toLowerCase().indexOf(" me") == -1 &&
|
|
237
|
-
clientName.toLowerCase().trim() !=
|
|
238
|
-
item.mainOrder.client.alias.toLowerCase().trim()
|
|
239
|
-
) {
|
|
240
|
-
clientName += " " + item.mainOrder.client.alias;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
data.push({
|
|
245
|
-
"@id": item["@id"],
|
|
246
|
-
id: item["@id"].match(/^\/purchasing\/orders\/([a-z0-9-]*)$/)[1],
|
|
247
|
-
mainOrder: item.mainOrderId,
|
|
248
|
-
client: clientName,
|
|
249
|
-
notaFiscal:
|
|
250
|
-
item.invoiceTax.length > 0
|
|
251
|
-
? "#" + item.invoiceTax[0].invoiceTax.invoiceNumber
|
|
252
|
-
: "",
|
|
253
|
-
dataPedido: item.orderDate,
|
|
254
|
-
ultimaModificacao: item.alterDate,
|
|
255
|
-
status: item.status.status,
|
|
256
|
-
color_status: item.status.color,
|
|
257
|
-
preco: item.price,
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
this.data = data;
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
"filters.text"() {
|
|
265
|
-
this.onRequest({
|
|
266
|
-
pagination: this.pagination,
|
|
267
|
-
filter: this.filters,
|
|
268
|
-
});
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
"filters.status"() {
|
|
272
|
-
this.onRequest({
|
|
273
|
-
pagination: this.pagination,
|
|
274
|
-
filter: this.filters,
|
|
275
|
-
});
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
methods: {
|
|
280
|
-
...mapActions({
|
|
281
|
-
getItems: "purchasingOrder/getItems",
|
|
282
|
-
reset: "purchasingOrder/reset",
|
|
283
|
-
getStatuses: "purchasingOrder/getStatuses",
|
|
284
|
-
}),
|
|
285
|
-
|
|
286
|
-
requestStatuses() {
|
|
287
|
-
this.loadingStatuses = true;
|
|
288
|
-
this.getStatuses({
|
|
289
|
-
visibility: "public",
|
|
290
|
-
realStatus: ["open", "pending", "closed"],
|
|
291
|
-
context:'order'
|
|
292
|
-
}).then((statuses) => {
|
|
293
|
-
if (statuses.length) {
|
|
294
|
-
let data = [];
|
|
295
|
-
for (let index in statuses) {
|
|
296
|
-
let item = statuses[index];
|
|
297
|
-
this.statuses.push({
|
|
298
|
-
label: this.$t(`order.statuses.${item.status}`),
|
|
299
|
-
value: item["@id"].match(/^\/statuses\/([a-z0-9-]*)$/)[1],
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
this.loadingStatuses = false;
|
|
304
|
-
});
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
onRequest(props) {
|
|
308
|
-
let { page, rowsPerPage, rowsNumber, sortBy, descending } =
|
|
309
|
-
props.pagination;
|
|
310
|
-
let filter = props.filter;
|
|
311
|
-
let params = { itemsPerPage: rowsPerPage, page };
|
|
312
|
-
|
|
313
|
-
if (this.filters.text != null && this.filters.text.length > 0) {
|
|
314
|
-
if (this.filters.text.length < 2) return;
|
|
315
|
-
|
|
316
|
-
params["searchBy"] = this.filters.text;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (this.filters.status != null && this.filters.status.value != -1) {
|
|
320
|
-
params["status"] = this.filters.status.value;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (this.filters.company != null) {
|
|
324
|
-
params["myCompany"] = this.filters.company.id;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (this.invoiceId !== null) {
|
|
328
|
-
params["invoice.invoice"] = this.invoiceId;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
params["order[alterDate]"] = "desc";
|
|
332
|
-
|
|
333
|
-
this.getItems(params).then(() => {
|
|
334
|
-
this.pagination.page = page;
|
|
335
|
-
this.pagination.rowsPerPage = rowsPerPage;
|
|
336
|
-
this.pagination.sortBy = sortBy;
|
|
337
|
-
this.pagination.descending = descending;
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
},
|
|
341
|
-
};
|
|
342
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<q-table
|
|
3
|
+
:loading="isLoading"
|
|
4
|
+
:data="data"
|
|
5
|
+
:columns="settings.columns"
|
|
6
|
+
:pagination.sync="pagination"
|
|
7
|
+
@request="onRequest"
|
|
8
|
+
row-key="id"
|
|
9
|
+
style="min-height: 90vh"
|
|
10
|
+
:rows-per-page-options="[5, 10, 15, 20, 25, 50]"
|
|
11
|
+
>
|
|
12
|
+
<template v-slot:body="props">
|
|
13
|
+
<q-tr :props="props">
|
|
14
|
+
<q-td key="id" :props="props">
|
|
15
|
+
<q-btn
|
|
16
|
+
outline
|
|
17
|
+
dense
|
|
18
|
+
:to="{
|
|
19
|
+
name: 'PurchasingOrderDetails',
|
|
20
|
+
params: { id: props.row.id },
|
|
21
|
+
}"
|
|
22
|
+
:label="`#${props.row.id}`"
|
|
23
|
+
:style="{ color: props.row.color_status }"
|
|
24
|
+
class="full-width"
|
|
25
|
+
/>
|
|
26
|
+
</q-td>
|
|
27
|
+
<q-td key="mainOrder" :props="props">
|
|
28
|
+
<q-btn
|
|
29
|
+
v-if="props.row.mainOrder"
|
|
30
|
+
outline
|
|
31
|
+
dense
|
|
32
|
+
:to="{
|
|
33
|
+
name: 'OrderDetails',
|
|
34
|
+
params: { id: props.row.mainOrder },
|
|
35
|
+
}"
|
|
36
|
+
:label="`#${props.row.mainOrder}`"
|
|
37
|
+
:style="{ color: 'grey' }"
|
|
38
|
+
class="full-width"
|
|
39
|
+
/>
|
|
40
|
+
</q-td>
|
|
41
|
+
<q-td key="client" :props="props">{{ props.row.client }}</q-td>
|
|
42
|
+
<q-td key="notaFiscal" :props="props">{{ props.row.notaFiscal }}</q-td>
|
|
43
|
+
<q-td key="dataPedido" :props="props">{{ props.cols[4].value }}</q-td>
|
|
44
|
+
<q-td key="ultimaModificacao" :props="props">{{
|
|
45
|
+
props.cols[5].value
|
|
46
|
+
}}</q-td>
|
|
47
|
+
<q-td
|
|
48
|
+
key="status"
|
|
49
|
+
:props="props"
|
|
50
|
+
:style="{ color: props.row.color_status }"
|
|
51
|
+
>
|
|
52
|
+
{{ $t(`order.statuses.${props.row.status}`) }}
|
|
53
|
+
</q-td>
|
|
54
|
+
<q-td key="preco" :props="props">{{ props.cols[7].value }}</q-td>
|
|
55
|
+
</q-tr>
|
|
56
|
+
</template>
|
|
57
|
+
</q-table>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
import { mapActions, mapGetters } from "vuex";
|
|
62
|
+
import { date } from "quasar";
|
|
63
|
+
import { formatMoney } from "@freteclick/quasar-common-ui/src/utils/formatter";
|
|
64
|
+
|
|
65
|
+
const SETTINGS = {
|
|
66
|
+
columns: [
|
|
67
|
+
{
|
|
68
|
+
name: "id",
|
|
69
|
+
field: "id",
|
|
70
|
+
align: "left",
|
|
71
|
+
label: "ID",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "mainOrder",
|
|
75
|
+
field: "mainOrder",
|
|
76
|
+
align: "left",
|
|
77
|
+
label: "Pedido Principal",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "client",
|
|
81
|
+
field: "client",
|
|
82
|
+
align: "left",
|
|
83
|
+
label: "Cliente",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "notaFiscal",
|
|
87
|
+
field: "notaFiscal",
|
|
88
|
+
align: "left",
|
|
89
|
+
label: "Nota Fiscal",
|
|
90
|
+
format: (val, row) => {
|
|
91
|
+
return val ? "#" + val : "";
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "dataPedido",
|
|
96
|
+
field: "dataPedido",
|
|
97
|
+
align: "left",
|
|
98
|
+
format: (val, row) => {
|
|
99
|
+
return date.formatDate(val, "DD/MM/YYYY");
|
|
100
|
+
},
|
|
101
|
+
label: "Data",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "ultimaModificacao",
|
|
105
|
+
field: "ultimaModificacao",
|
|
106
|
+
align: "left",
|
|
107
|
+
format: (val, row) => {
|
|
108
|
+
return date.formatDate(val, "DD/MM/YYYY HH:mm:ss");
|
|
109
|
+
},
|
|
110
|
+
label: "Ultima alteração",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "status",
|
|
114
|
+
field: "status",
|
|
115
|
+
align: "left",
|
|
116
|
+
label: "Status",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "preco",
|
|
120
|
+
field: "preco",
|
|
121
|
+
align: "left",
|
|
122
|
+
format: (val, row) => {
|
|
123
|
+
return formatMoney(val, "BRL", "pt-br");
|
|
124
|
+
},
|
|
125
|
+
label: "Preço",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
Object.freeze(SETTINGS);
|
|
131
|
+
|
|
132
|
+
export default {
|
|
133
|
+
props: {
|
|
134
|
+
search: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
required: false,
|
|
137
|
+
default: true,
|
|
138
|
+
},
|
|
139
|
+
invoiceId: {
|
|
140
|
+
type: String,
|
|
141
|
+
required: false,
|
|
142
|
+
default: null,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
created() {
|
|
147
|
+
if (this.myCompany !== null) {
|
|
148
|
+
this.filters.company = this.myCompany;
|
|
149
|
+
this.onRequest({
|
|
150
|
+
pagination: this.pagination,
|
|
151
|
+
filter: this.filters,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
this.requestStatuses();
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
beforeDestroy() {
|
|
158
|
+
this.reset();
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
data() {
|
|
162
|
+
let statuses = [{ label: "Todos", value: -1 }];
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
settings: SETTINGS,
|
|
166
|
+
data: [],
|
|
167
|
+
statuses: statuses,
|
|
168
|
+
filters: {
|
|
169
|
+
text: null,
|
|
170
|
+
status: statuses[0],
|
|
171
|
+
company: null,
|
|
172
|
+
},
|
|
173
|
+
pagination: {
|
|
174
|
+
sortBy: "ultimaModificacao",
|
|
175
|
+
descending: false,
|
|
176
|
+
page: 1,
|
|
177
|
+
rowsPerPage: 10,
|
|
178
|
+
rowsNumber: 10,
|
|
179
|
+
},
|
|
180
|
+
loadingStatuses: false,
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
computed: {
|
|
185
|
+
...mapGetters({
|
|
186
|
+
isLoading: "purchasingOrder/isLoading",
|
|
187
|
+
error: "purchasingOrder/error",
|
|
188
|
+
violations: "purchasingOrder/violations",
|
|
189
|
+
items: "purchasingOrder/items",
|
|
190
|
+
totalItems: "purchasingOrder/totalItems",
|
|
191
|
+
myCompany: "people/currentCompany",
|
|
192
|
+
}),
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
watch: {
|
|
196
|
+
myCompany(company) {
|
|
197
|
+
if (company !== null) {
|
|
198
|
+
this.filters.company = company;
|
|
199
|
+
this.onRequest({
|
|
200
|
+
pagination: this.pagination,
|
|
201
|
+
filter: this.filters,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
totalItems(val) {
|
|
207
|
+
this.pagination.rowsNumber = val;
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
items(items) {
|
|
211
|
+
if (!items) return;
|
|
212
|
+
|
|
213
|
+
let data = [];
|
|
214
|
+
|
|
215
|
+
for (let index in items) {
|
|
216
|
+
let item = items[index];
|
|
217
|
+
|
|
218
|
+
var clientName = "--";
|
|
219
|
+
|
|
220
|
+
if (item.mainOrder && item.mainOrder.client) {
|
|
221
|
+
clientName = item.mainOrder.client.name;
|
|
222
|
+
|
|
223
|
+
if (!clientName) {
|
|
224
|
+
clientName = item.mainOrder.client.alias;
|
|
225
|
+
} else if (
|
|
226
|
+
clientName.toLowerCase().indexOf(" ltda") == -1 &&
|
|
227
|
+
clientName.toLowerCase().indexOf(" eireli") == -1 &&
|
|
228
|
+
clientName.toLowerCase().indexOf(" comercio") == -1 &&
|
|
229
|
+
clientName.toLowerCase().indexOf(" comércio") == -1 &&
|
|
230
|
+
clientName.toLowerCase().indexOf(" comercial") == -1 &&
|
|
231
|
+
clientName.toLowerCase().indexOf(" industria") == -1 &&
|
|
232
|
+
clientName.toLowerCase().indexOf(" indústria") == -1 &&
|
|
233
|
+
clientName.toLowerCase().indexOf(" soluções") == -1 &&
|
|
234
|
+
clientName.toLowerCase().indexOf(" importação") == -1 &&
|
|
235
|
+
clientName.toLowerCase().indexOf(" solutions") == -1 &&
|
|
236
|
+
clientName.toLowerCase().indexOf(" me") == -1 &&
|
|
237
|
+
clientName.toLowerCase().trim() !=
|
|
238
|
+
item.mainOrder.client.alias.toLowerCase().trim()
|
|
239
|
+
) {
|
|
240
|
+
clientName += " " + item.mainOrder.client.alias;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
data.push({
|
|
245
|
+
"@id": item["@id"],
|
|
246
|
+
id: item["@id"].match(/^\/purchasing\/orders\/([a-z0-9-]*)$/)[1],
|
|
247
|
+
mainOrder: item.mainOrderId,
|
|
248
|
+
client: clientName,
|
|
249
|
+
notaFiscal:
|
|
250
|
+
item.invoiceTax.length > 0
|
|
251
|
+
? "#" + item.invoiceTax[0].invoiceTax.invoiceNumber
|
|
252
|
+
: "",
|
|
253
|
+
dataPedido: item.orderDate,
|
|
254
|
+
ultimaModificacao: item.alterDate,
|
|
255
|
+
status: item.status.status,
|
|
256
|
+
color_status: item.status.color,
|
|
257
|
+
preco: item.price,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
this.data = data;
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
"filters.text"() {
|
|
265
|
+
this.onRequest({
|
|
266
|
+
pagination: this.pagination,
|
|
267
|
+
filter: this.filters,
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
"filters.status"() {
|
|
272
|
+
this.onRequest({
|
|
273
|
+
pagination: this.pagination,
|
|
274
|
+
filter: this.filters,
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
methods: {
|
|
280
|
+
...mapActions({
|
|
281
|
+
getItems: "purchasingOrder/getItems",
|
|
282
|
+
reset: "purchasingOrder/reset",
|
|
283
|
+
getStatuses: "purchasingOrder/getStatuses",
|
|
284
|
+
}),
|
|
285
|
+
|
|
286
|
+
requestStatuses() {
|
|
287
|
+
this.loadingStatuses = true;
|
|
288
|
+
this.getStatuses({
|
|
289
|
+
visibility: "public",
|
|
290
|
+
realStatus: ["open", "pending", "closed"],
|
|
291
|
+
context:'order'
|
|
292
|
+
}).then((statuses) => {
|
|
293
|
+
if (statuses.length) {
|
|
294
|
+
let data = [];
|
|
295
|
+
for (let index in statuses) {
|
|
296
|
+
let item = statuses[index];
|
|
297
|
+
this.statuses.push({
|
|
298
|
+
label: this.$t(`order.statuses.${item.status}`),
|
|
299
|
+
value: item["@id"].match(/^\/statuses\/([a-z0-9-]*)$/)[1],
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
this.loadingStatuses = false;
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
onRequest(props) {
|
|
308
|
+
let { page, rowsPerPage, rowsNumber, sortBy, descending } =
|
|
309
|
+
props.pagination;
|
|
310
|
+
let filter = props.filter;
|
|
311
|
+
let params = { itemsPerPage: rowsPerPage, page };
|
|
312
|
+
|
|
313
|
+
if (this.filters.text != null && this.filters.text.length > 0) {
|
|
314
|
+
if (this.filters.text.length < 2) return;
|
|
315
|
+
|
|
316
|
+
params["searchBy"] = this.filters.text;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (this.filters.status != null && this.filters.status.value != -1) {
|
|
320
|
+
params["status"] = this.filters.status.value;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (this.filters.company != null) {
|
|
324
|
+
params["myCompany"] = this.filters.company.id;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (this.invoiceId !== null) {
|
|
328
|
+
params["invoice.invoice"] = this.invoiceId;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
params["order[alterDate]"] = "desc";
|
|
332
|
+
|
|
333
|
+
this.getItems(params).then(() => {
|
|
334
|
+
this.pagination.page = page;
|
|
335
|
+
this.pagination.rowsPerPage = rowsPerPage;
|
|
336
|
+
this.pagination.sortBy = sortBy;
|
|
337
|
+
this.pagination.descending = descending;
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
</script>
|