Skip to content
This repository was archived by the owner on Jul 20, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/AppBundle/Admin/AuthorityAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace AppBundle\Admin;

use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;

class AuthorityAdmin extends AbstractAdmin
{
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title')
->add('description')
->add('street')
->add('houseNumber')
->add('zipCode')
->add('city')
->add('latitude')
->add('longitude')
->add('polygon')
;
}

// Fields to be shown on filter forms
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title')
;
}

// Fields to be shown on lists
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('title')
;
}

// Fields to be shown on show action
protected function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->add('title')
;
}
}
219 changes: 219 additions & 0 deletions src/AppBundle/Entity/Authority.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<?php

namespace AppBundle\Entity;

use AppBundle\EntityInterface\CoordinateInterface;
use AppBundle\EntityInterface\ElasticSearchPinInterface;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;

/**
* @ORM\Entity()
* @ORM\Table(name="authority")
* @JMS\ExclusionPolicy("all")
*/
class Authority implements CoordinateInterface, ElasticSearchPinInterface
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @JMS\Expose
*/
protected $id;

/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank()
* @JMS\Expose
*/
protected $title;

/**
* @ORM\Column(type="text")
* @Assert\NotBlank()
* @JMS\Expose
*/
protected $description;

/**
* @ORM\Column(type="text", nullable=true)
* @JMS\Expose
*/
protected $address;

/**
* @ORM\Column(type="string", length=255, nullable=true)
* @JMS\Expose
*/
protected $street;

/**
* @ORM\Column(type="string", length=16, nullable=true)
* @JMS\Expose
*/
protected $houseNumber;

/**
* @ORM\Column(type="string", length=5, nullable=true)
* @JMS\Expose
*/
protected $zipCode;

/**
* @ORM\Column(type="string", length=255, nullable=true)
* @JMS\Expose
*/
protected $city;

/**
* @ORM\Column(type="text", nullable=true)
* @JMS\Expose
*/
protected $polygon;

/**
* @ORM\Column(type="float", nullable=true)
* @JMS\Expose
*/
protected $latitude = null;

/**
* @ORM\Column(type="float", nullable=true)
* @JMS\Expose
*/
protected $longitude = null;

public function __construct()
{
}

public function getId(): ?int
{
return $this->id;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): Authority
{
$this->title = $title;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(string $description): Authority
{
$this->description = $description;

return $this;
}

public function getAddress(): ?string
{
return $this->address;
}

public function setAddress(string $address): Authority
{
$this->address = $address;

return $this;
}

public function getStreet(): ?string
{
return $this->street;
}

public function setStreet(string $street): Authority
{
$this->street = $street;
return $this;
}

public function getHouseNumber(): ?string
{
return $this->houseNumber;
}

public function setHouseNumber(string $houseNumber): Authority
{
$this->houseNumber = $houseNumber;

return $this;
}

public function getZipCode(): ?string
{
return $this->zipCode;
}

public function setZipCode(string $zipCode): Authority
{
$this->zipCode = $zipCode;

return $this;
}

public function getCity(): ?string
{
return $this->city;
}

public function setCity(string $city): Authority
{
$this->city = $city;

return $this;
}

public function getPolygon(): ?string
{
return $this->polygon;
}

public function setPolygon(string $polygon): Authority
{
$this->polygon = $polygon;

return $this;
}

public function getLatitude(): ?float
{
return $this->latitude;
}

public function setLatitude(float $latitude): CoordinateInterface
{
$this->latitude = $latitude;

return $this;
}

public function getLongitude(): ?float
{
return $this->longitude;
}

public function setLongitude(float $longitude): CoordinateInterface
{
$this->longitude = $longitude;
return $this;
}

public function getPin(): string
{
return $this->latitude . ',' . $this->longitude;
}
}
10 changes: 10 additions & 0 deletions src/AppBundle/Resources/config/admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,15 @@
<argument>AppBundle</argument>
</call>
</service>

<service id="caldera.cycleways.admin.authority" class="AppBundle\Admin\AuthorityAdmin">
<tag name="sonata.admin" manager_type="orm" group="Inhalt" label="Authorities" />
<argument />
<argument>AppBundle\Entity\Authority</argument>
<argument />
<call method="setTranslationDomain">
<argument>AppBundle</argument>
</call>
</service>
</services>
</container>
12 changes: 12 additions & 0 deletions src/AppBundle/Resources/views/Incident/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@
</div>

<div class="col-md-4">
<div class="card card-block">
<h4 class="card-title">
Zuständigkeit prüfen
</h4>

<p>
<a href="#" class="btn btn-secondary">
Zuständigkeit prüfen
</a>
</p>
</div>

<div class="card card-block">
<h4 class="card-title">
Details
Expand Down