Page MenuHomec4science

InterferenceAddView.vue
No OneTemporary

File Metadata

Created
Tue, Sep 17, 08:16

InterferenceAddView.vue

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { useScenarioStore } from '../stores';
import ElemTypeToggle from '../components/ElemTypeToggle.vue';
import AmbianceInterferenceForm from '../components/AmbianceInterferenceForm.vue';
import SoundInterferenceForm from '../components/SoundInterferenceForm.vue';
import VisualInterferenceForm from '../components/VisualInterferenceForm.vue';
import FullInterferenceForm from '../components/FullInterferenceForm.vue';
import PartialInterferenceForm from '../components/PartialInterferenceForm.vue';
const router = useRouter();
const scenarioStore = useScenarioStore();
await scenarioStore.fetch();
const scenario = scenarioStore.state.find(v => v.id == router.currentRoute.value.params.id);
const type = ref();
const onTypeChange = (n) => {
router.push(router.currentRoute.value.path.replace(type.value, n));
type.value = n;
};
</script>
<template>
<v-container>
<div class="text-h6 text-center">pour {{ scenario.scenarioID }}</div>
<v-row class="ma-4" justify="center">
<ElemTypeToggle
:types="[
{ name: 'ambiance', value: 'ambiance' },
{ name: 'sonore', value: 'sound' },
{ name: 'visuelle', value: 'visual' },
{ name: 'libre', value: 'full' },
{ name: 'liée', value: 'partial' }
]"
@on-type-change="onTypeChange"
/>
</v-row>
<v-row>
<AmbianceInterferenceForm v-if="type === 'ambiance'" />
<SoundInterferenceForm v-if="type === 'sound'" />
<VisualInterferenceForm v-if="type === 'visual'" />
<FullInterferenceForm v-if="type === 'full'" />
<PartialInterferenceForm v-if="type === 'partial'" />
</v-row>
</v-container>
</template>

Event Timeline