@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.
- package/package.json +18 -0
- package/src/components/common/Filters.vue +141 -0
- package/src/components/expense/FormExpense.vue +309 -0
- package/src/components/expense/TableExpenses.vue +305 -0
- package/src/components/invoice/client/ClientInvoiceDetails.vue +213 -0
- package/src/components/invoice/client/InvoiceSearching.vue +383 -0
- package/src/components/invoice/client/details/InvoiceInvoice.vue +249 -0
- package/src/components/invoice/client/details/InvoiceOrders.vue +328 -0
- package/src/components/invoice/expense/CreateExpense.vue +539 -0
- package/src/components/invoice/expense/DetailExpense.vue +393 -0
- package/src/components/invoice/pay/InvoiceDetails.vue +210 -0
- package/src/components/invoice/pay/InvoiceSearching.vue +388 -0
- package/src/components/invoice/pay/details/InvoiceInvoice.vue +47 -0
- package/src/components/invoice/pay/details/InvoiceOrders.vue +342 -0
- package/src/components/invoice/receive/InvoiceDetails.vue +281 -0
- package/src/components/invoice/receive/InvoiceSearching.vue +359 -0
- package/src/components/invoice/receive/details/InvoiceInvoice.vue +371 -0
- package/src/components/invoice/receive/details/InvoiceInvoiceBkp.vue +260 -0
- package/src/components/invoice/receive/details/InvoiceOrders.vue +370 -0
- package/src/i18n/en-us/index.js +8 -0
- package/src/i18n/index.js +5 -0
- package/src/i18n/pt-br/index.js +30 -0
- package/src/pages/Invoice/Client/Details.vue +23 -0
- package/src/pages/Invoice/Client/Index.vue +27 -0
- package/src/pages/Invoice/Pay/Details.vue +23 -0
- package/src/pages/Invoice/Pay/Index.vue +53 -0
- package/src/pages/Invoice/Receive/Details.vue +23 -0
- package/src/pages/Invoice/Receive/Index.vue +27 -0
- package/src/router/routes.js +32 -0
- package/src/store/modules/invoice/comission/actions.js +66 -0
- package/src/store/modules/invoice/comission/getters.js +7 -0
- package/src/store/modules/invoice/comission/index.js +19 -0
- package/src/store/modules/invoice/comission/mutation_types.js +8 -0
- package/src/store/modules/invoice/comission/mutations.js +42 -0
- package/src/store/modules/invoice/expense/actions.js +98 -0
- package/src/store/modules/invoice/expense/getters.js +1 -0
- package/src/store/modules/invoice/expense/index.js +12 -0
- package/src/store/modules/invoice/expense/mutations.js +3 -0
- package/src/store/modules/invoice/expense/state.js +5 -0
- package/src/store/modules/invoice/pay/actions.js +114 -0
- package/src/store/modules/invoice/pay/getters.js +7 -0
- package/src/store/modules/invoice/pay/index.js +19 -0
- package/src/store/modules/invoice/pay/mutation_types.js +8 -0
- package/src/store/modules/invoice/pay/mutations.js +42 -0
- package/src/store/modules/invoice/receive/actions.js +152 -0
- package/src/store/modules/invoice/receive/actionsBkp.js +77 -0
- package/src/store/modules/invoice/receive/getters.js +7 -0
- package/src/store/modules/invoice/receive/index.js +19 -0
- package/src/store/modules/invoice/receive/mutation_types.js +8 -0
- package/src/store/modules/invoice/receive/mutations.js +42 -0
- package/src/store/store-flag.d.ts +9 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const retrieved = state => state.retrieved;
|
|
2
|
+
export const error = state => state.error;
|
|
3
|
+
export const isLoading = state => state.isLoading;
|
|
4
|
+
export const violations = state => state.violations;
|
|
5
|
+
export const items = state => state.items;
|
|
6
|
+
export const view = state => state.view;
|
|
7
|
+
export const totalItems = state => state.totalItems;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as actions from './actions';
|
|
2
|
+
import * as getters from './getters';
|
|
3
|
+
import mutations from './mutations';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
namespaced: true,
|
|
7
|
+
state : {
|
|
8
|
+
isLoading : false,
|
|
9
|
+
error : '',
|
|
10
|
+
violations: null,
|
|
11
|
+
retrieved : null,
|
|
12
|
+
totalItems: 10,
|
|
13
|
+
items : [],
|
|
14
|
+
view : [],
|
|
15
|
+
},
|
|
16
|
+
actions,
|
|
17
|
+
getters,
|
|
18
|
+
mutations,
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const SET_ERROR = 'SET_ERROR';
|
|
2
|
+
export const SET_ISLOADING = 'SET_ISLOADING';
|
|
3
|
+
export const SET_VIOLATIONS = 'SET_VIOLATIONS';
|
|
4
|
+
export const SET_ITEMS = 'SET_ITEMS';
|
|
5
|
+
export const SET_VIEW = 'SET_VIEW';
|
|
6
|
+
export const SET_TOTALITEMS = 'SET_TOTALITEMS';
|
|
7
|
+
export const SET_RETRIEVED = 'SET_RETRIEVED';
|
|
8
|
+
export const RESET = 'RESET';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as types from './mutation_types';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
[types.SET_ERROR] (state, error) {
|
|
5
|
+
Object.assign(state, { error });
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
[types.SET_ISLOADING] (state, isLoading = true) {
|
|
9
|
+
Object.assign(state, { isLoading: isLoading });
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
[types.SET_VIOLATIONS](state, violations) {
|
|
13
|
+
Object.assign(state, { violations });
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
[types.SET_RETRIEVED](state, retrieved) {
|
|
17
|
+
Object.assign(state, { retrieved });
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
[types.SET_ITEMS](state, items) {
|
|
21
|
+
Object.assign(state, { items });
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
[types.SET_VIEW](state, view) {
|
|
25
|
+
Object.assign(state, { view });
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
[types.SET_TOTALITEMS](state, totalItems) {
|
|
29
|
+
Object.assign(state, { totalItems });
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
[types.RESET](state) {
|
|
33
|
+
Object.assign(state, {
|
|
34
|
+
isLoading : false,
|
|
35
|
+
error : '',
|
|
36
|
+
violations: null,
|
|
37
|
+
retrieved : null,
|
|
38
|
+
totalItems: null,
|
|
39
|
+
items : [],
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
|
|
2
|
+
import { fetch } from '../../../../../../../../src/boot/myapi';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export function getProviders({ commit }, data) {
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
params: data.params ? data.params : {}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return fetch('/providers', options)
|
|
14
|
+
.then(response => response.json())
|
|
15
|
+
.then(response => {
|
|
16
|
+
return response['hydra:member'];
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const createExpense = ({ commit }, data) => {
|
|
21
|
+
let options = {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
body: JSON.stringify(data.values),
|
|
24
|
+
params: data.params ? data.params : {}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return fetch('/invoices', options)
|
|
28
|
+
.then(response => response.json())
|
|
29
|
+
.then(response => {
|
|
30
|
+
return response.data ? response.data : null;
|
|
31
|
+
})
|
|
32
|
+
.catch(e => {
|
|
33
|
+
if (e instanceof SubmissionError) {
|
|
34
|
+
throw new Error(e.errors._error);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
throw new Error(e.message);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const createProvider = ({ commit }, data) => {
|
|
42
|
+
let options = {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
body: JSON.stringify(data.values),
|
|
45
|
+
params: data.params ? data.params : {}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return fetch('/providers', options)
|
|
49
|
+
.then(response => response.json())
|
|
50
|
+
.then(response => {
|
|
51
|
+
return response;
|
|
52
|
+
})
|
|
53
|
+
.catch(e => {
|
|
54
|
+
if (e instanceof SubmissionError) {
|
|
55
|
+
throw new Error(e.errors._error);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
throw new Error(e.message);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const updateExpense = ({ commit }, data) => {
|
|
63
|
+
let options = {
|
|
64
|
+
method: 'PUT',
|
|
65
|
+
body: JSON.stringify(data.values),
|
|
66
|
+
params: data.params ? data.params : {}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return fetch(`/invoices/${data.id}`, options)
|
|
70
|
+
.then(response => response.json())
|
|
71
|
+
.then(response => {
|
|
72
|
+
return response.data ? response.data : null;
|
|
73
|
+
})
|
|
74
|
+
.catch(e => {
|
|
75
|
+
if (e instanceof SubmissionError) {
|
|
76
|
+
throw new Error(e.errors._error);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
throw new Error(e.message);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const deleteExpense = ({ commit }, data) => {
|
|
84
|
+
let options = {
|
|
85
|
+
method: 'DELETE',
|
|
86
|
+
body: JSON.stringify(data.values),
|
|
87
|
+
params: data.params ? data.params : {}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return fetch(`/invoices/${data.id}`, options)
|
|
91
|
+
.catch(e => {
|
|
92
|
+
if (e instanceof SubmissionError) {
|
|
93
|
+
throw new Error(e.errors._error);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
throw new Error(e.message);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const items = state => state.item
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
|
|
2
|
+
import { fetch } from '../../../../../../../../src/boot/myapi';
|
|
3
|
+
import * as types from './mutation_types';
|
|
4
|
+
|
|
5
|
+
const RESOURCE_ENDPOINT = '/finance/pay';
|
|
6
|
+
|
|
7
|
+
export const getItems = ({ commit }, params = {}) => {
|
|
8
|
+
commit(types.SET_ISLOADING);
|
|
9
|
+
|
|
10
|
+
return fetch(RESOURCE_ENDPOINT, { params })
|
|
11
|
+
.then(response => response.json())
|
|
12
|
+
.then(data => {
|
|
13
|
+
commit(types.SET_ISLOADING, false);
|
|
14
|
+
|
|
15
|
+
commit(types.SET_ITEMS, data['hydra:member']);
|
|
16
|
+
commit(types.SET_VIEW, data['hydra:view']);
|
|
17
|
+
commit(types.SET_TOTALITEMS, data['hydra:totalItems']);
|
|
18
|
+
|
|
19
|
+
return data['hydra:member'];
|
|
20
|
+
|
|
21
|
+
}).catch(e => {
|
|
22
|
+
commit(types.SET_ISLOADING, false);
|
|
23
|
+
|
|
24
|
+
if (e instanceof SubmissionError) {
|
|
25
|
+
commit(types.SET_VIOLATIONS, e.errors);
|
|
26
|
+
// eslint-disable-next-line
|
|
27
|
+
commit(types.SET_ERROR, e.errors._error);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
commit(types.SET_ERROR, e.message);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const reset = ({ commit }) => {
|
|
36
|
+
commit(types.RESET);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getStatuses = ({ commit }, params = {}) => {
|
|
40
|
+
return fetch('/statuses', { params })
|
|
41
|
+
.then(response => response.json())
|
|
42
|
+
.then(data => {
|
|
43
|
+
|
|
44
|
+
return data['hydra:member'];
|
|
45
|
+
|
|
46
|
+
}).catch(e => {
|
|
47
|
+
if (e instanceof SubmissionError) {
|
|
48
|
+
commit(types.SET_VIOLATIONS, e.errors);
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
commit(types.SET_ERROR, e.errors._error);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
commit(types.SET_ERROR, e.message);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const getInvoice = ({ commit }, { invoiceId, params }) => {
|
|
59
|
+
return fetch(`/finance/pay/${invoiceId}`, { params })
|
|
60
|
+
.then(response => response.json())
|
|
61
|
+
.then(data => {
|
|
62
|
+
|
|
63
|
+
return data;
|
|
64
|
+
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export const updateInvoiceDuedate = ({ commit }, { id, dueDate, params }) => {
|
|
70
|
+
let options = {
|
|
71
|
+
method: 'PUT',
|
|
72
|
+
body: JSON.stringify({ dueDate }),
|
|
73
|
+
params: params
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return fetch(`${id}`, options)
|
|
77
|
+
.then(response => response.json())
|
|
78
|
+
.then(invoice => {
|
|
79
|
+
if (invoice['@id'])
|
|
80
|
+
return invoice;
|
|
81
|
+
|
|
82
|
+
return null;
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const deleteInvoiceOrder = ({ commit }, { invoiceId, orderId, params }) => {
|
|
87
|
+
let options = {
|
|
88
|
+
method: 'PUT',
|
|
89
|
+
body: JSON.stringify({ orderId }),
|
|
90
|
+
params: params
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return fetch(`${invoiceId}/remove-order`, options)
|
|
94
|
+
.then(response => response.json())
|
|
95
|
+
.then(data => {
|
|
96
|
+
if (data.response) {
|
|
97
|
+
if (data.response.success === false)
|
|
98
|
+
throw Error(data.response.error);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return null;
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const bankItau = ({ commit }, { invoiceId, operation, params = {} }) => {
|
|
106
|
+
return fetch(`/finance/pay/${invoiceId}/bank/itau/${operation}`, { params })
|
|
107
|
+
.then(response => response.json())
|
|
108
|
+
.then(data => {
|
|
109
|
+
if (data.response)
|
|
110
|
+
return data.response.data !== null ? data.response.data : null;
|
|
111
|
+
|
|
112
|
+
return null;
|
|
113
|
+
});
|
|
114
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const retrieved = state => state.retrieved;
|
|
2
|
+
export const error = state => state.error;
|
|
3
|
+
export const isLoading = state => state.isLoading;
|
|
4
|
+
export const violations = state => state.violations;
|
|
5
|
+
export const items = state => state.items;
|
|
6
|
+
export const view = state => state.view;
|
|
7
|
+
export const totalItems = state => state.totalItems;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as actions from './actions';
|
|
2
|
+
import * as getters from './getters';
|
|
3
|
+
import mutations from './mutations';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
namespaced: true,
|
|
7
|
+
state : {
|
|
8
|
+
isLoading : false,
|
|
9
|
+
error : '',
|
|
10
|
+
violations: null,
|
|
11
|
+
retrieved : null,
|
|
12
|
+
totalItems: 10,
|
|
13
|
+
items : [],
|
|
14
|
+
view : [],
|
|
15
|
+
},
|
|
16
|
+
actions,
|
|
17
|
+
getters,
|
|
18
|
+
mutations,
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const SET_ERROR = 'SET_ERROR';
|
|
2
|
+
export const SET_ISLOADING = 'SET_ISLOADING';
|
|
3
|
+
export const SET_VIOLATIONS = 'SET_VIOLATIONS';
|
|
4
|
+
export const SET_ITEMS = 'SET_ITEMS';
|
|
5
|
+
export const SET_VIEW = 'SET_VIEW';
|
|
6
|
+
export const SET_TOTALITEMS = 'SET_TOTALITEMS';
|
|
7
|
+
export const SET_RETRIEVED = 'SET_RETRIEVED';
|
|
8
|
+
export const RESET = 'RESET';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as types from './mutation_types';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
[types.SET_ERROR] (state, error) {
|
|
5
|
+
Object.assign(state, { error });
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
[types.SET_ISLOADING] (state, isLoading = true) {
|
|
9
|
+
Object.assign(state, { isLoading: isLoading });
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
[types.SET_VIOLATIONS](state, violations) {
|
|
13
|
+
Object.assign(state, { violations });
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
[types.SET_RETRIEVED](state, retrieved) {
|
|
17
|
+
Object.assign(state, { retrieved });
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
[types.SET_ITEMS](state, items) {
|
|
21
|
+
Object.assign(state, { items });
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
[types.SET_VIEW](state, view) {
|
|
25
|
+
Object.assign(state, { view });
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
[types.SET_TOTALITEMS](state, totalItems) {
|
|
29
|
+
Object.assign(state, { totalItems });
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
[types.RESET](state) {
|
|
33
|
+
Object.assign(state, {
|
|
34
|
+
isLoading : false,
|
|
35
|
+
error : '',
|
|
36
|
+
violations: null,
|
|
37
|
+
retrieved : null,
|
|
38
|
+
totalItems: null,
|
|
39
|
+
items : [],
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
|
|
2
|
+
import { fetch } from '../../../../../../../../src/boot/myapi';
|
|
3
|
+
import * as types from './mutation_types';
|
|
4
|
+
|
|
5
|
+
const RESOURCE_ENDPOINT = '/finance/receive';
|
|
6
|
+
|
|
7
|
+
export const getItems = ({ commit }, params = {}) => {
|
|
8
|
+
commit(types.SET_ISLOADING);
|
|
9
|
+
|
|
10
|
+
return fetch(RESOURCE_ENDPOINT, { params })
|
|
11
|
+
.then(response => response.json())
|
|
12
|
+
.then(data => {
|
|
13
|
+
commit(types.SET_ISLOADING, false);
|
|
14
|
+
|
|
15
|
+
commit(types.SET_ITEMS, data['hydra:member']);
|
|
16
|
+
commit(types.SET_VIEW, data['hydra:view']);
|
|
17
|
+
commit(types.SET_TOTALITEMS, data['hydra:totalItems']);
|
|
18
|
+
|
|
19
|
+
return data['hydra:member'];
|
|
20
|
+
|
|
21
|
+
}).catch(e => {
|
|
22
|
+
commit(types.SET_ISLOADING, false);
|
|
23
|
+
|
|
24
|
+
if (e instanceof SubmissionError) {
|
|
25
|
+
commit(types.SET_VIOLATIONS, e.errors);
|
|
26
|
+
// eslint-disable-next-line
|
|
27
|
+
commit(types.SET_ERROR, e.errors._error);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
commit(types.SET_ERROR, e.message);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const reset = ({ commit }) => {
|
|
36
|
+
commit(types.RESET);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getStatuses = ({ commit }, params = {}) => {
|
|
40
|
+
return fetch('/statuses', { params })
|
|
41
|
+
.then(response => response.json())
|
|
42
|
+
.then(data => {
|
|
43
|
+
|
|
44
|
+
return data['hydra:member'];
|
|
45
|
+
|
|
46
|
+
}).catch(e => {
|
|
47
|
+
if (e instanceof SubmissionError) {
|
|
48
|
+
commit(types.SET_VIOLATIONS, e.errors);
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
commit(types.SET_ERROR, e.errors._error);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
commit(types.SET_ERROR, e.message);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const getInvoice = ({ commit }, { invoiceId, params }) => {
|
|
59
|
+
return fetch(`/finance/receive/${invoiceId}`, { params })
|
|
60
|
+
.then(response => response.json())
|
|
61
|
+
.then(data => {
|
|
62
|
+
return data;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export const renewInvoice = ({ commit }, { invoiceId, params }) => {
|
|
68
|
+
|
|
69
|
+
let options = {
|
|
70
|
+
method: 'PUT',
|
|
71
|
+
body: JSON.stringify({ params })
|
|
72
|
+
};
|
|
73
|
+
return fetch(`/finance/receive/${invoiceId}/renew`, options)
|
|
74
|
+
.then(response => response.json())
|
|
75
|
+
.then(data => {
|
|
76
|
+
|
|
77
|
+
if (!data.response || data.response.success === false) {
|
|
78
|
+
throw Error(data.response.error);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return data.response;
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const bankItau = ({ commit }, { invoiceId, operation, params = {} }) => {
|
|
86
|
+
return fetch(`/finance/receive/${invoiceId}/bank/itau/${operation}`, { params })
|
|
87
|
+
.then(response => response.json())
|
|
88
|
+
.then(data => {
|
|
89
|
+
if (data.response) {
|
|
90
|
+
return data.response.data !== null ? data.response.data : null;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const bankInter = ({ commit }, { invoiceId, operation, params = {} }) => {
|
|
97
|
+
return fetch(`/finance/receive/${invoiceId}/bank/inter/${operation}`, { params })
|
|
98
|
+
.then(response => response.json())
|
|
99
|
+
.then(data => {
|
|
100
|
+
if (data.response) {
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const getBankPerInvoiceId = ({ commit }, { invoiceId, params = {} }) => {
|
|
108
|
+
return fetch(`/finance/receive/${invoiceId}/bank`, { params })
|
|
109
|
+
.then(response => response.json())
|
|
110
|
+
.then(data => {
|
|
111
|
+
if (data.response)
|
|
112
|
+
return data.response.data !== null ? data.response.data : null;
|
|
113
|
+
return null;
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
export const updateInvoiceDuedate = ({ commit }, { id, dueDate, params }) => {
|
|
119
|
+
let options = {
|
|
120
|
+
method: 'PUT',
|
|
121
|
+
body: JSON.stringify({ dueDate }),
|
|
122
|
+
params: params
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return fetch(`${id}`, options)
|
|
126
|
+
.then(response => response.json())
|
|
127
|
+
.then(invoice => {
|
|
128
|
+
if (invoice['@id'])
|
|
129
|
+
return invoice;
|
|
130
|
+
|
|
131
|
+
return null;
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const deleteInvoiceOrder = ({ commit }, { invoiceId, orderId, params }) => {
|
|
136
|
+
let options = {
|
|
137
|
+
method: 'PUT',
|
|
138
|
+
body: JSON.stringify({ orderId }),
|
|
139
|
+
params: params
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return fetch(`${invoiceId}/remove-order`, options)
|
|
143
|
+
.then(response => response.json())
|
|
144
|
+
.then(data => {
|
|
145
|
+
if (data.response) {
|
|
146
|
+
if (data.response.success === false)
|
|
147
|
+
throw Error(data.response.error);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return null;
|
|
151
|
+
});
|
|
152
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import SubmissionError from '@freteclick/quasar-common-ui/src/error/SubmissionError';
|
|
2
|
+
import { fetch } from '../../../../../../../../src/boot/myapi';
|
|
3
|
+
import * as types from './mutation_types';
|
|
4
|
+
|
|
5
|
+
const RESOURCE_ENDPOINT = '/finance/receive';
|
|
6
|
+
|
|
7
|
+
export const getItems = ({ commit }, params = {}) => {
|
|
8
|
+
commit(types.SET_ISLOADING);
|
|
9
|
+
|
|
10
|
+
return fetch(RESOURCE_ENDPOINT, { params })
|
|
11
|
+
.then(response => response.json())
|
|
12
|
+
.then(data => {
|
|
13
|
+
commit(types.SET_ISLOADING , false);
|
|
14
|
+
|
|
15
|
+
commit(types.SET_ITEMS , data['hydra:member']);
|
|
16
|
+
commit(types.SET_VIEW , data['hydra:view']);
|
|
17
|
+
commit(types.SET_TOTALITEMS, data['hydra:totalItems']);
|
|
18
|
+
|
|
19
|
+
return data['hydra:member'];
|
|
20
|
+
|
|
21
|
+
}).catch(e => {
|
|
22
|
+
commit(types.SET_ISLOADING, false);
|
|
23
|
+
|
|
24
|
+
if (e instanceof SubmissionError) {
|
|
25
|
+
commit(types.SET_VIOLATIONS, e.errors);
|
|
26
|
+
// eslint-disable-next-line
|
|
27
|
+
commit(types.SET_ERROR, e.errors._error);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
commit(types.SET_ERROR, e.message);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const reset = ({ commit }) => {
|
|
36
|
+
commit(types.RESET);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const getStatuses = ({ commit }, params = {}) => {
|
|
40
|
+
return fetch('/statuses', { params })
|
|
41
|
+
.then(response => response.json())
|
|
42
|
+
.then(data => {
|
|
43
|
+
|
|
44
|
+
return data['hydra:member'];
|
|
45
|
+
|
|
46
|
+
}).catch(e => {
|
|
47
|
+
if (e instanceof SubmissionError) {
|
|
48
|
+
commit(types.SET_VIOLATIONS, e.errors);
|
|
49
|
+
// eslint-disable-next-line
|
|
50
|
+
commit(types.SET_ERROR, e.errors._error);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
commit(types.SET_ERROR, e.message);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const getInvoice = ({ commit }, { invoiceId, params }) => {
|
|
59
|
+
return fetch(`/finance/receive/${invoiceId}`, { params })
|
|
60
|
+
.then(response => response.json())
|
|
61
|
+
.then(data => {
|
|
62
|
+
|
|
63
|
+
return data;
|
|
64
|
+
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const bankItau = ({ commit }, { invoiceId, operation, params = {} }) => {
|
|
69
|
+
return fetch(`/finance/receive/${invoiceId}/bank/itau/${operation}`, { params })
|
|
70
|
+
.then(response => response.json())
|
|
71
|
+
.then(data => {
|
|
72
|
+
if (data.response)
|
|
73
|
+
return data.response.data !== null ? data.response.data : null;
|
|
74
|
+
|
|
75
|
+
return null;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const retrieved = state => state.retrieved;
|
|
2
|
+
export const error = state => state.error;
|
|
3
|
+
export const isLoading = state => state.isLoading;
|
|
4
|
+
export const violations = state => state.violations;
|
|
5
|
+
export const items = state => state.items;
|
|
6
|
+
export const view = state => state.view;
|
|
7
|
+
export const totalItems = state => state.totalItems;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as actions from './actions';
|
|
2
|
+
import * as getters from './getters';
|
|
3
|
+
import mutations from './mutations';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
namespaced: true,
|
|
7
|
+
state : {
|
|
8
|
+
isLoading : false,
|
|
9
|
+
error : '',
|
|
10
|
+
violations: null,
|
|
11
|
+
retrieved : null,
|
|
12
|
+
totalItems: 10,
|
|
13
|
+
items : [],
|
|
14
|
+
view : [],
|
|
15
|
+
},
|
|
16
|
+
actions,
|
|
17
|
+
getters,
|
|
18
|
+
mutations,
|
|
19
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const SET_ERROR = 'SET_ERROR';
|
|
2
|
+
export const SET_ISLOADING = 'SET_ISLOADING';
|
|
3
|
+
export const SET_VIOLATIONS = 'SET_VIOLATIONS';
|
|
4
|
+
export const SET_ITEMS = 'SET_ITEMS';
|
|
5
|
+
export const SET_VIEW = 'SET_VIEW';
|
|
6
|
+
export const SET_TOTALITEMS = 'SET_TOTALITEMS';
|
|
7
|
+
export const SET_RETRIEVED = 'SET_RETRIEVED';
|
|
8
|
+
export const RESET = 'RESET';
|