mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Merge remote-tracking branch 'origin/master' into issue230_person
This commit is contained in:
@@ -39,6 +39,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
final class ActivityController extends AbstractController
|
||||
@@ -307,8 +308,10 @@ final class ActivityController extends AbstractController
|
||||
$activityData = $request->query->get('activityData');
|
||||
}
|
||||
|
||||
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType
|
||||
|| !$activityType->isActive()) {
|
||||
if (
|
||||
!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType
|
||||
|| !$activityType->isActive()
|
||||
) {
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
|
||||
if (null !== $activityData) {
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\ActivityBundle\Controller;
|
||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||
use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\ActivityBundle\Controller;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Form\ActivityReasonType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@@ -19,6 +19,7 @@ use Chill\MainBundle\Entity\RoleScope;
|
||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
|
@@ -41,6 +41,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
$loader->load('services/form.yaml');
|
||||
$loader->load('services/templating.yaml');
|
||||
$loader->load('services/accompanyingPeriodConsistency.yaml');
|
||||
$loader->load('services/doctrine.entitylistener.yaml');
|
||||
}
|
||||
|
||||
public function prepend(ContainerBuilder $container)
|
||||
|
@@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
use function is_int;
|
||||
|
||||
/**
|
||||
|
@@ -47,7 +47,8 @@ use Symfony\Component\Serializer\Annotation\SerializedName;
|
||||
* })
|
||||
* @ActivityValidator\ActivityValidity
|
||||
*
|
||||
* @UserCircleConsistency(
|
||||
* TODO see if necessary
|
||||
* UserCircleConsistency(
|
||||
* "CHILL_ACTIVITY_SEE_DETAILS",
|
||||
* getUserFunction="getUser",
|
||||
* path="scope")
|
||||
|
@@ -163,16 +163,6 @@ class ActivityType
|
||||
*/
|
||||
private int $personVisible = self::FIELD_REQUIRED;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
private string $placeLabel = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
*/
|
||||
private int $placeVisible = self::FIELD_OPTIONAL;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||
*/
|
||||
@@ -406,16 +396,6 @@ class ActivityType
|
||||
return $this->personVisible;
|
||||
}
|
||||
|
||||
public function getPlaceLabel(): string
|
||||
{
|
||||
return $this->placeLabel;
|
||||
}
|
||||
|
||||
public function getPlaceVisible(): int
|
||||
{
|
||||
return $this->placeVisible;
|
||||
}
|
||||
|
||||
public function getReasonsLabel(): string
|
||||
{
|
||||
return $this->reasonsLabel;
|
||||
@@ -688,20 +668,6 @@ class ActivityType
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPlaceLabel(string $placeLabel): self
|
||||
{
|
||||
$this->placeLabel = $placeLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPlaceVisible(int $placeVisible): self
|
||||
{
|
||||
$this->placeVisible = $placeVisible;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setReasonsLabel(string $reasonsLabel): self
|
||||
{
|
||||
$this->reasonsLabel = $reasonsLabel;
|
||||
|
@@ -0,0 +1,77 @@
|
||||
<?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\ActivityBundle\EntityListener;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityEntityListener
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private AccompanyingPeriodWorkRepository $workRepository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, AccompanyingPeriodWorkRepository $workRepository)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->workRepository = $workRepository;
|
||||
}
|
||||
|
||||
public function persistActionToCourse(Activity $activity)
|
||||
{
|
||||
if ($activity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
$period = $activity->getAccompanyingPeriod();
|
||||
|
||||
$accompanyingCourseWorks = $this->workRepository->findByAccompanyingPeriod($period);
|
||||
$periodActions = [];
|
||||
$now = new DateTimeImmutable();
|
||||
|
||||
foreach ($accompanyingCourseWorks as $key => $work) {
|
||||
// take only the actions which are still opened
|
||||
if ($work->getEndDate() === null || $work->getEndDate() > ($activity->getDate() ?? $now)) {
|
||||
$periodActions[$key] = spl_object_hash($work->getSocialAction());
|
||||
}
|
||||
}
|
||||
|
||||
$associatedPersons = $activity->getPersonsAssociated();
|
||||
$associatedThirdparties = $activity->getThirdParties();
|
||||
|
||||
foreach ($activity->getSocialActions() as $action) {
|
||||
if (in_array(spl_object_hash($action), $periodActions, true)) {
|
||||
continue;
|
||||
}
|
||||
$newAction = new AccompanyingPeriodWork();
|
||||
$newAction->setSocialAction($action);
|
||||
$period->addWork($newAction);
|
||||
|
||||
$date = DateTimeImmutable::createFromMutable($activity->getDate());
|
||||
$newAction->setStartDate($date);
|
||||
|
||||
foreach ($associatedPersons as $person) {
|
||||
$newAction->addPerson($person);
|
||||
}
|
||||
|
||||
foreach ($associatedThirdparties as $thirdparty) {
|
||||
$newAction->setHandlingThierparty($thirdparty);
|
||||
}
|
||||
$this->em->persist($newAction);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -25,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
|
||||
|
@@ -27,6 +27,7 @@ use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
@@ -189,7 +190,9 @@ class ListActivity implements ListInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
|
||||
$centers = array_map(static function ($el) {
|
||||
return $el['center'];
|
||||
}, $acl);
|
||||
|
||||
// throw an error if any fields are present
|
||||
if (!array_key_exists('fields', $data)) {
|
||||
|
@@ -25,6 +25,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
|
||||
|
@@ -24,6 +24,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
|
@@ -31,6 +31,7 @@ use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
|
@@ -48,6 +48,7 @@ use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
@@ -260,6 +261,10 @@ class ActivityType extends AbstractType
|
||||
return implode(',', $personIds);
|
||||
},
|
||||
function (?string $personsAsString): array {
|
||||
if (null === $personsAsString) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $personsAsString)
|
||||
@@ -282,6 +287,10 @@ class ActivityType extends AbstractType
|
||||
return implode(',', $thirdpartyIds);
|
||||
},
|
||||
function (?string $thirdpartyAsString): array {
|
||||
if (null === $thirdpartyAsString) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $thirdpartyAsString)
|
||||
@@ -315,6 +324,10 @@ class ActivityType extends AbstractType
|
||||
return implode(',', $userIds);
|
||||
},
|
||||
function (?string $usersAsString): array {
|
||||
if (null === $usersAsString) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map(
|
||||
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
|
||||
explode(',', $usersAsString)
|
||||
@@ -332,7 +345,7 @@ class ActivityType extends AbstractType
|
||||
return '';
|
||||
}
|
||||
|
||||
return $location->getId();
|
||||
return (string) $location->getId();
|
||||
},
|
||||
function (?string $id): ?Location {
|
||||
return $this->om->getRepository(Location::class)->findOneBy(['id' => (int) $id]);
|
||||
@@ -379,7 +392,7 @@ class ActivityType extends AbstractType
|
||||
$timezoneUTC = new DateTimeZone('GMT');
|
||||
/** @var DateTime $data */
|
||||
$data = $formEvent->getData() === null ?
|
||||
DateTime::createFromFormat('U', 300) :
|
||||
DateTime::createFromFormat('U', '300') :
|
||||
$formEvent->getData();
|
||||
$seconds = $data->getTimezone()->getOffset($data);
|
||||
$data->setTimeZone($timezoneUTC);
|
||||
|
@@ -55,7 +55,7 @@ class ActivityTypeType extends AbstractType
|
||||
]);
|
||||
|
||||
$fields = [
|
||||
'persons', 'user', 'date', 'place', 'persons',
|
||||
'persons', 'user', 'date', 'location', 'persons',
|
||||
'thirdParties', 'durationTime', 'travelTime', 'attendee',
|
||||
'reasons', 'comment', 'sentReceived', 'documents',
|
||||
'emergency', 'socialIssues', 'socialActions', 'users',
|
||||
|
@@ -36,8 +36,10 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
$period = $parameters['accompanyingCourse'];
|
||||
|
||||
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
|
||||
&& $this->security->isGranted(ActivityVoter::SEE, $period)) {
|
||||
if (
|
||||
AccompanyingPeriod::STEP_DRAFT !== $period->getStep()
|
||||
&& $this->security->isGranted(ActivityVoter::SEE, $period)
|
||||
) {
|
||||
$menu->addChild($this->translator->trans('Activity'), [
|
||||
'route' => 'chill_activity_activity_list',
|
||||
'routeParameters' => [
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Menu;
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
@@ -22,6 +22,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
@@ -167,7 +168,9 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
|
||||
// we get the ids for those scopes
|
||||
$reachablesScopesId = array_map(
|
||||
static function (Scope $scope) { return $scope->getId(); },
|
||||
static function (Scope $scope) {
|
||||
return $scope->getId();
|
||||
},
|
||||
$reachableScopes
|
||||
);
|
||||
|
||||
|
@@ -31,6 +31,8 @@ class ActivityRepository extends ServiceEntityRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use @see{ActivityACLAwareRepositoryInterface::findByAccompanyingPeriod}
|
||||
*
|
||||
* @return Activity[]
|
||||
*/
|
||||
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array
|
||||
|
@@ -24,14 +24,16 @@ div.new-activity-select-type {
|
||||
}
|
||||
|
||||
//// ACTIVITY LIST PAGE
|
||||
// precise badge-title specific details
|
||||
// precise dashboard specific details
|
||||
|
||||
p.date-label {
|
||||
display: inline-block;
|
||||
margin: 0 0.5em 0 0;
|
||||
font-weight: 700;
|
||||
font-size: 18pt;
|
||||
}
|
||||
div.dashboard,
|
||||
h2.badge-title {
|
||||
div.duration {
|
||||
font-size: smaller;
|
||||
padding-left: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
ul.list-content {
|
||||
font-size: 70%;
|
||||
list-style-type: none;
|
||||
@@ -39,16 +41,13 @@ h2.badge-title {
|
||||
margin: 0;
|
||||
li {
|
||||
margin-bottom: 0.2em;
|
||||
// exception: change bg color for action badges above badge-title
|
||||
// exception: change bg color for action badges above dashboard
|
||||
.bg-light {
|
||||
background-color: $chill-light-gray !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div.main {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
//// ACTIVITY SHOW AND FORM PAGES
|
||||
// Exceptions for flex-bloc in concerned-groups
|
||||
|
@@ -17,6 +17,14 @@ const getLocations = () => fetchResults('/api/1.0/main/location.json');
|
||||
|
||||
const getLocationTypes = () => fetchResults('/api/1.0/main/location-type.json');
|
||||
|
||||
const getUserCurrentLocation =
|
||||
() => fetch('/api/1.0/main/user-current-location.json')
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* Load Location Type by defaultFor
|
||||
* @param {string} entity - can be "person" or "thirdparty"
|
||||
@@ -48,5 +56,6 @@ export {
|
||||
getLocations,
|
||||
getLocationTypes,
|
||||
getLocationTypeByDefaultFor,
|
||||
postLocation
|
||||
postLocation,
|
||||
getUserCurrentLocation
|
||||
};
|
||||
|
@@ -11,7 +11,7 @@
|
||||
</persons-bloc>
|
||||
</div>
|
||||
<div v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0">
|
||||
<ul class="list-suggest add-items">
|
||||
<ul class="list-suggest add-items inline">
|
||||
<li v-for="p in suggestedEntities" @click="addSuggestedEntity(p)">
|
||||
<span>{{ p.text }}</span>
|
||||
</li>
|
||||
|
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<li>
|
||||
<span :title="person.text">
|
||||
<span class="chill_denomination">{{ textCutted }}</span>
|
||||
<a @click.prevent="$emit('remove', person)"></a>
|
||||
<span class="chill_denomination" @click.prevent="$emit('remove', person)">{{ textCutted }}</span>
|
||||
</span>
|
||||
</li>
|
||||
</template>
|
||||
|
@@ -15,7 +15,7 @@
|
||||
:searchable="true"
|
||||
:placeholder="$t('activity.choose_location')"
|
||||
:custom-label="customLabel"
|
||||
:options="locations"
|
||||
:options="availableLocations"
|
||||
group-values="locations"
|
||||
group-label="locationGroup"
|
||||
v-model="location"
|
||||
@@ -32,7 +32,7 @@
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
import VueMultiselect from "vue-multiselect";
|
||||
import NewLocation from "./Location/NewLocation.vue";
|
||||
import { getLocations, getLocationTypeByDefaultFor } from "../api.js";
|
||||
import { getLocations, getLocationTypeByDefaultFor, getUserCurrentLocation } from "../api.js";
|
||||
|
||||
export default {
|
||||
name: "Location",
|
||||
@@ -40,13 +40,8 @@ export default {
|
||||
NewLocation,
|
||||
VueMultiselect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
locations: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["activity"]),
|
||||
...mapState(["activity", "availableLocations"]),
|
||||
...mapGetters(["suggestedEntities"]),
|
||||
location: {
|
||||
get() {
|
||||
@@ -57,53 +52,6 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
getLocations().then(
|
||||
(results) => {
|
||||
getLocationTypeByDefaultFor('person').then(
|
||||
(personLocationType) => {
|
||||
if (personLocationType) {
|
||||
const personLocation = this.makeAccompanyingPeriodLocation(personLocationType);
|
||||
const concernedPersonsLocation =
|
||||
this.makeConcernedPersonsLocation(personLocationType);
|
||||
getLocationTypeByDefaultFor('thirdparty').then(
|
||||
thirdpartyLocationType => {
|
||||
const concernedThirdPartiesLocation =
|
||||
this.makeConcernedThirdPartiesLocation(thirdpartyLocationType);
|
||||
this.locations = [
|
||||
{
|
||||
locationGroup: 'Localisation du parcours',
|
||||
locations: [personLocation]
|
||||
},
|
||||
{
|
||||
locationGroup: 'Parties concernées',
|
||||
locations: [...concernedPersonsLocation, ...concernedThirdPartiesLocation]
|
||||
},
|
||||
{
|
||||
locationGroup: 'Autres localisations',
|
||||
locations: results
|
||||
}
|
||||
];
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.locations = [
|
||||
{
|
||||
locationGroup: 'Localisations',
|
||||
locations: response.results
|
||||
}
|
||||
];
|
||||
}
|
||||
if (window.default_location_id) {
|
||||
let location = this.locations.filter(
|
||||
(l) => l.id === window.default_location_id
|
||||
);
|
||||
this.$store.dispatch("updateLocation", location);
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
labelAccompanyingCourseLocation(value) {
|
||||
return `${value.address.text} (${value.locationType.title.fr})`
|
||||
@@ -117,58 +65,6 @@ export default {
|
||||
: value.locationType.title.fr
|
||||
: '';
|
||||
},
|
||||
makeConcernedPersonsLocation(locationType) {
|
||||
let locations = [];
|
||||
this.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'person' && e.current_household_address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -this.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: {
|
||||
id: e.current_household_address.address_id,
|
||||
},
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
},
|
||||
makeConcernedThirdPartiesLocation(locationType) {
|
||||
let locations = [];
|
||||
this.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'thirdparty' && e.address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -this.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: { id: e.address.address_id },
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
},
|
||||
makeAccompanyingPeriodLocation(locationType) {
|
||||
const accPeriodLocation = this.activity.accompanyingPeriod.location;
|
||||
return {
|
||||
type: 'location',
|
||||
id: -1,
|
||||
onthefly: true,
|
||||
name: '__AccompanyingCourseLocation__',
|
||||
address: {
|
||||
id: accPeriodLocation.address_id,
|
||||
text: `${accPeriodLocation.text} - ${accPeriodLocation.postcode.code} ${accPeriodLocation.postcode.name}`
|
||||
},
|
||||
locationType: locationType
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@@ -1,22 +1,23 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { postLocation } from './api';
|
||||
import prepareLocations from './store.locations.js';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
//console.log('window.activity', window.activity);
|
||||
|
||||
const addIdToValue = (string, id) => {
|
||||
let array = string ? string.split(',') : [];
|
||||
array.push(id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
let array = string ? string.split(',') : [];
|
||||
array.push(id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
};
|
||||
|
||||
const removeIdFromValue = (string, id) => {
|
||||
let array = string.split(',');
|
||||
array = array.filter(el => el !== id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
let array = string.split(',');
|
||||
array = array.filter(el => el !== id.toString());
|
||||
let str = array.join();
|
||||
return str;
|
||||
};
|
||||
|
||||
const store = createStore({
|
||||
@@ -25,6 +26,7 @@ const store = createStore({
|
||||
activity: window.activity,
|
||||
socialIssuesOther: [],
|
||||
socialActionsList: [],
|
||||
availableLocations: [],
|
||||
},
|
||||
getters: {
|
||||
suggestedEntities(state) {
|
||||
@@ -50,9 +52,9 @@ const store = createStore({
|
||||
return state.activity.activityType.personsVisible === 0
|
||||
? []
|
||||
: state.activity.accompanyingPeriod.participations
|
||||
.filter((p) => p.endDate === null)
|
||||
.map((p) => p.person)
|
||||
.filter((p) => !existingPersonIds.includes(p.id));
|
||||
.filter((p) => p.endDate === null)
|
||||
.map((p) => p.person)
|
||||
.filter((p) => !existingPersonIds.includes(p.id));
|
||||
},
|
||||
suggestedRequestor(state) {
|
||||
if (state.activity.accompanyingPeriod.requestor === null) {
|
||||
@@ -78,8 +80,8 @@ const store = createStore({
|
||||
return state.activity.activityType.usersVisible === 0
|
||||
? []
|
||||
: [state.activity.accompanyingPeriod.user].filter(
|
||||
(u) => u !== null && !existingUserIds.includes(u.id)
|
||||
);
|
||||
(u) => u !== null && !existingUserIds.includes(u.id)
|
||||
);
|
||||
},
|
||||
suggestedResources(state) {
|
||||
const resources = state.activity.accompanyingPeriod.resources;
|
||||
@@ -200,6 +202,9 @@ const store = createStore({
|
||||
console.log("### mutation: updateLocation", value);
|
||||
state.activity.location = value;
|
||||
},
|
||||
addAvailableLocationGroup(state, group) {
|
||||
state.availableLocations.push(group);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addIssueSelected({ commit }, issue) {
|
||||
@@ -335,4 +340,6 @@ const store = createStore({
|
||||
},
|
||||
});
|
||||
|
||||
prepareLocations(store);
|
||||
|
||||
export default store;
|
||||
|
@@ -0,0 +1,123 @@
|
||||
import {getLocations, getLocationTypeByDefaultFor, getUserCurrentLocation} from "./api";
|
||||
|
||||
const makeConcernedPersonsLocation = (locationType, store) => {
|
||||
let locations = [];
|
||||
store.getters.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'person' && e.current_household_address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -store.getters.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: {
|
||||
id: e.current_household_address.address_id,
|
||||
},
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
};
|
||||
const makeConcernedThirdPartiesLocation = (locationType, store) => {
|
||||
let locations = [];
|
||||
store.getters.suggestedEntities.forEach(
|
||||
(e) => {
|
||||
if (e.type === 'thirdparty' && e.address !== null){
|
||||
locations.push({
|
||||
type: 'location',
|
||||
id: -store.getters.suggestedEntities.indexOf(e)*10,
|
||||
onthefly: true,
|
||||
name: e.text,
|
||||
address: { id: e.address.address_id },
|
||||
locationType: locationType
|
||||
});
|
||||
}
|
||||
}
|
||||
)
|
||||
return locations;
|
||||
};
|
||||
const makeAccompanyingPeriodLocation = (locationType, store) => {
|
||||
const accPeriodLocation = store.state.activity.accompanyingPeriod.location;
|
||||
return {
|
||||
type: 'location',
|
||||
id: -1,
|
||||
onthefly: true,
|
||||
name: '__AccompanyingCourseLocation__',
|
||||
address: {
|
||||
id: accPeriodLocation.address_id,
|
||||
text: `${accPeriodLocation.text} - ${accPeriodLocation.postcode.code} ${accPeriodLocation.postcode.name}`
|
||||
},
|
||||
locationType: locationType
|
||||
}
|
||||
};
|
||||
|
||||
export default function prepareLocations(store) {
|
||||
|
||||
// find the locations
|
||||
let allLocations = getLocations().then(
|
||||
(results) => {
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: 'Autres localisations',
|
||||
locations: results
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
let currentLocation = getUserCurrentLocation().then(
|
||||
userCurrentLocation => {
|
||||
if (null !== userCurrentLocation) {
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: 'Ma localisation',
|
||||
locations: [userCurrentLocation]
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
let partiesLocations = [], partyPromise;
|
||||
['person', 'thirdparty'].forEach(kind => {
|
||||
partyPromise = getLocationTypeByDefaultFor(kind).then(
|
||||
(kindLocationType) => {
|
||||
if (kindLocationType) {
|
||||
let concernedKindLocations;
|
||||
if (kind === 'person') {
|
||||
concernedKindLocations = makeConcernedPersonsLocation(kindLocationType, store);
|
||||
// add location for the parcours into suggestions
|
||||
const personLocation = makeAccompanyingPeriodLocation(kindLocationType, store);
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: 'Localisation du parcours',
|
||||
locations: [personLocation]
|
||||
});
|
||||
} else {
|
||||
concernedKindLocations = makeConcernedThirdPartiesLocation(kindLocationType, store);
|
||||
}
|
||||
|
||||
store.commit('addAvailableLocationGroup', {
|
||||
locationGroup: kind === 'person' ? 'Usagers concernés' : 'Tiers concernés',
|
||||
locations: concernedKindLocations,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
partiesLocations.push(partyPromise);
|
||||
});
|
||||
|
||||
// when all location are loaded
|
||||
Promise.all([allLocations, currentLocation, ...partiesLocations]).then(() => {
|
||||
console.log('current location in activity', store.state.activity.location);
|
||||
console.log('default loation id', window.default_location_id);
|
||||
if (window.default_location_id) {
|
||||
for (let group of store.state.availableLocations) {
|
||||
console.log(group);
|
||||
let location = group.locations.find((l) => l.id === window.default_location_id);
|
||||
console.log(location);
|
||||
if (location !== undefined) {
|
||||
store.dispatch('updateLocation', location);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
@@ -18,7 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
||||
// Feel free to remove this, extend it, or make something more sophisticated.
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
if (
|
||||
isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
|| !(in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server')
|
||||
) {
|
||||
|
@@ -1,110 +0,0 @@
|
||||
<h2 class="badge-title">
|
||||
<span class="title_label">
|
||||
|
||||
{% if activity.date %}
|
||||
<h3>{{ activity.date|format_date('short') }}</h3>
|
||||
{% endif %}
|
||||
|
||||
<div class="duration">
|
||||
{% if activity.durationTime and t.durationTimeVisible %}
|
||||
<p>
|
||||
<abbr class="fa fa-fw fa-hourglass-end" title="{{ 'Duration Time'|trans }}"></abbr>
|
||||
{{ activity.durationTime|date('H:i') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.travelTime and t.travelTimeVisible %}
|
||||
<p>
|
||||
<abbr class="fa fa-fw fa-car" title="{{ 'Travel time'|trans }}"></abbr>
|
||||
{{ activity.travelTime|date('H:i') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</span>
|
||||
<span class="title_action">
|
||||
|
||||
{{ activity.type.name | localize_translatable_string }}
|
||||
|
||||
{% if activity.emergency %}
|
||||
<span class="badge bg-danger rounded-pill fs-6">{{ 'Emergency'|trans|upper }}</span>
|
||||
{% endif %}
|
||||
|
||||
<ul class="small_in_title mt-3">
|
||||
|
||||
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
||||
<li>
|
||||
<span class="item-key">{{ 'Sent received'|trans ~ ' : ' }}</span>
|
||||
<b>{{ activity.sentReceived|capitalize|trans }}</b>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.location and t.locationVisible %}
|
||||
<li>
|
||||
<span class="item-key">{{ 'location'|trans ~ ': ' }}</span>
|
||||
<b>
|
||||
<span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
|
||||
{{ activity.location.name }}
|
||||
</b>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.user and t.userVisible %}
|
||||
<li>
|
||||
<span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span>
|
||||
<b>{{ activity.user.usernameCanonical }}</b>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="associated-persons">
|
||||
<span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
|
||||
{% for p in activity.personsAssociated %}
|
||||
<span class="badge-person">{{ p|chill_entity_render_box }}</span>
|
||||
{% endfor %}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="list-content my-3">
|
||||
{%- if t.reasonsVisible -%}
|
||||
{%- if activity.reasons is not empty -%}
|
||||
<li class="reasons">
|
||||
{% for r in activity.reasons %}
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- if t.socialIssuesVisible %}
|
||||
{%- if activity.socialIssues is not empty -%}
|
||||
<li class="social-issues">
|
||||
{% for r in activity.socialIssues %}
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- if t.socialActionsVisible -%}
|
||||
{%- if activity.socialActions is not empty -%}
|
||||
<li class="social-actions">
|
||||
{% for r in activity.socialActions %}
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
||||
<div class="mt-3">
|
||||
<a class="btn btn-sm btn-outline-primary"
|
||||
title="{{ 'Period number %number%'|trans({'%number%': activity.accompanyingPeriod.id}) }}"
|
||||
href="{{ chill_path_add_return_path(
|
||||
"chill_person_accompanying_course_index",
|
||||
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
|
||||
) }}"><i class="fa fa-random"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@@ -3,6 +3,14 @@
|
||||
{{ path(pathname, parms) }}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro insert_onthefly(type, entity) %}
|
||||
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
||||
action: 'show', displayBadge: true,
|
||||
targetEntity: { name: type, id: entity.id },
|
||||
buttonText: entity|chill_entity_render_string
|
||||
} %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro computeWidth(nbBlocks) %}
|
||||
{{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }}
|
||||
{% endmacro %}
|
||||
@@ -13,6 +21,7 @@
|
||||
{% set blocks = blocks|merge([{
|
||||
'title': 'Others persons'|trans,
|
||||
'items': entity.persons,
|
||||
'type': 'person',
|
||||
'path' : 'chill_person_view',
|
||||
'key' : 'person_id'
|
||||
}]) %}
|
||||
@@ -20,11 +29,13 @@
|
||||
{% set blocks = blocks|merge([{
|
||||
'title': 'Persons in accompanying course'|trans,
|
||||
'items': entity.personsAssociated,
|
||||
'type': 'person',
|
||||
'path' : 'chill_person_view',
|
||||
'key' : 'person_id'
|
||||
},{
|
||||
'title': 'Third persons'|trans,
|
||||
'items': entity.personsNotAssociated,
|
||||
'type': 'person',
|
||||
'path' : 'chill_person_view',
|
||||
'key' : 'person_id',
|
||||
}]) %}
|
||||
@@ -34,6 +45,7 @@
|
||||
{% set blocks = blocks|merge([{
|
||||
'title': 'Third parties'|trans,
|
||||
'items': entity.thirdParties,
|
||||
'type': 'thirdparty',
|
||||
'path' : 'chill_crud_3party_3party_view',
|
||||
'key' : 'id',
|
||||
}]) %}
|
||||
@@ -42,6 +54,7 @@
|
||||
{% set blocks = blocks|merge([{
|
||||
'title': 'Users concerned'|trans,
|
||||
'items': entity.users,
|
||||
'type': 'user',
|
||||
'key' : 'id',
|
||||
}]) %}
|
||||
{% endif %}
|
||||
@@ -59,22 +72,12 @@
|
||||
<ul class="list-content">
|
||||
{% for item in bloc.items %}
|
||||
<li>
|
||||
{% if bloc.path is defined %}
|
||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||
{{ item|chill_entity_render_box({
|
||||
'render': 'raw',
|
||||
'addAltNames': false
|
||||
}) }}
|
||||
{% if bloc.type == 'user' %}
|
||||
<span class="badge-user">
|
||||
{{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
|
||||
</span>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||
{{ item|chill_entity_render_box({
|
||||
'render': 'raw',
|
||||
'addAltNames': false
|
||||
}) }}
|
||||
</span>
|
||||
{{ _self.insert_onthefly(bloc.type, item) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
@@ -96,20 +99,12 @@
|
||||
<ul class="list-content">
|
||||
{% for item in bloc.items %}
|
||||
<li>
|
||||
{% if bloc.path is defined %}
|
||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||
{{ item|chill_entity_render_box({
|
||||
'render': 'raw',
|
||||
'addAltNames': false
|
||||
}) }}
|
||||
{% if bloc.type == 'user' %}
|
||||
<span class="badge-user">
|
||||
{{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
|
||||
</span>
|
||||
</a>
|
||||
{% else %}
|
||||
{{ item|chill_entity_render_box({
|
||||
'render': 'raw',
|
||||
'addAltNames': false
|
||||
}) }}
|
||||
{{ _self.insert_onthefly(bloc.type, item) }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
@@ -126,24 +121,18 @@
|
||||
<div class="wl-row">
|
||||
{% if bloc.items|length > 0 %}
|
||||
<div class="wl-col title">
|
||||
<h4>{{ bloc.title }}</h4>
|
||||
<h3>{{ bloc.title }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{% for item in bloc.items %}
|
||||
|
||||
<span class="wl-item {% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||
{% if bloc.path is defined %}
|
||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||
{{ item|chill_entity_render_box({
|
||||
'render': 'raw',
|
||||
'addAltNames': false
|
||||
}) }}
|
||||
</a>
|
||||
<span class="wl-item">
|
||||
{% if bloc.type == 'user' %}
|
||||
<span class="badge-user">
|
||||
{{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
|
||||
</span>
|
||||
{% else %}
|
||||
{{ item|chill_entity_render_box({
|
||||
'render': 'raw',
|
||||
'addAltNames': false
|
||||
}) }}
|
||||
{{ _self.insert_onthefly(bloc.type, item) }}
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<h1>{{ "Update activity"|trans }}</h1>
|
||||
<h2 class="chill-green mb-4">{{ entity.type.name|localize_translatable_string }}</h2>
|
||||
<h1>
|
||||
{{ "Update activity"|trans }}
|
||||
</h1>
|
||||
<h2 class="badge-title mb-5">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
{{ entity.type.name | localize_translatable_string }}
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
{{ form_start(edit_form) }}
|
||||
{{ form_errors(edit_form) }}
|
||||
@@ -37,7 +44,7 @@
|
||||
{% endif %}
|
||||
|
||||
{%- 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>
|
||||
<h2 class="chill-blue">{{ 'Concerned groups'|trans }}</h2>
|
||||
|
||||
{%- if edit_form.persons is defined -%}
|
||||
{{ form_widget(edit_form.persons) }}
|
||||
@@ -53,7 +60,7 @@
|
||||
{% endif %}
|
||||
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
<h2 class="chill-blue">{{ 'Activity data'|trans }}</h2>
|
||||
|
||||
{%- if edit_form.date is defined -%}
|
||||
{{ form_row(edit_form.date) }}
|
||||
@@ -73,7 +80,6 @@
|
||||
{% endif %}
|
||||
|
||||
{%- if edit_form.comment is defined -%}
|
||||
{# TODO .. public and private #}
|
||||
{{ form_row(edit_form.comment) }}
|
||||
{% endif %}
|
||||
|
||||
@@ -97,16 +103,16 @@
|
||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||
{% endif %}
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Cancel'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(edit_form) }}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-cancel">
|
||||
{{ 'Cancel'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(edit_form) }}
|
||||
{# {{ form(delete_form) }} #}
|
||||
|
@@ -10,49 +10,196 @@
|
||||
{% for activity in activities %}
|
||||
{% set t = activity.type %}
|
||||
<div class="item-bloc">
|
||||
|
||||
<div class="item-row">
|
||||
{% include '@ChillActivity/Activity/activity-badge-title.html.twig' %}
|
||||
<div class="wrap-list">
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
{% if activity.date %}
|
||||
<p class="date-label">
|
||||
{{ activity.date|format_date('short') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
<h2 class="badge-title">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
{{ activity.type.name | localize_translatable_string }}
|
||||
|
||||
{% if activity.emergency %}
|
||||
<span class="badge bg-danger rounded-pill fs-6 float-end">{{ 'Emergency'|trans|upper }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if activity.comment.comment is not empty
|
||||
or activity.persons|length > 0
|
||||
or activity.thirdParties|length > 0
|
||||
or activity.users|length > 0
|
||||
%}
|
||||
<div class="main">
|
||||
{% if activity.comment.comment is not empty %}
|
||||
{{ activity.comment|chill_entity_render_box({
|
||||
'disable_markdown': false,
|
||||
'limit_lines': 3,
|
||||
'metadata': false,
|
||||
}) }}
|
||||
{% endif %}
|
||||
<div class="item-row column separator">
|
||||
<div class="wrap-list">
|
||||
{% if activity.location and t.locationVisible %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title"><h3>{{ 'location'|trans }}</h3></div>
|
||||
<div class="wl-col list">
|
||||
<p class="wl-item">
|
||||
<span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
|
||||
{{ activity.location.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title"><h3>{{ 'Sent received'|trans }}</h3></div>
|
||||
<div class="wl-col list">
|
||||
<p class="wl-item">
|
||||
{{ activity.sentReceived|capitalize|trans }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.user and t.userVisible %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title"><h3>{{ 'Referrer'|trans }}</h3></div>
|
||||
<div class="wl-col list">
|
||||
<p class="wl-item">
|
||||
{{ activity.user.usernameCanonical|chill_entity_render_string|capitalize }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||
'context': context,
|
||||
'with_display': 'row',
|
||||
'with_display': 'wrap-list',
|
||||
'entity': activity,
|
||||
'badge_person': true
|
||||
} %}
|
||||
|
||||
<div class="wrap-list">
|
||||
{%- if activity.reasons is not empty and t.reasonsVisible -%}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
<h3>{{ 'Reasons'|trans }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{% for r in activity.reasons %}
|
||||
<p class="wl-item reasons">
|
||||
{{ r|chill_entity_render_box }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{%- if activity.socialIssues is not empty and t.socialIssuesVisible -%}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
<h3>{{ 'Social issues'|trans }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{% for r in activity.socialIssues %}
|
||||
<p class="wl-item social-issues">
|
||||
{{ r|chill_entity_render_box }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{%- if activity.socialActions is not empty and t.socialActionsVisible -%}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
<h3>{{ 'Social actions'|trans }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{% for r in activity.socialActions %}
|
||||
<p class="wl-item social-actions">
|
||||
{{ r|chill_entity_render_box }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.comment.comment is not empty and is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
<h3>{{ 'Comment'|trans }}</h3>
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
{{ activity.comment|chill_entity_render_box({
|
||||
'disable_markdown': false,
|
||||
'limit_lines': 3,
|
||||
'metadata': false
|
||||
}) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Only if ACL SEE_DETAILS AND/OR only on template SHOW ??
|
||||
durationTime
|
||||
travelTime
|
||||
comment
|
||||
documents
|
||||
attendee
|
||||
#}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="item-row separator">
|
||||
<div class="updatedBy"></div>
|
||||
<ul class="record_actions">
|
||||
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
||||
{#
|
||||
Disable person_id in following links, for redirect to accompanyingCourse context
|
||||
#}
|
||||
{% set person_id = null %}
|
||||
{% set accompanying_course_id = activity.accompanyingPeriod.id %}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_activity_activity_list',{
|
||||
'accompanying_period_id': accompanying_course_id
|
||||
}) }}"
|
||||
class="btn btn-primary"
|
||||
title="{{ 'See activity in accompanying course context'|trans }}">
|
||||
<i class="fa fa-random fa-fw"></i>
|
||||
{{ 'Period number %number%'|trans({'%number%': accompanying_course_id}) }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
||||
class="btn btn-sm btn-show "></a>
|
||||
<a href="{{ path('chill_activity_activity_show', {'id': activity.id,
|
||||
'person_id': person_id,
|
||||
'accompanying_period_id': accompanying_course_id
|
||||
}) }}"
|
||||
class="btn btn-show"
|
||||
title="{{ 'Show'|trans }}"></a>
|
||||
</li>
|
||||
{% if no_action is not defined or no_action == false %}
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
||||
class="btn btn-sm btn-update "></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
|
||||
class="btn btn-sm btn-delete "></a>
|
||||
</li>
|
||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_edit', {'id': activity.id,
|
||||
'person_id': person_id,
|
||||
'accompanying_period_id': accompanying_course_id
|
||||
}) }}"
|
||||
class="btn btn-update"
|
||||
title="{{ 'Edit'|trans }}"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_delete', {'id': activity.id,
|
||||
'person_id': person_id,
|
||||
'accompanying_period_id': accompanying_course_id
|
||||
}) }}"
|
||||
class="btn btn-delete"
|
||||
title="{{ 'Delete'|trans }}"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@@ -23,8 +23,8 @@
|
||||
{% if is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
|
||||
{{ 'Create'|trans }}
|
||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
|
||||
class="btn btn-create">{{ 'Create'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -3,10 +3,88 @@
|
||||
{% set t = activity.type %}
|
||||
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
||||
class="badge-link" title="{{ 'Show the activity'|trans }}">
|
||||
class="dashboard-link" title="{{ 'Show the activity'|trans }}">
|
||||
|
||||
{% include '@ChillActivity/Activity/activity-badge-title.html.twig' %}
|
||||
<div class="dashboard">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
|
||||
{%- if activity.date -%}
|
||||
<p class="date-label">{{ activity.date|format_date('short') }}</p>
|
||||
{%- endif -%}
|
||||
|
||||
<span class="like-h3">{{ activity.type.name | localize_translatable_string }}</span>
|
||||
|
||||
{% if activity.emergency %}
|
||||
<span class="badge bg-danger rounded-pill fs-6">{{ 'Emergency'|trans|upper }}</span>
|
||||
{% endif %}
|
||||
|
||||
<ul class="small_in_title mt-3">
|
||||
|
||||
{% if activity.sentReceived is not empty and t.sentReceivedVisible %}
|
||||
<li>
|
||||
<span class="item-key">{{ 'Sent received'|trans ~ ' : ' }}</span>
|
||||
<b>{{ activity.sentReceived|capitalize|trans }}</b>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.location and t.locationVisible %}
|
||||
<li>
|
||||
<span class="item-key">{{ 'location'|trans ~ ': ' }}</span>
|
||||
<b>
|
||||
<span>{{ activity.location.locationType.title|localize_translatable_string }}</span>
|
||||
{{ activity.location.name }}
|
||||
</b>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.user and t.userVisible %}
|
||||
<li>
|
||||
<span class="item-key">{{ 'Referrer'|trans ~ ': ' }}</span>
|
||||
<b>{{ activity.user.usernameCanonical }}</b>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="associated-persons">
|
||||
<span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
|
||||
{% for p in activity.personsAssociated %}
|
||||
<span class="badge-person">{{ p|chill_entity_render_box }}</span>
|
||||
{% endfor %}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="list-content my-3">
|
||||
{%- if t.reasonsVisible -%}
|
||||
{%- if activity.reasons is not empty -%}
|
||||
<li class="reasons">
|
||||
{% for r in activity.reasons %}
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- if t.socialIssuesVisible %}
|
||||
{%- if activity.socialIssues is not empty -%}
|
||||
<li class="social-issues">
|
||||
{% for r in activity.socialIssues %}
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{%- if t.socialActionsVisible -%}
|
||||
{%- if activity.socialActions is not empty -%}
|
||||
<li class="social-actions">
|
||||
{% for r in activity.socialActions %}
|
||||
{{ r|chill_entity_render_box }}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@@ -1,10 +1,16 @@
|
||||
<h1>{{ "Activity creation"|trans ~ ' :' }}</h1>
|
||||
<h2 class="chill-green mb-4">{{ entity.type.name|localize_translatable_string }}</h2>
|
||||
<h1>
|
||||
{{ "Activity creation"|trans }}
|
||||
</h1>
|
||||
<h2 class="badge-title mb-5">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
{{ entity.type.name | localize_translatable_string }}
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
|
||||
{%- if form.emergency is defined -%}
|
||||
{{ form_row(form.emergency) }}
|
||||
{% endif %}
|
||||
@@ -39,7 +45,7 @@
|
||||
|
||||
{%- if form.persons is defined or form.thirdParties is defined or form.users is defined -%}
|
||||
|
||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||
<h2 class="chill-blue">{{ 'Concerned groups'|trans }}</h2>
|
||||
|
||||
{%- if form.persons is defined -%}
|
||||
{{ form_widget(form.persons) }}
|
||||
@@ -55,7 +61,7 @@
|
||||
|
||||
{% endif %}
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
<h2 class="chill-blue">{{ 'Activity data'|trans }}</h2>
|
||||
|
||||
{%- if form.date is defined -%}
|
||||
{{ form_row(form.date) }}
|
||||
@@ -103,7 +109,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<button class="btn btn-create" type="submit">
|
||||
<button class="btn btn-save" type="submit">
|
||||
{{ 'Create'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
|
@@ -1,128 +1,185 @@
|
||||
{%- set t = entity.type -%}
|
||||
{%- import "@ChillDocStore/Macro/macro.html.twig" as m -%}
|
||||
|
||||
<h1>
|
||||
{{ "Activity"|trans }}
|
||||
{%- if t.emergencyVisible and entity.emergency -%}
|
||||
<span class="badge bg-secondary">
|
||||
{{- 'Emergency'|trans -}}
|
||||
</span>
|
||||
{%- endif -%}
|
||||
</h1>
|
||||
<h1>{{ "Activity"|trans }}</h1>
|
||||
|
||||
<dl class="chill_view_data">
|
||||
<div class="flex-table">
|
||||
<div class="item-bloc">
|
||||
|
||||
<dt class="inline">{{ 'by'|trans|capitalize }}</dt>
|
||||
<dd>{{ entity.user }}</dd>
|
||||
<div class="item-row">
|
||||
<div class="wrap-list">
|
||||
<div class="wl-row">
|
||||
<div class="wl-col title">
|
||||
{% if entity.date %}
|
||||
<p class="date-label">
|
||||
{{ entity.date|format_date('short') }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="wl-col list">
|
||||
<h2 class="badge-title">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
{{ entity.type.name | localize_translatable_string }}
|
||||
{% if entity.emergency %}
|
||||
<span class="badge bg-danger rounded-pill fs-6 float-end">{{ 'Emergency'|trans|upper }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dt class="inline">{{ 'Type'|trans }}</dt>
|
||||
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
||||
<div class="item-row separator">
|
||||
<dl class="chill_view_data">
|
||||
<dt class="inline">{{ 'Referrer'|trans|capitalize }}</dt>
|
||||
<dd>{{ entity.user }}</dd>
|
||||
|
||||
{%- if entity.scope -%}
|
||||
<dt class="inline">{{ 'Scope'|trans }}</dt>
|
||||
<dd><span class="scope">{{ entity.scope.name|localize_translatable_string }}</span></dd>
|
||||
{% endif %}
|
||||
{%- if entity.scope -%}
|
||||
<dt class="inline">{{ 'Scope'|trans }}</dt>
|
||||
<dd>
|
||||
<span class="scope">{{ entity.scope.name|localize_translatable_string }}</span>
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.socialIssuesVisible %}
|
||||
<dt class="inline">{{ 'Social issues'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.socialIssues|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</p>
|
||||
{% else %}
|
||||
{% for si in entity.socialIssues %}{{ si|chill_entity_render_box }}{% endfor %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
{% if t.socialIssuesVisible %}
|
||||
<dt class="inline">{{ 'Social issues'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.socialIssues|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</p>
|
||||
{% else %}
|
||||
{% for si in entity.socialIssues %}{{ si|chill_entity_render_box }}{% endfor %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.socialActionsVisible %}
|
||||
<dt class="inline">{{ 'Social actions'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.socialActions|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</p>
|
||||
{% else %}
|
||||
{% for sa in entity.socialActions %}{{ sa|chill_entity_render_box }}{% endfor %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
{% if t.socialActionsVisible %}
|
||||
<dt class="inline">{{ 'Social actions'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.socialActions|length == 0 %}
|
||||
<span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span>
|
||||
{% else %}
|
||||
{% for sa in entity.socialActions %}{{ sa|chill_entity_render_box }}{% endfor %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.reasonsVisible %}
|
||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||
{%- if entity.reasons is empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{% if t.reasonsVisible %}
|
||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||
<dd>
|
||||
{%- if entity.reasons is empty -%}
|
||||
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
|
||||
{%- else -%}
|
||||
{% for r in entity.reasons %}{{ r|chill_entity_render_box }}{% endfor %}
|
||||
{%- endif -%}
|
||||
</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc', 'badge_person': 'true' } %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
<h2 class="chill-blue">{{ 'Concerned groups'|trans }}</h2>
|
||||
|
||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||
<dd>{{ entity.date|format_date('long') }}</dd>
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||
'context': context,
|
||||
'with_display': 'bloc',
|
||||
'badge_person': 'true'
|
||||
} %}
|
||||
|
||||
{% if t.locationVisible %}
|
||||
<dt class="inline">{{ 'Activity location'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.location is not null %}
|
||||
<p>
|
||||
{{ entity.location.name }}
|
||||
<span> ({{ entity.location.locationType.title|localize_translatable_string }})</span>
|
||||
</p>
|
||||
{{ entity.location.address|chill_entity_render_box }}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
<h2 class="chill-blue">{{ 'Activity data'|trans }}</h2>
|
||||
|
||||
<div class="flex-table">
|
||||
<div class="item-bloc">
|
||||
|
||||
<dl class="chill_view_data">
|
||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||
<dd>{{ entity.date|format_date('long') }}</dd>
|
||||
|
||||
{% if t.locationVisible %}
|
||||
<dt class="inline">{{ 'Activity location'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.location is not null %}
|
||||
<p>
|
||||
<span>{{ entity.location.locationType.title|localize_translatable_string }}</span>
|
||||
{{ entity.location.name }}
|
||||
</p>
|
||||
<div class="ms-3">{{ entity.location.address|chill_entity_render_box }}</div>
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.durationTimeVisible %}
|
||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||
<dd>{% if entity.durationTime is not null %}
|
||||
{{ entity.durationTime|date('H:i') }}
|
||||
{% else %}
|
||||
{{ 'None'|trans|capitalize }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
{% if t.durationTimeVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %}
|
||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.durationTime is not null %}
|
||||
{{ entity.durationTime|date('H:i') }}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'None'|trans|capitalize }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.travelTimeVisible %}
|
||||
<dt class="inline">{{ 'Travel time'|trans }}</dt>
|
||||
<dd>{% if entity.travelTime is not null %}
|
||||
{{ entity.travelTime|date('H:i') }}
|
||||
{% else %}
|
||||
{{ 'None'|trans|capitalize }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
{% if t.travelTimeVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %}
|
||||
<dt class="inline">{{ 'Travel time'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.travelTime is not null %}
|
||||
{{ entity.travelTime|date('H:i') }}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'None'|trans|capitalize }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.commentVisible %}
|
||||
<dt class="inline">{{ 'activity.comment'|trans }}</dt>
|
||||
{%- if entity.comment.empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
||||
{%- endif -%}
|
||||
{% endif %}
|
||||
{% if t.commentVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %}
|
||||
<dt class="inline">{{ 'activity.comment'|trans }}</dt>
|
||||
<dd>
|
||||
{%- if entity.comment.empty -%}
|
||||
<span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span>
|
||||
{%- else -%}
|
||||
{{ entity.comment|chill_entity_render_box }}
|
||||
{%- endif -%}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.documentsVisible and entity.documents|length > 0 %}
|
||||
<dt>{{ 'Documents'|trans }}</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
{% for d in entity.documents %}
|
||||
<li>{{ m.download_button(d) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</dd>
|
||||
{% endif %}
|
||||
{% if t.documentsVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %}
|
||||
<dt class="inline">{{ 'Documents'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.documents|length > 0 %}
|
||||
<ul>
|
||||
{% for d in entity.documents %}
|
||||
<li>{{ m.download_button(d) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if t.attendeeVisible %}
|
||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
||||
{% endif %}
|
||||
{% if t.attendeeVisible and is_granted('CHILL_ACTIVITY_SEE_DETAILS', entity) %}
|
||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||
<dd>
|
||||
{% if entity.attendee is not null %}
|
||||
{% if entity.attendee %}
|
||||
{{ 'present'|trans|capitalize }}
|
||||
{% else %}
|
||||
{{ 'not present'|trans|capitalize }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'None'|trans|capitalize }}</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
</dl>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% set person_id = null %}
|
||||
{% if person %}
|
||||
@@ -140,23 +197,24 @@
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', entity) %}
|
||||
<li>
|
||||
<a class="btn btn-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||
{{ 'Edit'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{# TODO
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
||||
#}
|
||||
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
|
||||
{{ 'Delete'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{#
|
||||
{% endif %}
|
||||
#}
|
||||
</ul>
|
||||
<script>
|
||||
import ShowPane from "../../../../ChillMainBundle/Resources/public/vuejs/Address/components/ShowPane";
|
||||
export default {
|
||||
components: {ShowPane}
|
||||
}
|
||||
</script>
|
||||
|
@@ -8,8 +8,6 @@
|
||||
|
||||
{% block content -%}
|
||||
<div class="activity-show">
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
@@ -8,8 +8,6 @@
|
||||
|
||||
{% block personcontent -%}
|
||||
<div class="activity-show">
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
|
||||
</div>
|
||||
{% endblock personcontent %}
|
||||
|
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
@@ -64,8 +65,10 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof Center
|
||||
&& in_array($attribute, $this->getAttributes(), true)) {
|
||||
if (
|
||||
$subject instanceof Center
|
||||
&& in_array($attribute, $this->getAttributes(), true)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
@@ -92,6 +93,8 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
public function getRoles(): array
|
||||
{
|
||||
return [
|
||||
self::SEE,
|
||||
self::SEE_DETAILS,
|
||||
self::CREATE_PERSON,
|
||||
self::CREATE_ACCOMPANYING_COURSE,
|
||||
self::UPDATE,
|
||||
|
@@ -26,7 +26,7 @@ final class ActivityReasonAggregatorTest extends AbstractAggregatorTest
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -26,7 +26,7 @@ final class ActivityTypeAggregatorTest extends AbstractAggregatorTest
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -26,7 +26,7 @@ final class ActivityUserAggregatorTest extends AbstractAggregatorTest
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -24,7 +24,7 @@ final class CountActivityTest extends AbstractExportTest
|
||||
*/
|
||||
private $export;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -24,7 +24,7 @@ final class ListActivityTest extends AbstractExportTest
|
||||
*/
|
||||
private $export;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -26,7 +26,7 @@ final class StatActivityDurationSumTest extends AbstractExportTest
|
||||
*/
|
||||
private $export;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -25,7 +25,7 @@ final class ActivityReasonFilterTest extends AbstractFilterTest
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -26,7 +26,7 @@ final class PersonHavingActivityBetweenDateFilterTest extends AbstractFilterTest
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -45,7 +45,7 @@ final class ActivityTypeTest extends KernelTestCase
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -29,7 +29,7 @@ final class TranslatableActivityReasonTest extends TypeTestCase
|
||||
*/
|
||||
private static $prophet;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ final class TranslatableActivityTypeTest extends KernelTestCase
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -44,7 +44,7 @@ final class ActivityVoterTest extends KernelTestCase
|
||||
*/
|
||||
protected $voter;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->voter = self::$kernel->getContainer()
|
||||
|
@@ -24,6 +24,7 @@ use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function strtr;
|
||||
|
@@ -17,6 +17,7 @@ use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
|
||||
use function array_merge;
|
||||
use function count;
|
||||
|
||||
|
@@ -0,0 +1,15 @@
|
||||
services:
|
||||
Chill\ActivityBundle\EntityListener\ActivityEntityListener:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
-
|
||||
name: 'doctrine.orm.entity_listener'
|
||||
event: 'postPersist'
|
||||
entity: 'Chill\ActivityBundle\Entity\Activity'
|
||||
method: 'persistActionToCourse'
|
||||
-
|
||||
name: 'doctrine.orm.entity_listener'
|
||||
event: 'postUpdate'
|
||||
entity: 'Chill\ActivityBundle\Entity\Activity'
|
||||
method: 'persistActionToCourse'
|
@@ -13,6 +13,7 @@ namespace Chill\Migrations\Activity;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
|
@@ -0,0 +1,34 @@
|
||||
<?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\Activity;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20211207152023 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->throwIrreversibleMigrationException('placevisible and placelabel could not be created');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'DROP place visible and place label, which are replaced by location';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE activitytype DROP placevisible');
|
||||
$this->addSql('ALTER TABLE activitytype DROP placelabel');
|
||||
}
|
||||
}
|
@@ -146,8 +146,8 @@ User visible: Visibilité du champ Utilisateur
|
||||
User label: Libellé du champ Utilisateur
|
||||
Date visible: Visibilité du champ Date
|
||||
Date label: Libellé du champ Date
|
||||
Place visible: Visibilité du champ Lieu
|
||||
Place label: Libellé du champ Lieu
|
||||
Location visible: Visibilité du champ Lieu
|
||||
Location label: Libellé du champ Lieu
|
||||
Third parties visible: Visibilité du champ Tiers
|
||||
Third parties label: Libellé du champ Tiers
|
||||
Duration time visible: Visibilité du champ Durée
|
||||
@@ -222,3 +222,5 @@ Aggregate by activity type: Aggréger par type d'activité
|
||||
Aggregate by activity reason: Aggréger par sujet de l'activité
|
||||
|
||||
Last activities: Les dernières activités
|
||||
|
||||
See activity in accompanying course context: Voir l'activité dans le contexte du parcours d'accompagnement
|
||||
|
@@ -19,6 +19,7 @@ use DateTimeImmutable;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
||||
use function random_int;
|
||||
|
||||
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||
|
@@ -18,10 +18,12 @@ class LoadAsideActivityCategory extends \Doctrine\Bundle\FixturesBundle\Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager)
|
||||
{
|
||||
foreach ([
|
||||
'Appel téléphonique',
|
||||
'Formation',
|
||||
] as $key => $label) {
|
||||
foreach (
|
||||
[
|
||||
'Appel téléphonique',
|
||||
'Formation',
|
||||
] as $key => $label
|
||||
) {
|
||||
$category = new AsideActivityCategory();
|
||||
$category->setTitle(['fr' => $label]);
|
||||
$manager->persist($category);
|
||||
|
@@ -13,6 +13,7 @@ namespace Chill\AsideActivityBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
use function is_int;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
|
@@ -162,8 +162,12 @@ class AsideActivityCategory
|
||||
public function setParent(?self $parent): self
|
||||
{
|
||||
// cache the old result for changing it during validaiton
|
||||
$this->oldParent = $this->parent;
|
||||
if ($this->parent) {
|
||||
$this->oldParent = $this->parent;
|
||||
}
|
||||
|
||||
$this->parent = $parent;
|
||||
dump($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class AsideActivityFormType extends AbstractType
|
||||
@@ -137,7 +138,7 @@ final class AsideActivityFormType extends AbstractType
|
||||
$timezoneUTC = new DateTimeZone('GMT');
|
||||
/** @var DateTimeImmutable $data */
|
||||
$data = $formEvent->getData() === null ?
|
||||
DateTime::createFromFormat('U', 300) :
|
||||
DateTime::createFromFormat('U', '300') :
|
||||
$formEvent->getData();
|
||||
$seconds = $data->getTimezone()->getOffset($data);
|
||||
$data->setTimeZone($timezoneUTC);
|
||||
|
@@ -13,6 +13,7 @@ namespace Chill\AsideActivityBundle\Menu;
|
||||
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
|
||||
|
@@ -26,7 +26,7 @@ final class AsideActivityControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
self::bootKernel();
|
||||
|
@@ -13,6 +13,7 @@ namespace Chill\AMLI\BudgetBundle\Calculator;
|
||||
|
||||
use Chill\AMLI\BudgetBundle\Entity\AbstractElement;
|
||||
use OutOfBoundsException;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_keys;
|
||||
use function implode;
|
||||
|
@@ -21,6 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
use function get_class;
|
||||
|
||||
abstract class AbstractElementController extends Controller
|
||||
|
@@ -22,6 +22,7 @@ use Psr\Log\LoggerInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
use function array_merge;
|
||||
use function count;
|
||||
|
||||
|
@@ -21,6 +21,7 @@ use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function array_flip;
|
||||
use function asort;
|
||||
|
||||
|
@@ -21,6 +21,7 @@ use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function array_flip;
|
||||
|
||||
class ResourceType extends AbstractType
|
||||
|
@@ -18,6 +18,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
use function in_array;
|
||||
|
||||
class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
|
@@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use function count;
|
||||
|
||||
class CalendarRangeAPIController extends ApiController
|
||||
|
@@ -28,6 +28,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\Range;
|
||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
|
@@ -14,6 +14,7 @@ namespace Chill\CalendarBundle\Event;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
class ListenToActivityCreate
|
||||
|
@@ -20,7 +20,6 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
|
@@ -1,6 +1,10 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { postLocation } from 'ChillActivityAssets/vuejs/Activity/api';
|
||||
import {
|
||||
getLocations, getLocationTypeByDefaultFor,
|
||||
getUserCurrentLocation
|
||||
} from "../../../../../ChillActivityBundle/Resources/public/vuejs/Activity/api";
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
||||
@@ -82,7 +86,7 @@ const store = createStore({
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
||||
|
||||
// ConcernedGroups
|
||||
addPersonsInvolved(state, payload) {
|
||||
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||
@@ -94,7 +98,7 @@ const store = createStore({
|
||||
state.activity.thirdParties.push(payload.result);
|
||||
break;
|
||||
case 'user':
|
||||
state.activity.users.push(payload.result);
|
||||
state.activity.users.push(payload.result);
|
||||
break;
|
||||
};
|
||||
},
|
||||
@@ -108,7 +112,7 @@ const store = createStore({
|
||||
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
||||
break;
|
||||
case 'user':
|
||||
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||
break;
|
||||
};
|
||||
},
|
||||
@@ -217,9 +221,7 @@ const store = createStore({
|
||||
hiddenLocation.value = value.id;
|
||||
}
|
||||
commit("updateLocation", value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -92,8 +92,11 @@
|
||||
%}
|
||||
<div class="item-row details">
|
||||
<div class="item-col">
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': accompanyingCourse, 'with_display': 'row', 'entity': calendar } %}
|
||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||
'context': accompanyingCourse,
|
||||
'with_display': 'row',
|
||||
'entity': calendar
|
||||
} %}
|
||||
</div>
|
||||
|
||||
{% if calendar.comment.comment is not empty %}
|
||||
@@ -123,4 +126,4 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@@ -26,7 +26,7 @@ final class CalendarControllerTest extends WebTestCase
|
||||
/**
|
||||
* Setup before each test method (see phpunit doc).
|
||||
*/
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->client = self::createClient([], [
|
||||
|
@@ -25,6 +25,7 @@ use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
|
@@ -23,6 +23,7 @@ use Symfony\Bridge\Twig\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
@@ -135,7 +135,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
return null;
|
||||
}
|
||||
|
||||
return $date->format('Y-m-d');
|
||||
return $date->format('Y-m-d');
|
||||
|
||||
default:
|
||||
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:date.'
|
||||
|
@@ -21,6 +21,7 @@ use LogicException;
|
||||
use Symfony\Bridge\Twig\TwigEngine;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use function get_class;
|
||||
use function gettype;
|
||||
use function is_object;
|
||||
|
@@ -18,7 +18,6 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Symfony\Component\Validator\Constraints\LessThanOrEqual;
|
||||
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
class CustomFieldText extends AbstractCustomField
|
||||
@@ -65,8 +66,10 @@ class CustomFieldText extends AbstractCustomField
|
||||
|
||||
$attrArray = [];
|
||||
|
||||
if (array_key_exists(self::MULTIPLE_CF_INLINE, $options)
|
||||
&& $options[self::MULTIPLE_CF_INLINE]) {
|
||||
if (
|
||||
array_key_exists(self::MULTIPLE_CF_INLINE, $options)
|
||||
&& $options[self::MULTIPLE_CF_INLINE]
|
||||
) {
|
||||
$attrArray['class'] = 'multiple-cf-inline';
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@ use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class CustomFieldsGroupType extends AbstractType
|
||||
|
@@ -15,6 +15,7 @@ use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
||||
use function gettype;
|
||||
|
||||
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
|
||||
|
@@ -14,7 +14,9 @@ namespace Chill\CustomFieldsBundle\Form\DataTransformer;
|
||||
use Chill\CustomFieldsBundle\Entity\CustomField;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
|
||||
class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
|
||||
@@ -33,7 +35,9 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
|
||||
|
||||
// @TODO: in the array_map callback, CustomField::getLabel() does not exist. What do we do here?
|
||||
$customFieldsLablels = array_map(
|
||||
static function ($e) { return $e->getLabel(); },
|
||||
static function ($e) {
|
||||
return $e->getLabel();
|
||||
},
|
||||
$customFields
|
||||
);
|
||||
|
||||
|
@@ -15,6 +15,7 @@ use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
/**
|
||||
|
@@ -17,7 +17,6 @@ use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
|
||||
class ChoicesListType extends AbstractType
|
||||
|
@@ -18,7 +18,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
||||
// Feel free to remove this, extend it, or make something more sophisticated.
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
if (
|
||||
isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
|| !(in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server')
|
||||
) {
|
||||
|
@@ -37,7 +37,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
*/
|
||||
private $cfProvider;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
@@ -46,7 +46,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
||||
$this->cfChoice = $this->cfProvider->getCustomFieldByType('choice');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\
|
||||
*/
|
||||
private $formBuilder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -28,7 +28,7 @@ final class CustomFieldsTextTest extends WebTestCase
|
||||
*/
|
||||
private $customFieldProvider;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->customFieldProvider = self::$kernel->getContainer()
|
||||
|
@@ -27,7 +27,7 @@ final class PostTextIntegerExtensionTest extends KernelTestCase
|
||||
*/
|
||||
private $formBuilder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -27,7 +27,7 @@ final class PostTextNumberExtensionTest extends KernelTestCase
|
||||
*/
|
||||
private $formBuilder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -33,7 +33,7 @@ final class CustomFieldsHelperTest extends KernelTestCase
|
||||
*/
|
||||
private $randomCFText;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
|
@@ -34,7 +34,7 @@ final class CustomFieldRenderingTwigTest extends KernelTestCase
|
||||
*/
|
||||
private $cfRendering;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->cfRendering = self::$kernel->getContainer()
|
||||
|
@@ -36,7 +36,7 @@ final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
|
||||
*/
|
||||
private $cfRendering;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->cfRendering = self::$kernel->getContainer()
|
||||
|
@@ -11,8 +11,17 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle;
|
||||
|
||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ChillDocGeneratorBundle extends Bundle
|
||||
{
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
|
||||
$container->registerForAutoconfiguration(DocGeneratorContextInterface::class)
|
||||
->addTag('chill_docgen.context');
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,58 @@
|
||||
<?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\DocGeneratorBundle\Context;
|
||||
|
||||
use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
|
||||
class ContextManager
|
||||
{
|
||||
/**
|
||||
* @var DocGeneratorContextInterface[]|iterable
|
||||
*/
|
||||
private iterable $contexts;
|
||||
|
||||
public function __construct(iterable $contexts)
|
||||
{
|
||||
$this->contexts = $contexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throw ContextNotFoundException when the context is not found
|
||||
*/
|
||||
public function getContextByDocGeneratorTemplate(DocGeneratorTemplate $docGeneratorTemplate): DocGeneratorContextInterface
|
||||
{
|
||||
foreach ($this->contexts as $key => $context) {
|
||||
if ($docGeneratorTemplate->getContext() === $key) {
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ContextNotFoundException($docGeneratorTemplate->getContext());
|
||||
}
|
||||
|
||||
public function getContextByKey(string $searchedKey): DocGeneratorContextInterface
|
||||
{
|
||||
foreach ($this->contexts as $key => $context) {
|
||||
if ($searchedKey === $key) {
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
||||
throw new ContextNotFoundException($searchedKey);
|
||||
}
|
||||
|
||||
public function getContexts(): array
|
||||
{
|
||||
return iterator_to_array($this->contexts);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user