var listPatientComponent = { template: ` `, mounted() { this.doSearch(); }, data() { return { query: "", headers: [ { text: "LAB NUMBER", align: "left", sortable: false, value: "nolab", width: "25%", class: "pa-2 blue lighten-3 white--text" }, { text: "MR", align: "left", sortable: false, value: "mr", width: "25%", class: "pa-2 blue lighten-3 white--text" }, { text: "NAME", align: "left", sortable: false, value: "name", class: "pa-2 blue lighten-3 white--text" } ] }; }, methods: { clearSearch() { this.query = ""; this.doSearch(); }, doSearch(page = 1, rowPerPage = 8) { if (this.query == null) this.query = ""; this.$store.dispatch("patient/searchPatient", { query: this.query, page, rowPerPage }); }, prevPage() { let c_page = this.page - 1; this.doSearch(c_page); }, nextPage() { let c_page = this.page + 1; this.doSearch(c_page); }, gotoPage(e) { let c_page = e; this.doSearch(c_page); }, selectMe(item) { this.$store.dispatch('patient/selectMe', item); // let rows = this.$store.state.patient.rows; // for (let i in rows) { // // console.log(i); // rows[i].selected = false; // if (i.mr == item.mr) { // rows[i].selected = true; // } // } // this.$store.state.patient.rows = rows; } }, computed: { ...Vuex.mapState({ isLoading: state => state.patient.isLoading, isError: state => state.patient.isError, errorMessage: state => state.patient.errorMessage, patients: state => state.patient.rows, totalRecord: state => state.patient.totalRecord, page: state => state.patient.page, totalPage: state => state.patient.totalPage }), isSelected() { // for(let i of rows) { // if (i.mr == "MR-18107238"); // return true; // } return false; } }, updated() { console.log("Component Updated"); } }; export { listPatientComponent };