Fix templates + add public wanted reason

This commit is contained in:
Xbird
2022-11-25 10:23:02 +00:00
parent 5f4f9c37f5
commit 5ae08ebd13
9 changed files with 65 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221125100938 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE directory ADD wanted_public_reason TINYINT(1) DEFAULT \'0\' NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE directory DROP wanted_public_reason');
}
}

View File

@@ -19,7 +19,7 @@ class TemplateController extends AbstractController
/**
* @var Array $templates
*/
$templates = $TemplateRepository->listForUser($this->getUser())->getResult();
$templates = $TemplateRepository->listForUser($this->getUser())->archive(false)->getResult();
$json = [];
foreach ($templates as $template) {

View File

@@ -427,6 +427,12 @@ class Directory
*/
private $wantedPublicDisplay = false;
/**
* @ORM\Column(type="boolean", options={"default":"0"})
* @Gedmo\Versioned
*/
private $wantedPublicReason = false;
/**
* @ORM\OneToMany(targetEntity=Infringement::class, mappedBy="directory", orphanRemoval=true)
* @ORM\OrderBy({"createdAt" = "DESC"})
@@ -1376,6 +1382,18 @@ class Directory
return $this;
}
public function getWantedPublicReason(): ?bool
{
return $this->wantedPublicReason;
}
public function setWantedPublicReason(bool $wantedPublicReason): self
{
$this->wantedPublicReason = $wantedPublicReason;
return $this;
}
/**
* @return Collection|Infringement[]
*/

View File

@@ -69,6 +69,7 @@ class DirectoryType extends AbstractType
->add('wantedReason', null, ['label' => 'form_label_wantedReason', 'help' => 'form_help_wantedReason'])
->add('wantedDisplay', null, ['label' => 'form_label_wantedDisplay'])
->add('wantedPublicDisplay', null, ['label' => 'form_label_wantedPublicDisplay'])
->add('wantedPublicReason', null, ['label' => 'form_label_wantedPublicReason'])
;
}

View File

@@ -63,7 +63,10 @@
{% if directory.hasnopapers %}
<li class="list-group-item"><span class="fa-li"><i class="fas fa-scroll"></i></span>{% trans %}title_hasnopapers{% endtrans %}</li>
{% endif %}
{% if directory.wanted %}
{% endif %}
{% if app.user %}
{% if directory.wanted and ( app.user.hasPermission('general_legal_view') or directory.wantedPublicReason) %}
<li class="list-group-item text-danger"><span class="fa-li"><i class="far fa-id-badge"></i></span>{% trans %}title_directory_wanted_light{% endtrans %} : {{ directory.wantedReason | default('value_no_value'|trans) }}</li>
{% endif %}
{% endif %}
@@ -73,7 +76,7 @@
<div class="card-body">
{{ directory.address | default('value_no_value'|trans) | raw }}
</div>
</div>
</div>
</div>
</div>
{% if app.user and app.user.hasPermission('general_medical_view') %}

View File

@@ -15,7 +15,10 @@
<div class="row align-items-center m-b-0">
<div class="col">
<h6 class="m-b-5">{% trans %}title_wanted{% endtrans %}</h6>
<h3 class="m-b-0">{{i.fullname}}</h3>
<h3 class="m-b-0 fw-bold">{{i.fullname}}</h3>
{% if i.wantedPublicReason %}
<h4 class="m-b-0 text-danger">{{i.wantedReason}}</h4>
{% endif %}
</div>
<div class="col-auto">
<a data-toggle="lightbox" data-gallery="wanted"

View File

@@ -863,4 +863,5 @@ value_no_value: --
value_no: No
value_yes: Yes
Year: Year
you_can: You can
you_can: You can
form_label_wantedPublicReason: Set reason as public

View File

@@ -862,4 +862,5 @@ value_no_value: --
value_no: Non
value_yes: Oui
Year: Année
you_can: Vous pouvez
you_can: Vous pouvez
form_label_wantedPublicReason: Rendre la raison publique

View File

@@ -1,3 +1,3 @@
{
"version": "0.2.19"
"version": "0.2.20"
}