diff --git a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php
index 40d8aa6cd..92478d787 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Entity/AsideActivity.php
@@ -13,7 +13,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity
* @ORM\Table(schema="chill_asideactivity")
*/
-final class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
+class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
{
/**
* @ORM\Id
diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.js b/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.js
index ec66da770..e31132b67 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/js/date.js
@@ -13,15 +13,15 @@
*
*/
const dateToISO = (date) => {
- if (null === date) {
- return null;
- }
+ if (null === date) {
+ return null;
+ }
- return [
- date.getFullYear(),
- (date.getMonth() + 1).toString().padStart(2, '0'),
- date.getDate().toString().padStart(2, '0')
- ].join('-');
+ return [
+ date.getFullYear(),
+ (date.getMonth() + 1).toString().padStart(2, '0'),
+ date.getDate().toString().padStart(2, '0')
+ ].join('-');
};
/**
@@ -30,10 +30,10 @@ const dateToISO = (date) => {
* **Experimental**
*/
const ISOToDate = (str) => {
- let
- [year, month, day] = str.split('-');
-
- return new Date(year, month-1, day);
+ let
+ [year, month, day] = str.split('-');
+
+ return new Date(year, month-1, day);
}
/**
@@ -41,53 +41,100 @@ const ISOToDate = (str) => {
*
*/
const ISOToDatetime = (str) => {
- if (null === str) {
- return null;
- }
+ if (null === str) {
+ return null;
+ }
- let
- [cal, times] = str.split('T'),
- [year, month, date] = cal.split('-'),
- [time, timezone] = times.split(times.charAt(8)),
- [hours, minutes, seconds] = time.split(':')
- ;
+ let
+ [cal, times] = str.split('T'),
+ [year, month, date] = cal.split('-'),
+ [time, timezone] = times.split(times.charAt(8)),
+ [hours, minutes, seconds] = time.split(':')
+ ;
- return new Date(year, month-1, date, hours, minutes, seconds);
+ return new Date(year, month-1, date, hours, minutes, seconds);
}
/**
* Convert a date to ISO8601, valid for usage in api
- *
+ *
*/
const datetimeToISO = (date) => {
- let cal, time, offset;
- cal = [
- date.getFullYear(),
- (date.getMonth() + 1).toString().padStart(2, '0'),
- date.getDate().toString().padStart(2, '0')
- ].join('-');
-
- time = [
- date.getHours().toString().padStart(2, '0'),
- date.getMinutes().toString().padStart(2, '0'),
- date.getSeconds().toString().padStart(2, '0')
- ].join(':');
+ let cal, time, offset;
+ cal = [
+ date.getFullYear(),
+ (date.getMonth() + 1).toString().padStart(2, '0'),
+ date.getDate().toString().padStart(2, '0')
+ ].join('-');
- offset = [
- date.getTimezoneOffset() <= 0 ? '+' : '-',
- Math.abs(Math.floor(date.getTimezoneOffset() / 60)).toString().padStart(2, '0'),
- ':',
- Math.abs(date.getTimezoneOffset() % 60).toString().padStart(2, '0'),
- ].join('');
-
- let x = cal + 'T' + time + offset;
+ time = [
+ date.getHours().toString().padStart(2, '0'),
+ date.getMinutes().toString().padStart(2, '0'),
+ date.getSeconds().toString().padStart(2, '0')
+ ].join(':');
- return x;
+ offset = [
+ date.getTimezoneOffset() <= 0 ? '+' : '-',
+ Math.abs(Math.floor(date.getTimezoneOffset() / 60)).toString().padStart(2, '0'),
+ ':',
+ Math.abs(date.getTimezoneOffset() % 60).toString().padStart(2, '0'),
+ ].join('');
+
+ let x = cal + 'T' + time + offset;
+
+ return x;
};
+const intervalDaysToISO = (days) => {
+ if (null === days) {
+ return null;
+ }
+
+ return `PD${days}`;
+}
+
+const intervalISOToDays = (str) => {
+ if (null === str) {
+ return null
+ }
+
+ let days = 0;
+ let isDate = true;
+ for (let i = 0; i < str.length; i = i + 1) {
+ // we do not take time into account
+ if (!isDate) {
+ continue;
+ }
+ switch (str.charAt(i)) {
+ case 'P':
+ isDate = true;
+ break;
+ case 'Y':
+ i = i+1;
+ days = days + Number.parseInt(str.charAt(i)) * 365;
+ break;
+ case 'M':
+ i = i+1;
+ days = days + Number.parseInt(str.charAt(i)) * 30;
+ break;
+ case 'D':
+ i = i+1;
+ days = days + Number.parseInt(str.charAt(i));
+ break;
+ case 'T':
+ isDate = false;
+ break;
+ }
+ }
+
+ return days;
+}
+
export {
- dateToISO,
- ISOToDate,
- ISOToDatetime,
- datetimeToISO
+ dateToISO,
+ ISOToDate,
+ ISOToDatetime,
+ datetimeToISO,
+ intervalISOToDays,
+ intervalDaysToISO,
};
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
index 500e84e76..651943724 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
@@ -96,7 +96,7 @@
{{ $t('available_evaluations_text') }}
- -
+
-
{{ e.title.fr }}
@@ -349,12 +349,6 @@ export default {
return this.$store.state.goalsForAction.filter(g => !pickedIds.includes(g.id));
},
- availableForCheckEvaluation() {
- //console.log('evaluationsPicked', this.$store.state.evaluationsPicked);
- //console.log('evaluationsForAction', this.$store.state.evaluationsForAction);
- let pickedIds = this.$store.state.evaluationsPicked.map(e => e.evaluation.id);
- return this.$store.state.evaluationsForAction.filter(e => !pickedIds.includes(e.id));
- },
pickedEvaluations() {
return this.$store.state.evaluationsPicked;
},
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
index 401cf2b7b..f7e0902f4 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
@@ -1,10 +1,10 @@
-
+
{{ evaluation.evaluation.title.fr }}
-
+
- {{ $t('startDate') }} :
@@ -26,7 +26,11 @@
- {{ $t('comment') }} :
- - {{ evaluation.comment }}
+ -
+
+ {{ evaluation.comment }}
+
+
-
-
+
+
-
@@ -70,12 +74,10 @@ export default {
components: {
FormEvaluation
},
- props: ['evaluation', 'editEvaluation'],
+ props: ['evaluation'],
i18n,
data() {
- return {
- editEvaluation: false,
- };
+ return {};
},
computed: {
pickedEvaluations() {
@@ -84,11 +86,12 @@ export default {
},
methods: {
removeEvaluation(e) {
+ console.log(e);
this.$store.commit('removeEvaluation', e);
return;
},
toggleEditEvaluation(e) {
- this.editEvaluation = !this.editEvaluation;
+ this.$store.commit('toggleEvaluationEdit', { key: this.evaluation.key });
},
submitForm() {
this.toggleEditEvaluation();
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
index 8cabc92c9..51480e442 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
@@ -164,22 +164,16 @@ export default {
},
warningInterval: {
get() { return this.evaluation.warningInterval; },
- set(v) { this.evaluation.warningInterval = v; }
+ set(v) { this.$store.commit('setEvaluationWarningInterval', { key: this.evaluation.key, days: v }); }
},
comment: {
get() { return this.evaluation.comment; },
- set(v) { this.evaluation.comment = v; }
+ set(v) { this.$store.commit('setEvaluationComment', { key: this.evaluation.key, 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() {
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
index 71a97ea21..c5d5658d1 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
@@ -179,31 +179,44 @@ const store = createStore({
type: "accompanying_period_work_evaluation",
key: state.evaluationsPicked.length + 1,
evaluation: evaluation,
- "startDate": null,
- "endDate": null,
- "maxDate": null,
- "warningInterval": null,
- "comment": "",
+ startDate: null,
+ endDate: null,
+ maxDate: null,
+ warningInterval: null,
+ comment: "",
+ editEvaluation: true,
};
state.evaluationsPicked.push(e);
console.log('ep', state.evaluationsPicked);
},
removeEvaluation(state, evaluation) {
- state.evaluationsPicked = state.evaluationsPicked.filter(e => e.id !== evaluation.id);
+ state.evaluationsPicked = state.evaluationsPicked.filter(e => e.key !== evaluation.key);
console.log('ep', state.evaluationsPicked);
},
setEvaluationStartDate(state, {key, date}) {
- state.evaluationsPicked.find(e => e.key == key)
+ state.evaluationsPicked.find(e => e.key === key)
.startDate = date;
},
setEvaluationEndDate(state, {key, date}) {
- state.evaluationsPicked.find(e => e.key == key)
+ state.evaluationsPicked.find(e => e.key === key)
.endDate = date;
},
setEvaluationMaxDate(state, {key, date}) {
- state.evaluationsPicked.find(e => e.key == key)
+ state.evaluationsPicked.find(e => e.key === key)
.maxDate = date;
},
+ setEvaluationWarningInterval(state, {key, days}) {
+ state.evaluationsPicked.find(e => e.key === key)
+ .warningInterval = days;
+ },
+ setEvaluationComment(state, {key, comment}) {
+ state.evaluationsPicked.find(e => e.key === key)
+ .comment = comment;
+ },
+ toggleEvaluationEdit(state, {key}) {
+ let evaluation = state.evaluationsPicked.find(e => e.key === key);
+ evaluation.editEvaluation = !evaluation.editEvaluation;
+ },
setPersonsPickedIds(state, ids) {
//console.log('persons ids', ids);
state.personsPicked = state.personsReachables