Skip to content

Commit

Permalink
Fix sur les inscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Leune committed Jun 30, 2017
1 parent 4c4efe8 commit 4370825
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
8 changes: 7 additions & 1 deletion app/Resources/views/event/ticket/ticket.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<script src="{{ asset('js/inscription.js') }}"></script>

<script type="text/javascript">
var nbInscriptions = 1;
var nbInscriptions = {{ nbPersonnes }};
</script>


Expand All @@ -56,6 +56,12 @@
{% endif %}
</div>

{% if not ticketForm.vars.valid %}
<div class="tickets--errors">
{{ 'Une ou plusieurs erreurs sont survenues. Merci de vérifier le formulaire' }}
</div>
{% endif %}

{{ form_start(ticketForm, {attr: {id: 'formulaire'}}) }}

<div id="divPersonne">
Expand Down
12 changes: 7 additions & 5 deletions htdocs/css/tickets.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ div.tickets--bankwire{
ul.tickets--errors, #fieldset--7 div{
margin-left:200px;
}
ul.tickets--errors{
.tickets--errors{
font-weight: bold;
color: #B0413E;
}
Expand All @@ -162,21 +162,23 @@ p.tickets--type-stock-limit{
#tickets--other-payments{
cursor: pointer;
}
div.tickets--members-detail{
div.tickets--members-detail, div.tickets--errors{
padding: 0 1em;
border: 1px #50a0dd solid;
margin: 1em auto;
background-color:#f2f2f2;
}

div.sponsor--become-form {
margin-top:1em;
}
div.sponsor--become-form div.sponsor--become-submit{
text-align: right;
margin-right: 30px;
}
div.sponsor--become-form label{
div.sponsor--become-form label {
min-width: 20%;
width:auto;
width: auto;
}
div.tickets--errors{
border-color: #B0413E;
}
8 changes: 5 additions & 3 deletions sources/AppBundle/Controller/TicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ public function ticketAction($eventSlug, Request $request)

return $this->render('event/ticket/ticket.html.twig', [
'event' => $event,
'ticketForm' => $purchaseForm->createView()
'ticketForm' => $purchaseForm->createView(),
'nbPersonnes' => $purchaseForm->get('nbPersonnes')->getData() // If there is an error, this will open all fields
]);
}

Expand All @@ -206,7 +207,7 @@ public function paymentAction($eventSlug, Request $request)
$event = $this->checkEventSlug($eventSlug);
$invoiceRepository = $this->get('app.invoice_repository');

$invoiceRef = $request->get('invoiceRef');
$invoiceRef = $request->get('invoiceRef', $request->query->get('invoiceRef', null));
$invoice = $invoiceRepository->getByReference($invoiceRef);

if ($invoice === null) {
Expand All @@ -215,7 +216,7 @@ public function paymentAction($eventSlug, Request $request)

if ($invoice->getStatus() !== Ticket::STATUS_CREATED) {
$this->get('logger')->addWarning(sprintf('Invoice %s already paid, cannot show the paymentAction', $invoiceRef));
return $this->render(':event/ticket:payment_already_done.html.twig');
return $this->render(':event/ticket:payment_already_done.html.twig', ['event' => $event]);
}

$params = [
Expand All @@ -229,6 +230,7 @@ public function paymentAction($eventSlug, Request $request)
} elseif ($invoice->getPaymentType() === Ticket::PAYMENT_BANKWIRE) {
$params['rib'] = $GLOBALS['AFUP_CONF']->obtenir('rib');
}

return $this->render('event/ticket/payment.html.twig', $params);
}

Expand Down
3 changes: 2 additions & 1 deletion sources/AppBundle/Event/Form/PurchaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
],
'multiple' => false,
'expanded' => false,
'mapped' => false
'mapped' => false,
'data' => 1
])
->add('tickets', CollectionType::class, [
// each entry in the array will be an "email" field
Expand Down
3 changes: 2 additions & 1 deletion sources/AppBundle/Event/Form/TicketType.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'Email'
])
->add('phoneNumber', TextType::class, [
'label' => 'Téléphone'
'label' => 'Téléphone',
'required' => false
])
->add('ticketEventType', ChoiceType::class, [
'expanded' => true,
Expand Down

0 comments on commit 4370825

Please sign in to comment.