Merge branch 'ameliorations_composants_vue' of gitlab.com:Chill-Projet/chill-bundles into ameliorations_composants_vue

This commit is contained in:
2021-08-19 16:21:11 +02:00
290 changed files with 14212 additions and 4797 deletions

View File

@@ -70,8 +70,6 @@ class ThirdPartyController extends Controller
$nbThirdParties = $repository->countByMemberOfCenters($centers);
$pagination = $this->paginatorFactory->create($nbThirdParties);
$pagination->setItemsPerPage(20);
$thirdParties = $repository->findByMemberOfCenters(
$centers,
$pagination->getCurrentPage()->getFirstItemNumber(),

View File

@@ -0,0 +1,46 @@
<?php
namespace Chill\ThirdPartyBundle\DataFixtures\ORM;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Doctrine\Persistence\ObjectManager;
/**
* Class LoadThirdPartyCategory
* @package Chill\ThirdPartyBundle\DataFixtures\ORM
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
*/
class LoadThirdPartyCategory extends Fixture implements FixtureGroupInterface
{
public static function getGroups(): array
{
return ['thirdparty_categories'];
}
public function load(ObjectManager $manager)
{
$categories = [
['name' => ['fr' => "maison médicale" ]],
['name' => ['fr' => "hôpital" ]],
['name' => ['fr' => "médecin généraliste" ]],
['name' => ['fr' => "pharmacien" ]],
['name' => ['fr' => "assistance aux personnes âgées" ]],
['name' => ['fr' => "assistante maternelle" ]],
['name' => ['fr' => "assistant social" ]],
['name' => ['fr' => "éducateur spécialisé" ]],
['name' => ['fr' => "infirmier.ère" ]],
];
foreach ( $categories as $val) {
print "Creating thirdparty category : " . $val['name']['fr'] . "\n";
$category = (new ThirdPartyCategory())
->setName($val['name'])
->setActive(true);
$manager->persist($category);
}
$manager->flush();
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Chill\ThirdPartyBundle\DataFixtures\ORM;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Doctrine\Persistence\ObjectManager;
/**
* Class LoadThirdPartyCivility
* @package Chill\ThirdPartyBundle\DataFixtures\ORM
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
*/
class LoadThirdPartyCivility extends Fixture implements FixtureGroupInterface
{
public static function getGroups(): array
{
return ['thirdparty_civilities'];
}
public function load(ObjectManager $manager): void
{
$civilities = [
['name' => ['fr' => "Monsieur" ]],
['name' => ['fr' => "Madame" ]],
['name' => ['fr' => "Docteur" ]],
['name' => ['fr' => "Professeur" ]],
['name' => ['fr' => "Madame la Directrice" ]],
['name' => ['fr' => "Monsieur le Directeur" ]],
['name' => ['fr' => "Madame la Maire" ]],
['name' => ['fr' => "Monsieur le Maire" ]],
['name' => ['fr' => "Maître" ]],
];
foreach ( $civilities as $val) {
print "Creating thirdparty civility : " . $val['name']['fr'] . "\n";
$civility = (new ThirdPartyCivility())
->setName($val['name'])
->setActive(true);
$manager->persist($civility);
}
$manager->flush();
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Chill\ThirdPartyBundle\DataFixtures\ORM;
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Doctrine\Persistence\ObjectManager;
/**
* Class LoadThirdPartyProfession
* @package Chill\ThirdPartyBundle\DataFixtures\ORM
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
*/
class LoadThirdPartyProfession extends Fixture implements FixtureGroupInterface
{
public static function getGroups(): array
{
return ['thirdparty_professions'];
}
public function load(ObjectManager $manager)
{
$professions = [
['name' => ['fr' => "Directeur" ]],
['name' => ['fr' => "Docteur" ]],
['name' => ['fr' => "Médecin" ]],
['name' => ['fr' => "Opérateur" ]],
['name' => ['fr' => "Personnel administratif" ]],
['name' => ['fr' => "Président" ]],
['name' => ['fr' => "Responsable infirmier.ère" ]],
];
foreach ( $professions as $val) {
print "Creating thirdparty professions : " . $val['name']['fr'] . "\n";
$profession = (new ThirdPartyProfession())
->setName($val['name'])
->setActive(true);
$manager->persist($profession);
}
$manager->flush();
}
}

View File

@@ -22,6 +22,7 @@
namespace Chill\ThirdPartyBundle\Entity;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
@@ -41,13 +42,13 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
* @ORM\Entity(repositoryClass="Chill\ThirdPartyBundle\Repository\ThirdPartyRepository")
* @DiscriminatorMap(typeProperty="type", mapping={
* "thirdparty"=ThirdParty::class
*})
* })
* @ORM\HasLifecycleCallbacks()
*/
class ThirdParty
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
@@ -56,15 +57,73 @@ class ThirdParty
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
* @Assert\Length(min="2")
*/
private $name;
/**
* [fr] Raison sociale
* @var string
* @ORM\Column(name="name_company", type="string", length=255, nullable=true)
* @Assert\Length(min="3")
*/
private $nameCompany;
/**
* [fr] Sigle
* @var string
* @ORM\Column(name="acronym", type="string", length=64, nullable=true)
* @Assert\Length(min="2")
*/
private $acronym;
/**
* @var ThirdPartyCategory
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyCategory")
* @ORM\JoinTable(name="chill_3party.thirdparty_category",
* joinColumns={@ORM\JoinColumn(name="thirdparty_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")})
*/
private $categories;
/**
* @var array|null
* @ORM\Column(name="types", type="json", nullable=true)
* @Assert\Count(min=1)
*/
private $type;
/**
* Contact Persons: One Institutional ThirdParty has Many Contact Persons
* @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent")
*/
private Collection $children;
/**
* Institutional ThirdParty: Many Contact Persons have One Institutional ThirdParty
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
private ?ThirdParty $parent;
/**
* @var ThirdPartyCivility
* @ORM\OneToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyCivility")
* @ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
*/
private $civility;
/**
* [fr] Qualité
* @var ThirdPartyProfession
* @ORM\OneToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
* @ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
*/
private $profession;
/**
* @var string|null
*
* @ORM\Column(name="telephone", type="string", length=64, nullable=true)
* @Assert\Regex("/^([\+{1}])([0-9\s*]{4,20})$/",
* message="Invalid phone number: it should begin with the international prefix starting with ""+"", hold only digits and be smaller than 20 characters. Ex: +33123456789"
@@ -74,41 +133,11 @@ class ThirdParty
/**
* @var string|null
*
* @ORM\Column(name="email", type="string", length=255, nullable=true)
* @Assert\Email(checkMX=false)
*/
private $email;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var array|null
*
* @ORM\Column(name="types", type="json", nullable=true)
* @Assert\Count(min=1)
*/
private $type;
/**
* @var boolean
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
*/
private $active = true;
/**
* @var Collection instances of Center
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
* @ORM\JoinTable(name="chill_3party.party_center")
* @Assert\Count(min=1)
*/
private $centers;
/**
* @var Address|null
* @ORM\ManyToOne(targetEntity="\Chill\MainBundle\Entity\Address",
@@ -117,12 +146,69 @@ class ThirdParty
*/
private $address;
/**
* @var boolean
* @ORM\Column(name="active", type="boolean", options={"defaut": true})
*/
private $active = true;
/**
* @var string|null
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var Collection
* @ORM\ManyToMany(targetEntity="\Chill\MainBundle\Entity\Center")
* @ORM\JoinTable(name="chill_3party.party_center")
* @Assert\Count(min=1)
*/
private $centers;
/**
* @ORM\Column(name="created_at", type="datetime_immutable", nullable=false)
*/
private \DateTimeImmutable $createdAt;
/**
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private ?\DateTime $updatedAt;
/**
* @var User
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @ORM\JoinColumn(name="updated_by", referencedColumnName="id")
*/
private $updatedBy;
/**
* @ORM\PrePersist()
*/
public function prePersist()
{
$this->createdAt = new \DateTimeImmutable();
}
/**
* @ORM\PreUpdate()
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
/**
* ThirdParty constructor.
*/
public function __construct()
{
$this->centers = new ArrayCollection();
$this->categories = new ArrayCollection();
$this->children = new ArrayCollection();
}
/**
@@ -342,4 +428,212 @@ class ThirdParty
{
return $this->getName();
}
/**
* @return string|null
*/
public function getNameCompany(): ?string
{
return $this->nameCompany;
}
/**
* @param string $nameCompany
* @return ThirdParty
*/
public function setNameCompany(string $nameCompany): ThirdParty
{
$this->nameCompany = $nameCompany;
return $this;
}
/**
* @return string
*/
public function getAcronym(): ?string
{
return $this->acronym;
}
/**
* @param string $acronym
* @return $this
*/
public function setAcronym(string $acronym): ThirdParty
{
$this->acronym = $acronym;
return $this;
}
/**
* @return Collection
*/
public function getCategories(): Collection
{
return $this->categories;
}
/**
* @param ThirdPartyCategory $category
* @return $this
*/
public function addCategory(ThirdPartyCategory $category): self
{
$this->categories[] = $category;
return $this;
}
/**
* @param ThirdPartyCategory $category
* @return $this
*/
public function removeCategory(ThirdPartyCategory $category): self
{
$this->categories->removeElement($category);
return $this;
}
public function isLeaf(): bool
{
return $this->children->count() !== 0;
}
/**
* @return Collection
*/
public function getChildren(): Collection
{
return $this->children;
}
/**
* @param ThirdParty $child
* @return $this
*/
public function addChild(ThirdParty $child): self
{
$this->children[] = $child;
return $this;
}
/**
* @param ThirdParty $child
* @return $this
*/
public function removeChild(ThirdParty $child): self
{
$this->categories->removeElement($child);
return $this;
}
/**
* @return ThirdParty|null
*/
public function getParent(): ?ThirdParty
{
return $this->parent;
}
/**
* @param ThirdParty|null $parent
* @return $this
*/
public function setParent(?ThirdParty $parent): ThirdParty
{
$this->parent = $parent;
return $this;
}
/**
* @return ThirdPartyCivility|null
*/
public function getCivility(): ?ThirdPartyCivility
{
return $this->civility;
}
/**
* @param ThirdPartyCivility $civility
* @return $this
*/
public function setCivility(ThirdPartyCivility $civility): ThirdParty
{
$this->civility = $civility;
return $this;
}
/**
* @return ThirdPartyProfession
*/
public function getProfession(): ?ThirdPartyProfession
{
return $this->profession;
}
/**
* @param ThirdPartyProfession $profession
* @return $this
*/
public function setProfession(ThirdPartyProfession $profession): ThirdParty
{
$this->profession = $profession;
return $this;
}
/**
* @return \DateTimeImmutable
*/
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
/**
* @param \DateTimeImmutable $createdAt
* @return $this
*/
public function setCreatedAt(\DateTimeImmutable $createdAt): ThirdParty
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return \DateTime|null
*/
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
/**
* @param \DateTime $updatedAt
* @return $this
*/
public function setUpdatedAt(\DateTime $updatedAt): ThirdParty
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return User|null
*/
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
/**
* @param User $updatedBy
* @return $this
*/
public function setUpdatedBy(User $updatedBy): ThirdParty
{
$this->updatedBy = $updatedBy;
return $this;
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ThirdPartyBundle\Entity;
use Chill\ThirdPartyBundle\Repository\ThirdPartyCategoryRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_3party.party_category")
* @ORM\Entity(repositoryClass=ThirdPartyCategoryRepository::class)
*/
class ThirdPartyCategory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="json")
*/
private $name = [];
/**
* @ORM\Column(type="boolean")
*/
private $active = true;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?array
{
return $this->name;
}
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ThirdPartyBundle\Entity;
use Chill\ThirdPartyBundle\Repository\ThirdPartyCivilityRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_3party.party_civility")
* @ORM\Entity(repositoryClass=ThirdPartyCivilityRepository::class)
*/
class ThirdPartyCivility
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="json")
*/
private $name = [];
/**
* @ORM\Column(type="boolean")
*/
private $active = true;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?array
{
return $this->name;
}
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ThirdPartyBundle\Entity;
use Chill\ThirdPartyBundle\Repository\ThirdPartyProfessionRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="chill_3party.party_profession")
* @ORM\Entity(repositoryClass=ThirdPartyProfessionRepository::class)
*/
class ThirdPartyProfession
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="json")
*/
private $name = [];
/**
* @ORM\Column(type="boolean")
*/
private $active = true;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?array
{
return $this->name;
}
public function setName(array $name): self
{
$this->name = $name;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
}

View File

@@ -2,6 +2,13 @@
namespace Chill\ThirdPartyBundle\Form;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility;
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -20,34 +27,26 @@ use Chill\MainBundle\Form\Type\AddressType;
class ThirdPartyType extends AbstractType
{
/**
*
* @var AuthorizationHelper
*/
protected $authorizationHelper;
/**
*
* @var TokenStorageInterface
*/
protected $tokenStorage;
/**
*
* @var ThirdPartyTypeManager
*/
protected $typesManager;
protected AuthorizationHelper $authorizationHelper;
protected TokenStorageInterface $tokenStorage;
protected ThirdPartyTypeManager $typesManager;
protected TranslatableStringHelper $translatableStringHelper;
public function __construct(
AuthorizationHelper $authorizationHelper,
AuthorizationHelper $authorizationHelper,
TokenStorageInterface $tokenStorage,
ThirdPartyTypeManager $typesManager
ThirdPartyTypeManager $typesManager,
TranslatableStringHelper $translatableStringHelper
) {
$this->authorizationHelper = $authorizationHelper;
$this->tokenStorage = $tokenStorage;
$this->typesManager = $typesManager;
$this->translatableStringHelper = $translatableStringHelper;
}
/**
* {@inheritdoc}
*/
@@ -57,11 +56,31 @@ class ThirdPartyType extends AbstractType
foreach ($this->typesManager->getProviders() as $key => $provider) {
$types['chill_3party.key_label.'.$key] = $key;
}
$builder
->add('name', TextType::class, [
'required' => true
])
->add('categories', EntityType::class, [
'label' => 'thirdparty.Categories',
'class' => ThirdPartyCategory::class,
'choice_label' => function (ThirdPartyCategory $category): string {
return $this->translatableStringHelper->localize($category->getName());
},
'query_builder' => function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
'required' => true,
'multiple' => true,
'attr' => ['class' => 'select2']
])
->add('type', ChoiceType::class, [
'choices' => $types,
'expanded' => true,
'multiple' => true,
'label' => 'thirdparty.Type'
])
->add('telephone', TextType::class, [
'label' => 'Phonenumber',
'required' => false
@@ -69,16 +88,13 @@ class ThirdPartyType extends AbstractType
->add('email', EmailType::class, [
'required' => false
])
->add('comment', TextareaType::class, [
->add('address', AddressType::class, [
'has_valid_from' => false,
'null_if_empty' => true,
'required' => false
])
->add('type', ChoiceType::class, [
'choices' => $types,
'expanded' => true,
'multiple' => true,
'label' => 'thirdparty.Type'
])
->add('active', ChoiceType::class, [
'label' => 'thirdparty.Status',
'choices' => [
'Active, shown to users' => true,
'Inactive, not shown to users' => false
@@ -86,22 +102,65 @@ class ThirdPartyType extends AbstractType
'expanded' => true,
'multiple' => false
])
->add('comment', ChillTextareaType::class, [
'required' => false
])
->add('centers', EntityType::class, [
'choices' => $this->getReachableCenters($options),
'class' => \Chill\MainBundle\Entity\Center::class,
'multiple' => true,
'expanded' => true
])
->add('address', AddressType::class, [
'has_valid_from' => false,
'null_if_empty' => true,
'required' => false
'attr' => ['class' => 'select2']
])
;
// Contact Person ThirdParty (child)
if ($options['data']->isLeaf()) {
$builder
->add('civility', EntityType::class, [
'label' => 'thirdparty.Civility',
'class' => ThirdPartyCivility::class,
'choice_label' => function (ThirdPartyCivility $civility): string {
return $this->translatableStringHelper->localize($civility->getName());
},
'query_builder' => function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
'placeholder' => 'thirdparty.choose civility',
'required' => true
])
->add('profession', EntityType::class, [
'label' => 'thirdparty.Profession',
'class' => ThirdPartyProfession::class,
'choice_label' => function (ThirdPartyProfession $profession): string {
return $this->translatableStringHelper->localize($profession->getName());
},
'query_builder' => function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('p')
->where('p.active = true');
},
'placeholder' => 'thirdparty.choose profession',
'required' => false
])
;
// Institutional ThirdParty (parent)
} else {
$builder
->add('nameCompany', TextType::class, [
'label' => 'thirdparty.NameCompany',
'required' => false
])
->add('acronym', TextType::class, [
'label' => 'thirdparty.Acronym',
'required' => false
])
;
}
}
/**
*
*
* @param array $options
* @return \Chill\MainBundle\Entity\Center[]
*/
@@ -113,11 +172,11 @@ class ThirdPartyType extends AbstractType
case 'update': $role = new Role(ThirdPartyVoter::UPDATE);
break;
}
return $this->authorizationHelper->getReachableCenters(
$this->tokenStorage->getToken()->getUser(), $role);
}
/**
* {@inheritdoc}
*/
@@ -126,7 +185,7 @@ class ThirdPartyType extends AbstractType
$resolver->setDefaults(array(
'data_class' => 'Chill\ThirdPartyBundle\Entity\ThirdParty'
));
$resolver->setRequired('usage')
->setAllowedValues('usage', ['create', 'update'])
;

View File

@@ -0,0 +1,42 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ThirdPartyBundle\Repository;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ThirdPartyCategory|null find($id, $lockMode = null, $lockVersion = null)
* @method ThirdPartyCategory|null findOneBy(array $criteria, array $orderBy = null)
* @method ThirdPartyCategory[] findAll()
* @method ThirdPartyCategory[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ThirdPartyCategoryRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ThirdPartyCategory::class);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ThirdPartyBundle\Repository;
use Chill\ThirdPartyBundle\Entity\ThirdPartyCivility;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ThirdPartyCivility|null find($id, $lockMode = null, $lockVersion = null)
* @method ThirdPartyCivility|null findOneBy(array $criteria, array $orderBy = null)
* @method ThirdPartyCivility[] findAll()
* @method ThirdPartyCivility[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ThirdPartyCivilityRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ThirdPartyCivility::class);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\ThirdPartyBundle\Repository;
use Chill\ThirdPartyBundle\Entity\ThirdPartyProfession;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method ThirdPartyProfession|null find($id, $lockMode = null, $lockVersion = null)
* @method ThirdPartyProfession|null findOneBy(array $criteria, array $orderBy = null)
* @method ThirdPartyProfession[] findAll()
* @method ThirdPartyProfession[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ThirdPartyProfessionRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ThirdPartyProfession::class);
}
}

View File

@@ -1,3 +1,12 @@
///
div.thirdparty-list {
label.counter {
float: right;
span {
font-weight: bold;
}
}
}
/// render_box
section.chill-entity {
@@ -6,59 +15,3 @@ section.chill-entity {
}
}
/* AVANT
border: 1px solid black;
background-color: rgba(255, 255, 255, 0.65);
padding: 1em;
margin: 1em 0;
max-width: 500px;
div.name {
font-variant: small-caps;
}
div.category {
margin: 0.5em 0;
font-size: 85%;
span.category {
font-style: italic;
}
span::before {
margin-left: 0.5em;
margin-right: 0.5em;
font-family: 'ForkAwesome';
content: '\f02e';
font-style: normal;
}
}
div.comment {
font-size: 85%;
font-style: italic;
}
div.chill_address {
div.chill_address_address::before {
margin-left: 0.5em;
margin-right: 0.5em;
font-family: 'ForkAwesome';
content: '\f015';
}
}
div.contact {
font-variant: small-caps;
span::before {
margin-left: 0.5em;
margin-right: 0.5em;
font-family: 'ForkAwesome';
}
span.email::before {
content: '\f1fa';
}
span.telephone::before {
content: '\f095';
}
}
*/

View File

@@ -50,7 +50,7 @@
<div class="item-col">
<ul class="list-content fa-ul">
<!-- ADDRESS -->
<li v-if="thirdparty.address" class="chill-entity entity-address">
<li v-if="thirdparty.address">
<i class="fa fa-li fa-map-marker"></i>
<show-address :address="thirdparty.address" :multiline="false"></show-address>
</li>

View File

@@ -0,0 +1,23 @@
<template>
<div v-if="action === 'show'">
show
thirdparty
{{ id }}
</div>
<div v-else-if="action === 'edit' || action === 'create'">
{{ action }}
thirdparty
{{ id }}
</div>
</template>
<script>
export default {
name: "OnTheFlyThirdParty",
props: ['id', 'type', 'action']
}
// TODO move in ChillThirdpartyAssets
</script>
<style lang="css" scoped>
</style>

View File

@@ -52,7 +52,9 @@
{% endmacro label %}
{%- if render == 'raw' -%}
{{ _self.raw(thirdparty, options) }}
<span class="entity-raw">
{{ _self.raw(thirdparty, options) }}
</span>
{%- endif -%}
{%- if render == 'label' -%}
@@ -64,7 +66,7 @@
<div class="item-col">
{{ _self.label(thirdparty, options) }}
</div>
<div class="item-col">
<div class="item-col separator">
<ul class="list-content fa-ul">
{{ thirdparty.getAddress|chill_entity_render_box({
'render': 'list',
@@ -90,14 +92,15 @@
{{ options['customButtons']['before'] }}
{% endif %}
{%- if options['customButtons']['replace'] is not defined and is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) -%}
{% if options['customButtons']['replace'] is defined %}
{{ options['customButtons']['replace'] }}
{% elseif is_granted('CHILL_3PARTY_3PARTY_SHOW', thirdparty) %}
<li>
<a class="btn btn-show" target="_blank" title="{{ 'Show thirdparty'|trans }}"
<a class="btn btn-sm btn-show" target="_blank" title="{{ 'Show thirdparty'|trans }}"
href="{{ path('chill_3party_3party_show', { thirdparty_id: thirdparty.id }) }}"></a>
</li>
{%- else -%}
{{ options['customButtons']['replace'] }}
{%- endif -%}
{% else %}
{% endif %}
{% if options['customButtons']['after'] is defined %}
{{ options['customButtons']['after'] }}

View File

@@ -3,64 +3,107 @@
{% block title 'List of third parties'|trans %}
{% block content %}
<div class="col-10 centered">
<h1>{{ 'List of third parties'|trans }}</h1>
{% if third_parties|length == 0 %}
<p class="chill-no-data-statement">{{ 'No third parties'|trans }}</p>
{% else %}
<table>
<thead>
<tr>
<th style="width: 35px;"></th>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Category'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for tp in third_parties %}
<tr>
<th>{{ (tp.active ? '<i class="fa fa-check chill-green">' : '<i class="fa fa-times chill-red">')|raw }}</th>
<td>{{ tp.name }}</td>
{% set types = [] %}
{% for t in tp.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<td>{{ types|join(', ') }}</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_update', { 'thirdparty_id': tp.id }) }}" class="btn btn-update"></a>
</li>
{% endif %}
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_show', { 'thirdparty_id': tp.id }) }}" class="btn btn-show"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="thirdparty-list my-5">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{% if third_parties|length < pagination.getTotalItems %}
{{ chill_pagination(pagination) }}
{% endif %}
<h1>{{ 'List of third parties'|trans }}</h1>
{% endif %}
{% if third_parties|length == 0 %}
<p class="chill-no-data-statement">{{ 'No third parties'|trans }}</p>
{% else %}
{% if is_granted('CHILL_3PARTY_3PARTY_CREATE') %}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_new') }}" class="btn btn-create">
{{ "New third party"|trans }}
</a>
{% endif %}
<nav class="filter-actions border border-secondary my-4 p-3">
<i>outils de filtrage</i>
</nav>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<label class="counter">
<span>{{ pagination.totalItems }}</span> {{ 'third parties'|trans }}
</label>
<table class="table table-striped table-hover align-middle">
<thead>
<tr>
<th class="chill-pink" style="width: 35px;"></th>
<th class="chill-pink">{{ 'Name'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink">{{ 'Category'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink">{{ 'Address'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink">{{ 'thirdparty.UpdatedAt.short'|trans }}
<i class="fa fa-fw fa-sort"></i>
</th>
<th class="chill-pink"></th>
</tr>
</thead>
<tbody>
{% for tp in third_parties %}
<tr>
<th>{{ (tp.active ? '<i class="fa fa-check chill-green">' : '<i class="fa fa-times chill-red">')|raw }}</th>
<td>{{ tp.name }}</td>
{% set types = [] %}
{% for t in tp.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<td>{{ types|join(', ') }}</td>
<td>
{{ tp.address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
</td>
<td>
{% if tp.updatedAt != null %}
{{ tp.updatedAt|format_date('short') }}
{% else %}
{{ tp.createdAt|format_date('short') }}
{% endif %}
</td>
<td>
<ul class="record_actions">
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_update', { 'thirdparty_id': tp.id }) }}" class="btn btn-update"></a>
</li>
{% endif %}
{% if is_granted('CHILL_3PARTY_3PARTY_SHOW', tp) %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_show', { 'thirdparty_id': tp.id }) }}" class="btn btn-show"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if third_parties|length < pagination.getTotalItems %}
{{ chill_pagination(pagination, 'long') }}
{% endif %}
{% endif %}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
{{ chill_items_per_page(pagination) }}
</li>
{% if is_granted('CHILL_3PARTY_3PARTY_CREATE') %}
<li>
<a href="{{ chill_path_add_return_path('chill_3party_3party_new') }}" class="btn btn-create">
{{ "New third party"|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock %}

View File

@@ -3,32 +3,58 @@
{% block title 'Create third party'|trans %}
{% block content %}
<div class="col-10 centered">
<h1>{{ 'Create third party'|trans }}</h1>
<div class="thirdparty-new my-5">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.telephone) }}
{{ form_row(form.email) }}
{{ form_row(form.address) }}
{{ form_row(form.active) }}
{{ form_row(form.centers) }}
{{ form_row(form.comment) }}
<h1>{{ 'Create third party'|trans }}</h1>
{{ form_start(form) }}
<ul class="record_actions">
<li class="cancel">
<a href="{{ chill_return_path_or('chill_3party_3party_index') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, {'label': 'Create', 'attr': {'class': 'btn btn-new' }}) }}
</li>
</ul>
{{ form_end(form) }}
{% if form.civility is defined %}
{{ form_row(form.civility) }}
{% endif %}
{{ form_row(form.name) }}
{% if form.nameCompany is defined %}
{{ form_row(form.nameCompany) }}
{{ form_row(form.acronym) }}
{% endif %}
{% if form.profession is defined %}
{{ form_row(form.profession) }}
{% endif %}
{{ form_row(form.categories) }}
{{ form_row(form.type) }}
{{ form_row(form.telephone) }}
{{ form_row(form.email) }}
{{ form_row(form.address) }}
{{ form_row(form.comment) }}
{{ form_row(form.centers) }}
{{ form_row(form.active) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ chill_return_path_or('chill_3party_3party_index') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
</li>
<li>
{{ form_widget(form.submit, {'label': 'Create', 'attr': {'class': 'btn btn-new' }}) }}
</li>
</ul>
{{ form_end(form) }}
</div>
</div>
</div>
{% endblock %}

View File

@@ -5,61 +5,118 @@
{% block title title_ %}
{% block content %}
<div class="col-10 centered">
<h1>
{{ title_ }}
<span class="chill__box {{ thirdParty.active ? 'green' : 'red' }}">{{ (thirdParty.active ? 'Active, shown to users' : 'Inactive, not shown to users')|trans }}</span>
</h1>
<dl class="chill_view_data">
<dt>{{ 'Name'|trans }}</dt>
<dd>{{ thirdParty.name }}</dd>
<dt>{{ 'Type'|trans }}</dt>
{% set types = [] %}
{% for t in thirdParty.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<dd>{{ types|join(', ') }}</dd>
<dt>{{ 'Centers'|trans }}</dt>
<dd>{{ 'The party is visible in those centers'|trans }}&nbsp;: {{ thirdParty.centers|join(', ') }}</dd>
<dt>{{ 'Phonenumber'|trans }}</dt>
<dd>{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}</dd>
<dt>{{ 'email'|trans }}<dt>
<dd>{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}</dd>
<dt>{{ 'Address'|trans }}</dt>
<dd>
{% if thirdParty.address == null %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %}
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false }) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt>
<dd>{{ thirdParty.comment|chill_print_or_message("thirdparty.No_comment") }}</dd>
</dl>
<ul class="record_actions">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
{{ 'Cancel'|trans }}
</a>
</li>
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', thirdParty) %}
<li>
<a class="btn btn-update" href="{{ chill_path_forward_return_path('chill_3party_3party_update', { 'thirdparty_id': thirdParty.id }) }}">
{{ 'Update'|trans }}
</a>
</li>
{% endif %}
</ul>
<div class="thirdparty-show my-5">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<h1>
{{ title_ }}
<span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }}"
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
{{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
</span>
</h1>
<dl class="chill_view_data">
<dt>{{ 'Name'|trans }}</dt>
<dd>
{% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %}
{{ thirdParty.name }}
</dd>
{% if thirdParty.isLeaf == false %}
<dt>{{ 'thirdparty.NameCompany'|trans }}</dt>
<dd>
{% if thirdParty.nameCompany == null %}
<span class="chill-no-data-statement">{{ 'No nameCompany given'|trans }}</span>
{% else %}
{{ thirdParty.nameCompany }}
{% endif %}
</dd>
<dt>{{ 'thirdparty.Acronym'|trans }}</dt>
<dd>
{% if thirdParty.acronym == null %}
<span class="chill-no-data-statement">{{ 'No acronym given'|trans }}</span>
{% else %}
{{ thirdParty.acronym }}
{% endif %}
</dd>
{% endif %}
<dt>{{ 'Type'|trans }}</dt>
{% set types = [] %}
{% for t in thirdParty.type %}
{% set types = types|merge( [ ('chill_3party.key_label.'~t)|trans ] ) %}
{% endfor %}
<dd>
{{ types|join(', ') }}
</dd>
<dt>{{ 'Phonenumber'|trans }}</dt>
<dd>
{% if thirdParty.telephone == null %}
<span class="chill-no-data-statement">{{ 'No phone given'|trans }}</span>
{% else %}
<a href="{{ 'tel:' ~ thirdParty.telephone }}">
{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
</a>
{% endif %}
</dd>
<dt>{{ 'email'|trans }}<dt>
<dd>
{% if thirdParty.email == null %}
<span class="chill-no-data-statement">{{ 'No email given'|trans }}</span>
{% else %}
<a href="{{ 'mailto:' ~ thirdParty.email }}">
{{ thirdParty.email|chill_print_or_message("thirdparty.No_email") }}
</a>
{% endif %}
</dd>
<dt>{{ 'Address'|trans }}</dt>
<dd>
{% if thirdParty.address == null %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %}
{{ thirdParty.address|chill_entity_render_box({'with_valid_from': false }) }}
{% endif %}
</dd>
<dt>{{ 'Comment'|trans }}</dt>
<dd>
{% if thirdParty.comment is not empty %}
<blockquote class="chill-user-quote">
{{ thirdParty.comment|chill_markdown_to_html }}
</blockquote>
{% endif %}
</dd>
<dt>{{ 'Centers'|trans }}</dt>
<dd>{{ 'The party is visible in those centers'|trans }}&nbsp;: {{ thirdParty.centers|join(', ') }}</dd>
</dl>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_3party_3party_index') }}">
{{ 'Cancel'|trans }}
</a>
</li>
{% if is_granted('CHILL_3PARTY_3PARTY_UPDATE', thirdParty) %}
<li>
<a class="btn btn-update" href="{{ chill_path_forward_return_path('chill_3party_3party_update', { 'thirdparty_id': thirdParty.id }) }}">
{{ 'Update'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock %}
{% endblock %}

View File

@@ -3,35 +3,75 @@
{% block title 'Update third party %name%'|trans({ '%name%': thirdParty.name }) %}
{% block content %}
<div class="col-10 centered">
<h1>
{{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }}
<span class="chill__box {{ thirdParty.active ? 'green' : 'red' }}">{{ (thirdParty.active ? 'Active, shown to users' : 'Inactive, not shown to users')|trans }}</span>
<div class="thirdparty-edit my-5">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
</h1>
<h1>
{{ 'Update third party %name%'|trans({ '%name%': thirdParty.name }) }}
<span class="badge bg-{{ thirdParty.active ? 'success' : 'danger' }}"
title="{{ (thirdParty.active ? 'shown to users' : 'not shown to users')|trans }}">
{{ (thirdParty.active ? 'Active' : 'Inactive')|trans }}
</span>
</h1>
{{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.telephone) }}
{{ form_row(form.email) }}
{{ form_row(form.address) }}
{{ form_row(form.active) }}
{{ form_row(form.centers) }}
{{ form_row(form.comment) }}
<div class="date-by">
{% if thirdParty.updatedAt != null %}
{{ 'thirdparty.UpdatedAt.short'|trans ~ thirdParty.updatedAt|format_date('short') }}
{% else %}
{{ 'thirdparty.CreatedAt.short'|trans ~ thirdParty.createdAt|format_date('short') }}
{% endif %}
{% if thirdParty.updatedBy != null %}
{{ 'thirdparty.UpdateBy.short'|trans ~ thirdParty.updatedBy.usernameCanonical }}
{% endif %}
</div>
{{ form_start(form) }}
<ul class="record_actions">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_path_forward_return_path('chill_3party_3party_index') }}">
{{ 'Back to the list'|trans }}
</a>
<li>
{{ form_row(form.submit, {'label': 'Update', 'attr': {'class': 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(form) }}
{% if form.civility is defined %}
{{ form_row(form.civility) }}
{% endif %}
{{ form_row(form.name) }}
{% if form.nameCompany is defined %}
{{ form_row(form.nameCompany) }}
{{ form_row(form.acronym) }}
{% endif %}
{% if form.profession is defined %}
{{ form_row(form.profession) }}
{% endif %}
{{ form_row(form.categories) }}
{{ form_row(form.type) }}
{{ form_row(form.telephone) }}
{{ form_row(form.email) }}
{{ form_row(form.address) }}
{{ form_row(form.comment) }}
{{ form_row(form.centers) }}
{{ form_row(form.active) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ chill_path_forward_return_path('chill_3party_3party_index') }}">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
</li>
<li>
{{ form_widget(form.submit, {'label': 'Update', 'attr': {'class': 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(form) }}
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,4 +1,9 @@
module.exports = function(encore, entries)
{
entries.push(__dirname + '/Resources/public/chill/index.js');
// Aliases are used when webpack is trying to resolve modules path
encore.addAliases({
ChillThirdPartyAssets: __dirname + '/Resources/public'
});
};

View File

@@ -2,4 +2,16 @@
services:
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdParty:
tags:
- { 'name': doctrine.fixture.orm }
- { 'name': doctrine.fixture.orm }
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyCivility:
tags:
- { 'name': doctrine.fixture.orm }
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyCategory:
tags:
- { 'name': doctrine.fixture.orm }
Chill\ThirdPartyBundle\DataFixtures\ORM\LoadThirdPartyProfession:
tags:
- { 'name': doctrine.fixture.orm }

View File

@@ -4,9 +4,10 @@ services:
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
$typesManager: '@Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeManager'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: form.type }
Chill\ThirdPartyBundle\Form\Type\PickThirdPartyType:
arguments:
$em: '@Doctrine\ORM\EntityManagerInterface'
@@ -14,4 +15,4 @@ services:
$translator: '@Symfony\Component\Translation\TranslatorInterface'
$typesManager: '@Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeManager'
tags:
- { name: form.type }
- { name: form.type }

View File

@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add new fields to ThirdParty Entity
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
*/
final class Version20210719105918 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add new fields to ThirdParty Entity + new join tables';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE SEQUENCE chill_3party.party_category_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_3party.party_civility_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE chill_3party.party_profession_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_3party.party_category (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE chill_3party.party_civility (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE chill_3party.party_profession (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE chill_3party.thirdparty_category (thirdparty_id INT NOT NULL, category_id INT NOT NULL, PRIMARY KEY(thirdparty_id, category_id))');
$this->addSql('CREATE INDEX IDX_70495637C7D3A8E6 ON chill_3party.thirdparty_category (thirdparty_id)');
$this->addSql('CREATE INDEX IDX_7049563712469DE2 ON chill_3party.thirdparty_category (category_id)');
$this->addSql('ALTER TABLE chill_3party.thirdparty_category ADD CONSTRAINT FK_70495637C7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.thirdparty_category ADD CONSTRAINT FK_7049563712469DE2 FOREIGN KEY (category_id) REFERENCES chill_3party.party_category (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD parent_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD civility INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD profession INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD updated_by INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD name_company VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD acronym VARCHAR(64) DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT \'2015-01-01\' NOT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467B727ACA70 FOREIGN KEY (parent_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467B384D4799 FOREIGN KEY (civility) REFERENCES chill_3party.party_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BBA930D69 FOREIGN KEY (profession) REFERENCES chill_3party.party_profession (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467B16FE72E1 FOREIGN KEY (updated_by) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_D952467B727ACA70 ON chill_3party.third_party (parent_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D952467B384D4799 ON chill_3party.third_party (civility)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D952467BBA930D69 ON chill_3party.third_party (profession)');
$this->addSql('CREATE INDEX IDX_D952467B16FE72E1 ON chill_3party.third_party (updated_by)');
$this->addSql('ALTER INDEX chill_3party.idx_c65d4397c7d3a8e6 RENAME TO IDX_14DC4475C7D3A8E6');
$this->addSql('ALTER INDEX chill_3party.idx_c65d43975932f377 RENAME TO IDX_14DC44755932F377');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.thirdparty_category DROP CONSTRAINT FK_7049563712469DE2');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B384D4799');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BBA930D69');
$this->addSql('DROP SEQUENCE chill_3party.party_category_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_3party.party_civility_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_3party.party_profession_id_seq CASCADE');
$this->addSql('DROP TABLE chill_3party.party_category');
$this->addSql('DROP TABLE chill_3party.party_civility');
$this->addSql('DROP TABLE chill_3party.party_profession');
$this->addSql('DROP TABLE chill_3party.thirdparty_category');
$this->addSql('ALTER INDEX chill_3party.idx_14dc44755932f377 RENAME TO idx_c65d43975932f377');
$this->addSql('ALTER INDEX chill_3party.idx_14dc4475c7d3a8e6 RENAME TO idx_c65d4397c7d3a8e6');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B727ACA70');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B16FE72E1');
$this->addSql('ALTER TABLE chill_3party.third_party DROP parent_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP civility');
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
$this->addSql('ALTER TABLE chill_3party.third_party DROP updated_by');
$this->addSql('ALTER TABLE chill_3party.third_party DROP name_company');
$this->addSql('ALTER TABLE chill_3party.third_party DROP acronym');
$this->addSql('ALTER TABLE chill_3party.third_party DROP created_at');
$this->addSql('ALTER TABLE chill_3party.third_party DROP updated_at');
}
}

View File

@@ -1,5 +1,6 @@
Third party: Tiers
Third parties: Tiers
third parties: tiers
name: Nom
telephone: Téléphone
adress: Adresse
@@ -11,17 +12,45 @@ thirdparty.No_phonenumber: Aucun numéro de téléphone
thirdparty.No_email: Aucun email
thirdparty.No_comment: Aucun commentaire
New third party: Nouveau tiers
thirdparty.NameCompany: Raison sociale
thirdparty.Acronym: Sigle
thirdparty.Categories: Catégories
thirdparty.Child: Personne de contact
thirdparty.Children: Personnes de contact
thirdparty.Parent: Tiers institutionnel
thirdparty.Parents: Tiers institutionnels
thirdparty.Civility: Civilité
thirdparty.choose civility: --
thirdparty.Profession: Qualité
thirdparty.choose profession: --
thirdparty.CreatedAt.short: 'Créé le '
thirdparty.UpdatedAt.short: 'Modifié le '
thirdparty.UpdateBy.short: ' par '
thirdparty.CreatedAt.long: Date de création
thirdparty.UpdatedAt.long: Date de la dernière modification
thirdparty.UpdateBy.long: Utilisateur qui a effectué la dernière modification
New third party: Ajouter un nouveau tiers
Show third party %name%: Tiers "%name%"
Create third party: Créer un tiers
Update third party %name%: Mettre à jour "%name%"
List of third parties: Liste des tiers
Third party updated: Le tiers a été mis à jour
Third party created: Le tiers a été créé
Active, shown to users: Actif, visible par les utilisateurs
Inactive, not shown to users: Inactif, invisible par les utilisateurs
thirdparty.Status: Statut
Active, shown to users: Actif, visible pour les utilisateurs
Active: Actif
shown to users: visible pour les utilisateurs
Inactive, not shown to users: Inactif, invisible pour les utilisateurs
Inactive: Inactif
not shown to users: invisible pour les utilisateurs
Show thirdparty: Voir le tiers
No nameCompany given: Aucune raison sociale renseignée
No acronym given: Aucun sigle renseigné
No phone given: Aucun téléphone renseigné
No email given: Aucune adresse courriel renseignée
The party is visible in those centers: Le tiers est visible dans ces centres
No third parties: Aucun tiers