| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <template>
- <div class="editor-panel">
- <h3>Modifier une compétence ou préférence</h3>
- <div class="actions">
- <button class="btn small primary" v-on:click="emitCreationOrder">
- <i class="material-icons">create</i>Nouveau
- </button>
- <button
- class="btn small error"
- :disabled="competence === undefined"
- v-on:click="emitDeleteOrder"
- >
- <i class="material-icons">delete_forever</i>Supprimer
- </button>
- </div>
- <div class="empty" v-if="competence === undefined">
- Veuillez selectioner une ligne du tableau.
- </div>
- <div class="editor-body" v-else>
- <styled-input
- class="s3"
- label="Identifiant"
- id="competence_id"
- type="text"
- :modelValue="competence.id"
- disabled
- />
- <styled-input
- class="s9"
- label="Titre"
- id="name"
- type="text"
- :modelValue="competence.name"
- @input="inputListener($event, 'name')"
- />
- <styled-input
- label="Description"
- id="competence_description"
- type="textarea"
- :modelValue="competence.description"
- @input="inputListener($event, 'description')"
- />
- <h4 style="margin-top: 0.8rem">Propriétés</h4>
- <checkbox
- id="competence_isPreference"
- label="Préference"
- :modelValue="competence.isPreference"
- @input="checkboxListener($event, 'isPreference')"
- />
- <checkbox
- id="competence_isTeachable"
- label="Apprenable"
- :modelValue="competence.isTeachable"
- @input="checkboxListener($event, 'isTeachable')"
- />
- </div>
- </div>
- </template>
- <script lang="ts">
- import Competence from "@/models/Competence";
- import styledInput from "./input.vue";
- import checkbox from "./checkBox.vue";
- import { defineComponent, PropType } from "vue";
- import { MutationTypes } from "@/store/Mutations";
- import "@/assets/css/editor-panel.css";
- export default defineComponent({
- name: "EditeurCompetence",
- components: { styledInput, checkbox },
- props: { competence: { type: Object as PropType<Competence> } },
- data() {
- return {};
- },
- watch: {},
- computed: {},
- methods: {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- inputListener(event: any, field: keyof Competence) {
- this.updateCompetence(field, event.target.value);
- },
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- checkboxListener(event: any, field: keyof Competence) {
- this.updateCompetence(field, event.target.checked);
- },
- updateCompetence<K extends keyof Competence>(k: K, value: Competence[K]) {
- if (this.competence) {
- this.$store.commit(MutationTypes.editConstraint, {
- id: this.competence.id,
- field: k,
- value: value,
- });
- }
- },
- emitCreationOrder: function () {
- this.$emit("create");
- },
- emitDeleteOrder: function () {
- this.$emit("delete", this.competence);
- },
- },
- });
- </script>
- <style scoped></style>
|