@@ -1,47 +1,52 @@
{% extends 'base.html.twig' %}
{% extends 'base.html.twig' %}
{% block stylesheets%}
{% endblock %}
{% block body %}
<div id="page-wrapper">
<!-- /.row -->
<div class="row" style="padding: 30px">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
<h1 class="h2">Leden</h1>
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<tr>
<th>ID</th>
<th>Voornaam</th>
<th>Achternaam</th>
<th>Email</th>
<th>Geboortedatum</th>
<th>Telefoonnummer</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for customer in customers %}
<tr>
<td><a href="{{ path('customer_show', { 'id': customer.id }) }}">{{ customer.id }}</a></td>
<td>{{ customer.firstName }}</td>
<td>{{ customer.lastName }}</td>
<td>{{ customer.email }}</td>
<td>{% if customer.dateOfBirth %}{{ customer.dateOfBirth|date('Y-m-d') }}{% endif %}</td>
<td>{{ customer.telephoneNumber }}</td>
<td><a class="btn btn-primary my-2" href="{{ path('customer_show', { 'id': customer.id }) }}">Info</a></td>
<td><a class="btn btn-info" href="{{ path('customer_edit', { 'id': customer.id }) }}">Bewerk</a></td>
</tr>
{% endfor %}
</tbody>
</table>

{% block body %}
<h1>Customers list</h1>
<a class="btn btn-success" href="{{ path('customer_new') }}">Creƫer nieuw lid</a>

<table>
<thead>
<tr>
<th>Id</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>Dateofbirth</th>
<th>Telephonenumber</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for customer in customers %}
<tr>
<td><a href="{{ path('customer_show', { 'id': customer.id }) }}">{{ customer.id }}</a></td>
<td>{{ customer.firstName }}</td>
<td>{{ customer.lastName }}</td>
<td>{{ customer.email }}</td>
<td>{% if customer.dateOfBirth %}{{ customer.dateOfBirth|date('Y-m-d') }}{% endif %}</td>
<td>{{ customer.telephoneNumber }}</td>
<td>
<ul>
<li>
<a href="{{ path('customer_show', { 'id': customer.id }) }}">show</a>
</li>
<li>
<a href="{{ path('customer_edit', { 'id': customer.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>

<ul>
<li>
<a href="{{ path('customer_new') }}">Create a new customer</a>
</li>
</ul>
{% endblock %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -6,16 +6,41 @@
{#{% form_theme form 'bootstrap_3_horizontal_layout.html.twig' %}#}

{% block body %}
<h1>Customer creation</h1>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
<h1 class="h2">Creƫer nieuw lid</h1>
</div>

{{ form_start(form) }}
{{ form_widget(form) }}
<input type="submit" value="Create" />
{{ form_end(form) }}
<h2>Lid informatie</h2>
<div class="table-responsive">
<table class="table">
{{ form_start(form) }}
<tr>
<td>Voornaam</td>
<td>{{ form_widget(form.firstName) }}</td>
</tr>

<ul>
<li>
<a href="{{ path('customer_index') }}">Back to the list</a>
</li>
</ul>
<tr>
<td>Achternaam</td>
<td>{{ form_widget(form.lastName) }}</td>
</tr>

<tr>
<td>Email</td>
<td>{{ form_widget(form.email) }}</td>
</tr>
<tr>
<td>Geboortedatum</td>
<td>{{ form_widget(form.dateOfBirth) }}</td>
</tr>
<tr>
<td>Telefoonnummer</td>
<td>{{ form_widget(form.telephoneNumber) }}</td>
</tr>
</table>
<input class="btn btn-primary my-2" type="submit" value="Creƫer" />
{{ form_end(form) }}
<a class="btn btn-info" href="{{ path('customer_index') }}">Terug naar het overzicht</a>
</div>
</main>
{% endblock %}
@@ -1,48 +1,48 @@
{% extends 'base.html.twig' %}

{% block body %}
<h1>Customer</h1>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
<h1 class="h2">Leden</h1>
<div class="btn-toolbar mb-2 mb-md-0">
{{ form_start(delete_form) }}
<input class="btn btn-danger" type="submit" value="Verwijder lid">
{{ form_end(delete_form) }}
</div>
</div>

<table>
<tbody>
<tr>
<th>Id</th>
<td>{{ customer.id }}</td>
</tr>
<tr>
<th>Firstname</th>
<td>{{ customer.firstName }}</td>
</tr>
<tr>
<th>Lastname</th>
<td>{{ customer.lastName }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ customer.email }}</td>
</tr>
<tr>
<th>Dateofbirth</th>
<td>{% if customer.dateOfBirth %}{{ customer.dateOfBirth|date('Y-m-d') }}{% endif %}</td>
</tr>
<tr>
<th>Telephonenumber</th>
<td>{{ customer.telephoneNumber }}</td>
</tr>
</tbody>
</table>
<h2>Lid {{ customer.id }}</h2>
<div class="table-responsive">
<table class="table">

<tr>
<td>Voornaam</td>
<td><input type="text" class="form-control" value="{{ customer.firstName }}" readonly></td>
</tr>

<tr>
<td>Achternaam</td>
<td><input type="text" class="form-control" value="{{ customer.lastName }}" readonly></td>
</tr>

<tr>
<td>Email</td>
<td><input type="text" class="form-control" value="{{ customer.email }}" readonly></td>
</tr>
<tr>
<td>Geboortedatum</td>
<td><input type="text" class="form-control" value="{% if customer.dateOfBirth %}{{ customer.dateOfBirth|date('Y-m-d') }}{% endif %}" readonly></td>
</tr>
<tr>
<td>Telefoonnummer</td>
<td><input type="text" class="form-control" value="{{ customer.telephoneNumber }}" readonly></td>
</tr>
</table>
<a class="btn btn-info" href="{{ path('customer_edit', { 'id': customer.id }) }}">Bewerk</a>
<a class="btn btn-info" href="{{ path('customer_index') }}">Terug naar het overzicht</a>
</div>
</main>
</div>
</div>

<ul>
<li>
<a href="{{ path('customer_index') }}">Back to the list</a>
</li>
<li>
<a href="{{ path('customer_edit', { 'id': customer.id }) }}">Edit</a>
</li>
<li>
{{ form_start(delete_form) }}
<input type="submit" value="Delete">
{{ form_end(delete_form) }}
</li>
</ul>
{% endblock %}
@@ -88,13 +88,14 @@ public function editAction(Request $request, customer $customer)
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();

return $this->redirectToRoute('customer_edit', array('id' => $customer->getId()));
return $this->redirectToRoute('customer_show', array('id' => $customer->getId()));
}

return $this->render('customer/edit.html.twig', array(
'customer' => $customer,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),

return $this->render('customer/edit.html.twig', array(
'customer' => $customer,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}

@@ -3,6 +3,7 @@
namespace proeflesBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

@@ -13,7 +14,7 @@ class customerType extends AbstractType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('firstName')->add('lastName')->add('email')->add('dateOfBirth')->add('telephoneNumber');
$builder->add('firstName')->add('lastName')->add('email')->add('dateOfBirth',DateType::class, [ 'years' => range(date('Y') -100, date('Y')),])->add('telephoneNumber');
}

/**
@@ -3,6 +3,7 @@
namespace proeflesBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

@@ -13,7 +14,8 @@ class employeeType extends AbstractType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('firstName')->add('lastName')->add('street')->add('streetNumber')->add('city')->add('country')->add('cityOfBirth')->add('countryOfBirth')->add('email')->add('station')->add('department')->add('dateOfBirth');
$builder->add('firstName')->add('lastName')->add('street')->add('streetNumber')->add('city')->add('country')->add('cityOfBirth')->add('countryOfBirth')->add('email')->add('station')->add('department')
->add('date_of_birth',DateType::class, [ 'years' => range(date('Y') -100, date('Y')),]);
}

/**