Merge remote-tracking branch 'origin/master' into issue577_user_admin

This commit is contained in:
2022-05-27 16:05:49 +02:00
35 changed files with 635 additions and 47 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -143,6 +144,12 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
*/
private Collection $persons;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
* @Serializer\Groups({"read", "accompanying_period_work:edit"})
*/
private PrivateCommentEmbeddable $privateComment;
/**
* @ORM\ManyToMany(targetEntity=User::class)
* @ORM\JoinTable(name="chill_person_accompanying_period_work_referrer")
@@ -202,6 +209,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
public function __construct()
{
$this->goals = new ArrayCollection();
$this->privateComment = new PrivateCommentEmbeddable();
$this->results = new ArrayCollection();
$this->thirdParties = new ArrayCollection();
$this->persons = new ArrayCollection();
@@ -328,6 +336,11 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return $this->persons;
}
public function getPrivateComment(): PrivateCommentEmbeddable
{
return $this->privateComment;
}
/**
* @return Collection|User[]
*/
@@ -505,6 +518,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
return $this;
}
public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self
{
$this->privateComment->merge($privateComment);
return $this;
}
public function setSocialAction(?SocialAction $socialAction): self
{
$this->socialAction = $socialAction;

View File

@@ -253,7 +253,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
state.accompanyingCourse.administrativeLocation = value;
},
updateReferrer(state, value) {
//console.log('value', value);
state.accompanyingCourse.user = value;
},
updateJob(state, value) {
@@ -775,9 +774,7 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
throw error;
})
},
updateReferrer({ commit }, payload) {
console.log('update referrer', payload);
console.log('payload !== null', payload !== null);
updateReferrer({ commit, state }, payload) {
const url = `/api/1.0/person/accompanying-course/${id}.json`;
let body = { type: "accompanying_period", user: null };
@@ -788,7 +785,10 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
return makeFetch('PATCH', url, body)
.then((response) => {
commit('updateReferrer', response.user);
commit('setFilteredReferrersSuggested');
if (null !== payload.user_job && payload.user_job !== state.accompanyingCourse.job) {
this.dispatch('updateJob', payload.user_job);
}
// commit('setFilteredReferrersSuggested'); // this mutation doesn't exist?
})
.catch((error) => {
commit('catchError', error);
@@ -799,6 +799,8 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
const url = `/api/1.0/person/accompanying-course/${id}.json`;
let body = { type: "accompanying_period", job: null };
console.log('update job', payload);
if (payload !== null) {
body = { type: "accompanying_period", job: { id: payload.id, type: payload.type } };
}

View File

@@ -24,6 +24,15 @@
<input v-model="endDate" type="date" class="form-control" />
</div>
<div id="privateComment" class="action-row">
<label class="col-form-label">{{ $t('private_comment') }}</label>
<ckeditor
v-model="privateComment"
:editor="editor"
tag-name="textarea"
></ckeditor>
</div>
<div id="comment" class="action-row">
<label class="col-form-label">{{ $t('comments') }}</label>
<ckeditor
@@ -33,6 +42,7 @@
></ckeditor>
</div>
<div id="objectives" class="action-row">
<div aria="hidden" class="title">
<div><h3>{{ $t('goals_title') }}</h3></div>
@@ -141,12 +151,12 @@
<ul class="list-unstyled">
<li v-for="p in personsReachables" :key="p.id">
<div class="form-check">
<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">
<person-text :person="p"></person-text>
</label>
</div>
<div class="form-check">
<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">
<person-text :person="p"></person-text>
</label>
</div>
</li>
</ul>
</div>
@@ -274,18 +284,18 @@
</div>
</div>
<ul class="record_actions sticky-form-buttons">
<li>
<list-workflow-modal
:workflows="this.work.workflows"
:allowCreate="true"
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork"
:relatedEntityId="this.work.id"
:workflowsAvailables="this.work.workflows_availables"
:preventDefaultMoveToGenerate="true"
@go-to-generate-workflow="goToGenerateWorkflow"
></list-workflow-modal>
</li>
<ul class="record_actions sticky-form-buttons">
<li>
<list-workflow-modal
:workflows="this.work.workflows"
:allowCreate="true"
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork"
:relatedEntityId="this.work.id"
:workflowsAvailables="this.work.workflows_availables"
:preventDefaultMoveToGenerate="true"
@go-to-generate-workflow="goToGenerateWorkflow"
></list-workflow-modal>
</li>
<li v-if="!isPosting">
<button class="btn btn-save" @click="submit">
@@ -355,7 +365,8 @@ const i18n = {
referrers: "Agents traitants",
no_referrers: "Aucun agent traitant",
choose_referrers: "Choisir des agents traitants",
remove_referrer: "Enlever l'agent"
remove_referrer: "Enlever l'agent",
private_comment: "Commentaire privé"
}
}
};
@@ -417,8 +428,8 @@ export default {
},
};
},
computed: {
...mapState([
computed: {
...mapState([
'work',
'resultsForAction',
'evaluationsForAction',
@@ -461,6 +472,14 @@ export default {
this.$store.commit('setNote', v);
}
},
privateComment: {
get() {
return this.$store.state.privateComment;
},
set(v) {
this.$store.commit('setPrivateComment', v);
}
},
availableForCheckGoal() {
let pickedIds = this.$store.state.goalsPicked.map(g => g.goal.id);
@@ -573,6 +592,7 @@ div#workEditor {
"title title"
"startDate endDate"
"comment comment"
"privateComment privateComment"
"objectives objectives"
"evaluations evaluations"
"persons persons"
@@ -589,6 +609,8 @@ div#workEditor {
grid-area: endDate; }
#comment {
grid-area: comment; }
#privateComment {
grid-area: privateComment; }
#objectives {
grid-area: objectives; }
#evaluations {

View File

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

View File

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

View File

@@ -0,0 +1,33 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220527124737 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE activity DROP privateComment_comments');
}
public function getDescription(): string
{
return 'add private comment on accompanying period work';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD privateComment_comments JSON DEFAULT \'{}\'');
}
}

View File

@@ -608,6 +608,8 @@ accompanying_course_work:
Any work: Aucune action d'accompagnement
remove: Supprimer une action d'accompagnement
social_evaluation: Évaluation
private_comment: Commentaire privé
#
Person addresses: Adresses de résidence