mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
getter/setter for form input date
This commit is contained in:
parent
533865c41a
commit
436d583f65
@ -7,37 +7,26 @@
|
|||||||
<div v-if="!editEvaluation">
|
<div v-if="!editEvaluation">
|
||||||
<dl class="item-details definition-inline">
|
<dl class="item-details definition-inline">
|
||||||
|
|
||||||
<dt v-if="e.startDate">
|
<dt v-if="e.startDate">{{ $t('startDate') }} :</dt>
|
||||||
{{ $t('startDate') }} :</dt>
|
<dd v-if="e.startDate">{{ $d(e.startDate.datetime, 'short') }}</dd>
|
||||||
<dd v-if="e.startDate">
|
|
||||||
{{ e.startDate.datetime }}</dd>
|
|
||||||
|
|
||||||
<dt v-if="e.endDate">
|
<dt v-if="e.endDate">{{ $t('endDate') }} :</dt>
|
||||||
{{ $t('endDate') }} :</dt>
|
<dd v-if="e.endDate">{{ $d(e.endDate.datetime, 'short') }}</dd>
|
||||||
<dd v-if="e.endDate">
|
|
||||||
{{ e.endDate.datetime }}</dd>
|
|
||||||
|
|
||||||
<dt v-if="e.maxDate">
|
<dt v-if="e.maxDate">{{ $t('maxDate') }} :</dt>
|
||||||
{{ $t('maxDate') }} :</dt>
|
<dd v-if="e.maxDate">{{ $d(e.maxDate.datetime, 'short') }}</dd>
|
||||||
<dd v-if="e.maxDate">
|
|
||||||
{{ e.maxDate.datetime }}</dd>
|
|
||||||
|
|
||||||
<dt v-if="e.warningInterval">
|
<dt v-if="e.warningInterval">{{ $t('warningInterval') }} :</dt>
|
||||||
{{ $t('warningInterval') }} :</dt>
|
<dd v-if="e.warningInterval">{{ e.warningInterval }}</dd>
|
||||||
<dd v-if="e.warningInterval">
|
|
||||||
{{ e.warningInterval }}</dd>
|
|
||||||
|
|
||||||
<dt v-if="e.documents && e.documents.length > 0">
|
<dt v-if="e.documents && e.documents.length > 0">{{ $t('documents') }} :</dt>
|
||||||
{{ $t('documents') }} :</dt>
|
<dd v-if="e.documents && e.documents.length > 0">{{ e.documents.length }}</dd>
|
||||||
<dd v-if="e.documents && e.documents.length > 0">
|
|
||||||
{{ e.documents.length }}</dd>
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="item-details">
|
<dl class="item-details">
|
||||||
<dt v-if="e.comment">
|
|
||||||
{{ $t('comment') }} :</dt>
|
<dt v-if="e.comment">{{ $t('comment') }} :</dt>
|
||||||
<dd v-if="e.comment">
|
<dd v-if="e.comment">{{ e.comment }}</dd>
|
||||||
{{ e.comment }}</dd>
|
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
@ -47,8 +36,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="editEvaluation">
|
<div v-if="editEvaluation">
|
||||||
<form-evaluation ref="FormEvaluation" :key="e.id">
|
<form-evaluation ref="FormEvaluation" :key="e.id" :evaluation="e"></form-evaluation>
|
||||||
</form-evaluation>
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<button class="btn btn-sm btn-update" @click="submitForm">{{ $t('action.save') }}</button>
|
<button class="btn btn-sm btn-update" @click="submitForm">{{ $t('action.save') }}</button>
|
||||||
@ -99,7 +87,7 @@ export default {
|
|||||||
this.$store.commit('removeEvaluation', e);
|
this.$store.commit('removeEvaluation', e);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
toggleEditEvaluation() {
|
toggleEditEvaluation(e) {
|
||||||
this.editEvaluation = !this.editEvaluation;
|
this.editEvaluation = !this.editEvaluation;
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
|
||||||
import CKEditor from '@ckeditor/ckeditor5-vue';
|
import CKEditor from '@ckeditor/ckeditor5-vue';
|
||||||
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
|
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ const i18n = {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "FormEvaluation",
|
name: "FormEvaluation",
|
||||||
props: [],
|
props: ['evaluation'],
|
||||||
components: {
|
components: {
|
||||||
ckeditor: CKEditor.component,
|
ckeditor: CKEditor.component,
|
||||||
},
|
},
|
||||||
@ -118,34 +119,57 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
editor: ClassicEditor,
|
editor: ClassicEditor,
|
||||||
evaluation: {
|
//evaluation: {
|
||||||
status: null,
|
// status: null,
|
||||||
startDate: null,
|
// startDate: null,
|
||||||
endDate: null,
|
// endDate: null,
|
||||||
maxDate: null,
|
// maxDate: null,
|
||||||
warningInterval: null,
|
// warningInterval: null,
|
||||||
comment: null,
|
// comment: null,
|
||||||
template: null,
|
// template: null,
|
||||||
//documents: null
|
// //documents: null
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
/*
|
||||||
status: {
|
status: {
|
||||||
get() { return this.evaluation.status; },
|
get() { return this.evaluation.status; },
|
||||||
set(v) { this.evaluation.status = v; }
|
set(v) { this.evaluation.status = v; }
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
startDate: {
|
startDate: {
|
||||||
get() { return this.evaluation.startDate; },
|
get() {
|
||||||
set(v) { this.evaluation.startDate = v; }
|
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: {
|
endDate: {
|
||||||
get() { return this.evaluation.endDate; },
|
get() {
|
||||||
set(v) { this.evaluation.endDate = v; }
|
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: {
|
maxDate: {
|
||||||
get() { return this.evaluation.maxDate; },
|
get() {
|
||||||
set(v) { this.evaluation.maxDate = v; }
|
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: {
|
warningInterval: {
|
||||||
get() { return this.evaluation.warningInterval; },
|
get() { return this.evaluation.warningInterval; },
|
||||||
@ -181,6 +205,7 @@ export default {
|
|||||||
},
|
},
|
||||||
saveEvaluation() {
|
saveEvaluation() {
|
||||||
console.log('save evaluation');
|
console.log('save evaluation');
|
||||||
|
|
||||||
console.log('dispatch action: post/patch/put evaluation');
|
console.log('dispatch action: post/patch/put evaluation');
|
||||||
console.log('commit mutation: update state.mutation');
|
console.log('commit mutation: update state.mutation');
|
||||||
}
|
}
|
||||||
|
@ -84,15 +84,29 @@ const store = createStore({
|
|||||||
},
|
},
|
||||||
results: g.results.map(r => ({id: r.id, type: r.type})),
|
results: g.results.map(r => ({id: r.id, type: r.type})),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (g.id !== undefined) {
|
if (g.id !== undefined) {
|
||||||
o.id = g.id;
|
o.id = g.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}),
|
}),
|
||||||
accompanyingPeriodWorkEvaluations: state.evaluationsPicked.map(e => {
|
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;
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -221,9 +235,7 @@ const store = createStore({
|
|||||||
socialActionId = getters.socialAction.id,
|
socialActionId = getters.socialAction.id,
|
||||||
url = `/api/1.0/person/social-work/goal/by-social-action/${socialActionId}.json`
|
url = `/api/1.0/person/social-work/goal/by-social-action/${socialActionId}.json`
|
||||||
;
|
;
|
||||||
|
|
||||||
//console.log(url);
|
//console.log(url);
|
||||||
|
|
||||||
window
|
window
|
||||||
.fetch(
|
.fetch(
|
||||||
url
|
url
|
||||||
@ -245,9 +257,7 @@ const store = createStore({
|
|||||||
let
|
let
|
||||||
url = `/api/1.0/person/social-work/result/by-goal/${goal.id}.json`
|
url = `/api/1.0/person/social-work/result/by-goal/${goal.id}.json`
|
||||||
;
|
;
|
||||||
|
|
||||||
//console.log(url);
|
//console.log(url);
|
||||||
|
|
||||||
window.fetch(url)
|
window.fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
@ -267,9 +277,7 @@ const store = createStore({
|
|||||||
socialActionId = getters.socialAction.id,
|
socialActionId = getters.socialAction.id,
|
||||||
url = `/api/1.0/person/social-work/result/by-social-action/${socialActionId}.json`
|
url = `/api/1.0/person/social-work/result/by-social-action/${socialActionId}.json`
|
||||||
;
|
;
|
||||||
|
|
||||||
//console.log(url);
|
//console.log(url);
|
||||||
|
|
||||||
window.fetch(url)
|
window.fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
@ -306,10 +314,8 @@ const store = createStore({
|
|||||||
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json`,
|
url = `/api/1.0/person/accompanying-course/work/${state.work.id}.json`,
|
||||||
errors = []
|
errors = []
|
||||||
;
|
;
|
||||||
|
|
||||||
//console.log('action submitting', payload, url);
|
//console.log('action submitting', payload, url);
|
||||||
commit('setIsPosting', true);
|
commit('setIsPosting', true);
|
||||||
|
|
||||||
window.fetch(url, {
|
window.fetch(url, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user