-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imp: Allow to create a contract from the global list of contracts
- Loading branch information
1 parent
e73f9b6
commit 1e2dc34
Showing
7 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
// This file is part of Bileto. | ||
// Copyright 2022-2024 Probesys | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
namespace App\Form\Organization; | ||
|
||
use App\Form\Type as AppType; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Component\Translation\TranslatableMessage; | ||
|
||
class SelectForm extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder->add('organization', AppType\OrganizationType::class, [ | ||
'permission' => $options['permission'], | ||
'required' => true, | ||
'label' => new TranslatableMessage('forms.organization.select.choose'), | ||
]); | ||
|
||
if ($options['submit_label'] !== '') { | ||
$builder->add('submit', Type\SubmitType::class, [ | ||
'label' => $options['submit_label'], | ||
]); | ||
} | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->setDefaults([ | ||
'csrf_token_id' => 'organization select', | ||
'csrf_message' => 'csrf.invalid', | ||
'attr' => [ | ||
'class' => 'form--standard', | ||
], | ||
'permission' => '', | ||
'submit_label' => '', | ||
]); | ||
|
||
$resolver->setAllowedTypes('permission', 'string'); | ||
$resolver->setAllowedTypes('submit_label', ['string', TranslatableMessage::class]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{# | ||
# This file is part of Bileto. | ||
# Copyright 2022-2024 Probesys | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
#} | ||
|
||
{% extends 'modal.html.twig' %} | ||
|
||
{% block title %}{{ 'contracts.new.title' | trans }}{% endblock %} | ||
|
||
{% block body %} | ||
{{ form(form, { action: path('new contract') }) }} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters