From 0f7bf12ef06ea58e1c73c5718197ea5abaa0fe7f Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Thu, 7 Nov 2024 11:45:31 +0700 Subject: [PATCH] md-lokasi --- md-lokasi/components/filter.vue | 114 +++++++++ md-lokasi/components/lokasi.vue | 439 ++++++++++++++++++++++++++++++++ md-lokasi/components/main.vue | 88 +++++++ md-lokasi/index.html | 159 ++++++++++++ md-lokasi/language.js | 57 +++++ md-lokasi/modules/lokasi.js | 247 ++++++++++++++++++ 6 files changed, 1104 insertions(+) create mode 100644 md-lokasi/components/filter.vue create mode 100644 md-lokasi/components/lokasi.vue create mode 100644 md-lokasi/components/main.vue create mode 100644 md-lokasi/index.html create mode 100644 md-lokasi/language.js create mode 100644 md-lokasi/modules/lokasi.js diff --git a/md-lokasi/components/filter.vue b/md-lokasi/components/filter.vue new file mode 100644 index 0000000..4225795 --- /dev/null +++ b/md-lokasi/components/filter.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/md-lokasi/components/lokasi.vue b/md-lokasi/components/lokasi.vue new file mode 100644 index 0000000..87b8eea --- /dev/null +++ b/md-lokasi/components/lokasi.vue @@ -0,0 +1,439 @@ + + + + + diff --git a/md-lokasi/components/main.vue b/md-lokasi/components/main.vue new file mode 100644 index 0000000..55544c1 --- /dev/null +++ b/md-lokasi/components/main.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/md-lokasi/index.html b/md-lokasi/index.html new file mode 100644 index 0000000..08be98b --- /dev/null +++ b/md-lokasi/index.html @@ -0,0 +1,159 @@ + + + + + + WESTONE + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/md-lokasi/language.js b/md-lokasi/language.js new file mode 100644 index 0000000..5c203be --- /dev/null +++ b/md-lokasi/language.js @@ -0,0 +1,57 @@ +var CustomMessages = { + en: { + message: { + search: { + keyword: 'Location Name/Station Name' + }, + toolbalTitle: "PASIEN", + tableListPatient: { + lokasi: "LOCATION NAME", + station: "STATION NAME", + prioritas: "PRIORITY", + aksi: "ACTION", + }, + form: { + add: "NEW LOCATION", + edit: "CHANGE LOCATION", + lokasi: "LOCATION NAME", + station: "STATION NAME", + prioritas: "PRIORITY", + save: "SAVE", + saveEdit: "SAVE CHANGE", + close: "CLOSE", + deleteBtn: "Delete", + }, + deleteTitle: "DELETE LOCATION", + deleteMsg: "Are you sure you want to delete this location", + }, + }, + id: { + message: { + search: { + keyword: 'Nama Lokasi/Nama Station' + }, + toolbalTitle: "PASIEN", + tableListPatient: { + + lokasi: "NAMA LOKASI", + station: "NAMA STATION", + prioritas: "PRIORITAS", + aksi: "AKSI", + }, + form: { + add: "LOKASI BARU", + edit: "UBAH LOKASI", + lokasi: "NAMA LOKASI", + station: "NAMA STATION", + prioritas: "PRIORITAS", + save: "SIMPAN", + saveEdit: "SIMPAN PERUBAHAN", + close: "TUTUP", + deleteBtn: "Hapus", + }, + deleteTitle: "HAPUS LOCATION", + deleteMsg: "Apakah Anda yakin ingin menghapus lokasi ", + }, + }, +}; \ No newline at end of file diff --git a/md-lokasi/modules/lokasi.js b/md-lokasi/modules/lokasi.js new file mode 100644 index 0000000..6c24eb1 --- /dev/null +++ b/md-lokasi/modules/lokasi.js @@ -0,0 +1,247 @@ + +// const URL = "/westone-api/v1/system/auth"; +// const URL = "https://devcpone.aplikasi.web.id/westone-api/v1/system/auth/"; + +const store = { + namespaced: true, + state() { + return { + itemsPerPage: 5, + page: 1, + sortBy: 'id', + orderBy: 'asc', + search: '', + loading: false, + totalItems: 0, + action: 'add', + stationList: [ + { + id: 1, + name: 'Station A' + }, + { + id: 2, + name: 'Station B' + }, + { + id: 3, + name: 'Station C' + }, + ], + selectedStation: null, + inpLocation: '', + inpPriority: '', + locationList: [], + locationListTmp: [ + { + id: 1, + locationName: "R. 214-BMD", + stationName: "Sample Station BMD", + priority: "1", + }, + { + id: 2, + locationName: "R. 333 Sample 12", + stationName: "Sample Station LAB", + priority: "2", + }, + { + id: 3, + locationName: "R. 103 - Sampling 1", + stationName: "Sample Station LAB", + priority: "1", + }, + { + id: 4, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 5, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 6, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 7, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 8, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 9, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 10, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 11, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + { + id: 12, + locationName: "R. 103 Sampling 2", + stationName: "Sample Station LAB", + priority: "3", + }, + ], + selectedLocation: {}, + dialogForm: false, + dialogDelete: false, + snackbar: { + model: false, + type: "success", + message: "coba", + "multiLine": false, + "location": "top", + timeout: 1500 + }, + dialogInfo: { + title: 'INFORMATION', + model: false, + color: 'primary', + message: "information" + }, + + + }; + }, + mutations: { + update_dialogInfo(state, data) { + state.dialogInfo = data + }, + update_snackbar(state, data) { + state.snackbar = data + }, + update_dialogDelete(state, data) { + state.dialogDelete = data + }, + update_action(state, data) { + state.action = data + }, + update_inpLocation(state, data) { + state.inpLocation = data + }, + update_inpPriority(state, data) { + state.inpPriority = data + }, + update_stationList(state, data) { + state.stationList = data + }, + update_selectedStation(state, data) { + state.selectedStation = data + }, + update_dialogForm(state, data) { + state.dialogForm = data + }, + update_dialogForm(state, data) { + state.dialogForm = data + }, + update_sortBy(state, data) { + state.sortBy = data + }, + update_page(state, data) { + state.page = data + }, + update_orderBy(state, data) { + state.orderBy = data + }, + update_locationListTmp(state, data) { + state.locationListTmp = data + }, + update_totalItems(state, data) { + state.totalItems = data + }, + update_loading(state, data) { + state.loading = data + }, + update_search(state, data) { + state.search = data + }, + update_itemsPerPage(state, data) { + state.itemsPerPage = data + }, + update_locationList(state, data) { + state.locationList = data + }, + update_selectedLocation(state, data) { + state.selectedLocation = data + }, + + }, + actions: { + async search(context) { + context.commit('update_loading', true) + try { + let result = context.state.locationListTmp; + let sortBy = context.state.sortBy + let orderBy = context.state.orderBy + let search = context.state.search + let page = context.state.page + let itemsPerPage = context.state.itemsPerPage + context.commit('update_totalItems', result.length) + + // Pencarian + result = result.filter(item => + item.locationName.toLowerCase().includes(search.toLowerCase()) || + item.stationName.toLowerCase().includes(search.toLowerCase()) + ); + + // Sorting + result = result.slice().sort((a, b) => { + if (a[sortBy] < b[sortBy]) return orderBy === 'asc' ? -1 : 1; + if (a[sortBy] > b[sortBy]) return orderBy === 'asc' ? 1 : -1; + return 0; + }); + + // Pagination + const startIndex = (page - 1) * itemsPerPage; + result = result.slice(startIndex, startIndex + itemsPerPage); + console.log(result) + // this.locationList = result; + + context.commit('update_locationList', result) + // return result; + + } catch (error) { + console.log(error); + } + setTimeout(() => { + // let snackbar = { + // model: false, + // type: "success", + // message: "ini-coba", + // "multi-line": false, + // "location": "top", + // timeout: 1500 + // } + // context.commit('update_snackbar', snackbar) + + context.commit('update_loading', false) + }, 100); + } + } +}; + +export default store \ No newline at end of file