Get status dynamically
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
e12bcc0706
commit
249bef444e
|
@ -10,7 +10,14 @@
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="ui form" v-bind:class="{ loading: loading }">
|
<div class="ui positive message" v-if="success">
|
||||||
|
<div class="header">
|
||||||
|
Success
|
||||||
|
</div>
|
||||||
|
{{ success }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form class="ui form" v-bind:class="{ loading: loading }" v-if="!success">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Title</label>
|
<label>Title</label>
|
||||||
<input name="title" placeholder="Title" type="text" v-model="book.Title">
|
<input name="title" placeholder="Title" type="text" v-model="book.Title">
|
||||||
|
@ -83,8 +90,8 @@
|
||||||
<label>Status</label>
|
<label>Status</label>
|
||||||
<div class="field" v-for="status in allStatus">
|
<div class="field" v-for="status in allStatus">
|
||||||
<div class="ui radio checkbox">
|
<div class="ui radio checkbox">
|
||||||
<input name="status" :id="status.value" :value="status.value" class="hidden" type="radio" v-model="book.Status"/>
|
<input name="status" :id="status.ID" :value="status.ID" class="hidden" type="radio" v-model="book.Status"/>
|
||||||
<label :for="status.value">{{ status.name }}</label>
|
<label :for="status.ID">{{ status.Name }}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,6 +109,7 @@
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
error: '',
|
error: '',
|
||||||
|
success: '',
|
||||||
loading: false,
|
loading: false,
|
||||||
book: {
|
book: {
|
||||||
Title: '',
|
Title: '',
|
||||||
|
@ -121,25 +129,13 @@
|
||||||
addAuthorForm: [],
|
addAuthorForm: [],
|
||||||
newAuthors: {},
|
newAuthors: {},
|
||||||
newestAuthor: 0,
|
newestAuthor: 0,
|
||||||
allStatus: [
|
allStatus: []
|
||||||
{
|
|
||||||
name: 'New',
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Second Hand',
|
|
||||||
value: 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Other',
|
|
||||||
value: 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
this.loadPublishers()
|
this.loadPublishers()
|
||||||
this.loadAuthors()
|
this.loadAuthors()
|
||||||
|
this.loadStatus()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadPublishers: function () {
|
loadPublishers: function () {
|
||||||
|
@ -167,6 +163,15 @@
|
||||||
this.error = e
|
this.error = e
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
loadStatus: function () {
|
||||||
|
HTTP.get('status')
|
||||||
|
.then(response => {
|
||||||
|
this.allStatus = response.data
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.error = e
|
||||||
|
})
|
||||||
|
},
|
||||||
toggleAddPublisher: function () {
|
toggleAddPublisher: function () {
|
||||||
this.addPublisherForm = !this.addPublisherForm
|
this.addPublisherForm = !this.addPublisherForm
|
||||||
this.book.PublisherFull = {ID: 0, Name: ''}
|
this.book.PublisherFull = {ID: 0, Name: ''}
|
||||||
|
@ -223,6 +228,7 @@
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
console.log(response)
|
console.log(response)
|
||||||
|
this.success = 'The book was successfully inserted!'
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|
Loading…
Reference in New Issue