create document from evaluation

This commit is contained in:
2021-08-19 19:47:06 +02:00
parent 364346d0aa
commit a797143511
6 changed files with 106 additions and 34 deletions

View File

@@ -67,19 +67,15 @@
<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>
<template v-for="t in getTemplatesAvailaibleForEvaluation">
<option v-bind:value="t.id">{{ t.name.fr }}</option>
</template>
</select>
<button class="btn btn-update btn-sm change-icon" type="button"><i class="fa fa-fw fa-cog"></i></button>
<button v-if="canGenerate" class="btn btn-update btn-sm change-icon" type="button" @click="generateDocument"><i class="fa fa-fw fa-cog"></i></button>
<button v-else class="btn btn-update btn-sm change-icon" type="button" disabled ><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>
@@ -88,6 +84,7 @@
import {dateToISO, ISOToDate, ISOToDatetime} from 'ChillMainAssets/chill/js/date.js';
import CKEditor from '@ckeditor/ckeditor5-vue';
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
import { mapGetters, mapState } from 'vuex';
const i18n = {
messages: {
@@ -119,25 +116,19 @@ export default {
data() {
return {
editor: ClassicEditor,
//evaluation: {
// status: null,
// startDate: null,
// endDate: null,
// maxDate: null,
// warningInterval: null,
// comment: null,
// template: null,
// //documents: null
//}
template: null,
}
},
computed: {
/*
status: {
get() { return this.evaluation.status; },
set(v) { this.evaluation.status = v; }
...mapGetters([
'getTemplatesAvailaibleForEvaluation'
]),
...mapState([
'isPosting'
]),
canGenerate() {
return !this.$store.state.isPosting && this.template !== null;
},
*/
startDate: {
get() {
return dateToISO(this.evaluation.startDate);
@@ -171,10 +162,6 @@ export default {
get() { return this.evaluation.comment; },
set(v) { this.$store.commit('setEvaluationComment', { key: this.evaluation.key, comment: v }); }
},
template: {
get() { return this.evaluation.template; },
set(v) { this.evaluation.template = v; }
},
},
methods: {
listAllStatus() {
@@ -189,6 +176,10 @@ export default {
})
;
},
generateDocument() {
console.log('template picked', this.template);
this.$store.dispatch('generateDocument', { key: this.evaluation.key, templateId: this.template})
}
},
mounted() {
//this.listAllStatus();