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');
console.log(forms);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
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 { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';

View File

@ -514,7 +514,6 @@
<script>
import {mapState, mapGetters,} from 'vuex';
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date';
import CKEditor from '@ckeditor/ckeditor5-vue';
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/editor_config';
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 ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.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';
const i18n = {
@ -757,7 +755,7 @@ export default {
},
goToGenerateWorkflow({link}) {
// console.log('save before leave to generate workflow')
const callback = (data) => {
const callback = () => {
window.location.assign(link);
};
@ -766,7 +764,7 @@ export default {
},
goToGenerateNotification(tos) {
console.log('save before leave to notification');
const callback = (data) => {
const callback = () => {
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`);
} else {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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