Get status dynamically in Books
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
249bef444e
commit
f4ba392f93
|
@ -36,6 +36,10 @@
|
||||||
Refresh
|
Refresh
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
{{allStatus}}
|
||||||
|
</pre>
|
||||||
|
|
||||||
<form id="search">
|
<form id="search">
|
||||||
<div class="ui icon input">
|
<div class="ui icon input">
|
||||||
<input placeholder="Search for anything..." type="text" v-model="searchQuery">
|
<input placeholder="Search for anything..." type="text" v-model="searchQuery">
|
||||||
|
@ -106,10 +110,12 @@ export default {
|
||||||
loading: false,
|
loading: false,
|
||||||
paginate: ['books'],
|
paginate: ['books'],
|
||||||
error: '',
|
error: '',
|
||||||
success: ''
|
success: '',
|
||||||
|
allStatus: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
this.loadStatus()
|
||||||
this.loadBooks()
|
this.loadBooks()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -163,6 +169,11 @@ export default {
|
||||||
this.books[i].Author += ', '
|
this.books[i].Author += ', '
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make Status a name, not an id
|
||||||
|
this.books[i].Status = this.getStatusByID(this.books[i].Status)
|
||||||
|
|
||||||
|
// increment dat shit
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
@ -172,6 +183,23 @@ export default {
|
||||||
this.error = e
|
this.error = e
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
loadStatus: function () {
|
||||||
|
HTTP.get('status')
|
||||||
|
.then(response => {
|
||||||
|
this.allStatus = response.data
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.error = e
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getStatusByID: function (id) {
|
||||||
|
for (const i in this.allStatus) {
|
||||||
|
if (this.allStatus[i].ID === id) {
|
||||||
|
return this.allStatus[i].Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
},
|
||||||
gridBtnClicked (opt, gridObject) {
|
gridBtnClicked (opt, gridObject) {
|
||||||
opt.action(gridObject)
|
opt.action(gridObject)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue