mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
person: suggest entities for requestor
This commit is contained in:
parent
0ad7ca6235
commit
4abb1a7a57
@ -133,6 +133,17 @@
|
|||||||
<label class="chill-no-data-statement">{{ $t('requestor.counter') }}</label>
|
<label class="chill-no-data-statement">{{ $t('requestor.counter') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="accompanyingCourse.requestor === null && suggestedEntities.length > 0">
|
||||||
|
<ul class="list-suggest add-items">
|
||||||
|
<li v-for="p in suggestedEntities" :key="uniqueId(p)" @click="addSuggestedEntity(p)">
|
||||||
|
<span class="badge bg-primary" style="cursor: pointer;">
|
||||||
|
<i class="fa fa-plus fa-fw text-success"></i>
|
||||||
|
{{ p.text }}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<add-persons v-if="accompanyingCourse.requestor === null"
|
<add-persons v-if="accompanyingCourse.requestor === null"
|
||||||
buttonTitle="requestor.add_requestor"
|
buttonTitle="requestor.add_requestor"
|
||||||
@ -153,6 +164,7 @@ import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
|||||||
import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue';
|
import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue';
|
||||||
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
|
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
|
||||||
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
||||||
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Requestor',
|
name: 'Requestor',
|
||||||
@ -177,6 +189,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
suggestedEntities: state => [
|
||||||
|
...state.accompanyingCourse.participations.map(p => p.person),
|
||||||
|
...state.accompanyingCourse.resources.map(r => r.resource)
|
||||||
|
]
|
||||||
|
.filter((e) => e !== null)
|
||||||
|
}),
|
||||||
accompanyingCourse() {
|
accompanyingCourse() {
|
||||||
return this.$store.state.accompanyingCourse
|
return this.$store.state.accompanyingCourse
|
||||||
},
|
},
|
||||||
@ -227,6 +246,19 @@ export default {
|
|||||||
this.$toast.open({message: 'An error occurred'})
|
this.$toast.open({message: 'An error occurred'})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
addSuggestedEntity(e) {
|
||||||
|
this.$store.dispatch('addRequestor', { result: e, type: e.type }) //TODO check person | thirdparty
|
||||||
|
.catch(({name, violations}) => {
|
||||||
|
if (name === 'ValidationException' || name === 'AccessException') {
|
||||||
|
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
uniqueId(e) {
|
||||||
|
return `${e.type}-${e.id}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user