fix evaluation datepickers in edit

This commit is contained in:
Julie Lenaerts 2022-04-20 13:32:51 +02:00
parent bc550ea42a
commit 0ce23230da
3 changed files with 50 additions and 48 deletions

View File

@ -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 this.evaluation.startDate; console.log('evaluation', this.evaluation);
}, return this.evaluation.startDate;
set(v) { },
this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: v }); set(v) {
} this.$store.commit('setEvaluationStartDate', { key: this.evaluation.key, date: v });
}
}, },
endDate: { endDate: {
get() { get() {
return this.evaluation.endDate; return this.evaluation.endDate;
}, },
set(v) { set(v) {
this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: v }); this.$store.commit('setEvaluationEndDate', { key: this.evaluation.key, date: v });
} }
}, },
maxDate: { maxDate: {
get() { get() {
return this.evaluation.maxDate; return this.evaluation.maxDate;
}, },
set(v) { set(v) {
this.$store.commit('setEvaluationMaxDate', { key: this.evaluation.key, date: 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

@ -132,9 +132,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 +264,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;
}, },