Skip to content

Commit

Permalink
Assets: use translations in form & planing
Browse files Browse the repository at this point in the history
  • Loading branch information
nikophil committed Apr 15, 2020
1 parent c300633 commit 0b71b84
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 26 deletions.
26 changes: 13 additions & 13 deletions src/Form/Type/CommissionableAssetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,45 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$builder
->add('type', ChoiceType::class, [
'choices' => self::TYPES,
'label' => 'Type',
'label' => 'asset.type',
])
->add('name', TextType::class, [
'label' => 'Identifiant',
'label' => 'asset.name',
])
->add('hasMobileRadio', ChoiceType::class, [
'choices' => [
'Oui' => true,
'Non' => false,
'common.yes' => true,
'common.no' => false,
],
'expanded' => true,
'multiple' => false,
'label' => 'Présence d\'un mobile radio ?',
'label' => 'asset.hasMobileRadio',
])
->add('hasFirstAidKit', ChoiceType::class, [
'choices' => [
'Oui' => true,
'Non' => false,
'common.yes' => true,
'common.no' => false,
],
'expanded' => true,
'multiple' => false,
'label' => 'Présence d\'un lot de secours ?',
'label' => 'asset.hasFirstAidKit',
])
->add('parkingLocation', TextType::class, [
'required' => false,
'label' => 'Lieu de stationnement',
'label' => 'asset.parkingLocation',
])
->add('contact', TextType::class, [
'required' => false,
'label' => 'Qui contacter ?',
'label' => 'asset.contact',
])
->add('seatingCapacity', IntegerType::class, [
'label' => 'Combien de places ?',
'label' => 'asset.seatingCapacity',
])
->add('licensePlate', TextType::class, [
'label' => 'Plaque d\'immatriculation',
'label' => 'asset.licensePlate',
])
->add('comments', TextareaType::class, [
'label' => 'Commentaires',
'label' => 'asset.comments',
])
->add('submit', SubmitType::class)
;
Expand Down
5 changes: 0 additions & 5 deletions src/Migrations/Version20200414132415.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200414132415 extends AbstractMigration
{
public function getDescription(): string
Expand All @@ -19,15 +16,13 @@ public function getDescription(): string

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('ALTER TABLE commissionable_asset ADD license_plate VARCHAR(255) DEFAULT NULL, ADD comments TEXT DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('postgresql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('ALTER TABLE commissionable_asset DROP license_plate, DROP comments');
Expand Down
16 changes: 8 additions & 8 deletions templates/organization/planning/_availabilities_assets.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

{# columns number of blocks itemDataHeader and itemDataDetails should be the same than in _availabilities_users.html.twig #}
{% block itemDataHeader %}
<th class="item-data">Radio mobile?</th>
<th class="item-data" colspan="2">Kit de premiers soins?</th>
<th class="item-data">Contact</th>
<th class="item-data" colspan="2">Lieu de stationnement</th>
<th class="item-data">Places</th>
<th class="item-data">Immatriculation</th>
<th class="item-data">{{ 'asset.planing.hasMobileRadio'|trans }}</th>
<th class="item-data" colspan="2">{{ 'asset.planing.hasFirstAidKit'|trans }}</th>
<th class="item-data">{{ 'asset.planing.contact'|trans }}</th>
<th class="item-data" colspan="2">{{ 'asset.parkingLocation'|trans }}</th>
<th class="item-data">{{ 'asset.planing.seatingCapacity'|trans }}</th>
<th class="item-data">{{ 'asset.planing.licensePlate'|trans }}</th>
{% endblock itemDataHeader %}

{% block itemDataDetails %}
<td class="item-data">{{ item.entity.hasMobileRadio ? 'Oui' : '-' }}</td>
<td class="item-data" colspan="2">{{ item.entity.hasFirstAidKit ? 'Oui' : '-' }}</td>
<td class="item-data">{{ item.entity.hasMobileRadio ? 'common.yes' | trans : '-' }}</td>
<td class="item-data" colspan="2">{{ item.entity.hasFirstAidKit ? 'common.yes' | trans : '-' }}</td>
<td class="item-data">{{ item.entity.contact }}</td>
<td class="item-data" colspan="2">{{ item.entity.parkingLocation }}</td>
<td class="item-data">{{ item.entity.seatingCapacity }}</td>
Expand Down
16 changes: 16 additions & 0 deletions translations/messages.fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,19 @@ user:
skills: Compétences
uniform: Uniforme
welcome: Bienvenue, %name%
asset:
type: Type
name: Identifiant
hasMobileRadio: Présence d'un mobile radio ?
hasFirstAidKit: Présence d'un lot de secours ?
contact: Qui contacter ?
parkingLocation: Lieu de stationnement
seatingCapacity: Combien de places ?
licensePlate: Plaque d'immatriculation
comments: Commentaires
planing:
hasMobileRadio: Mobile radio ?
hasFirstAidKit: Kit de premiers soins ?
contact: Contact
seatingCapacity: Places
licensePlate: Immatriculation

0 comments on commit 0b71b84

Please sign in to comment.