From c5f2a5903296517c1c583e4ed24c5ca731f79e35 Mon Sep 17 00:00:00 2001 From: syahdham Date: Thu, 17 Nov 2022 09:56:31 +0700 Subject: [PATCH 1/5] Push history purchase order --- src/modules/purchase/order-history.js | 56 + src/modules/purchase/order.js | 39 + src/views/purchase/order/History.vue | 207 + src/views/purchase/order/Index.vue | 32 +- .../purchase/order/RequestApproveAll.vue | 395 + src/views/purchase/order/routes.js | 4 +- yarn.lock | 13403 ---------------- 7 files changed, 726 insertions(+), 13410 deletions(-) create mode 100644 src/modules/purchase/order-history.js create mode 100644 src/views/purchase/order/History.vue create mode 100644 src/views/purchase/order/RequestApproveAll.vue delete mode 100644 yarn.lock diff --git a/src/modules/purchase/order-history.js b/src/modules/purchase/order-history.js new file mode 100644 index 00000000..74e7eb93 --- /dev/null +++ b/src/modules/purchase/order-history.js @@ -0,0 +1,56 @@ +import api from '@/api' + +const url = '/purchase/orders' + +const state = { + purchaseOrderHistories: [], + pagination: {} +} + +const getters = { + purchaseOrderHistories: state => { + return state.purchaseOrderHistories + }, + pagination: state => { + return state.pagination + } +} + +const mutations = { + 'FETCH_ARRAY' (state, payload) { + state.purchaseOrderHistories = payload.data + state.pagination = payload.meta + } +} + +const actions = { + get ({ commit }, payload) { + return new Promise((resolve, reject) => { + api.get(url + '/' + payload.id + '/histories', payload) + .then(response => { + commit('FETCH_ARRAY', response) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + add (context, payload) { + return new Promise((resolve, reject) => { + api.post(url + '/' + payload.id + '/histories', payload) + .then(response => { + resolve(response) + }).catch(error => { + reject(error) + }) + }) + } +} + +export default { + namespaced: true, + state, + getters, + mutations, + actions +} diff --git a/src/modules/purchase/order.js b/src/modules/purchase/order.js index 6a3cfcda..b4e0b991 100644 --- a/src/modules/purchase/order.js +++ b/src/modules/purchase/order.js @@ -22,6 +22,7 @@ const state = { items: [] }, purchaseOrders: [], + histories: [], pagination: {} } @@ -32,6 +33,9 @@ const getters = { purchaseOrders: state => { return state.purchaseOrders }, + histories: state => { + return state.histories + }, pagination: state => { return state.pagination } @@ -48,6 +52,10 @@ const mutations = { }) state.purchaseOrder = payload.data }, + 'FETCH_HISTORY' (state, payload) { + state.histories = payload.data + state.pagination = payload.meta + }, 'CREATE' (state, payload) { state.purchaseOrder = payload }, @@ -71,6 +79,27 @@ const actions = { }) }) }, + history ({ commit }, payload) { + return new Promise((resolve, reject) => { + api.get(url + '/history', payload) + .then(response => { + commit('FETCH_HISTORY', response) + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, + storeHistory (context, payload) { + return new Promise((resolve, reject) => { + api.post(url + '/history', payload) + .then(response => { + resolve(response) + }).catch(error => { + reject(error) + }) + }) + }, find ({ commit }, payload) { return new Promise((resolve, reject) => { api.get(url + '/' + payload.id, payload) @@ -151,6 +180,16 @@ const actions = { reject(error) }) }) + }, + sendBulkRequestApproval (context, payload) { + return new Promise((resolve, reject) => { + api.post(url + '/send-bulk-request-approval', payload) + .then(response => { + resolve(response) + }).catch(error => { + reject(error) + }) + }) } } diff --git a/src/views/purchase/order/History.vue b/src/views/purchase/order/History.vue new file mode 100644 index 00000000..ddde96a1 --- /dev/null +++ b/src/views/purchase/order/History.vue @@ -0,0 +1,207 @@ + + + diff --git a/src/views/purchase/order/Index.vue b/src/views/purchase/order/Index.vue index 1e9774b0..75f34cd7 100644 --- a/src/views/purchase/order/Index.vue +++ b/src/views/purchase/order/Index.vue @@ -29,13 +29,22 @@ @input="filterSearch" /> -
- + - {{ $t('advance filter') | uppercase }} - + {{ $t('request approve all') | uppercase }} + + +
Form Status + + History +