privateComment for action (not working yet)

This commit is contained in:
Julie Lenaerts 2022-04-27 11:52:01 +02:00
parent 4dc56db018
commit c56a125a78
3 changed files with 42 additions and 25 deletions

View File

@ -150,12 +150,12 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li v-for="p in personsReachables" :key="p.id"> <li v-for="p in personsReachables" :key="p.id">
<div class="form-check"> <div class="form-check">
<input v-model="personsPicked" :value="p.id" type="checkbox" class="me-2 form-check-input" :id="'person_check'+p.id"> <input v-model="personsPicked" :value="p.id" type="checkbox" class="me-2 form-check-input" :id="'person_check'+p.id">
<label :for="'person_check'+p.id" class="form-check-label"> <label :for="'person_check'+p.id" class="form-check-label">
<person-text :person="p"></person-text> <person-text :person="p"></person-text>
</label> </label>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>
@ -283,18 +283,18 @@
</div> </div>
</div> </div>
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li> <li>
<list-workflow-modal <list-workflow-modal
:workflows="this.work.workflows" :workflows="this.work.workflows"
:allowCreate="true" :allowCreate="true"
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork" relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork"
:relatedEntityId="this.work.id" :relatedEntityId="this.work.id"
:workflowsAvailables="this.work.workflows_availables" :workflowsAvailables="this.work.workflows_availables"
:preventDefaultMoveToGenerate="true" :preventDefaultMoveToGenerate="true"
@go-to-generate-workflow="goToGenerateWorkflow" @go-to-generate-workflow="goToGenerateWorkflow"
></list-workflow-modal> ></list-workflow-modal>
</li> </li>
<li v-if="!isPosting"> <li v-if="!isPosting">
<button class="btn btn-save" @click="submit"> <button class="btn btn-save" @click="submit">
@ -426,8 +426,8 @@ export default {
}, },
}; };
}, },
computed: { computed: {
...mapState([ ...mapState([
'work', 'work',
'resultsForAction', 'resultsForAction',
'evaluationsForAction', 'evaluationsForAction',
@ -470,6 +470,14 @@ export default {
this.$store.commit('setNote', v); this.$store.commit('setNote', v);
} }
}, },
privateComment: {
get() {
return this.$store.state.privateComment;
},
set(v) {
this.$store.commit('setPrivateComment', v);
}
},
availableForCheckGoal() { availableForCheckGoal() {
let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id); let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id);
@ -530,12 +538,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

@ -17,6 +17,7 @@ const store = createStore({
endDate: window.accompanyingCourseWork.endDate !== null ? endDate: window.accompanyingCourseWork.endDate !== null ?
ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null, ISOToDatetime(window.accompanyingCourseWork.endDate.datetime) : null,
note: window.accompanyingCourseWork.note, note: window.accompanyingCourseWork.note,
privateComment: window.accompanyingCourseWork.privateComment,
goalsPicked: window.accompanyingCourseWork.goals, goalsPicked: window.accompanyingCourseWork.goals,
goalsForAction: [], goalsForAction: [],
resultsPicked: window.accompanyingCourseWork.results, resultsPicked: window.accompanyingCourseWork.results,
@ -79,6 +80,7 @@ const store = createStore({
datetime: datetimeToISO(state.endDate) datetime: datetimeToISO(state.endDate)
}, },
note: state.note, note: state.note,
privateComment: state.privateComment,
persons: state.personsPicked.map(p => ({id: p.id, type: p.type})), persons: state.personsPicked.map(p => ({id: p.id, type: p.type})),
handlingThierParty: state.handlingThirdParty === null ? null : { handlingThierParty: state.handlingThirdParty === null ? null : {
id: state.handlingThirdParty.id, id: state.handlingThirdParty.id,
@ -296,6 +298,9 @@ const store = createStore({
setNote(state, note) { setNote(state, note) {
state.note = note; state.note = note;
}, },
setPrivateComment(state, privateComment) {
state.privateComment = privateComment;
},
setHandlingThirdParty(state, thirdParty) { setHandlingThirdParty(state, thirdParty) {
state.handlingThirdParty = thirdParty; state.handlingThirdParty = thirdParty;
}, },
@ -453,6 +458,8 @@ const store = createStore({
; ;
commit('setIsPosting', true); commit('setIsPosting', true);
console.log('payload', payload);
return makeFetch('PUT', url, payload) return makeFetch('PUT', url, payload)
.then(data => { .then(data => {
if (typeof(callback) !== 'undefined') { if (typeof(callback) !== 'undefined') {

View File

@ -223,6 +223,8 @@ components:
- "accompanying_period_work" - "accompanying_period_work"
note: note:
type: string type: string
privateComment:
type: string
startDate: startDate:
$ref: "#/components/schemas/Date" $ref: "#/components/schemas/Date"
endDate: endDate: