144 lines
No EOL
6.9 KiB
Text
144 lines
No EOL
6.9 KiB
Text
<div class="container-fluid" id="app">
|
|
<form class="bg-white rounded shadow-5-strong p-5" method="POST" @submit="add">
|
|
<div class="row">
|
|
<div class="col-12 col-sm-3 p-2 text-center">
|
|
<img src="<%= page.values.thumb %>" alt="Miniature" />
|
|
<hr />
|
|
<img v-for="image in album.images" :src="image.uri150" alt="Miniature" style="max-width: 60px;" />
|
|
<hr />
|
|
<ol>
|
|
<li v-for="track in album.tracklist">{{ track.title }} ({{track.duration}})</li>
|
|
</ol>
|
|
</div>
|
|
<div class="col-12 col-sm-9 p-2">
|
|
<div class="row">
|
|
<div class="col-12 p-2">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="title" name="title" class="form-control" v-model="album.title" disabled />
|
|
<label class="form-label" for="artists">Titre</label>
|
|
</div>
|
|
|
|
<div class="form-outline mb-4" v-for="artist in album.artists">
|
|
<input type="text" id="artists" name="artists" class="form-control" v-model="artist.name" disabled />
|
|
<label class="form-label" for="artists">Artiste</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2" v-for="genre in album.genres">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="genres" name="genres" class="form-control" v-model="genre" disabled />
|
|
<label class="form-label" for="company">Genre</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-6 p-2" v-for="style in album.styles">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="style" name="style" class="form-control" v-model="style" disabled />
|
|
<label class="form-label" for="company">Style</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="year" name="year" class="form-control" v-model="album.year" disabled />
|
|
<label class="form-label" for="year">Année</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-sm-6 p-2">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="released" name="released" class="form-control" v-model="album.released" disabled />
|
|
<label class="form-label" for="released">Date de sortie</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="country" name="country" class="form-control" v-model="album.country" disabled />
|
|
<label class="form-label" for="country">Pays</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2">
|
|
<ol>
|
|
<li v-for="identifier in album.identifiers">
|
|
{{identifier.value}} ({{identifier.type}})
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 p-2">
|
|
<div class="form-outline mb-4">
|
|
<textarea id="notes" id="notes" name="notes" class="form-control" v-model="album.notes" disabled></textarea>
|
|
<label class="form-label" for="country">Notes</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2" v-for="format in album.formats">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="format" name="format" class="form-control" v-model="format.name" disabled />
|
|
<label class="form-label" for="format">Format</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2" v-for="label in album.labels">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="label" name="label" class="form-control" v-model="label.name" disabled />
|
|
<label class="form-label" for="label">Label</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2" v-for="company in album.companies">
|
|
<div class="form-outline mb-4">
|
|
<input type="text" id="company" name="company" class="form-control" v-model="company.name" disabled />
|
|
<label class="form-label" for="company">Société</label>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2">
|
|
<ol>
|
|
<li v-for="video in album.videos">
|
|
<a :href="video.uri" target="_blank">{{video.title}}</a>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<hr />
|
|
<div class="col-12 col-sm-6 p-2">
|
|
<ol>
|
|
<li v-for="extraartist in album.extraartists">
|
|
{{extraartist.name}} ({{extraartist.role}})
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary btn-block">Ajouter</button>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
const defaultValues = <%- JSON.stringify(page.values) %>;
|
|
|
|
Vue.createApp({
|
|
data() {
|
|
return {
|
|
album: defaultValues,
|
|
}
|
|
},
|
|
methods: {
|
|
add(event) {
|
|
event.preventDefault();
|
|
|
|
axios.post('/api/v1/albums', this.album)
|
|
.then(() => {
|
|
window.location.href = '/ma-collection';
|
|
})
|
|
.catch((err) => {
|
|
console.log('ERR:', err.response);
|
|
showToastr(err.response?.data?.message || "Impossible d'ajouter ce album pour le moment…");
|
|
});
|
|
}
|
|
}
|
|
}).mount('#app')
|
|
</script>
|
|
|