deal with opening/closing the files

This commit is contained in:
2013-11-26 23:00:30 +01:00
parent e390c891d8
commit 377a69d26f
20 changed files with 1262 additions and 22 deletions

View File

@@ -49,6 +49,20 @@ div#person_wrapper {
margin-left: 0.2em;
}
.has_error {
label {
color: red;
}
ul.errors li {
color: red;
}
input {
}
}
div.form_control {
.controls {
float: right;

View File

@@ -44,6 +44,9 @@ CL\Chill\PersonBundle\Entity\Person:
type: text
email:
type: text
proxyHistoryOpenState:
type: boolean
name: proxy_open
manyToOne:
countryOfBirth:
targetEntity: CL\Chill\MainBundle\Entity\Country
@@ -53,4 +56,9 @@ CL\Chill\PersonBundle\Entity\Person:
targetEntity: CL\Chill\MainBundle\Entity\Country
inversedBy: nationals
nullable: true
oneToMany:
history:
targetEntity: PersonHistoryFile
mappedBy: person
cascade: [persist, remove, merge, detach]
lifecycleCallbacks: { }

View File

@@ -0,0 +1,25 @@
CL\Chill\PersonBundle\Entity\PersonHistoryFile:
type: entity
table: person_history_file
id:
id:
type: integer
id: true
generator: { strategy: AUTO }
fields:
date_opening:
type: date
date_closing:
type: date
default: null
nullable: true
motive:
type: string
length: 200
memo:
type: text
manyToOne:
person:
targetEntity: Person
inversedBy: history
cascade: [refresh]

View File

@@ -19,16 +19,28 @@ chill_person_general_update:
chill_person_search:
pattern: /search
defaults: { _controller: CLChillPersonBundle:Person:search }
chill_person_view_history:
pattern: /view/{id}/history
defaults: {_controller: CLChillPersonBundle:Person:history }
defaults: { _controller: CLChillPersonBundle:Person:search }
chill_person_history_list:
pattern: /{id}/history
defaults: { _controller: CLChillPersonBundle:History:list }
options:
menu: person
order: 100
label: menu.person.history
chill_person_history_update:
pattern: /{id}/history/{historyId}/update
defaults: { _controller: CLChillPersonBundle:History:update }
chill_person_history_close:
pattern: /{id}/history/close
defaults: { _controller: CLChillPersonBundle:History:close }
chill_person_history_open:
pattern: /{id}/history/open
defaults: { _controller: CLChillPersonBundle:History:open }
#sample
chill_appointment_list:
pattern: /view/{id}/appointment/list
@@ -84,4 +96,4 @@ chill_docs:
options:
menu: person
order: 800
label: "Documents"
label: "Documents"

View File

@@ -0,0 +1,57 @@
CL\Chill\PersonBundle\Entity\Person:
properties:
belgian_national_number:
- NotBlank:
groups: [general]
- CL\BelgianNationalNumberBundle\Validator\Constraint\BelgianNationalNumber:
groups: [general]
name:
- NotBlank:
groups: [general]
- Length:
min: 2
max: 255
minMessage: validation.Person.constraint.name_min
maxMessage: validation.Person.constraint.name_max
groups: [general]
surname:
- NotBlank:
groups: [general]
- Length:
min: 2
max: 255
minMessage: validation.Person.constraint.name_min
maxMessage: validation.Person.constraint.name_max
groups: [general]
dateOfBirth:
- Date:
groups: [general]
nbOfChild:
- Range:
min: 0
max: 20
minMessage: validation.Person.constraint.nbOfChild_min
maxMessage: validation.Person.constraint.nbOfChild_max
invalidMessage: validation.Person.constraint.nbOfChild_invalid
groups: [general]
history:
- Valid:
traverse: true
constraints:
- Callback:
methods: [isHistoryValid]
groups: [history_consistent]
CL\Chill\PersonBundle\Entity\PersonHistoryFile:
properties:
date_opening:
- Date: ~
- NotNull: ~
date_closing:
- Date: ~
constraints:
- Callback:
methods: [isDateConsistent]

View File

@@ -7,4 +7,6 @@ div#person_wrapper div#person_details dd { margin: 0 0 0 199px; padding: 0 0 0.5
div#person_wrapper div#person_details label { color: green; }
div#person_wrapper div#person_details label:not(.radio) { min-width: 190px; font-weight: bold; }
div#person_wrapper div#person_details label.radio { margin-left: 0.2em; }
div#person_wrapper div#person_details .has_error label { color: red; }
div#person_wrapper div#person_details .has_error ul.errors li { color: red; }
div#person_wrapper div#person_details div.form_control .controls { float: right; }

View File

@@ -14,6 +14,11 @@ person:
MAN: Homme
WOM: Femme
undefined: Non renseigné
history:
close:
motives:
not_come: Plus venu
finished: Accompagnement terminé
search:
@@ -25,9 +30,22 @@ validation:
form:
person:
success: Bravo ! Les données ont été mises à jour.
error: '{1} Le champs %field% est incorrect. Veuillez le mettre à jour | ]1, Inf] Plusieurs champs sont incorrects. Veuillez les vérifier.'
views:
error: '{1} Le champs %field% est incorrect. Veuillez le corriger. | ]1, Inf] Plusieurs champs sont incorrects. Veuillez les vérifier.'
controller:
Person:
history:
close:
done: Bravo ! Le dossier de <em>%name%</em> a été clotûré.
error: Une erreur est survenue. Le dossier n'a pu être clos.
error_in_form: Le formulaire n'est pas valide.
is_not_open: Le dossier de </em>%name%</em> n'est pas ouvert. Il ne peut donc être fermé.
open:
done: Bravo ! Le dossier de <em>%name%</em> est maintenant ouvert.
error: Une erreur est survenue. Le dossier n'a pu être ouvert.
error_in_form: Le formulaire n'est pas valide.
is_not_closed: Le dossier de <em>%name%</em> n'est pas fermé. Il ne peut donc être ouvert.
views:
layout:
born: '{0} Né le %date% | {1} Née le %date%'
without_nationality: Nationalité inconnue
@@ -62,6 +80,28 @@ views:
submit: Envoi
list:
without_nationality: Nationalité inconnue
#History
hlist:
title: Historique du dossier - %name%
dateOpening_title: Date d'ouverture
dateClosing_title: Date de fermeture
still_open: Toujours en cours
edit: Modifier
close: Clôre le dossier
open: Ouvrir le dossier
close:
last_opening_since: Dernière ouverture le %last_opening%.
action: Clotûrer
select_a_motive: Choisissez un motif
date_of_closing: Date de clotûre
motive_of_closing: Motif de clôture
texto: Mémo
open:
action: Ouvrir
date_of_opening: Date d'ouverture
texto: Mémo

View File

@@ -0,0 +1,14 @@
validation:
Person:
constraint:
name_min: Ce nom est trop court. Il devrait contenir {{ limit }} caractères.
name_max: Ce nom est trop long. Il devrait contenir {{ limit }} caractères.
nbOfChild_min: Ce nombre est négatif. Il ne peut y avoir moins de 0 enfants.
nbOfChild_max: Ce nombre est trop élevé. Il ne peut être supérieur à {{ limit }}.
nbOfChild_invalid: La valeur introduite n'est pas un nombre.
history:
opening_is_before_closing: L'historique des ouvertures et fermetures de dossier n'est pas cohérent. La date %dateOpening% ouvre un dossier avant une précédente fermeture au %dateClosing%. Vérifiez la liste des ouvertures et fermetures.
open_history_without_closing: Vous tentez d'ouvrir un dossier à une date passée alors qu'il est réouvert plus tard. Veuillez insérer une nouvelle ligne d'ouverture avant de la clotûrer avant la suivante.
PersonHistoryFile:
constraint:
dateOfClosing_before_dateOfOpening: La date de fermeture du dossier ne peut pas être avant la date d'ouverture.

View File

@@ -1 +0,0 @@
Hello {{ name }}!

View File

@@ -0,0 +1,31 @@
{% extends "CLChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = null %}
{% block title %}{% endblock title %}
{% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %}
{% block personcontent %}
{{ form_start(form) }}
{{ 'views.Person.close.last_opening_since'|trans(
{ '%last_opening%' : history.dateOpening|date(date_format) }) }}
{{ form_row(form.dateClosing, {'label' : 'views.Person.close.date_of_closing'} ) }}
{{ form_row(form.motive, {'label' : 'views.Person.close.motive_of_closing'} ) }}
{{ form_row(form.texto, {'label' : 'views.Person.close.texto' } ) }}
{{ form_rest(form) }}
<div class="medium btn danger icon-right entypo icon-lock">
<button type="submit">{{ 'views.Person.close.action'|trans }}</button>
</div>
{{ form_end(form) }}
{% endblock personcontent %}

View File

@@ -0,0 +1,70 @@
{% extends "CLChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_person_history_list' %}
{% block title %}{{ 'views.Person.hlist.title'|trans({ '%name%' : person.__toString}) }}{% endblock title %}
{% block personcontent %}
<table class="striped rounded">
<thead>
<tr>
<th>{{ 'views.Person.hlist.dateOpening_title'|trans }}</th>
<th>{{ 'views.Person.hlist.dateClosing_title'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for history in histories %}
<tr>
<td>{{ history.dateOpening|date(date_format) }}</td>
<td>{% spaceless %}
{% if history.isOpen %}
{{ 'views.Person.hlist.still_open'|trans }}
{% else %}
{{ history.dateClosing|date(date_format) }}
{% endif %}
{% endspaceless %}</td>
<td>
<div class="small warning btn icon-right entypo icon-pencil"><a href="{{ path('chill_person_history_update', {'id' : person.id, 'historyId' : history.id } ) }}">{{ 'views.Person.hlist.edit'|trans }}</a></div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="form_control">
<div class="controls">
<div class="btn medium danger icon-right entypo {% spaceless %}
{% if person.isOpen == true %}
icon-lock
{% else %}
icon-lock-open
{% endif %}{% endspaceless %}">
{% spaceless %}
{% if person.isOpen == true %}
<a href="{{ path('chill_person_history_close', {'id' : person.id}) }}">
{{'views.Person.hlist.close'|trans }}
</a>
{% else %}
<a href="{{ path('chill_person_history_open', {'id' : person.id} ) }}">
{{'views.Person.hlist.open'|trans }}
</a>
{% endif %}
{% endspaceless %}
</div>
</div>
</div>
{% endblock personcontent %}

View File

@@ -0,0 +1,26 @@
{% extends "CLChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = null %}
{% block title %}{% endblock title %}
{% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %}
{% block personcontent %}
{{ form_start(form) }}
{{ form_row(form.dateOpening, {'label' : 'views.Person.open.date_of_opening'} ) }}
{{ form_row(form.texto, {'label' : 'views.Person.open.texto' } ) }}
{{ form_rest(form) }}
<div class="medium btn danger icon-right entypo icon-lock">
<button type="submit">{{ 'views.Person.open.action'|trans }}</button>
</div>
{{ form_end(form) }}
{% endblock personcontent %}

View File

@@ -30,7 +30,7 @@ This view should receive those arguments:
<dd>{{ person.surname }}</dd>
<dt class="inline">{{ 'views.Person.view.name'|trans }}</dt>
<dd>{{ person.surname }}</dd>
<dd>{{ person.name }}</dd>
<dt class="inline">{{ 'views.Person.view.gender'|trans }}</dt>
<dd>{{ ( 'person.gender.' ~ person.genre|default('undefined'))|trans }}</dd>

View File

@@ -17,7 +17,11 @@
<div id="general">
<h1>
<span class="surname">{{ person.surname }}</span>
<span class="personName">{{ person.name }}</span>
<span class="personName">{{ person.name }}</span> {% spaceless %}
{% if person.isOpen == false %}
<i class="icon-lock"></i>
{% endif %}
{% endspaceless %}
</h1>
<p class="date detail">{% transchoice person.genreNumeric