JS corrections in ChillPersonBundle required by ESLint

This commit is contained in:
Julie Lenaerts 2024-11-12 15:38:46 +01:00
parent dd854ea339
commit 22ecb11227
15 changed files with 32 additions and 41 deletions

View File

@ -37,7 +37,7 @@ const onSubmit = function(e) {
}); });
} }
window.addEventListener('DOMContentLoaded', function(e) { window.addEventListener('DOMContentLoaded', function() {
let forms = document.querySelectorAll('.quickLocationForm'); let forms = document.querySelectorAll('.quickLocationForm');
console.log(forms); console.log(forms);

View File

@ -16,7 +16,7 @@ window.addEventListener('DOMContentLoaded', function() {
load_event: null, load_event: null,
froms: [entitySelector], froms: [entitySelector],
container: [personContainer], container: [personContainer],
test: function(froms, event) { test: function(froms) {
for (let container of froms) { for (let container of froms) {
return container.querySelector('input[value="person"]').checked; return container.querySelector('input[value="person"]').checked;
} }
@ -30,7 +30,7 @@ window.addEventListener('DOMContentLoaded', function() {
load_event: null, load_event: null,
froms: [entitySelector], froms: [entitySelector],
container: [thirdpartyContainer], container: [thirdpartyContainer],
test: function(froms, event) { test: function(froms) {
for (let container of froms) { for (let container of froms) {
return container.querySelector('input[value="thirdparty"]').checked; return container.querySelector('input[value="thirdparty"]').checked;
} }
@ -44,7 +44,7 @@ window.addEventListener('DOMContentLoaded', function() {
load_event: null, load_event: null,
froms: [entitySelector], froms: [entitySelector],
container: [freetextContainer], container: [freetextContainer],
test: function(froms, event) { test: function(froms) {
for (let container of froms) { for (let container of froms) {
return container.querySelector('input[value="freetext"]').checked; return container.querySelector('input[value="freetext"]').checked;
} }

View File

@ -30,7 +30,7 @@
</div> --> </div> -->
</template> </template>
<script> <script>
import { mapGetters, mapState } from 'vuex' import { mapState } from 'vuex'
import Banner from './components/Banner.vue'; import Banner from './components/Banner.vue';
import StickyNav from './components/StickyNav.vue'; import StickyNav from './components/StickyNav.vue';
import OriginDemand from './components/OriginDemand.vue'; import OriginDemand from './components/OriginDemand.vue';

View File

@ -131,9 +131,6 @@ export default {
} }
}, },
methods: { methods: {
onContentChange() {
let lastRecordedContent = this.formData.content;
},
removeComment() { removeComment() {
this.$store.dispatch('removePinnedComment', {id: this.pinnedComment.id}) this.$store.dispatch('removePinnedComment', {id: this.pinnedComment.id})
.catch(({name, violations}) => { .catch(({name, violations}) => {

View File

@ -5,10 +5,8 @@ import { getAccompanyingCourse,
getReferrersSuggested, getReferrersSuggested,
getUsers, getUsers,
} from '../api'; } from '../api';
import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
import { datetimeToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date'; import { datetimeToISO, ISOToDate } from 'ChillMainAssets/chill/js/date';
const debug = process.env.NODE_ENV !== 'production'; const debug = process.env.NODE_ENV !== 'production';
@ -22,7 +20,7 @@ let getScopesPromise = (root) => {
let accompanyingCoursePromise = getAccompanyingCourse(id); let accompanyingCoursePromise = getAccompanyingCourse(id);
let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCoursePromise]) let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCoursePromise])
.then(([scopes, accompanyingCourse]) => new Promise((resolve, reject) => { .then(([scopes, accompanyingCourse]) => new Promise((resolve) => {
const store = createStore({ const store = createStore({
strict: debug, strict: debug,
@ -235,7 +233,7 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
} }
}, },
removePinnedComment(state, value) { removePinnedComment(state) {
state.accompanyingCourse.pinnedComment = null; state.accompanyingCourse.pinnedComment = null;
}, },
setPinCommentAbortController(state, value) { setPinCommentAbortController(state, value) {
@ -641,8 +639,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
let checkedScopesIds = scopes.map(scope => scope.id); let checkedScopesIds = scopes.map(scope => scope.id);
let removedScopesIds = currentServerScopesIds.filter(id => !checkedScopesIds.includes(id)); let removedScopesIds = currentServerScopesIds.filter(id => !checkedScopesIds.includes(id));
let addedScopesIds = checkedScopesIds.filter(id => !currentServerScopesIds.includes(id)); let addedScopesIds = checkedScopesIds.filter(id => !currentServerScopesIds.includes(id));
let lengthAfterOperation = currentServerScopesIds.length + addedScopesIds.length
- removedScopesIds.length;
return dispatch('updateScopes', { return dispatch('updateScopes', {
addedScopesIds, removedScopesIds addedScopesIds, removedScopesIds

View File

@ -181,9 +181,8 @@
<script> <script>
import { mapState, mapActions, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import VueMultiselect from 'vue-multiselect'; import VueMultiselect from 'vue-multiselect';
import { dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date';
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
const i18n = { const i18n = {

View File

@ -1,6 +1,6 @@
import { createStore } from 'vuex'; import { createStore } from 'vuex';
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date'; import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date';
import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js'; import { findSocialActionsBySocialIssue } from 'ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js';
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js'; // import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';

View File

@ -514,7 +514,6 @@
<script> <script>
import {mapState, mapGetters,} from 'vuex'; import {mapState, mapGetters,} from 'vuex';
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date';
import CKEditor from '@ckeditor/ckeditor5-vue'; import CKEditor from '@ckeditor/ckeditor5-vue';
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/editor_config'; import ClassicEditor from 'ChillMainAssets/module/ckeditor5/editor_config';
import AddResult from './components/AddResult.vue'; import AddResult from './components/AddResult.vue';
@ -524,7 +523,6 @@ import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue'; import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue'; import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
const i18n = { const i18n = {
@ -757,7 +755,7 @@ export default {
}, },
goToGenerateWorkflow({link}) { goToGenerateWorkflow({link}) {
// console.log('save before leave to generate workflow') // console.log('save before leave to generate workflow')
const callback = (data) => { const callback = () => {
window.location.assign(link); window.location.assign(link);
}; };
@ -766,7 +764,7 @@ export default {
}, },
goToGenerateNotification(tos) { goToGenerateNotification(tos) {
console.log('save before leave to notification'); console.log('save before leave to notification');
const callback = (data) => { const callback = () => {
if (tos === true) { if (tos === true) {
window.location.assign(`/fr/notification/create?entityClass=Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork&entityId=${this.work.id}&tos[0]=${this.work.accompanyingPeriod.user.id}&returnPath=/fr/person/accompanying-period/${this.work.accompanyingPeriod.id}/work`); window.location.assign(`/fr/notification/create?entityClass=Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork&entityId=${this.work.id}&tos[0]=${this.work.accompanyingPeriod.user.id}&returnPath=/fr/person/accompanying-period/${this.work.accompanyingPeriod.id}/work`);
} else { } else {

View File

@ -143,13 +143,13 @@ export default {
this.$store.commit('removeEvaluation', e); this.$store.commit('removeEvaluation', e);
return; return;
}, },
toggleEditEvaluation(e) { toggleEditEvaluation() {
this.$store.commit('toggleEvaluationEdit', { key: this.evaluation.key }); this.$store.commit('toggleEvaluationEdit', { key: this.evaluation.key });
}, },
submitForm() { submitForm() {
this.toggleEditEvaluation(); this.toggleEditEvaluation();
}, },
goToGenerateWorkflow({event, link, workflowName}) { goToGenerateWorkflow({workflowName}) {
const callback = (data) => { const callback = (data) => {
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id; let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
window.location.assign(buildLinkCreate(workflowName, window.location.assign(buildLinkCreate(workflowName,

View File

@ -82,7 +82,8 @@
{{ $t('select_time_spent') }} {{ $t('select_time_spent') }}
</option> </option>
<option <option
v-for="time in timeSpentChoices" v-for="(time, index) in timeSpentChoices"
:key="index"
:value="time.value" :value="time.value"
> >
{{ time.text }} {{ time.text }}

View File

@ -342,7 +342,7 @@ export default {
return makeFetch('POST', '/api/1.0/person/household/members/move.json', member) return makeFetch('POST', '/api/1.0/person/household/members/move.json', member)
.then(_response => { .then(_response => {
makeFetch('POST', `/api/1.0/person/household/${responseHousehold.id}/address.json`, address) makeFetch('POST', `/api/1.0/person/household/${responseHousehold.id}/address.json`, address)
.then(_response => {}) .then(_response => {console.log(_response)})
.catch((error) => { .catch((error) => {
if (error.name === 'ValidationException') { if (error.name === 'ValidationException') {
for (let v of error.violations) { for (let v of error.violations) {

View File

@ -96,7 +96,7 @@ export default {
} }
}, },
methods: { methods: {
saveFormOnTheFly({data, type}) { saveFormOnTheFly({data}) {
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data) makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
.then(response => { .then(response => {
this.$emit('newPriorSuggestion', response); this.$emit('newPriorSuggestion', response);

View File

@ -336,14 +336,14 @@ export default {
} }
}, },
altNameLabel: function () { altNameLabel: function () {
for (let i = 0; i < this.person.altNames.length; i++) { let altNameLabel = ''
return this.person.altNames[i].label this.person.altNames.forEach(altName => altNameLabel += altName.label)
} return altNameLabel
}, },
altNameKey: function () { altNameKey: function () {
for (let i = 0; i < this.person.altNames.length; i++) { let altNameKey = ''
return this.person.altNames[i].key this.person.altNames.forEach(altName => altNameKey += altName.key)
} return altNameKey
}, },
getUrl: function () { getUrl: function () {
return `/fr/person/${this.person.id}/general`; return `/fr/person/${this.person.id}/general`;

View File

@ -45,14 +45,14 @@ export default {
}, },
computed: { computed: {
altNameLabel: function() { altNameLabel: function() {
for(let i = 0; i < this.person.altNames.length; i++){ let altNameLabel = ''
return this.person.altNames[i].label this.person.altNames.forEach(altName => altNameLabel += altName.label)
} return altNameLabel
}, },
altNameKey: function() { altNameKey: function() {
for(let i = 0; i < this.person.altNames.length; i++){ let altNameKey = ''
return this.person.altNames[i].key this.person.altNames.forEach(altName => altNameKey += altName.key)
} return altNameKey
}, },
cutText: function() { cutText: function() {
let more = (this.person.text.length > 15) ?'…' : ''; let more = (this.person.text.length > 15) ?'…' : '';

View File

@ -436,7 +436,7 @@ export default {
} }
}, },
methods: { methods: {
checkErrors(e) { checkErrors() {
this.errors = []; this.errors = [];
if (this.person.lastName === "") { if (this.person.lastName === "") {
this.errors.push("Le nom ne doit pas être vide."); this.errors.push("Le nom ne doit pas être vide.");
@ -453,7 +453,7 @@ export default {
}, },
loadData() { loadData() {
getPerson(this.id) getPerson(this.id)
.then(person => new Promise((resolve, reject) => { .then(person => new Promise((resolve) => {
this.person = person; this.person = person;
//console.log('get person', this.person); //console.log('get person', this.person);
resolve(); resolve();