mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
Apply prettier rules
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h2><a id="section-30" />{{ $t('origin.title') }}</h2>
|
||||
<h2><a id="section-30" />{{ $t("origin.title") }}</h2>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="selectOrigin">
|
||||
{{ $t('origin.title') }}
|
||||
{{ $t("origin.title") }}
|
||||
</label>
|
||||
|
||||
<VueMultiselect
|
||||
@@ -24,72 +24,70 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="!isOriginValid"
|
||||
class="alert alert-warning to-confirm"
|
||||
>
|
||||
{{ $t('origin.not_valid') }}
|
||||
<div v-if="!isOriginValid" class="alert alert-warning to-confirm">
|
||||
{{ $t("origin.not_valid") }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import VueMultiselect from 'vue-multiselect';
|
||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||
import { mapState, mapGetters } from 'vuex';
|
||||
import VueMultiselect from "vue-multiselect";
|
||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'OriginDemand',
|
||||
components: { VueMultiselect },
|
||||
data() {
|
||||
return {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
value: state => state.accompanyingCourse.origin,
|
||||
}),
|
||||
...mapGetters([
|
||||
'isOriginValid'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
const url = `/api/1.0/person/accompanying-period/origin.json`;
|
||||
makeFetch('GET', url)
|
||||
.then(response => {
|
||||
this.options = response.results;
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
this.$toast.open({message: error.txt})
|
||||
})
|
||||
},
|
||||
updateOrigin(value) {
|
||||
this.$store.dispatch('updateOrigin', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
transText ({ text }) {
|
||||
return text.fr;
|
||||
},
|
||||
}
|
||||
}
|
||||
name: "OriginDemand",
|
||||
components: { VueMultiselect },
|
||||
data() {
|
||||
return {
|
||||
options: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
value: (state) => state.accompanyingCourse.origin,
|
||||
}),
|
||||
...mapGetters(["isOriginValid"]),
|
||||
},
|
||||
mounted() {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
const url = `/api/1.0/person/accompanying-period/origin.json`;
|
||||
makeFetch("GET", url)
|
||||
.then((response) => {
|
||||
this.options = response.results;
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
commit("catchError", error);
|
||||
this.$toast.open({ message: error.txt });
|
||||
});
|
||||
},
|
||||
updateOrigin(value) {
|
||||
this.$store
|
||||
.dispatch("updateOrigin", value)
|
||||
.catch(({ name, violations }) => {
|
||||
if (name === "ValidationException" || name === "AccessException") {
|
||||
violations.forEach((violation) =>
|
||||
this.$toast.open({ message: violation }),
|
||||
);
|
||||
} else {
|
||||
this.$toast.open({ message: "An error occurred" });
|
||||
}
|
||||
});
|
||||
},
|
||||
transText({ text }) {
|
||||
return text.fr;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||
<style lang="css" scoped>
|
||||
label {
|
||||
display: none;
|
||||
}
|
||||
label {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user