Add Wanted Vehicle list

This commit is contained in:
Xbird
2022-10-07 21:10:20 +00:00
parent 2f53709b3c
commit bb78e7e802
13 changed files with 256 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
<?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 Version20221007204956 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('CREATE TABLE wantedvehicle (id INT NOT NULL, type VARCHAR(255) NOT NULL, numberplate VARCHAR(255) DEFAULT NULL, model VARCHAR(255) DEFAULT NULL, content TEXT NOT NULL, color VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE wantedvehicle ADD CONSTRAINT FK_42BDD5B7BF396750 FOREIGN KEY (id) REFERENCES document (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE wantedvehicle');
}
}

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 Version20221007210348 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 wantedvehicle CHANGE content content TEXT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE wantedvehicle CHANGE content content TEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
}
}

Binary file not shown.

View File

@@ -0,0 +1 @@
https://fonts.googleapis.com/css?family=Material+Icons+Two+Tone

View File

@@ -0,0 +1,115 @@
<?php
namespace App\Entity;
use App\Entity\Document;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Repository\WantedvehicleRepository;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=WantedvehicleRepository::class)
*/
class Wantedvehicle extends Document
{
/**
* @ORM\Column(type="string", length=255)
* @Gedmo\Versioned
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Gedmo\Versioned
*/
private $numberplate;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Gedmo\Versioned
*/
private $model;
/**
* @ORM\Column(type="text", length=65535, nullable=true)
* @Gedmo\Versioned
* @Assert\Length(
* max=65535,
* maxMessage="Content too long : {{ limit }} max"
* )
*/
private $content;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Gedmo\Versioned
*/
private $color;
public function __construct(User $user)
{
parent::__construct($user);
$this->setNeedLegalAccess(true);
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getNumberplate(): ?string
{
return $this->numberplate;
}
public function setNumberplate(?string $numberplate): self
{
$this->numberplate = $numberplate;
return $this;
}
public function getModel(): ?string
{
return $this->model;
}
public function setModel(?string $model): self
{
$this->model = $model;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Form;
use App\Form\DocumentType;
use App\Entity\Wantedvehicle;
use App\Form\Type\ContentType;
use App\Form\Type\VehicleType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class WantedvehicleType extends DocumentType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder
->add('type', VehicleType::class)
->add('numberplate', null, ['label' => 'form_label_numberplate'])
->add('model', null, ['label' => 'form_label_model'])
->add('color', null, ['label' => 'form_label_color'])
->add('content', ContentType::class, ['label' => 'form_label_informations', 'required' => false])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Wantedvehicle::class,
]);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Repository;
use App\Entity\Wantedvehicle;
use Doctrine\Persistence\ManagerRegistry;
use App\Repository\Tools\DocumentRepositoriesExtension;
/**
* @method Wantedvehicle|null find($id, $lockMode = null, $lockVersion = null)
* @method Wantedvehicle|null findOneBy(array $criteria, array $orderBy = null)
* @method Wantedvehicle[] findAll()
* @method Wantedvehicle[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class WantedvehicleRepository extends DocumentRepositoriesExtension
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Wantedvehicle::class);
$this->fields = ['type', 'numberplate','model', 'content', 'color']; //with title, list fields we can search in
}
}

View File

@@ -146,6 +146,9 @@
<li class="pc-item">
<a href="{{ path('document_list', {type: 'stolenvehicle'}) }}" class="pc-link"><span class="pc-micon"><i class="material-icons-two-tone">taxi_alert</i></span><span class="pc-mtext">{% trans %}title_stolen_vehicles{% endtrans %}</span></a>
</li>
<li class="pc-item">
<a href="{{ path('document_list', {type: 'wantedvehicle'}) }}" class="pc-link"><span class="pc-micon"><i class="material-icons-two-tone">minor_crash</i></span><span class="pc-mtext">{% trans %}title_wanted_vehicles{% endtrans %}</span></a>
</li>
<li class="pc-item">
<a href="{{ path('document_list', {type: 'medical'}) }}" class="pc-link"><span class="pc-micon"><i class="material-icons-two-tone">vaccines</i></span><span class="pc-mtext">{% trans %}title_medicals{% endtrans %}</span></a>
</li>

View File

@@ -0,0 +1,10 @@
<ul>
<li>{% trans %}title_type{% endtrans %}: {{ document.type|trans }}</li>
<li>{% trans %}title_numberplate{% endtrans %}: {{ document.numberplate | default('value_no_value'|trans) }}</li>
<li>{% trans %}title_model{% endtrans %}: {{ document.model | default('value_no_value'|trans) }}</li>
<li>{% trans %}title_color{% endtrans %}: {{ document.color | default('value_no_value'|trans) }}</li>
</ul>
<h5>{% trans %}title_informations{% endtrans %} : </h5>
<div class="p-2">
{{ document.content | raw }}
</div>

View File

@@ -143,6 +143,7 @@ breadcrumb_Template: Template
breadcrumb_Templates: Templates
breadcrumb_Users: Phone book
breadcrumb_view: View
breadcrumb_Wantedvehicles: Wanted vehicle
button_add_comment: Add a comment
button_add_group: Add Group
button_add: Add
@@ -194,6 +195,7 @@ documentType_Report: Report
documentType_Sanction: Sanction
documentType_Stolenvehicle: Stolen Vehicle
documentType_Template: Template
documentType_Wantedvehicle: Wanted vehicle
edited_your: edited your
email_link_confirm_my_email: Confirm my email
email_template_subtitle: Online Gestion
@@ -817,6 +819,7 @@ title_value: Value
title_verified: Verified
title_versus: Versus
title_wanted_directory: Wanted directories
title_wanted_vehicles: Wanted vehicles
title_wanted: Wanted
title_wanteds: Wanteds
title_watchdog: Watchdog

View File

@@ -143,6 +143,7 @@ breadcrumb_Template: Modèle
breadcrumb_Templates: Modèles
breadcrumb_Users: Annuaire
breadcrumb_view: Voir
breadcrumb_Wantedvehicles: Véhicule recherché
button_add_comment: Ajouter un commentaire
button_add_group: Créer un groupe
button_add: Ajouter
@@ -194,6 +195,7 @@ documentType_Report: Rapport
documentType_Sanction: Sanction
documentType_Stolenvehicle: Déclaration de vol de véhicule
documentType_Template: Modèle
documentType_Wantedvehicle: Véhicule recherché
edited_your: a édité votre
email_link_confirm_my_email: Confirmer mon adresse email
email_template_subtitle: Gestion en ligne
@@ -816,6 +818,7 @@ title_value: Valeur
title_verified: Vérifié
title_versus: Contre
title_wanted_directory: Personnes recherchées
title_wanted_vehicles: Véhicules recherchés
title_wanted: Personne Recherchée
title_wanteds: Recherchés
title_watchdog: Watchdog

View File

@@ -1,3 +1,3 @@
{
"version": "0.2.14"
"version": "0.2.15"
}