var listPatientComponent = { template: ` Patient Listing `, mounted() { this.doSearch(); }, data() { return { query: "", headers: [ { text: "No. Reg", align: "left", sortable: false, value: "M_PatientNoReg" }, { text: "Name", align: "left", sortable: false, value: "M_PatientName" }, { text: "DOB", align: "center", sortable: false, value: "M_PatientDOB" }, { text: "HP", value: "M_PatientHP", sortable: false, align: "left" }, { text: "Address", value: "M_PatientAddress", sortable: false, align: "left" } ] }; }, methods: { clearSearch() { this.query = ""; this.doSearch(); }, doSearch(page = 1, rowPerPage = 8) { if (this.query == null) this.query = ""; this.$store.dispatch("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); } }, computed: { ...Vuex.mapState({ isLoading: state => state.isLoading, isError: state => state.isError, errorMessage: state => state.errorMessage, patients: state => state.rows, totalRecord: state => state.totalRecord, page: state => state.page, totalPage: state => state.totalPage }) }, updated() { console.log("Component Updated"); } }; export { listPatientComponent };