mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Merge branch add-location-period into 'master'
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="item-title" @click="removeEvaluation(e)">
|
||||
<i class="fa fa-fw fa-times"></i>
|
||||
{{ evaluation.evaluation.title.fr }}
|
||||
</div>
|
||||
<div v-if="!editEvaluation">
|
||||
<dl class="item-details definition-inline">
|
||||
|
||||
<dt v-if="evaluation.startDate">{{ $t('startDate') }} :</dt>
|
||||
<dd v-if="evaluation.startDate">{{ $d(evaluation.startDate.datetime, 'short') }}</dd>
|
||||
|
||||
<dt v-if="evaluation.endDate">{{ $t('endDate') }} :</dt>
|
||||
<dd v-if="evaluation.endDate">{{ $d(evaluation.endDate.datetime, 'short') }}</dd>
|
||||
|
||||
<dt v-if="evaluation.maxDate">{{ $t('maxDate') }} :</dt>
|
||||
<dd v-if="evaluation.maxDate">{{ $d(evaluation.maxDate.datetime, 'short') }}</dd>
|
||||
|
||||
<dt v-if="evaluation.warningInterval">{{ $t('warningInterval') }} :</dt>
|
||||
<dd v-if="evaluation.warningInterval">{{ evaluation.warningInterval }}</dd>
|
||||
|
||||
<dt v-if="evaluation.documents && evaluation.documents.length > 0">{{ $t('documents') }} :</dt>
|
||||
<dd v-if="evaluation.documents && evaluation.documents.length > 0">{{ evaluation.documents.length }}</dd>
|
||||
|
||||
</dl>
|
||||
<dl class="item-details">
|
||||
|
||||
<dt v-if="evaluation.comment">{{ $t('comment') }} :</dt>
|
||||
<dd v-if="evaluation.comment">{{ evaluation.comment }}</dd>
|
||||
|
||||
</dl>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-sm btn-update" @click="toggleEditEvaluation(e)">{{ $t('action.edit') }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="editEvaluation">
|
||||
<form-evaluation ref="FormEvaluation" :key="evaluation.id" :evaluation="evaluation"></form-evaluation>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button class="btn btn-sm btn-update" @click="submitForm">{{ $t('action.save') }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FormEvaluation from './FormEvaluation.vue';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
fr: {
|
||||
no_evaluation_associated: "Aucune évaluation associée",
|
||||
add_an_evaluation: "Évaluations disponibles",
|
||||
evaluation_has_no_evaluation: "Aucune évaluation disponible",
|
||||
startDate: "Date d'ouverture",
|
||||
endDate: "Date de fin",
|
||||
maxDate: "Date d'échéance",
|
||||
warningInterval: "Rappel (jours)",
|
||||
comment: "Note publique",
|
||||
documents: "Documents",
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "AddEvaluation",
|
||||
components: {
|
||||
FormEvaluation
|
||||
},
|
||||
props: ['evaluation'],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
editEvaluation: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
pickedEvaluations() {
|
||||
return this.$store.state.evaluationsPicked;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
removeEvaluation(e) {
|
||||
this.$store.commit('removeEvaluation', e);
|
||||
return;
|
||||
},
|
||||
toggleEditEvaluation(e) {
|
||||
this.editEvaluation = !this.editEvaluation;
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.FormEvaluation.saveEvaluation();
|
||||
this.toggleEditEvaluation();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@@ -1,166 +1,128 @@
|
||||
<template>
|
||||
<div class="addResult" v-if="hasResult">
|
||||
<p class="chill-no-data-statement" v-if="pickedResults.length ===0">
|
||||
Aucun résultat associé
|
||||
</p>
|
||||
<ul class="list-results">
|
||||
<li v-for="r in pickedResults" @click="removeResult(r)" class="badge bg-primary">
|
||||
<i class="fa fa-times"></i>
|
||||
{{ r.title.fr }}
|
||||
</li>
|
||||
<template v-if="isExpanded">
|
||||
<li v-for="r in availableForCheckResults" @click="addResult(r)" class="badge bg-primary">
|
||||
<i class="fa fa-plus"></i>
|
||||
{{ r.title.fr }}
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
<ul class="record_actions">
|
||||
<li v-if="isExpanded">
|
||||
<button @click="toggleSelect" class="btn btn-hide" >
|
||||
<i class="fa fa-eye-slash"></i>
|
||||
Masquer résultats et orientations disponibles
|
||||
</button>
|
||||
</li>
|
||||
<li v-else>
|
||||
<button @click="toggleSelect" class="btn btn-show">
|
||||
Afficher résultats et orientations disponibles
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="noResult" v-if="!hasResult">
|
||||
<div class="chill-no-data-statement">
|
||||
{{ $t('goal_has_no_result') }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="hasResult" class="addResult">
|
||||
<p v-if="pickedResults.length ===0" class="chill-no-data-statement">
|
||||
Aucun résultat associé
|
||||
</p>
|
||||
<ul class="list-results">
|
||||
<li v-for="r in pickedResults" class="badge bg-primary" @click="removeResult(r)">
|
||||
<i class="fa fa-times"></i>
|
||||
{{ r.title.fr }}
|
||||
</li>
|
||||
<template v-if="isExpanded">
|
||||
<li v-for="r in availableForCheckResults" class="badge bg-primary" @click="addResult(r)">
|
||||
<i class="fa fa-plus"></i>
|
||||
{{ r.title.fr }}
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
<ul class="record_actions">
|
||||
<li v-if="isExpanded">
|
||||
<button class="btn btn-hide" @click="toggleSelect">
|
||||
<i class="fa fa-eye-slash"></i>
|
||||
Masquer résultats et orientations disponibles
|
||||
</button>
|
||||
</li>
|
||||
<li v-else>
|
||||
<button class="btn btn-show" @click="toggleSelect">
|
||||
Afficher résultats et orientations disponibles
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="!hasResult" class="noResult">
|
||||
<div class="chill-no-data-statement">
|
||||
{{ $t('goal_has_no_result') }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
button.hide {
|
||||
background-color: rgb(51, 77, 92);
|
||||
}
|
||||
|
||||
ul.list-results {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
margin: 0.5rem;
|
||||
}
|
||||
|
||||
li.badge {
|
||||
padding-bottom: 0;
|
||||
padding-top: 0;
|
||||
padding-left: 0;
|
||||
|
||||
i.fa {
|
||||
/*border-radius: 0.25rem; */
|
||||
padding: 0.25rem;
|
||||
}
|
||||
|
||||
i.fa-plus {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
i.fa-times {
|
||||
background-color: red;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
fr: {
|
||||
add_a_result: "Résultat - orientation disponibles",
|
||||
goal_has_no_result: "Aucun résultat - orientation disponible",
|
||||
}
|
||||
}
|
||||
messages: {
|
||||
fr: {
|
||||
add_a_result: "Résultat - orientation disponibles",
|
||||
goal_has_no_result: "Aucun résultat - orientation disponible",
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "AddResult",
|
||||
props: [ 'destination', 'goal' ],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hasResult() {
|
||||
if (this.destination === 'action') {
|
||||
return this.$store.state.resultsForAction.length > 0;
|
||||
} else if (this.destination === 'goal') {
|
||||
return this.$store.getters.resultsForGoal(this.goal).length > 0;
|
||||
}
|
||||
name: "AddResult",
|
||||
props: ['destination', 'goal', 'availableResults'],
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
isExpanded: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hasResult() {
|
||||
if (this.destination === 'action') {
|
||||
return this.$store.state.resultsForAction.length > 0;
|
||||
} else if (this.destination === 'goal') {
|
||||
return this.$store.getters.resultsForGoal(this.goal).length > 0;
|
||||
}
|
||||
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
pickedResults() {
|
||||
console.log('get checked');
|
||||
console.log('this.destination', this.destination);
|
||||
console.log('this.goal', this.goal);
|
||||
if (this.destination === 'action') {
|
||||
return this.$store.state.resultsPicked;
|
||||
} else if (this.destination === 'goal') {
|
||||
return this.$store.getters.resultsPickedForGoal(this.goal);
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
pickedResults() {
|
||||
//console.log('get checked');
|
||||
//console.log('this.destination', this.destination);
|
||||
//console.log('this.goal', this.goal);
|
||||
if (this.destination === 'action') {
|
||||
return this.$store.state.resultsPicked;
|
||||
} else if (this.destination === 'goal') {
|
||||
return this.$store.getters.resultsPickedForGoal(this.goal);
|
||||
}
|
||||
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
availableForCheckResults() {
|
||||
console.log('availableForCheckResults');
|
||||
console.log('this.destination', this.destination);
|
||||
console.log('this.goal', this.goal);
|
||||
if (this.destination === 'action') {
|
||||
let pickedIds = this.$store.state.resultsPicked.map(r => r.id);
|
||||
console.log('picked ids', pickedIds);
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
availableForCheckResults() {
|
||||
//console.log('availableForCheckResults');
|
||||
//console.log('this.destination', this.destination);
|
||||
//console.log('this.goal', this.goal);
|
||||
if (this.destination === 'action') {
|
||||
let pickedIds = this.$store.state.resultsPicked.map(r => r.id);
|
||||
//console.log('picked ids', pickedIds);
|
||||
|
||||
return this.$store.state.resultsForAction.filter(r => !pickedIds.includes(r.id));
|
||||
} else if (this.destination === 'goal') {
|
||||
console.log('results picked for goal', this.$store.getters.resultsPickedForGoal(this.goal));
|
||||
let pickedIds = this.$store.getters.resultsPickedForGoal(this.goal).map(r => r.id);
|
||||
return this.$store.state.resultsForAction.filter(r => !pickedIds.includes(r.id));
|
||||
} else if (this.destination === 'goal') {
|
||||
//console.log('results picked for goal', this.$store.getters.resultsPickedForGoal(this.goal));
|
||||
let pickedIds = this.$store.getters.resultsPickedForGoal(this.goal).map(r => r.id);
|
||||
|
||||
return this.$store.getters.resultsForGoal(this.goal).filter(r => !pickedIds.includes(r.id));
|
||||
}
|
||||
return this.$store.getters.resultsForGoal(this.goal).filter(r => !pickedIds.includes(r.id));
|
||||
}
|
||||
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleSelect() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
},
|
||||
addResult(r) {
|
||||
console.log('addResult', r);
|
||||
if (this.destination === 'action') {
|
||||
this.$store.commit('addResultPicked', r);
|
||||
return;
|
||||
} else if (this.destination === 'goal') {
|
||||
this.$store.commit('addResultForGoalPicked', { goal: this.goal, result: r });
|
||||
return;
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
removeResult(r) {
|
||||
console.log('removeresult', r);
|
||||
if (this.destination === 'action') {
|
||||
this.$store.commit('removeResultPicked', r);
|
||||
return;
|
||||
} else if (this.destination === 'goal') {
|
||||
this.$store.commit('removeResultForGoalPicked', { goal: this.goal, result: r });
|
||||
return;
|
||||
},
|
||||
methods: {
|
||||
toggleSelect() {
|
||||
this.isExpanded = !this.isExpanded;
|
||||
},
|
||||
addResult(r) {
|
||||
//console.log('addResult', r);
|
||||
if (this.destination === 'action') {
|
||||
this.$store.commit('addResultPicked', r);
|
||||
return;
|
||||
} else if (this.destination === 'goal') {
|
||||
this.$store.commit('addResultForGoalPicked', {goal: this.goal, result: r});
|
||||
return;
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
},
|
||||
removeResult(r) {
|
||||
//console.log('removeresult', r);
|
||||
if (this.destination === 'action') {
|
||||
this.$store.commit('removeResultPicked', r);
|
||||
return;
|
||||
} else if (this.destination === 'goal') {
|
||||
this.$store.commit('removeResultForGoalPicked', {goal: this.goal, result: r});
|
||||
return;
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
}
|
||||
throw Error(`this.destination is not implemented: ${this.destination}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--h2>
|
||||
{{ $t('evaluation_title') }}
|
||||
</h2-->
|
||||
|
||||
<div class="m-md-3">
|
||||
<!--div class="row mb-3">
|
||||
<label class="col-sm-4 col-form-label">{{ $t('evaluation_status') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-select form-select-sm" v-model="status">
|
||||
<option disabled value="">{{ $t('evaluation_choose_a_status') }}</option>
|
||||
<option v-for="s in listAllStatus" :value="s.id">
|
||||
{{ s.id }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div-->
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-4 col-sm-2 col-md-4 col-lg-2 col-form-label">
|
||||
{{ $t('evaluation_startdate') }}
|
||||
</label>
|
||||
<div class="col-8 col-sm-4 col-md-8 col-lg-4">
|
||||
<input class="form-control form-control-sm" type="date" v-model="startDate"/>
|
||||
</div>
|
||||
|
||||
<label class="col-4 col-sm-2 col-md-4 col-lg-2 col-form-label">
|
||||
{{ $t('evaluation_enddate') }}
|
||||
</label>
|
||||
<div class="col-8 col-sm-4 col-md-8 col-lg-4">
|
||||
<input class="form-control form-control-sm" type="date" v-model="endDate"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-4 col-sm-2 col-md-4 col-lg-2 col-form-label">
|
||||
{{ $t('evaluation_maxdate') }}
|
||||
</label>
|
||||
<div class="col-8 col-sm-4 col-md-8 col-lg-4">
|
||||
<input class="form-control form-control-sm" type="date" v-model="maxDate"/>
|
||||
</div>
|
||||
|
||||
<label class="col-4 col-sm-2 col-md-4 col-lg-2 col-form-label">
|
||||
{{ $t('evaluation_warning_interval') }}
|
||||
</label>
|
||||
<div class="col-8 col-sm-4 col-md-8 col-lg-4">
|
||||
<input class="form-control form-control-sm" type="number" v-model.number="warningInterval"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-4 col-form-label">{{ $t('evaluation_public_comment') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<ckeditor
|
||||
:editor="editor"
|
||||
:placeholder="$t('evaluation_comment_placeholder')"
|
||||
v-model="comment"
|
||||
tag-name="textarea"
|
||||
></ckeditor>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-4 col-form-label">{{ $t('evaluation_generate_a_document') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<select class="form-select form-select-sm" v-model="template">
|
||||
<option disabled value="">{{ $t('evaluation_choose_a_template') }}</option>
|
||||
<option>A</option>
|
||||
</select>
|
||||
<button class="btn btn-update btn-sm change-icon" type="button"><i class="fa fa-fw fa-cog"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--div class="row mb-3">
|
||||
<label class="col-sm-4 col-form-label">{{ $t('evaluation_add_a_document') }}</label>
|
||||
<div class="col-sm-8">
|
||||
<button class="btn btn-create btn-sm" @click="documents"></button>
|
||||
</div>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
fr: {
|
||||
evaluation_title: "Ecrire une évaluation",
|
||||
evaluation_status: "Statut",
|
||||
evaluation_choose_a_status: "Choisir un statut",
|
||||
evaluation_startdate: "Date d'ouverture",
|
||||
evaluation_enddate: "Date de fin",
|
||||
evaluation_maxdate: "Date d'échéance",
|
||||
evaluation_warning_interval: "Rappel (jours)",
|
||||
evaluation_public_comment: "Note publique",
|
||||
evaluation_comment_placeholder: "Commencez à écrire ...",
|
||||
evaluation_generate_a_document: "Générer un document",
|
||||
evaluation_choose_a_template: "Choisir un gabarit",
|
||||
evaluation_add_a_document: "Ajouter un document",
|
||||
evaluation_add: "Ajouter une évaluation"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "FormEvaluation",
|
||||
props: ['evaluation'],
|
||||
components: {
|
||||
ckeditor: CKEditor.component,
|
||||
},
|
||||
i18n,
|
||||
data() {
|
||||
return {
|
||||
editor: ClassicEditor,
|
||||
//evaluation: {
|
||||
// status: null,
|
||||
// startDate: null,
|
||||
// endDate: null,
|
||||
// maxDate: null,
|
||||
// warningInterval: null,
|
||||
// comment: null,
|
||||
// template: null,
|
||||
// //documents: null
|
||||
//}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
/*
|
||||
status: {
|
||||
get() { return this.evaluation.status; },
|
||||
set(v) { this.evaluation.status = v; }
|
||||
},
|
||||
*/
|
||||
startDate: {
|
||||
get() {
|
||||
if (this.evaluation.startDate) {
|
||||
return this.evaluation.startDate.datetime.split('T')[0];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set(v) {
|
||||
this.evaluation.startDate.datetime = `${v}T00:00:00+0100`;
|
||||
}
|
||||
},
|
||||
endDate: {
|
||||
get() {
|
||||
if (this.evaluation.endDate) {
|
||||
return this.evaluation.endDate.datetime.split('T')[0];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set(v) {
|
||||
this.evaluation.endDate.datetime = `${v}T00:00:00+0100`;
|
||||
}
|
||||
},
|
||||
maxDate: {
|
||||
get() {
|
||||
if (this.evaluation.maxDate) {
|
||||
return this.evaluation.maxDate.datetime.split('T')[0];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
set(v) {
|
||||
this.evaluation.maxDate.datetime = `${v}T00:00:00+0100`;
|
||||
}
|
||||
},
|
||||
warningInterval: {
|
||||
get() { return this.evaluation.warningInterval; },
|
||||
set(v) { this.evaluation.warningInterval = v; }
|
||||
},
|
||||
comment: {
|
||||
get() { return this.evaluation.comment; },
|
||||
set(v) { this.evaluation.comment = v; }
|
||||
},
|
||||
template: {
|
||||
get() { return this.evaluation.template; },
|
||||
set(v) { this.evaluation.template = v; }
|
||||
},
|
||||
/*
|
||||
documents: {
|
||||
get() { return this.evaluation.documents; },
|
||||
set(v) { this.evaluation.documents = v; }
|
||||
}
|
||||
*/
|
||||
},
|
||||
methods: {
|
||||
listAllStatus() {
|
||||
console.log('load all status');
|
||||
let url = `/api/`;
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw { m: 'yeeah', s: response.status, b: response.body };
|
||||
})
|
||||
;
|
||||
},
|
||||
saveEvaluation() {
|
||||
console.log('save evaluation');
|
||||
|
||||
console.log('dispatch action: post/patch/put evaluation');
|
||||
console.log('commit mutation: update state.mutation');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//this.listAllStatus();
|
||||
}
|
||||
}
|
||||
</script>
|
@@ -5,7 +5,7 @@ import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
||||
console.log(window.accompanyingCourseWork);
|
||||
console.log('acw', window.accompanyingCourseWork);
|
||||
|
||||
const store = createStore({
|
||||
strict: debug,
|
||||
@@ -16,10 +16,12 @@ const store = createStore({
|
||||
ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null),
|
||||
note: window.accompanyingCourseWork.note,
|
||||
goalsPicked: window.accompanyingCourseWork.goals,
|
||||
goalsForAction: [],
|
||||
resultsPicked: window.accompanyingCourseWork.results,
|
||||
resultsForAction: [],
|
||||
goalsForAction: [],
|
||||
resultsForGoal: [],
|
||||
evaluationsPicked: window.accompanyingCourseWork.accompanyingPeriodWorkEvaluations,
|
||||
evaluationsForAction: [],
|
||||
personsPicked: window.accompanyingCourseWork.persons,
|
||||
personsReachables: window.accompanyingCourseWork.accompanyingPeriod.participations.filter(p => p.endDate == null)
|
||||
.map(p => p.person),
|
||||
@@ -79,11 +81,28 @@ const store = createStore({
|
||||
},
|
||||
results: g.results.map(r => ({id: r.id, type: r.type})),
|
||||
};
|
||||
|
||||
if (g.id !== undefined) {
|
||||
o.id = g.id;
|
||||
}
|
||||
|
||||
return o;
|
||||
}),
|
||||
accompanyingPeriodWorkEvaluations: state.evaluationsPicked.map(e => {
|
||||
let o = {
|
||||
type: e.type,
|
||||
evaluation: {
|
||||
id: e.evaluation.id,
|
||||
type: e.evaluation.type
|
||||
},
|
||||
startDate: e.startDate,
|
||||
endDate: e.endDate,
|
||||
maxDate: e.maxDate,
|
||||
warningInterval: e.warningInterval,
|
||||
comment: e.comment,
|
||||
documents: e.documents
|
||||
};
|
||||
if (e.id !== undefined) {
|
||||
o.id = e.id;
|
||||
}
|
||||
return o;
|
||||
})
|
||||
};
|
||||
@@ -97,19 +116,24 @@ const store = createStore({
|
||||
state.endDate = date;
|
||||
},
|
||||
setResultsForAction(state, results) {
|
||||
console.log('set results for action', results);
|
||||
//console.log('set results for action', results);
|
||||
state.resultsForAction = results;
|
||||
},
|
||||
setResultsForGoal(state, { goal, results }) {
|
||||
console.log('set results for goal', results);
|
||||
//console.log('set results for goal', results);
|
||||
state.goalsForAction.push(goal);
|
||||
for (let i in results) {
|
||||
let r = results[i];
|
||||
r.goalId = goal.id;
|
||||
console.log('adding result', r);
|
||||
//console.log('adding result', r);
|
||||
state.resultsForGoal.push(r);
|
||||
}
|
||||
},
|
||||
setEvaluationsForAction(state, results) {
|
||||
//console.log('set evaluations for action', results);
|
||||
state.evaluationsForAction = results;
|
||||
console.log('e4a', state.evaluationsForAction);
|
||||
},
|
||||
addResultPicked(state, result) {
|
||||
state.resultsPicked.push(result);
|
||||
},
|
||||
@@ -130,10 +154,10 @@ const store = createStore({
|
||||
},
|
||||
addResultForGoalPicked(state, { goal, result}) {
|
||||
let found = state.goalsPicked.find(g => g.goal.id === goal.id);
|
||||
console.log('adResultForGoalPicked');
|
||||
console.log('found', found);
|
||||
console.log('goal', goal);
|
||||
console.log('result', result);
|
||||
//console.log('adResultForGoalPicked');
|
||||
//console.log('found', found);
|
||||
//console.log('goal', goal);
|
||||
//console.log('result', result);
|
||||
|
||||
if (found === undefined) {
|
||||
return;
|
||||
@@ -150,8 +174,26 @@ const store = createStore({
|
||||
|
||||
found.results = found.results.filter(r => r.id !== result.id);
|
||||
},
|
||||
addEvaluation(state, evaluation) {
|
||||
let e = {
|
||||
type: "accompanying_period_work_evaluation",
|
||||
evaluation: evaluation,
|
||||
//startDate,
|
||||
//endDate,
|
||||
//maxDate,
|
||||
//warningInterval
|
||||
//comment,
|
||||
//documents,
|
||||
}
|
||||
state.evaluationsPicked.push(e);
|
||||
console.log('ep', state.evaluationsPicked);
|
||||
},
|
||||
removeEvaluation(state, evaluation) {
|
||||
state.evaluationsPicked = state.evaluationsPicked.filter(e => e.id !== evaluation.id);
|
||||
console.log('ep', state.evaluationsPicked);
|
||||
},
|
||||
setPersonsPickedIds(state, ids) {
|
||||
console.log('persons ids', ids);
|
||||
//console.log('persons ids', ids);
|
||||
state.personsPicked = state.personsReachables
|
||||
.filter(p => ids.includes(p.id))
|
||||
},
|
||||
@@ -162,11 +204,11 @@ const store = createStore({
|
||||
state.handlingThirdParty = thirdParty;
|
||||
},
|
||||
addThirdParties(state, thirdParties) {
|
||||
console.log('addThirdParties', thirdParties);
|
||||
//console.log('addThirdParties', thirdParties);
|
||||
// filter to remove existing thirdparties
|
||||
let ids = state.thirdParties.map(t => t.id);
|
||||
let unexistings = thirdParties.filter(t => !ids.includes(t.id));
|
||||
console.log('unexisting third parties', unexistings);
|
||||
//console.log('unexisting third parties', unexistings);
|
||||
for (let i in unexistings) {
|
||||
state.thirdParties.push(unexistings[i]);
|
||||
}
|
||||
@@ -176,7 +218,7 @@ const store = createStore({
|
||||
.filter(t => t.id !== thirdParty.id);
|
||||
},
|
||||
setErrors(state, errors) {
|
||||
console.log('handling errors', errors);
|
||||
//console.log('handling errors', errors);
|
||||
state.errors = errors;
|
||||
},
|
||||
setIsPosting(state, st) {
|
||||
@@ -185,14 +227,12 @@ const store = createStore({
|
||||
},
|
||||
actions: {
|
||||
getReachablesGoalsForAction({ getters, commit, dispatch }) {
|
||||
console.log('getReachablesGoalsForAction');
|
||||
//console.log('getReachablesGoalsForAction');
|
||||
let
|
||||
socialActionId = getters.socialAction.id,
|
||||
url = `/api/1.0/person/social-work/goal/by-social-action/${socialActionId}.json`
|
||||
;
|
||||
|
||||
console.log(url);
|
||||
|
||||
//console.log(url);
|
||||
window
|
||||
.fetch(
|
||||
url
|
||||
@@ -210,13 +250,11 @@ const store = createStore({
|
||||
});
|
||||
},
|
||||
getReachablesResultsForGoal({ commit }, goal) {
|
||||
console.log('getReachablesResultsForGoal');
|
||||
//console.log('getReachablesResultsForGoal');
|
||||
let
|
||||
url = `/api/1.0/person/social-work/result/by-goal/${goal.id}.json`
|
||||
;
|
||||
|
||||
console.log(url);
|
||||
|
||||
//console.log(url);
|
||||
window.fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
@@ -226,19 +264,17 @@ const store = createStore({
|
||||
throw { m: 'Error while retriving results for goal', s: response.status, b: response.body };
|
||||
})
|
||||
.then(data => {
|
||||
console.log('data');
|
||||
//console.log('data');
|
||||
commit('setResultsForGoal', { goal, results: data.results });
|
||||
});
|
||||
},
|
||||
getReachablesResultsForAction({ getters, commit }) {
|
||||
console.log('getReachablesResultsForAction');
|
||||
//console.log('getReachablesResultsForAction');
|
||||
let
|
||||
socialActionId = getters.socialAction.id,
|
||||
url = `/api/1.0/person/social-work/result/by-social-action/${socialActionId}.json`
|
||||
;
|
||||
|
||||
console.log(url);
|
||||
|
||||
//console.log(url);
|
||||
window.fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
@@ -248,20 +284,35 @@ const store = createStore({
|
||||
throw { m: 'Error while retriving results for social action', s: response.status, b: response.body };
|
||||
})
|
||||
.then(data => {
|
||||
console.log('data retrived', data);
|
||||
//console.log('data retrived', data);
|
||||
commit('setResultsForAction', data.results);
|
||||
});
|
||||
},
|
||||
getReachablesEvaluationsForAction({ getters, commit }) {
|
||||
//console.log('getReachablesEvaluationsForAction');
|
||||
let
|
||||
socialActionId = getters.socialAction.id,
|
||||
url = `/api/1.0/person/social-work/evaluation/by-social-action/${socialActionId}.json`
|
||||
;
|
||||
window.fetch(url)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw { m: 'Error while retriving evaluations for social action', s: response.status, b: response.body };
|
||||
})
|
||||
.then(data => {
|
||||
commit('setEvaluationsForAction', data.results);
|
||||
});
|
||||
},
|
||||
submit({ getters, state, commit }) {
|
||||
let
|
||||
payload = getters.buildPayload,
|
||||
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json`,
|
||||
errors = []
|
||||
;
|
||||
|
||||
console.log('action subitting', payload, url);
|
||||
//console.log('action submitting', payload, url);
|
||||
commit('setIsPosting', true);
|
||||
|
||||
window.fetch(url, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@@ -295,6 +346,9 @@ const store = createStore({
|
||||
initAsync({ dispatch }) {
|
||||
dispatch('getReachablesResultsForAction');
|
||||
dispatch('getReachablesGoalsForAction');
|
||||
dispatch('getReachablesEvaluationsForAction');
|
||||
|
||||
console.log('ep', this.state.evaluationsPicked);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
@@ -1,9 +1,8 @@
|
||||
<template>
|
||||
<ul class="record_actions">
|
||||
<li class="add-persons">
|
||||
<a class="btn btn-create" @click="openModal">
|
||||
{{ $t(buttonTitle) }}
|
||||
</a>
|
||||
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
|
||||
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -19,7 +18,7 @@
|
||||
<template v-slot:body-head>
|
||||
<div class="modal-body">
|
||||
<div class="search">
|
||||
|
||||
|
||||
<label class="col-form-label" style="float: right;">
|
||||
{{ $tc('add_persons.suggested_counter', suggestedCounter) }}
|
||||
</label>
|
||||
@@ -66,17 +65,17 @@
|
||||
|
||||
<div class="create-button">
|
||||
<on-the-fly
|
||||
v-if="query.length >= 3"
|
||||
v-if="query.length >= 3"
|
||||
v-bind:buttonText="$t('onthefly.create.button', {q: query})"
|
||||
action="create"><!-- TODO first close this modal -->
|
||||
</on-the-fly>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:footer>
|
||||
<button class="btn btn-create"
|
||||
<button class="btn btn-create"
|
||||
@click.prevent="$emit('addNewPersons', { selected, modal })">
|
||||
{{ $t('action.add')}}
|
||||
</button>
|
||||
@@ -150,13 +149,19 @@ export default {
|
||||
];
|
||||
let union = [...new Set([
|
||||
...this.suggested.slice().reverse(),
|
||||
...this.selected.slice().reverse(),
|
||||
...this.selected.slice().reverse(),
|
||||
])];
|
||||
return uniqBy(union, k => k.key);
|
||||
},
|
||||
//options() {
|
||||
// return this.options;
|
||||
//},
|
||||
getClassButton() {
|
||||
let size = (typeof this.options.button !== 'undefined' && typeof this.options.button.size !== 'undefined') ? this.options.button.size : '';
|
||||
let type = (typeof this.options.button !== 'undefined' && typeof this.options.button.type !== 'undefined') ? this.options.button.type : 'btn-create';
|
||||
return size ? size + ' ' + type : type;
|
||||
},
|
||||
displayTextButton() {
|
||||
return (typeof this.options.button !== 'undefined' && typeof this.options.button.display !== 'undefined') ?
|
||||
this.options.button.display : true;
|
||||
},
|
||||
checkUniq() {
|
||||
if (this.options.uniq === true) {
|
||||
return 'radio';
|
||||
@@ -184,7 +189,7 @@ export default {
|
||||
this.loadSuggestions([]);
|
||||
}
|
||||
},
|
||||
loadSuggestions(suggested) {
|
||||
loadSuggestions(suggested) {
|
||||
//console.log('suggested', suggested);
|
||||
this.search.suggested = suggested;
|
||||
this.search.suggested.forEach(function(item) {
|
||||
@@ -230,7 +235,7 @@ export default {
|
||||
margin: auto 4em;
|
||||
div.search {
|
||||
position: relative;
|
||||
input {
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 1.2em 1.5em 1.2em 2.5em;
|
||||
//margin: 1em 0;
|
||||
@@ -239,7 +244,7 @@ export default {
|
||||
position: absolute;
|
||||
opacity: 0.5;
|
||||
padding: 0.65em 0;
|
||||
top: 50%;
|
||||
top: 50%;
|
||||
}
|
||||
i.fa-search {
|
||||
left: 0.5em;
|
||||
|
Reference in New Issue
Block a user