diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6973ff6d7..86e65c390 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ cache: before_script: # add extensions to postgres - - PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm; CREATE EXTENSION IF NOT EXISTS btree_gist;" + - PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;" # Install and run Composer - curl -sS https://getcomposer.org/installer | php - php -d memory_limit=2G composer.phar install diff --git a/composer.json b/composer.json index 95074c18f..748a7d862 100644 --- a/composer.json +++ b/composer.json @@ -73,7 +73,7 @@ "symfony/web-profiler-bundle": "^5.0", "symfony/var-dumper": "4.*", "symfony/debug-bundle": "^5.1", - "symfony/phpunit-bridge": "^5.2", + "symfony/phpunit-bridge": "^5.2", "nelmio/alice": "^3.8" }, "scripts": { diff --git a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php index a4dbdfad3..a1c6b6c65 100644 --- a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php +++ b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php @@ -117,7 +117,7 @@ class TimelineActivityProvider implements TimelineProviderInterface private function getWhereClauseForPerson(Person $person) { $parameters = []; - $metadataActivity = $this->em->getClassMetadata('ChillActivityBundle:Activity'); + $metadataActivity = $this->em->getClassMetadata(Activity::class); $associationMapping = $metadataActivity->getAssociationMapping('person'); $role = new Role('CHILL_ACTIVITY_SEE'); $reachableScopes = $this->helper->getReachableScopes($this->user, @@ -154,8 +154,8 @@ class TimelineActivityProvider implements TimelineProviderInterface private function getFromClausePerson() { - $metadataActivity = $this->em->getClassMetadata('ChillActivityBundle:Activity'); - $metadataPerson = $this->em->getClassMetadata('ChillPersonBundle:Person'); + $metadataActivity = $this->em->getClassMetadata(Activity::class); + $metadataPerson = $this->em->getClassMetadata(Person::class); $associationMapping = $metadataActivity->getAssociationMapping('person'); return $metadataActivity->getTableName().' JOIN ' @@ -173,7 +173,7 @@ class TimelineActivityProvider implements TimelineProviderInterface */ public function getEntities(array $ids) { - $activities = $this->em->getRepository('ChillActivityBundle:Activity') + $activities = $this->em->getRepository(Activity::class) ->findBy(array('id' => $ids)); $result = array(); diff --git a/src/Bundle/ChillMainBundle/Controller/AddressController.php b/src/Bundle/ChillMainBundle/Controller/AddressController.php deleted file mode 100644 index 1aeb39062..000000000 --- a/src/Bundle/ChillMainBundle/Controller/AddressController.php +++ /dev/null @@ -1,63 +0,0 @@ -json($address); - default: - throw new BadRequestException('Unsupported format'); - } - } - - - /** - * Get API Data for showing endpoint - * - * @Route( - * "/{_locale}/main/api/1.0/address-reference/{address_reference_id}/show.{_format}", - * name="chill_main_address_reference_api_show" - * ) - * @ParamConverter("addressReference", options={"id": "address_reference_id"}) - */ - public function showAddressReference(AddressReference $addressReference, $_format): Response - { - // TODO check ACL ? - switch ($_format) { - case 'json': - return $this->json($addressReference); - default: - throw new BadRequestException('Unsupported format'); - } - - } -} diff --git a/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php new file mode 100644 index 000000000..cbe0ea0a5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/AddressReferenceAPIController.php @@ -0,0 +1,27 @@ +query->has('postal_code')) { + + $qb->where('e.postcode = :postal_code') + ->setParameter('postal_code', $request->query->get('postal_code')); + + } + } + +} diff --git a/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php new file mode 100644 index 000000000..026784208 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/PostalCodeAPIController.php @@ -0,0 +1,27 @@ +query->has('country')) { + + $qb->where('e.country = :country') + ->setParameter('country', $request->query->get('country')); + + } + } + +} diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 5644138e6..f6d10ec9e 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -284,6 +284,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, ] ], [ + 'controller' => \Chill\MainBundle\Controller\AddressReferenceAPIController::class, 'class' => \Chill\MainBundle\Entity\AddressReference::class, 'name' => 'address_reference', 'base_path' => '/api/1.0/main/address-reference', @@ -304,6 +305,7 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, ] ], [ + 'controller' => \Chill\MainBundle\Controller\PostalCodeAPIController::class, 'class' => \Chill\MainBundle\Entity\PostalCode::class, 'name' => 'postal_code', 'base_path' => '/api/1.0/main/postal-code', diff --git a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php index 43c21ae59..2e6f83a69 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php +++ b/src/Bundle/ChillMainBundle/Doctrine/Model/Point.php @@ -9,11 +9,11 @@ use \JsonSerializable; * */ class Point implements JsonSerializable { - private float $lat; - private float $lon; + private ?float $lat = null; + private ?float $lon = null; public static string $SRID = '4326'; - private function __construct(float $lon, float $lat) + private function __construct(?float $lon, ?float $lat) { $this->lat = $lat; $this->lon = $lon; diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php index 2003a7910..2fc024e8c 100644 --- a/src/Bundle/ChillMainBundle/Entity/Address.php +++ b/src/Bundle/ChillMainBundle/Entity/Address.php @@ -4,6 +4,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Serializer\Annotation\Groups; use Chill\MainBundle\Doctrine\Model\Point; use Chill\ThirdPartyBundle\Entity\ThirdParty; @@ -22,6 +23,7 @@ class Address * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @groups({"write"}) */ private $id; @@ -29,6 +31,7 @@ class Address * @var string * * @ORM\Column(type="string", length=255) + * @groups({"write"}) */ private $street = ''; @@ -36,6 +39,7 @@ class Address * @var string * * @ORM\Column(type="string", length=255) + * @groups({"write"}) */ private $streetNumber = ''; @@ -43,6 +47,7 @@ class Address * @var PostalCode * * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") + * @groups({"write"}) */ private $postcode; @@ -50,6 +55,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=16, nullable=true) + * @groups({"write"}) */ private $floor; @@ -57,6 +63,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=16, nullable=true) + * @groups({"write"}) */ private $corridor; @@ -64,6 +71,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=16, nullable=true) + * @groups({"write"}) */ private $steps; @@ -71,6 +79,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"write"}) */ private $buildingName; @@ -78,6 +87,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=16, nullable=true) + * @groups({"write"}) */ private $flat; @@ -85,6 +95,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"write"}) */ private $distribution; @@ -92,6 +103,7 @@ class Address * @var string|null * * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"write"}) */ private $extra; @@ -102,6 +114,7 @@ class Address * @var \DateTime * * @ORM\Column(type="date") + * @groups({"write"}) */ private $validFrom; @@ -112,11 +125,13 @@ class Address * @var \DateTime|null * * @ORM\Column(type="date", nullable=true) + * @groups({"write"}) */ private $validTo; /** * True if the address is a "no address", aka homeless person, ... + * @groups({"write"}) * * @var bool */ @@ -128,6 +143,7 @@ class Address * @var Point|null * * @ORM\Column(type="point", nullable=true) + * @groups({"write"}) */ private $point; @@ -137,6 +153,7 @@ class Address * @var ThirdParty|null * * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty") + * @groups({"write"}) * @ORM\JoinColumn(nullable=true, onDelete="SET NULL") */ private $linkedToThirdParty; diff --git a/src/Bundle/ChillMainBundle/Entity/AddressReference.php b/src/Bundle/ChillMainBundle/Entity/AddressReference.php index b1fca205d..d13de4de9 100644 --- a/src/Bundle/ChillMainBundle/Entity/AddressReference.php +++ b/src/Bundle/ChillMainBundle/Entity/AddressReference.php @@ -4,6 +4,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Chill\MainBundle\Doctrine\Model\Point; +use Symfony\Component\Serializer\Annotation\Groups; /** * @ORM\Entity() @@ -16,21 +17,25 @@ class AddressReference * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") + * @groups({"read"}) */ private $id; /** * @ORM\Column(type="string", length=255) + * @groups({"read"}) */ private $refId; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $street; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $streetNumber; @@ -38,16 +43,19 @@ class AddressReference * @var PostalCode * * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\PostalCode") + * @groups({"read"}) */ private $postcode; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $municipalityCode; /** * @ORM\Column(type="string", length=255, nullable=true) + * @groups({"read"}) */ private $source; @@ -57,6 +65,7 @@ class AddressReference * @var Point * * @ORM\Column(type="point") + * @groups({"read"}) */ private $point; diff --git a/src/Bundle/ChillMainBundle/Entity/Country.php b/src/Bundle/ChillMainBundle/Entity/Country.php index f8f68c3f3..932944d03 100644 --- a/src/Bundle/ChillMainBundle/Entity/Country.php +++ b/src/Bundle/ChillMainBundle/Entity/Country.php @@ -3,6 +3,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; /** * Country @@ -20,6 +21,7 @@ class Country * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @groups({"read"}) */ private $id; @@ -27,13 +29,16 @@ class Country * @var string * * @ORM\Column(type="json_array") + * @groups({"read"}) + * */ private $name; - + /** * @var string * * @ORM\Column(type="string", length=3) + * @groups({"read"}) */ private $countryCode; @@ -41,7 +46,7 @@ class Country /** * Get id * - * @return integer + * @return integer */ public function getId() { @@ -57,20 +62,20 @@ class Country public function setName($name) { $this->name = $name; - + return $this; } /** * Get name * - * @return string + * @return string */ public function getName() { return $this->name; } - + /** * @return string */ @@ -90,12 +95,12 @@ class Country /** * - * @param string $countryCode + * @param string $countryCode */ public function setCountryCode($countryCode) { $this->countryCode = $countryCode; return $this; } - + } diff --git a/src/Bundle/ChillMainBundle/Entity/PostalCode.php b/src/Bundle/ChillMainBundle/Entity/PostalCode.php index 3cff0a6bf..a70a955b8 100644 --- a/src/Bundle/ChillMainBundle/Entity/PostalCode.php +++ b/src/Bundle/ChillMainBundle/Entity/PostalCode.php @@ -3,6 +3,7 @@ namespace Chill\MainBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; /** * PostalCode @@ -25,6 +26,7 @@ class PostalCode * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @groups({"read"}) */ private $id; @@ -32,6 +34,7 @@ class PostalCode * @var string * * @ORM\Column(type="string", length=255, name="label") + * @groups({"read"}) */ private $name; @@ -39,6 +42,7 @@ class PostalCode * @var string * * @ORM\Column(type="string", length=100) + * @groups({"read"}) */ private $code; @@ -46,6 +50,7 @@ class PostalCode * @var Country * * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country") + * @groups({"read"}) */ private $country; diff --git a/src/Bundle/ChillMainBundle/Resources/public/modules/bootstrap/bootstrap.scss b/src/Bundle/ChillMainBundle/Resources/public/modules/bootstrap/bootstrap.scss index 8a77ac48f..cc9c090e2 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/modules/bootstrap/bootstrap.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/modules/bootstrap/bootstrap.scss @@ -23,7 +23,7 @@ // @import "bootstrap/scss/button-group"; // @import "bootstrap/scss/input-group"; // @import "bootstrap/scss/custom-forms"; -// @import "bootstrap/scss/nav"; +@import "bootstrap/scss/nav"; // @import "bootstrap/scss/navbar"; // @import "bootstrap/scss/card"; // @import "bootstrap/scss/breadcrumb"; diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index b91aadb42..2eb1f9bc7 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -50,7 +50,7 @@ div#header-accompanying_course-name { background: none repeat scroll 0 0 #718596; color: #FFF; h1 { - margin: 0.4em 0; + margin: 0.4em 0; } span { a { @@ -71,7 +71,7 @@ div#header-accompanying_course-details { /* * FLEX RESPONSIVE TABLE/BLOCK PRESENTATION */ -div.flex-bloc, +div.flex-bloc, div.flex-table { h2, h3, h4, dl, p { margin: 0; @@ -85,38 +85,38 @@ div.flex-table { * Bloc appearance */ div.flex-bloc { - box-sizing: border-box; + box-sizing: border-box; display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; align-content: stretch; - + div.item-bloc { flex-grow: 0; flex-shrink: 1; flex-basis: 50%; - + margin: 0; border: 1px solid #000; padding: 1em; - + border-top: 0; - &:nth-child(1), &:nth-child(2) { + &:nth-child(1), &:nth-child(2) { border-top: 1px solid #000; } border-left: 0; &:nth-child(odd) { border-left: 1px solid #000; } - + //background-color: #e6e6e6; display: flex; flex-direction: column; - + div.item-row { flex-grow: 1; flex-shrink: 1; flex-basis: auto; display: flex; flex-direction: column; - + div.item-col { &:first-child { flex-grow: 0; flex-shrink: 0; flex-basis: auto; @@ -124,7 +124,7 @@ div.flex-bloc { &:last-child { flex-grow: 1; flex-shrink: 1; flex-basis: auto; display: flex; - + .list-content { // ul, dl, or div } ul.record_actions { @@ -134,7 +134,7 @@ div.flex-bloc { li { margin-right: 5px; } - } + } } } } @@ -147,7 +147,7 @@ div.flex-bloc { margin: auto 0; div.item-bloc { border-left: 1px solid #000; - &:nth-child(2) { + &:nth-child(2) { border-top: 0; } } @@ -156,13 +156,13 @@ div.flex-bloc { /* * Table appearance -*/ +*/ div.flex-table { display: flex; flex-direction: column; align-items: stretch; align-content: stretch; - + div.item-bloc { display: flex; flex-direction: column; @@ -173,7 +173,7 @@ div.flex-table { border-top: 1px solid #000; } &:nth-child(even) { - background-color: #e6e6e6; + background-color: #e6e6e6; } div.item-row { @@ -185,7 +185,7 @@ div.flex-table { padding-top: 0.5em; flex-direction: column; } - + div.item-col { &:first-child { flex-grow: 0; flex-shrink: 0; flex-basis: 33%; @@ -194,7 +194,7 @@ div.flex-table { flex-grow: 1; flex-shrink: 1; flex-basis: auto; display: flex; justify-content: flex-end; - + .list-content { // ul, dl, or div } ul.record_actions { @@ -204,7 +204,7 @@ div.flex-table { li { margin-right: 5px; } - } + } } } @media only screen and (max-width: 900px) { @@ -217,9 +217,47 @@ div.flex-table { } } } - - // neutralize + + // neutralize div.chill_address div.chill_address_address p { text-indent: 0; } } } -} +} + + + +/* +* Address form +*/ +div.address_form { + display: flex; + flex-direction: column; + div.address_form__header { + + } + div.address_form__select { + display: flex; + flex-direction: row; + justify-content: space-between; + + div.address_form__select__body { + display: flex; + flex-direction: column; + flex-grow: 1; + } + + div.address_form__select__map { + margin: 0px 20px; + div#address_map { + height:400px; + width:400px; + } + } + } + div.address_form__more { + + } +} + + + diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index 461b0038e..7c27db341 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -1,5 +1,5 @@