var listPatientComponent = { template: ` PATIENT LISTING `, mounted() { this.doSearch(); }, data() { return { query: "", headers: [{ text: "MR", align: "left", sortable: false, value: "mr" }, { text: "NAME", align: "left", sortable: false, value: "name" }, { text: "ADDRESS", value: "address", sortable: false, align: "left", width: "30%" }, { text: "SEX", value: "sex", sortable: false, align: "left" }, { text: "ACTION", value: "action", sortable: false, align: "center", width: "20%" } ] }; }, 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 };