Merge remote-tracking branch 'origin/master'

This commit is contained in:
Julien Fastré 2022-04-26 11:54:01 +02:00
commit 795a8e9daf
25 changed files with 413 additions and 307 deletions

View File

@ -11,9 +11,14 @@ and this project adheres to
## Unreleased ## Unreleased
<!-- write down unreleased development here --> <!-- write down unreleased development here -->
* [Activity form] invert 'incoming' and 'receiving' in Activity form * [Datepickers] datepickers fixed when using keyboard to enter date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/545)
* [Activity form] keep the same order for 'attendee' field in new and edit form * [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
* [list with period] use "sameas" test operator to introduce requestor in list * [Person_search] Closed parcours shown within an accordeon that can be opened/closed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/574)
## Test releases
### 2021-04-24
* [notification email on course designation] allow raw string in email content generation * [notification email on course designation] allow raw string in email content generation
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older * [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
* [Documents] Change wording 'créer' to 'enregistrer' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/634) * [Documents] Change wording 'créer' to 'enregistrer' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/634)
@ -25,10 +30,15 @@ and this project adheres to
* [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error * [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error
* [Notifications] delay the sending of notificaiton to kernel.terminate * [Notifications] delay the sending of notificaiton to kernel.terminate
* [Notifications / Period user change] fix the sending of notification when user changes * [Notifications / Period user change] fix the sending of notification when user changes
* [Activity form] invert 'incoming' and 'receiving' in Activity form
* [Activity form] keep the same order for 'attendee' field in new and edit form
* [list with period] use "sameas" test operator to introduce requestor in list
* [notification email on course designation] allow raw string in email content generation
* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
## Test releases
### 2021-04-13 ### 2021-04-13
* [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541) * [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541)
* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543) * [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person); * [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);

View File

@ -54,19 +54,19 @@
{{ $t('activity.select_first_a_social_issue') }} {{ $t('activity.select_first_a_social_issue') }}
</span> </span>
<template v-else-if="socialActionsList.length > 0"> <template v-else-if="socialActionsList.length > 0">
<check-social-action <check-social-action
v-if="socialIssuesSelected.length || socialActionsSelected.length" v-if="socialIssuesSelected.length || socialActionsSelected.length"
v-for="action in socialActionsList" v-for="action in socialActionsList"
:key="action.id" :key="action.id"
:action="action" :action="action"
:selection="socialActionsSelected" :selection="socialActionsSelected"
@updateSelected="updateActionsSelected"> @updateSelected="updateActionsSelected">
</check-social-action> </check-social-action>
</template> </template>
<span v-else-if="actionAreLoaded && socialActionsList.length === 0" class="inline-choice chill-no-data-statement mt-3"> <span v-else-if="actionAreLoaded && socialActionsList.length === 0" class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.social_action_list_empty') }} {{ $t('activity.social_action_list_empty') }}
</span> </span>
@ -111,7 +111,7 @@ export default {
return this.$store.state.socialIssuesOther; return this.$store.state.socialIssuesOther;
}, },
socialActionsList() { socialActionsList() {
return this.$store.state.socialActionsList; return this.$store.getters.socialActionsListSorted;
}, },
socialActionsSelected() { socialActionsSelected() {
return this.$store.state.activity.socialActions; return this.$store.state.activity.socialActions;

View File

@ -101,6 +101,9 @@ const store = createStore({
state.activity.activityType.thirdPartiesVisible !== 0) state.activity.activityType.thirdPartiesVisible !== 0)
); );
}, },
socialActionsListSorted(state) {
return [ ...state.socialActionsList].sort((a, b) => a.ordering - b.ordering);
},
}, },
mutations: { mutations: {
// SocialIssueAcc // SocialIssueAcc
@ -131,7 +134,6 @@ const store = createStore({
state.socialActionsList = []; state.socialActionsList = [];
}, },
addActionInList(state, action) { addActionInList(state, action) {
//console.log('add action list', action.id);
state.socialActionsList.push(action); state.socialActionsList.push(action);
}, },
updateActionsSelected(state, actions) { updateActionsSelected(state, actions) {

View File

@ -16,6 +16,9 @@
// Chill forms // Chill forms
@import './scss/forms'; @import './scss/forms';
// Extend bootstrap accordion
@import './scss/accordion';
// Chill record_actions // Chill record_actions
@import './scss/record_actions'; @import './scss/record_actions';

View File

@ -0,0 +1,11 @@
.accordion {
// show a folded / label on accordion
button[aria-expanded="true"] > span.folded,
button[aria-expanded="false"] > span.unfolded { display: none; }
button[aria-expanded="false"] > span.folded,
button[aria-expanded="true"] > span.unfolded { display: inline; }
.accordion-item {
margin-bottom: 1rem;
}
}

View File

@ -30,6 +30,7 @@ div.list-with-period {
// override wrap-list // override wrap-list
div.wrap-list.periods-list { div.wrap-list.periods-list {
padding-right: 1rem;
div.wl-row { div.wl-row {
flex-wrap: nowrap; flex-wrap: nowrap;
div.wl-col { div.wl-col {
@ -63,6 +64,7 @@ div.list-with-period {
} }
div.periods-list { div.periods-list {
padding-right: 1rem;
div.title { div.title {
text-align: right; text-align: right;
div.date {} div.date {}

View File

@ -5,9 +5,8 @@
</h2> </h2>
<div> <div>
<div class="mb-3 row"> <div class="mb-3 row">
<label class="col-form-label col-sm-4">{{ $t('startdate.date') }}</label> <div class="col-sm-12 date-update">
<div class="col-sm-8"> <input class="form-control" type="date" id="startDate" v-model="startDateInput">
<input class="form-control" type="date" v-model="startDate" @change="updateStartDate" />
</div> </div>
</div> </div>
</div> </div>
@ -17,30 +16,54 @@
<script> <script>
import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js'; import { dateToISO, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
import { mapState, mapGetters } from 'vuex'; import { mapState } from 'vuex';
export default { export default {
name: 'startDate', name: 'startDate',
methods: { data() {
updateStartDate(event) { return {
const date = event.target.value; lastRecordedDate: null
// console.log(date) }
this.$store.dispatch('updateStartDate', date)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
}
});
},
}, },
computed: { computed: {
...mapState({ ...mapState({
startDate: state => dateToISO(ISOToDatetime(state.accompanyingCourse.openingDate.datetime)) startDate: state => dateToISO(ISOToDatetime(state.accompanyingCourse.openingDate.datetime))
}) }),
startDateInput: {
get() {
return this.startDate;
},
set(value) {
this.lastRecordedDate = value;
setTimeout(() => {
console.log('timeout finished')
if (this.lastRecordedDate === value) {
console.log('last recorded', this.lastRecordedDate, 'value', value)
this.$store.dispatch('updateStartDate', 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'})
}
})
}
}, 3000)
}
}
} }
} }
</script> </script>
<style lang="scss" scoped>
.date-update {
display: flex;
justify-content: space-between;
&-btn {
margin-left: 1rem;
}
}
</style>

View File

@ -153,7 +153,7 @@ const appMessages = {
}, },
startdate: { startdate: {
change: "Date d'ouverture", change: "Date d'ouverture",
date: "Date d'ouverture", // update: "La nouvelle date d'ouverture a été enregistrée"
}, },
// catch errors // catch errors
'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.", 'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.",

View File

@ -322,7 +322,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
} }
}, },
updateStartDate(state, date) { updateStartDate(state, date) {
console.log('new state date', date)
state.accompanyingCourse.openingDate = date; state.accompanyingCourse.openingDate = date;
} }
}, },
@ -814,11 +813,9 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
}) })
}, },
updateStartDate({commit}, payload) { updateStartDate({commit}, payload) {
console.log('payload', payload)
const date = ISOToDate(payload);
const url = `/api/1.0/person/accompanying-course/${id}.json`; const url = `/api/1.0/person/accompanying-course/${id}.json`;
const body = { type: "accompanying_period", openingDate: { datetime: datetimeToISO(date) }}; const date = payload === null || payload === '' ? null : { datetime: datetimeToISO(ISOToDate(payload)) }
console.log('body', body) const body = { type: "accompanying_period", openingDate: date};
return makeFetch('PATCH', url, body) return makeFetch('PATCH', url, body)
.then((response) => { .then((response) => {
commit('updateStartDate', response.openingDate); commit('updateStartDate', response.openingDate);

View File

@ -227,19 +227,18 @@ export default {
}, },
startDate: { startDate: {
get() { get() {
let d = this.$store.state.startDate; return this.$store.state.startDate;
return dateToISO(d);
}, },
set(value) { set(value) {
this.$store.commit('setStartDate', ISOToDate(value)); this.$store.commit('setStartDate', value);
} }
}, },
endDate: { endDate: {
get() { get() {
return dateToISO(this.$store.state.endDate); return this.$store.state.endDate;
}, },
set(value) { set(value) {
this.$store.commit('setEndDate', ISOToDate(value)); this.$store.commit('setEndDate', value);
} }
}, },
setSocialIssue: { setSocialIssue: {

View File

@ -1,6 +1,6 @@
import { createStore } from 'vuex'; import { createStore } from 'vuex';
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js'; import { datetimeToISO, dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
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';
@ -20,7 +20,7 @@ const store = createStore({
.map(p => p.person), .map(p => p.person),
personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null) personsReachables: window.accompanyingCourse.participations.filter(p => p.endDate == null)
.map(p => p.person), .map(p => p.person),
startDate: new Date(), startDate: dateToISO(new Date()),
endDate: null, endDate: null,
isLoadingSocialActions: false, isLoadingSocialActions: false,
isPostingWork: false, isPostingWork: false,
@ -47,7 +47,7 @@ const store = createStore({
id: state.socialActionPicked.id id: state.socialActionPicked.id
}, },
startDate: { startDate: {
datetime: datetimeToISO(state.startDate) datetime: datetimeToISO(ISOToDate(state.startDate))
}, },
persons: [] persons: []
}; };
@ -61,7 +61,7 @@ const store = createStore({
if (null !== state.endDate) { if (null !== state.endDate) {
payload.endDate = { payload.endDate = {
datetime: datetimeToISO(state.endDate) datetime: datetimeToISO(ISOToDate(state.endDate))
}; };
} }
@ -111,6 +111,7 @@ const store = createStore({
state.startDate = date; state.startDate = date;
}, },
setEndDate(state, date) { setEndDate(state, date) {
console.log(date)
state.endDate = date; state.endDate = date;
}, },
setPersonsPickedIds(state, ids) { setPersonsPickedIds(state, ids) {

View File

@ -439,18 +439,18 @@ export default {
]), ]),
startDate: { startDate: {
get() { get() {
return dateToISO(this.$store.state.startDate); return this.$store.state.startDate;
}, },
set(v) { set(v) {
this.$store.commit('setStartDate', ISOToDate(v)); this.$store.commit('setStartDate', v);
} }
}, },
endDate: { endDate: {
get() { get() {
return dateToISO(this.$store.state.endDate); return this.$store.state.endDate;
}, },
set(v) { set(v) {
this.$store.commit('setEndDate', ISOToDate(v)); this.$store.commit('setEndDate', v);
} }
}, },
note: { note: {
@ -521,12 +521,12 @@ export default {
this.$store.commit('removeReferrer', u); this.$store.commit('removeReferrer', u);
}, },
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 = (data) => {
window.location.assign(link); window.location.assign(link);
}; };
return this.$store.dispatch('submit', callback) return this.$store.dispatch('submit', callback)
.catch(e => { console.log(e); throw e; }); .catch(e => { console.log(e); throw e; });
}, },
submit() { submit() {

View File

@ -298,38 +298,39 @@ export default {
} }
}, },
computed: { computed: {
...mapState([ ...mapState([
'isPosting' 'isPosting'
]), ]),
getTemplatesAvailables() { getTemplatesAvailables() {
return this.$store.getters.getTemplatesAvailablesForEvaluation(this.evaluation.evaluation); return this.$store.getters.getTemplatesAvailablesForEvaluation(this.evaluation.evaluation);
}, },
canGenerate() { canGenerate() {
return !this.$store.state.isPosting && this.template !== null; return !this.$store.state.isPosting && this.template !== null;
}, },
startDate: { startDate: {
get() { get() {
return dateToISO(this.evaluation.startDate); console.log('evaluation', this.evaluation);
}, return this.evaluation.startDate;
set(v) { },
this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: ISOToDate(v) }); set(v) {
} this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: v });
}
}, },
endDate: { endDate: {
get() { get() {
return dateToISO(this.evaluation.endDate); return this.evaluation.endDate;
}, },
set(v) { set(v) {
this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: ISOToDate(v) }); this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: v });
} }
}, },
maxDate: { maxDate: {
get() { get() {
return dateToISO(this.evaluation.maxDate); return this.evaluation.maxDate;
}, },
set(v) { set(v) {
this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: ISOToDate(v) }); this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: v });
} }
}, },
warningInterval: { warningInterval: {
get() { return this.evaluation.warningInterval; }, get() { return this.evaluation.warningInterval; },
@ -344,7 +345,7 @@ export default {
ISOToDatetime, ISOToDatetime,
canEditDocument(document) { canEditDocument(document) {
return 'storedObject' in document ? return 'storedObject' in document ?
this.mime.includes(document.storedObject.type) && document.storedObject.keyInfos.length === 0 : false; this.mime.includes(document.storedObject.type) && document.storedObject.keyInfos.length === 0 : false;
}, },
listAllStatus() { listAllStatus() {
console.log('load all status'); console.log('load all status');
@ -360,16 +361,16 @@ export default {
}, },
buildEditLink(storedObject) { buildEditLink(storedObject) {
return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent( return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
window.location.pathname + window.location.search + window.location.hash); window.location.pathname + window.location.search + window.location.hash);
}, },
submitBeforeGenerate({template}) { submitBeforeGenerate({template}) {
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(buildLink(template, evaluationId, 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation')); window.location.assign(buildLink(template, evaluationId, 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation'));
}; };
return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; }); return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; });
}, },
onInputDocumentTitle(event) { onInputDocumentTitle(event) {
const id = Number(event.target.id); const id = Number(event.target.id);
@ -395,20 +396,20 @@ export default {
}, },
removeDocument(document) { removeDocument(document) {
if (window.confirm("Êtes-vous sûr·e de vouloir supprimer le document qui a pour titre \"" + document.title +"\" ?")) { if (window.confirm("Êtes-vous sûr·e de vouloir supprimer le document qui a pour titre \"" + document.title +"\" ?")) {
this.$store.commit('removeDocument', {key: this.evaluation.key, document: document}); this.$store.commit('removeDocument', {key: this.evaluation.key, document: document});
} }
}, },
goToGenerateWorkflowEvaluationDocument({event, link, workflowName, payload}) { goToGenerateWorkflowEvaluationDocument({event, link, workflowName, payload}) {
const callback = (data) => { const callback = (data) => {
let evaluation = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key); let evaluation = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key);
let updatedDocument = evaluation.documents.find(d => d.key === payload.doc.key); let updatedDocument = evaluation.documents.find(d => d.key === payload.doc.key);
window.location.assign(buildLinkCreate(workflowName, window.location.assign(buildLinkCreate(workflowName,
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', updatedDocument.id)); 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', updatedDocument.id));
}; };
return this.$store.dispatch('submit', callback) return this.$store.dispatch('submit', callback)
.catch(e => { console.log(e); throw e; }); .catch(e => { console.log(e); throw e; });
}, },
}, },
} }
</script> </script>

View File

@ -1,5 +1,5 @@
import { createStore } from 'vuex'; import { createStore } from 'vuex';
import { datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js'; import { dateToISO, ISOToDate, datetimeToISO, ISOToDatetime, intervalDaysToISO, intervalISOToDays } from 'ChillMainAssets/chill/js/date.js';
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 { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js'; import { fetchResults, makeFetch } from 'ChillMainAssets/lib/api/apiMethods.js';
@ -13,9 +13,9 @@ const store = createStore({
state: { state: {
work: window.accompanyingCourseWork, work: window.accompanyingCourseWork,
startDate: window.accompanyingCourseWork.startDate !== null ? startDate: window.accompanyingCourseWork.startDate !== null ?
ISOToDatetime(window.accompanyingCourseWork.startDate.datetime) : null, dateToISO(new Date(window.accompanyingCourseWork.startDate.datetime)) : null,
endDate: window.accompanyingCourseWork.endDate !== null ? endDate: window.accompanyingCourseWork.endDate !== null ?
ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null, dateToISO(new Date(window.accompanyingCourseWork.endDate.datetime)) : null,
note: window.accompanyingCourseWork.note, note: window.accompanyingCourseWork.note,
goalsPicked: window.accompanyingCourseWork.goals, goalsPicked: window.accompanyingCourseWork.goals,
goalsForAction: [], goalsForAction: [],
@ -69,14 +69,15 @@ const store = createStore({
return []; return [];
}, },
buildPayload(state) { buildPayload(state) {
console.log('end date', state.endDate);
return { return {
type: 'accompanying_period_work', type: 'accompanying_period_work',
id: state.work.id, id: state.work.id,
startDate: state.startDate === null ? null : { startDate: state.startDate === null || state.startDate === '' ? null : {
datetime: datetimeToISO(state.startDate) datetime: datetimeToISO(ISOToDate(state.startDate))
}, },
endDate: state.endDate === null ? null : { endDate: state.endDate === null || state.endDate === '' ? null : {
datetime: datetimeToISO(state.endDate) datetime: datetimeToISO(ISOToDate(state.endDate))
}, },
note: state.note, note: state.note,
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})), persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
@ -110,9 +111,9 @@ const store = createStore({
id: e.evaluation.id, id: e.evaluation.id,
type: e.evaluation.type type: e.evaluation.type
}, },
startDate: e.startDate !== null ? { datetime: datetimeToISO(e.startDate) } : null, startDate: e.startDate === null || e.startDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.startDate)) },
endDate: e.endDate !== null ? { datetime: datetimeToISO(e.endDate) } : null, endDate: e.endDate === null || e.endDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.endDate)) },
maxDate: e.maxDate !== null ? { datetime: datetimeToISO(e.maxDate) } : null, maxDate: e.maxDate === null || e.maxDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.maxDate)) },
warningInterval: intervalDaysToISO(e.warningInterval), warningInterval: intervalDaysToISO(e.warningInterval),
comment: e.comment, comment: e.comment,
documents: e.documents documents: e.documents
@ -132,9 +133,9 @@ const store = createStore({
var k = Object.assign(e, { var k = Object.assign(e, {
key: index, key: index,
editEvaluation: false, editEvaluation: false,
startDate: e.startDate !== null ? ISOToDatetime(e.startDate.datetime) : null, startDate: e.startDate !== null ? dateToISO(new Date(e.startDate.datetime)) : null,
endDate: e.endDate !== null ? ISOToDatetime(e.endDate.datetime) : null, endDate: e.endDate !== null ? dateToISO(new Date(e.endDate.datetime)) : null,
maxDate: e.maxDate !== null ? ISOToDatetime(e.maxDate.datetime) : null, maxDate: e.maxDate !== null ? dateToISO(new Date(e.maxDate.datetime)) : null,
warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null, warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null,
documents: e.documents.map((d, docIndex) => { documents: e.documents.map((d, docIndex) => {
return Object.assign(d, { return Object.assign(d, {
@ -264,6 +265,7 @@ const store = createStore({
.startDate = date; .startDate = date;
}, },
setEvaluationEndDate(state, {key, date}) { setEvaluationEndDate(state, {key, date}) {
console.log('commit date', date)
state.evaluationsPicked.find(e => e.key === key) state.evaluationsPicked.find(e => e.key === key)
.endDate = date; .endDate = date;
}, },

View File

@ -66,18 +66,19 @@ export default {
}, },
startDate: { startDate: {
get() { get() {
return [ return this.$store.state.startDate;
this.$store.state.startDate.getFullYear(), // return [
(this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'), // this.$store.state.startDate.getFullYear(),
this.$store.state.startDate.getDate().toString().padStart(2, '0') // (this.$store.state.startDate.getMonth() + 1).toString().padStart(2, '0'),
].join('-'); // this.$store.state.startDate.getDate().toString().padStart(2, '0')
// ].join('-');
}, },
set(value) { set(value) {
let // let
[year, month, day] = value.split('-'), // [year, month, day] = value.split('-'),
dValue = new Date(year, month-1, day); // dValue = new Date(year, month-1, day);
this.$store.dispatch('setStartDate', dValue); this.$store.dispatch('setStartDate', value);
} }
} }
} }

View File

@ -2,7 +2,7 @@ import { createStore } from 'vuex';
import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js'; import { householdMove, fetchHouseholdSuggestionByAccompanyingPeriod, fetchAddressSuggestionByPerson} from './../api.js';
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js' import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods.js'
import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js'; import { fetchHouseholdByAddressReference } from 'ChillPersonAssets/lib/household.js';
import { datetimeToISO } from 'ChillMainAssets/chill/js/date.js'; import { datetimeToISO, dateToISO, ISOToDate } from 'ChillMainAssets/chill/js/date.js';
const debug = process.env.NODE_ENV !== 'production'; const debug = process.env.NODE_ENV !== 'production';
@ -30,7 +30,7 @@ const store = createStore({
} }
return 0; return 0;
}), }),
startDate: new Date(), startDate: dateToISO(new Date()),
/** /**
* Indicates if the destination is: * Indicates if the destination is:
* *
@ -278,7 +278,7 @@ const store = createStore({
type: conc.person.type type: conc.person.type
}, },
start_date: { start_date: {
datetime: datetimeToISO(state.startDate) datetime: state.startDate === null || state.startDate === '' ? null : datetimeToISO(ISOToDate(state.startDate))
} }
}; };
@ -302,7 +302,7 @@ const store = createStore({
}, },
number_of_children: state.numberOfChildren, number_of_children: state.numberOfChildren,
start_date: { start_date: {
datetime: datetimeToISO(state.startDate), datetime: datetimeToISO(ISOToDate(state.startDate)),
}, },
}; };
} }

View File

@ -25,22 +25,6 @@
<div class="item-row separator"> <div class="item-row separator">
<div class="wrap-list"> <div class="wrap-list">
{% if w.createdBy %}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Referrers'|trans }}</h3>
</div>
<div class="wl-col list">
<p class="wl-item">
{% for u in w.referrers %}
{{ u|chill_entity_render_box }}
{% if not loop.last %}, {% endif %}
{% endfor %}
</p>
</div>
</div>
{% endif %}
{%- if w.persons -%} {%- if w.persons -%}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
@ -78,6 +62,22 @@
</div> </div>
{% endif %} {% endif %}
{%- if w.referrers -%}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Referrers'|trans }}</h3>
</div>
<div class="wl-col list">
{% for u in w.referrers %}
<span class="wl-item">
{{ u|chill_entity_render_box }}
{% if not loop.last %}, {% endif %}
</span>
{% endfor %}
</div>
</div>
{% endif %}
{%- if w.socialAction.issue -%} {%- if w.socialAction.issue -%}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">

View File

@ -28,6 +28,15 @@
<span class="badge-thirdparty">{{ w.handlingThierParty|chill_entity_render_box }}</span> <span class="badge-thirdparty">{{ w.handlingThierParty|chill_entity_render_box }}</span>
</li> </li>
{% endif %} {% endif %}
{% if w.referrers %}
<li>
<span class="item-key">{{ 'Referrers'|trans ~ ' : ' }}</span>
{% for u in w.referrers %}
<span class="badge-user">{{ u|chill_entity_render_box }}</span>
{% if not loop.last %}, {% endif %}
{% endfor %}
</li>
{% endif %}
<li class="associated-persons"> <li class="associated-persons">
<span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span> <span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
{% for p in w.persons %} {% for p in w.persons %}

View File

@ -20,7 +20,7 @@
{% elseif period.step == 'CONFIRMED' %} {% elseif period.step == 'CONFIRMED' %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span> <span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% else %} {% else %}
<span class="badge bg-primary">{{- 'Closed'|trans|upper -}}</span> <span class="badge bg-danger">{{- 'Closed'|trans|upper -}}</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -10,12 +10,6 @@
{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %} {% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %}
{% if accompanying_periods_old|length > 0 %} {% if accompanying_periods_old|length > 0 %}
<style>
button[aria-expanded="true"] > span.folded,
button[aria-expanded="false"] > span.unfolded { display: none; }
button[aria-expanded="false"] > span.folded,
button[aria-expanded="true"] > span.unfolded { display: inline; }
</style>
<div class="accordion" id="nonCurrent"> <div class="accordion" id="nonCurrent">
<div class="accordion-item"> <div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ household.id }}"> <h2 class="accordion-header" id="heading_{{ household.id }}">

View File

@ -191,12 +191,6 @@
{% endif %} {% endif %}
{% if old_members|length > 0 %} {% if old_members|length > 0 %}
<style>
button[aria-expanded="true"] > span.folded,
button[aria-expanded="false"] > span.unfolded { display: none; }
button[aria-expanded="false"] > span.folded,
button[aria-expanded="true"] > span.unfolded { display: inline; }
</style>
<div class="accordion" id="nonCurrent"> <div class="accordion" id="nonCurrent">
<div class="accordion-item"> <div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ p == '_none' ? '_none' : p.id }}"> <h2 class="accordion-header" id="heading_{{ p == '_none' ? '_none' : p.id }}">

View File

@ -10,6 +10,157 @@
</li> </li>
{% endmacro %} {% endmacro %}
{% macro accompanying_period(acp, person) %}
{% set app = person.findParticipationForPeriod(acp) %}
<div class="item-row separator">
<div class="wrap-list periods-list">
<div class="wl-row">
<div class="wl-col title">
<h3 class="courseid mb-2">
<i class="fa fa-random fa-fw"></i>
{{ 'Course number'|trans }} {{ acp.id }}
</h3>
</div>
<div class="wl-col list">
<div class="d-flex flex-column justify-content-center">
{% if app != null %}
<div class="date">
{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
</div>
{% endif %}
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %}
{% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }}
{% endif %}
</div>
<div class="ms-auto">
{% if acp.requestoranonymous == false and acp.requestorPerson is same as(person) %}
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
{% endif %}
{% if acp.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
{% if acp.confidential %}
<span class="badge rounded-pill bg-confidential">{{- 'Confidential'|trans|upper -}}</span>
{% endif %}
{% if acp.step == 'DRAFT' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span>
{% endif %}
{% if acp.step == 'CLOSED' %}
<span class="badge bg-danger" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
{% endif %}
</div>
</div>
</div>
{% if acp.user is not null %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="referrer">{{ 'Referrer'|trans }}</h3>
</div>
<div class="wl-col list">
<div class="user">
{{ acp.user|chill_entity_render_box }}
</div>
</div>
</div>
{% endif %}
{% if acp.socialIssues|length > 0 %}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Social issues'|trans }}</h3>
</div>
<div class="wl-col list">
{% for issue in acp.socialIssues %}
{{ issue|chill_entity_render_box }}
{% endfor %}
</div>
</div>
{% endif %}
{% if acp.currentParticipations|length > 1 %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="participants">
{{ 'Participants'|trans }}
</h3>
</div>
<div class="wl-col list">
{% set participating = false %}
{% for part in acp.currentParticipations %}
{% if part.person.id != person.id %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: part.person.id },
action: 'show',
displayBadge: true,
buttonText: part.person|chill_entity_render_string,
isDead: part.person.deathdate is not null
} %}
{% else %}
{% set participating = true %}
{% endif %}
{% endfor %}
{% if participating %}
{{ 'person.and_himself'|trans({'gender': person.gender}) }}
{% endif %}
</div>
</div>
{% endif %}
{% if acp.requestoranonymous == false %}
{% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
<div class="wl-row">
<div class="wl-col title">
<h3>
{% if acp.requestorPerson is not null %}
{{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }}
{% else %}
{{ 'Requestor'|trans({'gender': 'other'})}}
{% endif %}
</h3>
</div>
<div class="wl-col list">
{% if acp.requestorThirdParty is not null %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id },
action: 'show',
displayBadge: true,
buttonText: acp.requestorThirdParty|chill_entity_render_string
} %}
{% else %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: acp.requestorPerson.id },
action: 'show',
displayBadge: true,
buttonText: acp.requestorPerson|chill_entity_render_string,
isDead: acp.requestorPerson.deathdate is not null
} %}
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
<ul class="record_actions record_actions_column">
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>
</li>
</ul>
</div>
</div>
{% endmacro %}
<div class="list-with-period"> <div class="list-with-period">
<h2>{{ title|default('Person search results')|trans }}</h2> <h2>{{ title|default('Person search results')|trans }}</h2>
@ -66,167 +217,53 @@
{#- 'acps' is for AcCompanyingPeriodS #} {#- 'acps' is for AcCompanyingPeriodS #}
{%- set acps = [] %} {%- set acps = [] %}
{%- set acpsClosed = [] %}
{%- for acp in person.accompanyingPeriodInvolved %} {%- for acp in person.accompanyingPeriodInvolved %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %} {%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %}
{%- set acps = acps|merge([acp]) %} {% if acp.step == 'CLOSED' %}
{%- set acpsClosed = acpsClosed|merge([acp]) %}
{% else %}
{%- set acps = acps|merge([acp]) %}
{% endif %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{# add as requestor #} {# add as requestor #}
{% if acps|length > 0 %} {% if acps|length > 0 %}
{% for acp in acps %} {% for acp in acps %}
{% set app = person.findParticipationForPeriod(acp) %} {{ _self.accompanying_period(acp, person) }}
<div class="item-row separator">
<div class="wrap-list periods-list">
<div class="wl-row">
<div class="wl-col title">
<h3 class="courseid mb-2">
<i class="fa fa-random fa-fw"></i>
{{ 'Course number'|trans }} {{ acp.id }}
</h3>
</div>
<div class="wl-col list">
<div class="d-flex flex-column justify-content-center">
{% if app != null %}
<div class="date">
{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
</div>
{% endif %}
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %}
{% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }}
{% endif %}
</div>
<div class="ms-auto">
{% if acp.requestoranonymous == false and acp.requestorPerson is same as(person) %}
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
{% endif %}
{% if acp.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
{% if acp.confidential %}
<span class="badge rounded-pill bg-confidential">{{- 'Confidential'|trans|upper -}}</span>
{% endif %}
{% if acp.step == 'DRAFT' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span>
{% endif %}
{% if acp.step == 'CLOSED' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
{% endif %}
</div>
</div>
</div>
{% if acp.user is not null %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="referrer">{{ 'Referrer'|trans }}</h3>
</div>
<div class="wl-col list">
<div class="user">
{{ acp.user|chill_entity_render_box }}
</div>
</div>
</div>
{% endif %}
{% if acp.socialIssues|length > 0 %}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Social issues'|trans }}</h3>
</div>
<div class="wl-col list">
{% for issue in acp.socialIssues %}
{{ issue|chill_entity_render_box }}
{% endfor %}
</div>
</div>
{% endif %}
{% if acp.currentParticipations|length > 1 %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="participants">
{{ 'Participants'|trans }}
</h3>
</div>
<div class="wl-col list">
{% set participating = false %}
{% for part in acp.currentParticipations %}
{% if part.person.id != person.id %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: part.person.id },
action: 'show',
displayBadge: true,
buttonText: part.person|chill_entity_render_string,
isDead: part.person.deathdate is not null
} %}
{% else %}
{% set participating = true %}
{% endif %}
{% endfor %}
{% if participating %}
{{ 'person.and_himself'|trans({'gender': person.gender}) }}
{% endif %}
</div>
</div>
{% endif %}
{% if acp.requestoranonymous == false %}
{% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
<div class="wl-row">
<div class="wl-col title">
<h3>
{% if acp.requestorPerson is not null %}
{{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }}
{% else %}
{{ 'Requestor'|trans({'gender': 'other'})}}
{% endif %}
</h3>
</div>
<div class="wl-col list">
{% if acp.requestorThirdParty is not null %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id },
action: 'show',
displayBadge: true,
buttonText: acp.requestorThirdParty|chill_entity_render_string
} %}
{% else %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: acp.requestorPerson.id },
action: 'show',
displayBadge: true,
buttonText: acp.requestorPerson|chill_entity_render_string,
isDead: acp.requestorPerson.deathdate is not null
} %}
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
<ul class="record_actions record_actions_column">
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>
</li>
</ul>
</div>
</div>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if acpsClosed|length > 0 %}
<div class="accordion" id="member_{{ person.id }}">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ person.id }}">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse_{{ person.id }}"
aria-expanded="false"
aria-controls="collapse_{{ person.id }}">
<span class="folded">{{ 'periods.show closed periods'|trans({ 'nb_items': acpsClosed|length }) }}</span>
<span class="unfolded text-secondary">{{ 'periods.hide closed periods'|trans({ 'nb_items': acpsClosed|length }) }}</span>
</button>
</h2>
<div id="collapse_{{ person.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_{{ person.id }}"
data-bs-parent="#nonCurrent">
{% for acp in acpsClosed %}
{{ _self.accompanying_period(acp, person) }}
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -40,6 +40,7 @@ class SocialActionNormalizer implements NormalizerAwareInterface, NormalizerInte
'desactivationDate' => $this->normalizer->normalize($socialAction->getDesactivationDate(), $format, $context), 'desactivationDate' => $this->normalizer->normalize($socialAction->getDesactivationDate(), $format, $context),
'title' => $socialAction->getTitle(), 'title' => $socialAction->getTitle(),
'issue' => $this->normalizer->normalize($socialAction->getIssue(), $format, $context), 'issue' => $this->normalizer->normalize($socialAction->getIssue(), $format, $context),
'ordering' => $socialAction->getOrdering(),
]; ];
case 'docgen': case 'docgen':

View File

@ -114,3 +114,19 @@ household_composition:
few {# enfants dans le ménage} few {# enfants dans le ménage}
other {# enfants dans le ménage} other {# enfants dans le ménage}
} }
periods:
show closed periods: >-
{nb_items, plural,
=0 {Aucun parcours clôturé}
one {Montrer un parcours clôturé}
many {Montrer # parcours clôturés}
other {Montrer # parcours clôturés}
}
hide closed periods: >-
{nb_items, plural,
=0 {Aucun parcours clôturé}
one {Masquer un parcours clôturé}
many {Masquer # parcours clôturés}
other {Masquer # parcours clôturés}
}

View File

@ -214,7 +214,7 @@ No requestor: Pas de demandeur
No resources: "Pas d'interlocuteurs privilégiés" No resources: "Pas d'interlocuteurs privilégiés"
Persons associated: Usagers concernés Persons associated: Usagers concernés
Referrer: Référent Referrer: Référent
Referrers: Référents Referrers: Agents traitants
Some peoples does not belong to any household currently. Add them to an household soon: Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur ménage dès que possible. Some peoples does not belong to any household currently. Add them to an household soon: Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur ménage dès que possible.
Add to household now: Ajouter à un ménage Add to household now: Ajouter à un ménage
Any resource for this accompanying course: Aucun interlocuteur privilégié pour ce parcours Any resource for this accompanying course: Aucun interlocuteur privilégié pour ce parcours
@ -465,6 +465,9 @@ fix it: Compléter
accompanying_course: accompanying_course:
administrative_location: Localisation administrative administrative_location: Localisation administrative
comment is pinned: Le commentaire est épinglé comment is pinned: Le commentaire est épinglé
show: Montrer
hide: Masquer
closed periods: parcours clôturer
# Accompanying Course comments # Accompanying Course comments
Accompanying Course Comment: Commentaire Accompanying Course Comment: Commentaire