mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
location admin: add active field on Location and LocationType
This commit is contained in:
parent
7dc4590580
commit
154416cddf
@ -20,7 +20,10 @@ class LocationApiController extends ApiController
|
|||||||
$query->expr()->eq('e.createdBy', ':user'),
|
$query->expr()->eq('e.createdBy', ':user'),
|
||||||
$query->expr()->gte('e.createdAt', ':dateBefore')
|
$query->expr()->gte('e.createdAt', ':dateBefore')
|
||||||
),
|
),
|
||||||
$query->expr()->eq('e.availableForUsers', "'TRUE'")
|
$query->expr()->andX(
|
||||||
|
$query->expr()->eq('e.availableForUsers', "'TRUE'"),
|
||||||
|
$query->expr()->eq('e.active', "'TRUE'")
|
||||||
|
)
|
||||||
))
|
))
|
||||||
->setParameters([
|
->setParameters([
|
||||||
'user' => $this->getUser(),
|
'user' => $this->getUser(),
|
||||||
|
@ -58,7 +58,8 @@ class LoadLocationType extends AbstractFixture implements ContainerAwareInterfac
|
|||||||
foreach ($arr as $a) {
|
foreach ($arr as $a) {
|
||||||
$locationType = (new LocationType())
|
$locationType = (new LocationType())
|
||||||
->setTitle($a['name'])
|
->setTitle($a['name'])
|
||||||
->setAvailableForUsers(True)
|
->setAvailableForUsers(true)
|
||||||
|
->setActive(true)
|
||||||
->setAddressRequired($a['address_required']);
|
->setAddressRequired($a['address_required']);
|
||||||
$manager->persist($locationType);
|
$manager->persist($locationType);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,12 @@ class Location implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*/
|
*/
|
||||||
private bool $availableForUsers = false;
|
private bool $availableForUsers = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", nullable=true)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
*/
|
||||||
|
private bool $active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=User::class)
|
* @ORM\ManyToOne(targetEntity=User::class)
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
@ -192,6 +198,18 @@ class Location implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getActive(): ?bool
|
||||||
|
{
|
||||||
|
return $this->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
|
$this->active = $active;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getCreatedBy(): ?User
|
public function getCreatedBy(): ?User
|
||||||
{
|
{
|
||||||
return $this->createdBy;
|
return $this->createdBy;
|
||||||
|
@ -40,6 +40,12 @@ class LocationType
|
|||||||
*/
|
*/
|
||||||
private bool $availableForUsers = true;
|
private bool $availableForUsers = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", nullable=true)
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
|
*/
|
||||||
|
private bool $active = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=32, options={"default"="optional"})
|
* @ORM\Column(type="string", length=32, options={"default"="optional"})
|
||||||
* @Serializer\Groups({"read"})
|
* @Serializer\Groups({"read"})
|
||||||
@ -70,6 +76,18 @@ class LocationType
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getActive(): ?bool
|
||||||
|
{
|
||||||
|
return $this->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
|
$this->active = $active;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAvailableForUsers(): ?bool
|
public function getAvailableForUsers(): ?bool
|
||||||
{
|
{
|
||||||
return $this->availableForUsers;
|
return $this->availableForUsers;
|
||||||
|
@ -51,6 +51,14 @@ final class LocationFormType extends AbstractType
|
|||||||
'use_valid_from' => false,
|
'use_valid_from' => false,
|
||||||
'use_valid_to' => false,
|
'use_valid_to' => false,
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
|
])
|
||||||
|
->add('active', ChoiceType::class,
|
||||||
|
[
|
||||||
|
'choices' => [
|
||||||
|
'Yes' => true,
|
||||||
|
'No' => false
|
||||||
|
],
|
||||||
|
'expanded' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,14 @@ final class LocationTypeType extends AbstractType
|
|||||||
'never' => LocationType::STATUS_NEVER,
|
'never' => LocationType::STATUS_NEVER,
|
||||||
],
|
],
|
||||||
'expanded' => true
|
'expanded' => true
|
||||||
|
])
|
||||||
|
->add('active', ChoiceType::class,
|
||||||
|
[
|
||||||
|
'choices' => [
|
||||||
|
'Yes' => true,
|
||||||
|
'No' => false
|
||||||
|
],
|
||||||
|
'expanded' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<th>{{ 'Phonenumber2'|trans }}</th>
|
<th>{{ 'Phonenumber2'|trans }}</th>
|
||||||
<th>{{ 'Email'|trans }}</th>
|
<th>{{ 'Email'|trans }}</th>
|
||||||
<th>{{ 'Address'|trans }}</th>
|
<th>{{ 'Address'|trans }}</th>
|
||||||
|
<th>{{ 'Active'|trans }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -25,6 +26,13 @@
|
|||||||
{{ entity.address.street}}, {{ entity.address.streetnumber }}
|
{{ entity.address.street}}, {{ entity.address.streetnumber }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td style="text-align:center;">
|
||||||
|
{%- if entity.active -%}
|
||||||
|
<i class="fa fa-check-square-o"></i>
|
||||||
|
{%- else -%}
|
||||||
|
<i class="fa fa-square-o"></i>
|
||||||
|
{%- endif -%}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<th>{{ 'Available for users'|trans }}</th>
|
<th>{{ 'Available for users'|trans }}</th>
|
||||||
<th>{{ 'Address required'|trans }}</th>
|
<th>{{ 'Address required'|trans }}</th>
|
||||||
<th>{{ 'Contact data'|trans }}</th>
|
<th>{{ 'Contact data'|trans }}</th>
|
||||||
|
<th>{{ 'Active'|trans }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -25,6 +26,13 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>{{ entity.addressRequired|trans }}</td>
|
<td>{{ entity.addressRequired|trans }}</td>
|
||||||
<td>{{ entity.contactData|trans }}</td>
|
<td>{{ entity.contactData|trans }}</td>
|
||||||
|
<td style="text-align:center;">
|
||||||
|
{%- if entity.active -%}
|
||||||
|
<i class="fa fa-check-square-o"></i>
|
||||||
|
{%- else -%}
|
||||||
|
<i class="fa fa-square-o"></i>
|
||||||
|
{%- endif -%}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Main;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add active on Location and LocationType
|
||||||
|
*/
|
||||||
|
final class Version20211022094429 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add active on Location and LocationType';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location ADD active BOOLEAN DEFAULT NULL;');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location_type ADD active BOOLEAN DEFAULT NULL;');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location_type DROP active');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_location DROP active');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user