mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
activity: avoid adding persons|Users|Thirdparty if not allowed
This commit is contained in:
parent
f5a6314ca2
commit
aa53df8bb0
@ -22,6 +22,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||||
|
use Symfony\Component\Serializer\Annotation\SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Activity
|
* Class Activity
|
||||||
@ -30,7 +31,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
|||||||
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
|
* @ORM\Entity(repositoryClass="Chill\ActivityBundle\Repository\ActivityRepository")
|
||||||
* @ORM\Table(name="activity")
|
* @ORM\Table(name="activity")
|
||||||
* @ORM\HasLifecycleCallbacks()
|
* @ORM\HasLifecycleCallbacks()
|
||||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
* @DiscriminatorMap(typeProperty="_type", mapping={
|
||||||
* "activity"=Activity::class
|
* "activity"=Activity::class
|
||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
@ -102,6 +103,8 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
|
||||||
|
* @Groups({"read"})
|
||||||
|
* @SerializedName("activityType")
|
||||||
*/
|
*/
|
||||||
private ActivityType $type;
|
private ActivityType $type;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ActivityType
|
* Class ActivityType
|
||||||
@ -45,11 +46,13 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private array $name = [];
|
private array $name = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private bool $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
@ -100,6 +103,7 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private int $personsVisible = self::FIELD_OPTIONAL;
|
private int $personsVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
@ -110,6 +114,7 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
|
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
@ -190,6 +195,7 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default"=1})
|
||||||
|
* @Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private int $usersVisible = self::FIELD_OPTIONAL;
|
private int $usersVisible = self::FIELD_OPTIONAL;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport to="#add-persons">
|
<teleport to="#add-persons" v-if="isComponentVisible">
|
||||||
|
|
||||||
<div class="flex-bloc concerned-groups" :class="getContext">
|
<div class="flex-bloc concerned-groups" :class="getContext">
|
||||||
<persons-bloc
|
<persons-bloc
|
||||||
@ -21,7 +21,7 @@
|
|||||||
buttonTitle="activity.add_persons"
|
buttonTitle="activity.add_persons"
|
||||||
modalTitle="activity.add_persons"
|
modalTitle="activity.add_persons"
|
||||||
v-bind:key="addPersons.key"
|
v-bind:key="addPersons.key"
|
||||||
v-bind:options="addPersons.options"
|
v-bind:options="addPersonsOptions"
|
||||||
@addNewPersons="addNewPersons"
|
@addNewPersons="addNewPersons"
|
||||||
ref="addPersons">
|
ref="addPersons">
|
||||||
</add-persons>
|
</add-persons>
|
||||||
@ -46,43 +46,38 @@ export default {
|
|||||||
{ key: 'persons',
|
{ key: 'persons',
|
||||||
title: 'activity.bloc_persons',
|
title: 'activity.bloc_persons',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: false
|
included: window.activity.activityType.personsVisible !== 0
|
||||||
},
|
},
|
||||||
{ key: 'personsAssociated',
|
{ key: 'personsAssociated',
|
||||||
title: 'activity.bloc_persons_associated',
|
title: 'activity.bloc_persons_associated',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: false
|
included: window.activity.activityType.personsVisible !== 0
|
||||||
},
|
},
|
||||||
{ key: 'personsNotAssociated',
|
{ key: 'personsNotAssociated',
|
||||||
title: 'activity.bloc_persons_not_associated',
|
title: 'activity.bloc_persons_not_associated',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: false
|
included: window.activity.activityType.personsVisible !== 0
|
||||||
},
|
},
|
||||||
{ key: 'thirdparty',
|
{ key: 'thirdparty',
|
||||||
title: 'activity.bloc_thirdparty',
|
title: 'activity.bloc_thirdparty',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: true
|
included: window.activity.activityType.thirdPartiesVisible !== 0
|
||||||
},
|
},
|
||||||
{ key: 'users',
|
{ key: 'users',
|
||||||
title: 'activity.bloc_users',
|
title: 'activity.bloc_users',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: true
|
included: window.activity.activityType.usersVisible !== 0
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
addPersons: {
|
addPersons: {
|
||||||
key: 'activity',
|
key: 'activity'
|
||||||
options: {
|
|
||||||
type: ['person', 'thirdparty', 'user'],
|
|
||||||
priority: null,
|
|
||||||
uniq: false,
|
|
||||||
button: {
|
|
||||||
size: 'btn-sm'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
isComponentVisible() {
|
||||||
|
return window.activity.activityType.personsVisible !== 0 || window.activity.activityType.thirdPartiesVisible !== 0 || window.activity.activityType.usersVisible !== 0
|
||||||
|
},
|
||||||
...mapState({
|
...mapState({
|
||||||
persons: state => state.activity.persons,
|
persons: state => state.activity.persons,
|
||||||
thirdParties: state => state.activity.thirdParties,
|
thirdParties: state => state.activity.thirdParties,
|
||||||
@ -97,7 +92,27 @@ export default {
|
|||||||
},
|
},
|
||||||
contextPersonsBlocs() {
|
contextPersonsBlocs() {
|
||||||
return this.personsBlocs.filter(bloc => bloc.included !== false);
|
return this.personsBlocs.filter(bloc => bloc.included !== false);
|
||||||
}
|
},
|
||||||
|
addPersonsOptions() {
|
||||||
|
let optionsType = [];
|
||||||
|
if (window.activity.activityType.personsVisible !== 0) {
|
||||||
|
optionsType.push('person')
|
||||||
|
}
|
||||||
|
if (window.activity.activityType.thirdPartiesVisible !== 0) {
|
||||||
|
optionsType.push('thirdparty')
|
||||||
|
}
|
||||||
|
if (window.activity.activityType.usersVisible !== 0) {
|
||||||
|
optionsType.push('user')
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
type: optionsType,
|
||||||
|
priority: null,
|
||||||
|
uniq: false,
|
||||||
|
button: {
|
||||||
|
size: 'btn-sm'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setPersonsInBloc();
|
this.setPersonsInBloc();
|
||||||
|
@ -19,211 +19,290 @@ const removeIdFromValue = (string, id) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const store = createStore({
|
const store = createStore({
|
||||||
strict: debug,
|
strict: debug,
|
||||||
state: {
|
state: {
|
||||||
activity: window.activity,
|
activity: window.activity,
|
||||||
socialIssuesOther: [],
|
socialIssuesOther: [],
|
||||||
socialActionsList: [],
|
socialActionsList: [],
|
||||||
},
|
|
||||||
getters: {
|
|
||||||
suggestedEntities(state) {
|
|
||||||
console.log(state.activity)
|
|
||||||
if (typeof(state.activity.accompanyingPeriod) === 'undefined') {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const allEntities = [
|
|
||||||
...store.getters.suggestedPersons,
|
|
||||||
...store.getters.suggestedRequestor,
|
|
||||||
...store.getters.suggestedUser,
|
|
||||||
...store.getters.suggestedResources
|
|
||||||
];
|
|
||||||
const uniqueIds = [...new Set(allEntities.map(i => `${i.type}-${i.id}`))];
|
|
||||||
return Array.from(uniqueIds, id => allEntities.filter(r => `${r.type}-${r.id}` === id)[0]);
|
|
||||||
},
|
},
|
||||||
suggestedPersons(state) {
|
getters: {
|
||||||
const existingPersonIds = state.activity.persons.map(p => p.id);
|
suggestedEntities(state) {
|
||||||
return state.activity.accompanyingPeriod.participations
|
console.log(state.activity);
|
||||||
.filter(p => p.endDate === null)
|
if (typeof state.activity.accompanyingPeriod === "undefined") {
|
||||||
.map(p => p.person)
|
return [];
|
||||||
.filter(p => !existingPersonIds.includes(p.id))
|
}
|
||||||
},
|
const allEntities = [
|
||||||
suggestedRequestor(state) {
|
...store.getters.suggestedPersons,
|
||||||
const existingPersonIds = state.activity.persons.map(p => p.id);
|
...store.getters.suggestedRequestor,
|
||||||
const existingThirdPartyIds = state.activity.thirdParties.map(p => p.id);
|
...store.getters.suggestedUser,
|
||||||
return [state.activity.accompanyingPeriod.requestor]
|
...store.getters.suggestedResources,
|
||||||
.filter(r =>
|
];
|
||||||
(r.type === 'person' && !existingPersonIds.includes(r.id)) ||
|
const uniqueIds = [
|
||||||
(r.type === 'thirdparty' && !existingThirdPartyIds.includes(r.id))
|
...new Set(allEntities.map((i) => `${i.type}-${i.id}`)),
|
||||||
);
|
];
|
||||||
},
|
return Array.from(
|
||||||
suggestedUser(state) {
|
uniqueIds,
|
||||||
const existingUserIds = state.activity.users.map(p => p.id);
|
(id) => allEntities.filter((r) => `${r.type}-${r.id}` === id)[0]
|
||||||
return [state.activity.accompanyingPeriod.user]
|
);
|
||||||
.filter(
|
},
|
||||||
u => !existingUserIds.includes(u.id)
|
suggestedPersons(state) {
|
||||||
);
|
const existingPersonIds = state.activity.persons.map((p) => p.id);
|
||||||
},
|
return state.activity.activityType.personsVisible === 0
|
||||||
suggestedResources(state) {
|
? []
|
||||||
const resources = state.activity.accompanyingPeriod.resources;
|
: state.activity.accompanyingPeriod.participations
|
||||||
const existingPersonIds = state.activity.persons.map(p => p.id);
|
.filter((p) => p.endDate === null)
|
||||||
const existingThirdPartyIds = state.activity.thirdParties.map(p => p.id);
|
.map((p) => p.person)
|
||||||
return state.activity.accompanyingPeriod.resources
|
.filter((p) => !existingPersonIds.includes(p.id));
|
||||||
.map(r => r.resource)
|
},
|
||||||
.filter(r =>
|
suggestedRequestor(state) {
|
||||||
(r.type === 'person' && !existingPersonIds.includes(r.id)) ||
|
const existingPersonIds = state.activity.persons.map((p) => p.id);
|
||||||
(r.type === 'thirdparty' && !existingThirdPartyIds.includes(r.id))
|
const existingThirdPartyIds = state.activity.thirdParties.map(
|
||||||
);
|
(p) => p.id
|
||||||
}
|
);
|
||||||
},
|
return [state.activity.accompanyingPeriod.requestor].filter(
|
||||||
mutations: {
|
(r) =>
|
||||||
// SocialIssueAcc
|
(r.type === "person" &&
|
||||||
addIssueInList(state, issue) {
|
!existingPersonIds.includes(r.id) &&
|
||||||
//console.log('add issue list', issue.id);
|
state.activity.activityType.personsVisible !== 0) ||
|
||||||
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
(r.type === "thirdparty" &&
|
||||||
},
|
!existingThirdPartyIds.includes(r.id) &&
|
||||||
addIssueSelected(state, issue) {
|
state.activity.activityType.thirdPartiesVisible !== 0)
|
||||||
//console.log('add issue selected', issue.id);
|
);
|
||||||
state.activity.socialIssues.push(issue);
|
},
|
||||||
},
|
suggestedUser(state) {
|
||||||
updateIssuesSelected(state, issues) {
|
const existingUserIds = state.activity.users.map((p) => p.id);
|
||||||
//console.log('update issues selected', issues);
|
return state.activity.activityType.usersVisible === 0
|
||||||
state.activity.socialIssues = issues;
|
? []
|
||||||
},
|
: [state.activity.accompanyingPeriod.user].filter(
|
||||||
updateIssuesOther(state, payload) {
|
(u) => !existingUserIds.includes(u.id)
|
||||||
//console.log('update issues other');
|
);
|
||||||
state.socialIssuesOther = payload;
|
},
|
||||||
},
|
suggestedResources(state) {
|
||||||
removeIssueInOther(state, issue) {
|
const resources = state.activity.accompanyingPeriod.resources;
|
||||||
//console.log('remove issue other', issue.id);
|
const existingPersonIds = state.activity.persons.map((p) => p.id);
|
||||||
state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
|
const existingThirdPartyIds = state.activity.thirdParties.map(
|
||||||
},
|
(p) => p.id
|
||||||
resetActionsList(state) {
|
);
|
||||||
//console.log('reset list actions');
|
return state.activity.accompanyingPeriod.resources
|
||||||
state.socialActionsList = [];
|
.map((r) => r.resource)
|
||||||
},
|
.filter(
|
||||||
addActionInList(state, action) {
|
(r) =>
|
||||||
//console.log('add action list', action.id);
|
(r.type === "person" &&
|
||||||
state.socialActionsList.push(action);
|
!existingPersonIds.includes(r.id) &&
|
||||||
},
|
state.activity.activityType.personsVisible !== 0) ||
|
||||||
updateActionsSelected(state, actions) {
|
(r.type === "thirdparty" &&
|
||||||
//console.log('update actions selected', actions);
|
!existingThirdPartyIds.includes(r.id) &&
|
||||||
state.activity.socialActions = actions;
|
state.activity.activityType.thirdPartiesVisible !== 0)
|
||||||
},
|
);
|
||||||
filterList(state, list) {
|
},
|
||||||
const filterList = (list) => {
|
|
||||||
// remove duplicates entries
|
|
||||||
list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
|
|
||||||
// alpha sort
|
|
||||||
list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
|
|
||||||
return list;
|
|
||||||
};
|
|
||||||
if (list === 'issues') {
|
|
||||||
state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
|
|
||||||
}
|
|
||||||
if (list === 'actions') {
|
|
||||||
state.socialActionsList = filterList(state.socialActionsList);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
mutations: {
|
||||||
|
// SocialIssueAcc
|
||||||
|
addIssueInList(state, issue) {
|
||||||
|
//console.log('add issue list', issue.id);
|
||||||
|
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
||||||
|
},
|
||||||
|
addIssueSelected(state, issue) {
|
||||||
|
//console.log('add issue selected', issue.id);
|
||||||
|
state.activity.socialIssues.push(issue);
|
||||||
|
},
|
||||||
|
updateIssuesSelected(state, issues) {
|
||||||
|
//console.log('update issues selected', issues);
|
||||||
|
state.activity.socialIssues = issues;
|
||||||
|
},
|
||||||
|
updateIssuesOther(state, payload) {
|
||||||
|
//console.log('update issues other');
|
||||||
|
state.socialIssuesOther = payload;
|
||||||
|
},
|
||||||
|
removeIssueInOther(state, issue) {
|
||||||
|
//console.log('remove issue other', issue.id);
|
||||||
|
state.socialIssuesOther = state.socialIssuesOther.filter(
|
||||||
|
(i) => i.id !== issue.id
|
||||||
|
);
|
||||||
|
},
|
||||||
|
resetActionsList(state) {
|
||||||
|
//console.log('reset list actions');
|
||||||
|
state.socialActionsList = [];
|
||||||
|
},
|
||||||
|
addActionInList(state, action) {
|
||||||
|
//console.log('add action list', action.id);
|
||||||
|
state.socialActionsList.push(action);
|
||||||
|
},
|
||||||
|
updateActionsSelected(state, actions) {
|
||||||
|
//console.log('update actions selected', actions);
|
||||||
|
state.activity.socialActions = actions;
|
||||||
|
},
|
||||||
|
filterList(state, list) {
|
||||||
|
const filterList = (list) => {
|
||||||
|
// remove duplicates entries
|
||||||
|
list = list.filter(
|
||||||
|
(value, index) =>
|
||||||
|
list.findIndex((array) => array.id === value.id) ===
|
||||||
|
index
|
||||||
|
);
|
||||||
|
// alpha sort
|
||||||
|
list.sort((a, b) =>
|
||||||
|
a.text > b.text ? 1 : b.text > a.text ? -1 : 0
|
||||||
|
);
|
||||||
|
return list;
|
||||||
|
};
|
||||||
|
if (list === "issues") {
|
||||||
|
state.activity.accompanyingPeriod.socialIssues = filterList(
|
||||||
|
state.activity.accompanyingPeriod.socialIssues
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (list === "actions") {
|
||||||
|
state.socialActionsList = filterList(state.socialActionsList);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// ConcernedGroups
|
// ConcernedGroups
|
||||||
addPersonsInvolved(state, payload) {
|
addPersonsInvolved(state, payload) {
|
||||||
console.log('### mutation addPersonsInvolved', payload);
|
console.log("### mutation addPersonsInvolved", payload);
|
||||||
switch (payload.result.type) {
|
switch (payload.result.type) {
|
||||||
case 'person':
|
case "person":
|
||||||
state.activity.persons.push(payload.result);
|
state.activity.persons.push(payload.result);
|
||||||
break;
|
break;
|
||||||
case 'thirdparty':
|
case "thirdparty":
|
||||||
state.activity.thirdParties.push(payload.result);
|
state.activity.thirdParties.push(payload.result);
|
||||||
break;
|
break;
|
||||||
case 'user':
|
case "user":
|
||||||
state.activity.users.push(payload.result);
|
state.activity.users.push(payload.result);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
},
|
||||||
|
removePersonInvolved(state, payload) {
|
||||||
|
//console.log('### mutation removePersonInvolved', payload.type);
|
||||||
|
switch (payload.type) {
|
||||||
|
case "person":
|
||||||
|
state.activity.persons = state.activity.persons.filter(
|
||||||
|
(person) => person !== payload
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "thirdparty":
|
||||||
|
state.activity.thirdParties =
|
||||||
|
state.activity.thirdParties.filter(
|
||||||
|
(thirdparty) => thirdparty !== payload
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "user":
|
||||||
|
state.activity.users = state.activity.users.filter(
|
||||||
|
(user) => user !== payload
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateLocation(state, value) {
|
||||||
|
console.log("### mutation: updateLocation", value);
|
||||||
|
state.activity.location = value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
removePersonInvolved(state, payload) {
|
actions: {
|
||||||
//console.log('### mutation removePersonInvolved', payload.type);
|
addIssueSelected({ commit }, issue) {
|
||||||
switch (payload.type) {
|
let aSocialIssues = document.getElementById(
|
||||||
case 'person':
|
"chill_activitybundle_activity_socialIssues"
|
||||||
state.activity.persons = state.activity.persons.filter(person => person !== payload);
|
);
|
||||||
break;
|
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
|
||||||
case 'thirdparty':
|
commit("addIssueSelected", issue);
|
||||||
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
},
|
||||||
break;
|
updateIssuesSelected({ commit }, payload) {
|
||||||
case 'user':
|
let aSocialIssues = document.getElementById(
|
||||||
state.activity.users = state.activity.users.filter(user => user !== payload);
|
"chill_activitybundle_activity_socialIssues"
|
||||||
break;
|
);
|
||||||
};
|
aSocialIssues.value = "";
|
||||||
|
payload.forEach((item) => {
|
||||||
|
aSocialIssues.value = addIdToValue(
|
||||||
|
aSocialIssues.value,
|
||||||
|
item.id
|
||||||
|
);
|
||||||
|
});
|
||||||
|
commit("updateIssuesSelected", payload);
|
||||||
|
},
|
||||||
|
updateActionsSelected({ commit }, payload) {
|
||||||
|
let aSocialActions = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_socialActions"
|
||||||
|
);
|
||||||
|
aSocialActions.value = "";
|
||||||
|
payload.forEach((item) => {
|
||||||
|
aSocialActions.value = addIdToValue(
|
||||||
|
aSocialActions.value,
|
||||||
|
item.id
|
||||||
|
);
|
||||||
|
});
|
||||||
|
commit("updateActionsSelected", payload);
|
||||||
|
},
|
||||||
|
addPersonsInvolved({ commit }, payload) {
|
||||||
|
//console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case "person":
|
||||||
|
let aPersons = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_persons"
|
||||||
|
);
|
||||||
|
aPersons.value = addIdToValue(
|
||||||
|
aPersons.value,
|
||||||
|
payload.result.id
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "thirdparty":
|
||||||
|
let aThirdParties = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_thirdParties"
|
||||||
|
);
|
||||||
|
aThirdParties.value = addIdToValue(
|
||||||
|
aThirdParties.value,
|
||||||
|
payload.result.id
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "user":
|
||||||
|
let aUsers = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_users"
|
||||||
|
);
|
||||||
|
aUsers.value = addIdToValue(
|
||||||
|
aUsers.value,
|
||||||
|
payload.result.id
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
commit("addPersonsInvolved", payload);
|
||||||
|
},
|
||||||
|
removePersonInvolved({ commit }, payload) {
|
||||||
|
//console.log('### action removePersonInvolved', payload);
|
||||||
|
switch (payload.type) {
|
||||||
|
case "person":
|
||||||
|
let aPersons = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_persons"
|
||||||
|
);
|
||||||
|
aPersons.value = removeIdFromValue(
|
||||||
|
aPersons.value,
|
||||||
|
payload.id
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "thirdparty":
|
||||||
|
let aThirdParties = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_thirdParties"
|
||||||
|
);
|
||||||
|
aThirdParties.value = removeIdFromValue(
|
||||||
|
aThirdParties.value,
|
||||||
|
payload.id
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "user":
|
||||||
|
let aUsers = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_users"
|
||||||
|
);
|
||||||
|
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
commit("removePersonInvolved", payload);
|
||||||
|
},
|
||||||
|
updateLocation({ commit }, value) {
|
||||||
|
console.log("### action: updateLocation", value);
|
||||||
|
let hiddenLocation = document.getElementById(
|
||||||
|
"chill_activitybundle_activity_location"
|
||||||
|
);
|
||||||
|
hiddenLocation.value = value.id;
|
||||||
|
commit("updateLocation", value);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
updateLocation(state, value) {
|
|
||||||
console.log('### mutation: updateLocation', value);
|
|
||||||
state.activity.location = value;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
addIssueSelected({ commit }, issue) {
|
|
||||||
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
|
|
||||||
commit('addIssueSelected', issue);
|
|
||||||
},
|
|
||||||
updateIssuesSelected({ commit }, payload) {
|
|
||||||
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
|
||||||
aSocialIssues.value = '';
|
|
||||||
payload.forEach(item => {
|
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
|
|
||||||
});
|
|
||||||
commit('updateIssuesSelected', payload);
|
|
||||||
},
|
|
||||||
updateActionsSelected({ commit }, payload) {
|
|
||||||
let aSocialActions = document.getElementById("chill_activitybundle_activity_socialActions");
|
|
||||||
aSocialActions.value = '';
|
|
||||||
payload.forEach(item => {
|
|
||||||
aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
|
|
||||||
});
|
|
||||||
commit('updateActionsSelected', payload);
|
|
||||||
},
|
|
||||||
addPersonsInvolved({ commit }, payload) {
|
|
||||||
//console.log('### action addPersonsInvolved', payload.result.type);
|
|
||||||
switch (payload.result.type) {
|
|
||||||
case 'person':
|
|
||||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
|
||||||
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
|
|
||||||
break;
|
|
||||||
case 'thirdparty':
|
|
||||||
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
|
||||||
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
|
|
||||||
break;
|
|
||||||
case 'user':
|
|
||||||
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
|
||||||
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
commit('addPersonsInvolved', payload);
|
|
||||||
},
|
|
||||||
removePersonInvolved({ commit }, payload) {
|
|
||||||
//console.log('### action removePersonInvolved', payload);
|
|
||||||
switch (payload.type) {
|
|
||||||
case 'person':
|
|
||||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
|
||||||
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
|
|
||||||
break;
|
|
||||||
case 'thirdparty':
|
|
||||||
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
|
||||||
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
|
|
||||||
break;
|
|
||||||
case 'user':
|
|
||||||
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
|
||||||
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
commit('removePersonInvolved', payload);
|
|
||||||
},
|
|
||||||
updateLocation({ commit }, value) {
|
|
||||||
console.log('### action: updateLocation', value);
|
|
||||||
let hiddenLocation = document.getElementById("chill_activitybundle_activity_location");
|
|
||||||
hiddenLocation.value = value.id;
|
|
||||||
commit('updateLocation', value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default store;
|
export default store;
|
||||||
|
@ -34,16 +34,18 @@
|
|||||||
{{ form_row(edit_form.reasons) }}
|
{{ form_row(edit_form.reasons) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
{%- if edit_form.persons is defined or edit_form.thirdParties is defined or edit_form.users is defined -%}
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
|
||||||
{%- if edit_form.persons is defined -%}
|
{%- if edit_form.persons is defined -%}
|
||||||
{{ form_widget(edit_form.persons) }}
|
{{ form_widget(edit_form.persons) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if edit_form.thirdParties is defined -%}
|
{%- if edit_form.thirdParties is defined -%}
|
||||||
{{ form_widget(edit_form.thirdParties) }}
|
{{ form_widget(edit_form.thirdParties) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if edit_form.users is defined -%}
|
{%- if edit_form.users is defined -%}
|
||||||
{{ form_widget(edit_form.users) }}
|
{{ form_widget(edit_form.users) }}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="add-persons"></div>
|
<div id="add-persons"></div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user