initial commit

This commit is contained in:
2019-05-09 09:22:56 +02:00
commit 04506781cd
32 changed files with 2330 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
chill_amli_familymembers_controllers:
resource: "@ChillAMLIFamilyMembersBundle/Controller"
type: annotation

View File

@@ -0,0 +1,4 @@
services:
Chill\AMLI\FamilyMembersBundle\Config\ConfigRepository:
arguments:
$links: '%chill_family_members.links%'

View File

@@ -0,0 +1,5 @@
services:
Chill\AMLI\FamilyMembersBundle\Controller\:
autowire: true
resource: '../../../Controller'
tags: ['controller.service_arguments']

View File

@@ -0,0 +1,7 @@
services:
Chill\AMLI\FamilyMembersBundle\Form\FamilyMemberType:
arguments:
$configRepository: '@Chill\AMLI\FamilyMembersBundle\Config\ConfigRepository'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: 'form.type' }

View File

@@ -0,0 +1,7 @@
services:
Chill\AMLI\FamilyMembersBundle\Menu\UserMenuBuilder:
arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
$translator: '@Symfony\Component\Translation\TranslatorInterface'
tags:
- { name: 'chill.menu_builder' }

View File

@@ -0,0 +1,7 @@
services:
Chill\AMLI\FamilyMembersBundle\Security\Voter\FamilyMemberVoter:
arguments:
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
tags:
- { name: chill.role }
- { name: security.voter }

View File

@@ -0,0 +1,7 @@
services:
Chill\AMLI\FamilyMembersBundle\Templating\Twig:
arguments:
$configRepository: '@Chill\AMLI\FamilyMembersBundle\Config\ConfigRepository'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: 'twig.extension' }

View File

@@ -0,0 +1,36 @@
<?php declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* create schema for chill_family
*/
final class Version20180522142023 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA chill_family');
$this->addSql('CREATE SEQUENCE chill_family.family_member_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_family.family_member (id INT NOT NULL, person_id INT DEFAULT NULL, lastname VARCHAR(255) NOT NULL, firstname VARCHAR(255) NOT NULL, gender VARCHAR(20) NOT NULL, birthdate DATE DEFAULT NULL, professionnalSituation TEXT NOT NULL, link VARCHAR(255) NOT NULL, startDate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, endDate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, maritalStatus_id VARCHAR(7) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_A61F4A49217BBB47 ON chill_family.family_member (person_id)');
$this->addSql('CREATE INDEX IDX_A61F4A49D7D03CE3 ON chill_family.family_member (maritalStatus_id)');
$this->addSql('COMMENT ON COLUMN chill_family.family_member.birthdate IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_family.family_member.startDate IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_family.family_member.endDate IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE chill_family.family_member ADD CONSTRAINT FK_A61F4A49217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_family.family_member ADD CONSTRAINT FK_A61F4A49D7D03CE3 FOREIGN KEY (maritalStatus_id) REFERENCES chill_person_marital_status (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP SCHEMA chill_family CASCADE');
}
}

View File

@@ -0,0 +1,28 @@
<?php declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
/**
* Add `familial_situation` to family members
*/
final class Version20180723133605 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE chill_amli.associated_family_member ADD familial_situation VARCHAR(200) DEFAULT NULL');
$this->addSql('ALTER TABLE chill_family.family_member ADD familial_situation VARCHAR(200) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE chill_family.family_member DROP familial_situation');
$this->addSql('ALTER TABLE chill_amli.associated_family_member DROP familial_situation');
}
}

View File

@@ -0,0 +1,29 @@
Family memberships: Membres du ménage
Professionnal situation: Situation professionnelle
Link: Lien de parenté
Relationship: Lien de parenté
Choose a link: Choisissez un lien
Familial situation: Situation familiale
Arrival date in the family: Date d'arrivée dans le ménage
Departure date of the family: Date de départ du ménage
Family members for %name%: Membre du ménage de %name%
Family member "%membersName%" for %name%: Membre du ménage "%membersName%" de "%name%"
Actual family members: Membre du ménage actuellement
Future family members: Futurs membres du ménage
Past family members: Anciens membres du ménage
Member since %startDate% until %endDate%: Membre depuis le %startDate% et jusqu'au %endDate%
Member since %startDate%: Membre depuis le %startDate%
family membership link: Lien de parenté
family membership period: Période d'appartenance
Create new family membership: Ajouter un nouveau membre
There isn't any family member: Aucun membre du ménage enregistré
New family members for %name%: Nouveau membre du ménage de %name%
Edit family members for %name%: Modifier le membre du ménage de %name%
Family member created: Le membre du ménage a été ajouté
Family member updated: Le membre du ménage a été mis à jour
Remove family membership: Supprimer le membre du ménage
"Are you sure you want to remove the family membership \"%members_name%\" associated to \"%name%\" ?": "Êtes-vous sûr de vouloir supprimer le membre \"%members_name%\" du ménage associé à \"%name%\" ?"
The family member has been successfully removed.: Le membre du ménage a été supprimé

View File

@@ -0,0 +1 @@
"The membership's end date should be after the start date": La date de fin doit être située après la date de début

View File

@@ -0,0 +1,19 @@
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = '' %}
{% set person = familyMember.person %}
{% block title 'Remove family membership'|trans %}
{% block personcontent %}
{{ include('ChillMainBundle:Util:confirmation_template.html.twig',
{
'title' : 'Remove family membership'|trans,
'confirm_question' : 'Are you sure you want to remove the family membership "%members_name%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%members_name%': familyMember.firstname ~ ' ' ~ familyMember.lastname } ),
'cancel_route' : 'chill_family_members_family_members_index',
'cancel_parameters' : { 'id' : familyMember.person.id },
'form' : delete_form
} ) }}
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "@ChillPerson/layout.html.twig" %}
{% set activeRouteKey = '' %}
{% set title = 'Edit family members for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block personcontent %}
<h1>{{ title }}</h1>
{{ form_start(form) }}
{{ form_row(form.firstname) }}
{{ form_row(form.lastname) }}
{{ form_row(form.birthdate) }}
{{ form_row(form.link) }}
{{ form_row(form.gender) }}
{{ form_row(form.familialSituation) }}
{{ form_row(form.professionnalSituation) }}
{{ form_row(form.maritalStatus) }}
{{ form_row(form.startDate) }}
{{ form_row(form.endDate) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_family_members_family_members_index", { 'id': person.id } ) }}" class="sc-button bt-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'sc-button bt-edit' }, 'label': 'Edit' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,124 @@
{% extends "@ChillPerson/layout.html.twig" %}
{% set activeRouteKey = '' %}
{% set title = 'Family members for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% set actualFamilyMembers = [] %}
{% set futureFamilyMembers = [] %}
{% set pastFamilyMembers = [] %}
{% for f in familyMembers %}
{% if f.startDate|date('U') <= 'now'|date('U') %}
{% if f.endDate is null or f.endDate|date('U') >= 'now'|date('U') %}
{% set actualFamilyMembers = actualFamilyMembers|merge([ f ]) %}
{% else %}
{% set pastFamilyMembers = pastFamilyMembers|merge([ f ]) %}
{% endif %}
{% else %}
{% set futureFamilyMembers = futureFamilyMembers|merge([ f ]) %}
{% endif %}
{% endfor %}
{% macro table(familyMembers) %}
<table>
<thead>
<tr>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'birthdate'|trans }}</th>
<th>{{ 'family membership link'|trans }}</th>
<th>{{ 'family membership period'|trans }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for f in familyMembers %}
<tr>
<td>
{% set name = f.firstName ~ ' ' ~ f.lastName %}
{% if name is not empty %}
{{ name }}
{% else %}
<span class="chill-no-data-statement">{{ 'name unknown'|trans }}</span>
{% endif %}
</td>
<td>
{% if f.birthdate is not null %}
{{ f.birthdate|localizeddate('long', 'none') }}
{% else %}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{% endif %}
</td>
<td>
{{ f.link|family_member_link_display }}
</td>
<td>
{% if f.endDate is not null %}
{{ 'Member since %startDate% until %endDate%'|trans( { '%startDate%': f.startDate|localizeddate('long', 'none'), '%endDate%': f.endDate|localizeddate('long', 'none') } ) }}
{% else %}
{{ 'Member since %startDate%'|trans( { '%startDate%': f.startDate|localizeddate('long', 'none') } ) }}
{% endif %}
</td>
<td>
<ul class="record_actions">
{% if is_granted(constant('Chill\\AMLI\\FamilyMembersBundle\\Security\\Voter\\FamilyMemberVoter::SHOW'), f) %}
<li>
<a href="{{ path('chill_family_members_family_members_view', { 'id': f.id } ) }}" class="sc-button bt-show"></a>
</li>
{% endif %}
{% if is_granted(constant('Chill\\AMLI\\FamilyMembersBundle\\Security\\Voter\\FamilyMemberVoter::UPDATE'), f) %}
<li>
<a href="{{ path('chill_family_members_family_members_edit', { 'id': f.id } ) }}" class="sc-button bt-edit"></a>
</li>
{% endif %}
{% if is_granted(constant('Chill\\AMLI\\FamilyMembersBundle\\Security\\Voter\\FamilyMemberVoter::DELETE'), f) %}
<li>
<a href="{{ path('chill_family_members_family_members_delete', { 'id': f.id } ) }}" class="sc-button bt-delete"></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro %}
{% import _self as m %}
{% block personcontent %}
<h1>{{ title }}</h1>
{% if familyMembers|length == 0 %}
<p><span class="chill-no-data-statement">{{ "There isn't any family member"|trans }}</span></p>
{% else %}
{% if actualFamilyMembers|length > 0 %}
<h2>{{ 'Actual family members'|trans }}</h2>
{{ m.table(actualFamilyMembers) }}
{% endif %}
{% if futureFamilyMembers|length > 0 %}
<h2>{{ 'Future family members'|trans }}</h2>
{{ m.table(futureFamilyMembers) }}
{% endif %}
{% if pastFamilyMembers|length > 0 %}
<h2>{{ 'Past family members'|trans }}</h2>
{{ m.table(pastFamilyMembers) }}
{% endif %}
{% endif %}
{% if is_granted(constant('Chill\\AMLI\\FamilyMembersBundle\\Security\\Voter\\FamilyMemberVoter::CREATE'), person) %}
<ul class="record_actions">
<li>
<a class="sc-button bt-create" href="{{ path('chill_family_members_family_members_new', { 'id': person.id} ) }}">{{ 'Create new family membership'|trans }}</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,35 @@
{% extends "@ChillPerson/layout.html.twig" %}
{% set activeRouteKey = '' %}
{% set title = 'New family members for %name%'|trans({ '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block personcontent %}
<h1>{{ title }}</h1>
{{ form_start(form) }}
{{ form_row(form.firstname) }}
{{ form_row(form.lastname) }}
{{ form_row(form.birthdate) }}
{{ form_row(form.link) }}
{{ form_row(form.gender) }}
{{ form_row(form.familialSituation) }}
{{ form_row(form.professionnalSituation) }}
{{ form_row(form.maritalStatus) }}
{{ form_row(form.startDate) }}
{{ form_row(form.endDate) }}
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_family_members_family_members_index", { 'id': person.id } ) }}" class="sc-button bt-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class': 'sc-button bt-create' }, 'label': 'Create' } ) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,77 @@
{% extends "@ChillPerson/layout.html.twig" %}
{% set activeRouteKey = '' %}
{% set person = familyMember.person %}
{% set title = 'Family member "%membersName%" for %name%'|trans({ '%membersName%': familyMember.firstName ~ ' ' ~ familyMember.lastName, '%name%' : person.firstName ~ " " ~ person.lastName } ) %}
{% block title title %}
{% block personcontent %}
<h1>{{ title }}</h1>
<dl class="chill_view_data">
<dt>{{ 'Name'|trans }}</dt>
<dd>{{ familyMember.firstName ~ ' ' ~ familyMember.lastName }}</dd>
<dt>{{ 'family membership link'|trans }}</dt>
<dd>{{ familyMember.link|family_member_link_display }}</dd>
<dt>{{ 'family membership period'|trans }}</dt>
<dd>
{% if familyMember.endDate is not null %}
{{ 'Member since %startDate% until %endDate%'|trans( { '%startDate%': familyMember.startDate|localizeddate('long', 'none'), '%endDate%': familyMember.endDate|localizeddate('long', 'none') } ) }}
{% else %}
{{ 'Member since %startDate%'|trans( { '%startDate%': familyMember.startDate|localizeddate('long', 'none') } ) }}
{% endif %}
</dd>
<dt>{{ 'Birthdate'|trans }}</dt>
<dd>
{%- if familyMember.birthdate is not null -%}
{{ familyMember.birthdate|localizeddate('long', 'none') }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
<dt>{{ 'Gender'|trans }}</dt>
<dd>
{%- if familyMember.gender is not null -%}
{{ familyMember.gender|trans }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
<dt>{{ 'Marital status'|trans }}</dt>
<dd>
{%- if familyMember.maritalStatus is not null -%}
{{ familyMember.maritalStatus.name|localize_translatable_string }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
<dt>{{ 'Professionnal situation'|trans }}</dt>
<dd>
{%- if familyMember.professionnalSituation is not empty -%}
{{ familyMember.professionnalSituation }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
{%- endif -%}
</dd>
</dl>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path("chill_family_members_family_members_index", { 'id': person.id } ) }}" class="sc-button bt-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
{% if is_granted(constant('Chill\\AMLI\\FamilyMembersBundle\\Security\\Voter\\FamilyMemberVoter::UPDATE'), familyMember) %}
<li>
<a href="{{ path('chill_family_members_family_members_edit', { 'id': familyMember.id } ) }}" class="sc-button bt-edit">{{ 'Edit'|trans }}</a>
</li>
{% endif %}
</ul>
{% endblock %}