2022-04-03 01:20:55 +02:00
|
|
|
<template>
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Date de projection</label>
|
|
|
|
<div class="control">
|
2022-04-06 01:12:35 +02:00
|
|
|
<input
|
|
|
|
v-model="film.projectionDate"
|
|
|
|
class="input"
|
|
|
|
type="datetime-local"
|
|
|
|
/>
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-06 01:12:35 +02:00
|
|
|
|
2022-04-03 01:20:55 +02:00
|
|
|
<div class="field">
|
|
|
|
<label class="label">Titre</label>
|
|
|
|
<div class="control">
|
2022-04-06 01:12:35 +02:00
|
|
|
<input
|
|
|
|
v-model="film.title"
|
|
|
|
class="input"
|
|
|
|
type="text"
|
|
|
|
@change="findFilm"
|
|
|
|
/>
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-06 01:12:35 +02:00
|
|
|
|
2022-04-03 01:20:55 +02:00
|
|
|
<div class="field">
|
|
|
|
<label class="label">Réalisateur</label>
|
|
|
|
<div class="control">
|
2022-04-06 01:12:35 +02:00
|
|
|
<input v-model="film.director" class="input" type="text" />
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-06 01:12:35 +02:00
|
|
|
|
2022-04-03 01:20:55 +02:00
|
|
|
<div class="field">
|
|
|
|
<label class="label">Durée</label>
|
|
|
|
<div class="control">
|
2022-05-29 23:08:49 +02:00
|
|
|
<input v-model="durationNoSecond" class="input" type="time" />
|
2022-04-06 01:12:35 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Synopsis</label>
|
|
|
|
<div class="control">
|
|
|
|
<textarea v-model="film.synopsis" class="input" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Année de sortie du film</label>
|
|
|
|
<div class="control">
|
2022-04-09 02:56:05 +02:00
|
|
|
<input
|
|
|
|
v-model="film.releaseYear"
|
|
|
|
class="input"
|
|
|
|
type="number"
|
|
|
|
min="1895"
|
|
|
|
/>
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-06 01:12:35 +02:00
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Lien de la bande-annonce</label>
|
|
|
|
<div class="control">
|
|
|
|
<input v-model="film.trailerLink" class="input" type="url" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="checkbox">
|
|
|
|
<input v-model="film.isInColor" type="checkbox" />
|
|
|
|
Couleur
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Format</label>
|
|
|
|
<div class="control">
|
|
|
|
<label class="radio">
|
|
|
|
<input type="radio" name="format" />
|
|
|
|
{{ Format.ANALOG_35 }}
|
|
|
|
</label>
|
|
|
|
<label class="radio">
|
|
|
|
<input type="radio" name="format" />
|
2022-04-09 02:48:03 +02:00
|
|
|
{{ Format.DIGITAL }}
|
2022-04-06 01:12:35 +02:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Langue / Sous-titre</label>
|
|
|
|
<div class="control">
|
|
|
|
<label class="radio">
|
|
|
|
<input type="radio" name="language-subtitle" />
|
|
|
|
{{ LanguageSubtitles.FRENCH }}
|
|
|
|
</label>
|
|
|
|
<label class="radio">
|
|
|
|
<input type="radio" name="language-subtitle" />
|
|
|
|
{{ LanguageSubtitles.FOREIGN }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
<label class="label">Lien du poster</label>
|
|
|
|
<div class="control">
|
|
|
|
<input v-model="film.posterLink" class="input" type="url" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-07-13 02:18:06 +02:00
|
|
|
<div class="field">
|
|
|
|
<label class="label">Lien de l'événement Facebook</label>
|
|
|
|
<div class="control">
|
|
|
|
<input v-model="film.facebookEventLink" class="input" type="url" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-04-06 01:12:35 +02:00
|
|
|
<div class="field">
|
|
|
|
<label class="label">Lien de la bannière</label>
|
|
|
|
<div class="control">
|
|
|
|
<input v-model="film.bannerLink" class="input" type="url" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="buttons">
|
2022-04-09 02:56:05 +02:00
|
|
|
<!-- TODO change labels according to publishing status -->
|
2022-04-09 19:31:43 +02:00
|
|
|
<button class="button" @click="emits('save')">
|
|
|
|
{{
|
|
|
|
film?.isConfirmed
|
|
|
|
? "Sauvegarder et mettre en brouillon"
|
|
|
|
: "Sauvegarder"
|
|
|
|
}}
|
|
|
|
</button>
|
2022-04-09 02:56:05 +02:00
|
|
|
<button class="button is-primary" @click="emits('publish')">
|
2022-04-09 19:31:43 +02:00
|
|
|
{{ film?.isConfirmed ? "Sauvegarder" : "Publier" }}
|
2022-04-09 02:56:05 +02:00
|
|
|
</button>
|
2022-08-27 19:59:57 +02:00
|
|
|
<nuxt-link :to="`/admin/${film.id}`">
|
|
|
|
<button class="button">Quitter l'édition</button>
|
|
|
|
</nuxt-link>
|
2022-04-06 01:12:35 +02:00
|
|
|
</div>
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="column">
|
|
|
|
<!-- doc : https://bluefantail.github.io/bulma-list/ -->
|
|
|
|
<div class="list has-visible-pointer-controls">
|
|
|
|
<div
|
2022-05-30 00:18:09 +02:00
|
|
|
v-for="(foundFilm, index) of foundFilms"
|
2022-04-03 01:20:55 +02:00
|
|
|
:key="foundFilm.id"
|
|
|
|
class="list-item"
|
|
|
|
>
|
|
|
|
<div class="list-item-image">
|
|
|
|
<figure class="image is-64x64">
|
|
|
|
<img :src="image(index)" />
|
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
<div class="list-item-content">
|
|
|
|
<div class="list-item-title">{{ foundFilm.title }}</div>
|
|
|
|
<div class="list-item-description">
|
2022-05-30 00:18:09 +02:00
|
|
|
{{ foundFilm.releaseDate }}
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="list-item-controls">
|
|
|
|
<div class="buttons is-right">
|
2022-06-10 01:37:13 +02:00
|
|
|
<button class="button" @click="fill(foundFilm.id)">
|
|
|
|
Préremplir
|
|
|
|
</button>
|
2022-04-03 01:20:55 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-04-06 01:12:35 +02:00
|
|
|
import { Film, Format, LanguageSubtitles } from "~/composables/types"
|
2022-04-09 02:56:05 +02:00
|
|
|
import { PropType } from "@vue/runtime-core"
|
2022-04-06 01:12:35 +02:00
|
|
|
|
2022-04-09 02:56:05 +02:00
|
|
|
defineProps({
|
|
|
|
modelValue: {
|
|
|
|
type: Object as PropType<Film>,
|
|
|
|
default: () => {
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
},
|
2022-04-03 01:20:55 +02:00
|
|
|
})
|
2022-04-09 02:56:05 +02:00
|
|
|
const emits = defineEmits(["save", "publish"])
|
|
|
|
const film = useModel<Film>("modelValue", { type: "object" })
|
2022-04-03 01:20:55 +02:00
|
|
|
|
|
|
|
const foundFilms = ref()
|
|
|
|
// https://developers.themoviedb.org/3/getting-started/images
|
|
|
|
const image = computed(() => (index: number) => {
|
2022-05-30 00:18:09 +02:00
|
|
|
return `https://image.tmdb.org/t/p/w500${foundFilms.value[index]?.posterPath}`
|
2022-04-03 01:20:55 +02:00
|
|
|
})
|
|
|
|
|
2022-05-29 23:08:49 +02:00
|
|
|
const durationNoSecond = computed<string>({
|
|
|
|
get: () => film.value.duration,
|
|
|
|
set(value: string) {
|
|
|
|
film.value.duration = value.replace(/:\d{2}$/, ":00")
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2022-04-03 01:20:55 +02:00
|
|
|
async function findFilm() {
|
2022-05-30 00:18:09 +02:00
|
|
|
foundFilms.value = (
|
|
|
|
await apiGet("tmdb/search/", { query: film.value.title })
|
|
|
|
).data.value
|
2022-04-03 01:20:55 +02:00
|
|
|
}
|
2022-06-10 01:37:13 +02:00
|
|
|
|
|
|
|
async function fill(tmdbId: number) {
|
|
|
|
film.value = (await apiGet(`tmdb/${tmdbId}/fill/`)).data.value
|
|
|
|
// TODO fix form reactivity
|
|
|
|
}
|
2022-04-03 01:20:55 +02:00
|
|
|
</script>
|
2022-06-10 01:36:31 +02:00
|
|
|
|
|
|
|
<style lang="sass" scoped>
|
|
|
|
.image img
|
|
|
|
height: 100%
|
|
|
|
object-fit: cover
|
|
|
|
</style>
|