mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add workflow on evaluationdocument in UI
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
<h5>{{ $t('Documents') }} :</h5>
|
||||
|
||||
<div class="flex-table">
|
||||
<div class="item-bloc" v-for="(d, i) in evaluation.documents" :key="i">
|
||||
<div class="item-bloc" v-for="(d, i) in evaluation.documents" :key="d.key">
|
||||
<div class="item-row">
|
||||
<div class="input-group input-group-lg mb-3">
|
||||
<div>
|
||||
@@ -86,13 +86,23 @@
|
||||
</div>
|
||||
<div class="item-col">
|
||||
<ul class="record_actions" >
|
||||
<li>
|
||||
<a :href="buildEditLink(d.storedObject)" class="btn btn-action btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
<li v-if="d.workflows_availables.length > 0">
|
||||
<list-workflow-modal
|
||||
:workflows="d.workflows"
|
||||
:allowCreate="true"
|
||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument"
|
||||
:relatedEntityId="d.id"
|
||||
:workflowsAvailables="d.workflows_availables"
|
||||
:preventDefaultMoveToGenerate="true"
|
||||
:goToGenerateWorkflowPayload="{doc: d}"
|
||||
@go-to-generate-workflow="goToGenerateWorkflowEvaluationDocument"
|
||||
></list-workflow-modal>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-sm btn-delete" @click="removeDocument(d)">
|
||||
<a :href="buildEditLink(d.storedObject)" class="btn btn-wopilink"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-delete" @click="removeDocument(d)">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -142,6 +152,8 @@ import { mapGetters, mapState } from 'vuex';
|
||||
import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue';
|
||||
import {buildLink} from 'ChillDocGeneratorAssets/lib/document-generator';
|
||||
import AddAsyncUpload from 'ChillDocStoreAssets/vuejs/_components/AddAsyncUpload.vue';
|
||||
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
|
||||
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
@@ -175,7 +187,8 @@ export default {
|
||||
components: {
|
||||
ckeditor: CKEditor.component,
|
||||
PickTemplate,
|
||||
AddAsyncUpload
|
||||
AddAsyncUpload,
|
||||
ListWorkflowModal,
|
||||
},
|
||||
i18n,
|
||||
data() {
|
||||
@@ -189,9 +202,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.evaluation)
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'isPosting'
|
||||
@@ -279,7 +289,18 @@ export default {
|
||||
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});
|
||||
}
|
||||
}
|
||||
},
|
||||
goToGenerateWorkflowEvaluationDocument({event, link, workflowName, payload}) {
|
||||
const callback = (data) => {
|
||||
let evaluation = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key);
|
||||
let updatedDocument = evaluation.documents.find(d => d.key === payload.doc.key);
|
||||
window.location.assign(buildLinkCreate(workflowName,
|
||||
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', updatedDocument.id));
|
||||
};
|
||||
|
||||
return this.$store.dispatch('submit', callback)
|
||||
.catch(e => { console.log(e); throw e; });
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@@ -131,6 +131,11 @@ const store = createStore({
|
||||
endDate: e.endDate !== null ? ISOToDatetime(e.endDate.datetime) : null,
|
||||
maxDate: e.maxDate !== null ? ISOToDatetime(e.maxDate.datetime) : null,
|
||||
warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null,
|
||||
documents: e.documents.map((d, dindex) => {
|
||||
return Object.assign(d, {
|
||||
key: index
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
return k;
|
||||
@@ -199,16 +204,22 @@ const store = createStore({
|
||||
found.results = found.results.filter(r => r.id !== result.id);
|
||||
},
|
||||
addDocument(state, payload) {
|
||||
state.evaluationsPicked.find(e => e.key === payload.key).documents.push(payload.document);
|
||||
let evaluation = state.evaluationsPicked.find(e => e.key === payload.key);
|
||||
evaluation.documents.push(Object.assign(
|
||||
payload.document, {
|
||||
key: evaluation.documents.length + 1,
|
||||
workflows_availables: state.work.workflows_availables_evaluation_documents,
|
||||
workflows: [],
|
||||
}));
|
||||
},
|
||||
removeDocument(state, payload) {
|
||||
let evaluations = state.evaluationsPicked.find(e => e.key === payload.key);
|
||||
removeDocument(state, {key, document}) {
|
||||
let evaluations = state.evaluationsPicked.find(e => e.key === key);
|
||||
|
||||
if (evaluations === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
evaluations.documents = evaluations.documents.filter(d => d.id !== payload.document.id);
|
||||
evaluations.documents = evaluations.documents.filter(d => d.key !== document.key);
|
||||
},
|
||||
addEvaluation(state, evaluation) {
|
||||
let e = {
|
||||
|
Reference in New Issue
Block a user