mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-30 02:25:00 +00:00
Compare commits
10 Commits
ameliorati
...
102_activi
Author | SHA1 | Date | |
---|---|---|---|
d248d7e8af | |||
d58c0efae9 | |||
1283ea4010 | |||
3f01986234 | |||
f751d6abca | |||
f4962f86a0 | |||
1db69cdfe9 | |||
f41e27d75a | |||
158effe232 | |||
8b30652b6b |
@@ -5,13 +5,11 @@ image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
|||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- tests/app/vendor/
|
- tests/app/vendor/
|
||||||
- .composer
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# add extensions to postgres
|
# add extensions to postgres
|
||||||
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||||
# Install and run Composer
|
# Install and run Composer
|
||||||
- mkdir -p $COMPOSER_HOME
|
|
||||||
- curl -sS https://getcomposer.org/installer | php
|
- curl -sS https://getcomposer.org/installer | php
|
||||||
- php -d memory_limit=2G composer.phar install
|
- php -d memory_limit=2G composer.phar install
|
||||||
- php tests/app/bin/console doctrine:migrations:migrate -n
|
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||||
@@ -36,10 +34,6 @@ variables:
|
|||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
REDIS_URL: redis://redis:6379
|
REDIS_URL: redis://redis:6379
|
||||||
# change vendor dir to make the app install into tests/apps
|
|
||||||
COMPOSER_VENDOR_DIR: tests/app/vendor
|
|
||||||
# cache some composer data
|
|
||||||
COMPOSER_HOME: .composer
|
|
||||||
|
|
||||||
|
|
||||||
# Run our tests
|
# Run our tests
|
||||||
|
@@ -20,8 +20,7 @@
|
|||||||
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
|
"Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle",
|
||||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
||||||
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src"
|
||||||
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
|
@@ -28,7 +28,7 @@ Then, render the pagination using the dedicated twig function.
|
|||||||
|
|
||||||
.. code-block:: html+twig
|
.. code-block:: html+twig
|
||||||
|
|
||||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
{% extends "ChillPersonBundle::layout.html.twig" %}
|
||||||
|
|
||||||
{% block title 'Item list'|trans %}
|
{% block title 'Item list'|trans %}
|
||||||
|
|
||||||
|
@@ -149,7 +149,7 @@ It proposes a new block :
|
|||||||
|
|
||||||
* where to display the admin content
|
* where to display the admin content
|
||||||
|
|
||||||
@ChillPersonBundle/Person/layout.html.twig
|
ChillPersonBundle::layout.html.twig
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the person details in the block `top_banner`, set the menu `person` as the vertical menu.
|
This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the person details in the block `top_banner`, set the menu `person` as the vertical menu.
|
||||||
|
@@ -1,29 +1,43 @@
|
|||||||
// Access to Bootstrap variables and mixins
|
// Access to Bootstrap variables and mixins
|
||||||
@import '~ChillMainAssets/module/bootstrap/shared';
|
@import '~ChillMainAssets/module/bootstrap/shared';
|
||||||
|
|
||||||
// activity creation first step: select type page
|
//@import '~ChillMainSass/custom/mixins/entity';
|
||||||
div.new-activity-select-type {
|
|
||||||
div.activity-row {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 12px;
|
|
||||||
|
|
||||||
div.bloc {
|
//.chill-entity.chill-entity__activity-reason {
|
||||||
width: 200px;
|
// @include entity($chill-pink, white);
|
||||||
align-self: flex-end;
|
//}
|
||||||
height: 140px;
|
|
||||||
display: flex;
|
.activity {
|
||||||
justify-content: center;
|
//color: $chill-green;
|
||||||
align-items: center;
|
}
|
||||||
|
|
||||||
|
// exceptions for flex-bloc in concerned-groups
|
||||||
|
div.flex-bloc.concerned-groups {
|
||||||
|
margin-top: 1em;
|
||||||
|
div.item-bloc {
|
||||||
|
flex-grow: 0; flex-shrink: 0; flex-basis: 25%; //4 blocs
|
||||||
|
ul.list-content {
|
||||||
|
list-style-type: none;
|
||||||
|
padding-left: 0;
|
||||||
|
li {
|
||||||
|
margin-bottom: 0.2em;
|
||||||
|
a {
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: #ffffffab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.person div.item-bloc {
|
||||||
|
flex-basis: 33%; //3 blocs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// exceptions for flex-table in list-records
|
// exceptions for flex-table in list-records
|
||||||
div.activity-list {
|
div.flex-table.list-records {
|
||||||
div.flex-table {
|
|
||||||
div.item-bloc {
|
div.item-bloc {
|
||||||
div.item-row.main {
|
div.item-row.main {
|
||||||
div.item-col {
|
div.item-col {
|
||||||
@@ -40,10 +54,10 @@ div.activity-list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
li.social-issues .badge-primary {
|
li.social-issues .badge-primary {
|
||||||
background-color: $orange;
|
background-color: var(--chill-orange);
|
||||||
}
|
}
|
||||||
li.social-actions .badge-primary {
|
li.social-actions .badge-primary {
|
||||||
background-color: $green;
|
background-color: var(--chill-green);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,31 +113,20 @@ div.activity-list {
|
|||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// exceptions for flex-bloc in concerned-groups
|
div.activity-row {
|
||||||
div.flex-bloc.concerned-groups {
|
display: flex;
|
||||||
margin-top: 1em;
|
flex-direction: row;
|
||||||
div.item-bloc {
|
flex-wrap: wrap;
|
||||||
flex-grow: 0; flex-shrink: 0; flex-basis: 25%; //4 blocs
|
justify-content: center;
|
||||||
ul.list-content {
|
gap: 12px;
|
||||||
list-style-type: none;
|
div.bloc {
|
||||||
padding-left: 0;
|
width: 200px;
|
||||||
li {
|
align-self: flex-end;
|
||||||
margin-bottom: 0.2em;
|
height: 140px;
|
||||||
a {
|
display: flex;
|
||||||
color: $white;
|
justify-content: center;
|
||||||
cursor: pointer;
|
align-items: center;
|
||||||
&:hover {
|
|
||||||
color: #ffffffab;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.person div.item-bloc {
|
|
||||||
flex-basis: 33%; //3 blocs
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -60,10 +60,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
<span class="badge bg-primary">
|
<span class="badge bg-primary">
|
||||||
{{ item|chill_entity_render_box({
|
{{ item|chill_entity_render_box({'render': 'raw'}) }}
|
||||||
'render': 'raw',
|
|
||||||
'addAltNames': false
|
|
||||||
}) }}
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -87,10 +84,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
<span class="badge bg-primary">
|
<span class="badge bg-primary">
|
||||||
{{ item|chill_entity_render_box({
|
{{ item|chill_entity_render_box({'only_denomination': true}) }}
|
||||||
'render': 'raw',
|
|
||||||
'addAltNames': false
|
|
||||||
}) }}
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@@ -54,7 +54,7 @@
|
|||||||
{{ form_row(edit_form.date) }}
|
{{ form_row(edit_form.date) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# TODO .. location #}
|
.. location
|
||||||
|
|
||||||
{%- if edit_form.durationTime is defined -%}
|
{%- if edit_form.durationTime is defined -%}
|
||||||
{{ form_row(edit_form.durationTime) }}
|
{{ form_row(edit_form.durationTime) }}
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if edit_form.comment is defined -%}
|
{%- if edit_form.comment is defined -%}
|
||||||
{# TODO .. public and private #}
|
.. public and private
|
||||||
{{ form_row(edit_form.comment) }}
|
{{ form_row(edit_form.comment) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
{{ form_row(edit_form.attendee) }}
|
{{ form_row(edit_form.attendee) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# TODO .. status #}
|
.. status
|
||||||
|
|
||||||
{% set person_id = null %}
|
{% set person_id = null %}
|
||||||
{% if entity.person %}
|
{% if entity.person %}
|
||||||
|
@@ -1,13 +1,24 @@
|
|||||||
<div class="activity-list context-{{ context }}">
|
{% set person_id = null %}
|
||||||
|
{% if person %}
|
||||||
|
{% set person_id = person.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if activities|length == 0 %}
|
{% set accompanying_course_id = null %}
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2>{{ 'Activity list' |trans }}</h2>
|
||||||
|
|
||||||
|
{% if activities|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
{{ "There isn't any activities."|trans }}
|
{{ "There isn't any activities."|trans }}
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-sm btn-create"></a>
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create button-small"></a>
|
||||||
</p>
|
</p>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<div class="flex-table list-records context-{{ context }}">
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<div class="flex-table">
|
|
||||||
{% for activity in activities %}
|
{% for activity in activities %}
|
||||||
{% set t = activity.type %}
|
{% set t = activity.type %}
|
||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
@@ -76,7 +87,9 @@
|
|||||||
|
|
||||||
{%- if t.reasonsVisible -%}
|
{%- if t.reasonsVisible -%}
|
||||||
<li>
|
<li>
|
||||||
{%- if activity.reasons is not empty -%}
|
{%- if activity.reasons is empty -%}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
|
||||||
|
{%- else -%}
|
||||||
{% for r in activity.reasons %}
|
{% for r in activity.reasons %}
|
||||||
{{ r|chill_entity_render_box }}
|
{{ r|chill_entity_render_box }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -86,7 +99,9 @@
|
|||||||
|
|
||||||
{%- if t.socialIssuesVisible %}
|
{%- if t.socialIssuesVisible %}
|
||||||
<li class="social-issues">
|
<li class="social-issues">
|
||||||
{%- if activity.socialIssues is not empty -%}
|
{%- if activity.socialIssues is empty -%}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</span>
|
||||||
|
{%- else -%}
|
||||||
{% for r in activity.socialIssues %}
|
{% for r in activity.socialIssues %}
|
||||||
{{ r|chill_entity_render_box }}
|
{{ r|chill_entity_render_box }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -96,7 +111,9 @@
|
|||||||
|
|
||||||
{%- if t.socialActionsVisible -%}
|
{%- if t.socialActionsVisible -%}
|
||||||
<li class="social-actions">
|
<li class="social-actions">
|
||||||
{%- if activity.socialActions is not empty -%}
|
{%- if activity.socialActions is empty -%}
|
||||||
|
<span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span>
|
||||||
|
{%- else -%}
|
||||||
{% for r in activity.socialActions %}
|
{% for r in activity.socialActions %}
|
||||||
<span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span>
|
<span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -108,23 +125,20 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-show "></a>
|
||||||
class="btn btn-sm btn-show "></a>
|
|
||||||
</li>
|
</li>
|
||||||
{# TOOD
|
{# TOOD
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||||
#}
|
#}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-update "></a>
|
||||||
class="btn btn-sm btn-update "></a>
|
|
||||||
</li>
|
</li>
|
||||||
{# TOOD
|
{# TOOD
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
||||||
#}
|
#}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
|
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete "></a>
|
||||||
class="btn btn-sm btn-delete "></a>
|
|
||||||
</li>
|
</li>
|
||||||
{#
|
{#
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -133,23 +147,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if activity.comment.comment is not empty
|
{%
|
||||||
|
if activity.comment.comment is not empty
|
||||||
or activity.persons|length > 0
|
or activity.persons|length > 0
|
||||||
or activity.thirdParties|length > 0
|
or activity.thirdParties|length > 0
|
||||||
or activity.users|length > 0
|
or activity.users|length > 0
|
||||||
%}
|
%}
|
||||||
<div class="item-row details">
|
<div class="item-row details">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if activity.comment.comment is not empty %}
|
{% if activity.comment.comment is not empty %}
|
||||||
<div class="item-col">
|
<div class="item-col comment">
|
||||||
{{ activity.comment|chill_entity_render_box({
|
{{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
|
||||||
'disable_markdown': false,
|
|
||||||
'limit_lines': 3,
|
|
||||||
'metadata': false,
|
|
||||||
}) }}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -157,7 +169,16 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if context != 'person' %}
|
||||||
|
{# TODO set this condition in configuration #}
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
|
||||||
|
{{ 'Add a new activity' | trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
@@ -5,27 +5,5 @@
|
|||||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% set person_id = null %}
|
|
||||||
{% if person %}
|
|
||||||
{% set person_id = person.id %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% set accompanying_course_id = null %}
|
|
||||||
{% if accompanyingCourse %}
|
|
||||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<h1>{{ 'Activity list' |trans }}</h1>
|
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %}
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
|
|
||||||
{{ 'Add a new activity' | trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -21,27 +21,5 @@
|
|||||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
{% set person_id = null %}
|
|
||||||
{% if person %}
|
|
||||||
{% set person_id = person.id %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% set accompanying_course_id = null %}
|
|
||||||
{% if accompanyingCourse %}
|
|
||||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<h1>{{ 'Activity list' |trans }}</h1>
|
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
|
|
||||||
class="btn btn-create disabled" tabindex="-1" role="button" aria-disabled="true">{{ 'Add a new activity' | trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
{{ form_row(form.date) }}
|
{{ form_row(form.date) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# TODO .. location #}
|
.. location
|
||||||
|
|
||||||
{%- if form.durationTime is defined -%}
|
{%- if form.durationTime is defined -%}
|
||||||
{{ form_row(form.durationTime) }}
|
{{ form_row(form.durationTime) }}
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- if form.comment is defined -%}
|
{%- if form.comment is defined -%}
|
||||||
{# TODO .. public and private #}
|
.. public and private
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
{{ form_row(form.attendee) }}
|
{{ form_row(form.attendee) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# TODO .. status #}
|
.. status
|
||||||
|
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
<div class="new-activity-select-type">
|
<h2 class="chill-red">{{ "Activity creation"|trans }}</h2>
|
||||||
<h2 class="chill-red">{{ "Activity creation"|trans }}</h2>
|
|
||||||
|
|
||||||
{# TODO: refaire l'html css des tuilles #}
|
{# TODO: refaire l'html css des tuilles #}
|
||||||
|
|
||||||
{% for row in data %}
|
{% for row in data %}
|
||||||
<h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3>
|
<h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3>
|
||||||
<div class="activity-row">
|
<div class="activity-row">
|
||||||
{% for activityType in row.activityTypes %}
|
{% for activityType in row.activityTypes %}
|
||||||
@@ -26,5 +25,4 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
|
||||||
|
@@ -81,9 +81,9 @@ activity:
|
|||||||
'%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"'
|
'%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"'
|
||||||
|
|
||||||
#controller
|
#controller
|
||||||
'Success : activity created!': L'activité a été créée.
|
'Success : activity created!': Bravo ! L'activité a été créée.
|
||||||
'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'activité n'a pas été créée.
|
'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'activité n'a pas été créée.
|
||||||
'Success : activity updated!': L'activité a été mise à jour.
|
'Success : activity updated!': Bravo ! L'activité a été mise à jour.
|
||||||
'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'activité n'a pas été mise à jour.
|
'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'activité n'a pas été mise à jour.
|
||||||
|
|
||||||
# ROLES
|
# ROLES
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for activity configuration
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
* @author Champs Libres <info@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class AdminController extends AbstractController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function redirectToAdminIndexAction()
|
||||||
|
{
|
||||||
|
return $this->redirectToRoute('chill_main_admin_central');
|
||||||
|
}
|
||||||
|
}
|
@@ -1,14 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\AsideActivityBundle\Controller;
|
namespace Chill\AsideActivityBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
|
||||||
|
final class AsideActivityController extends CRUDController
|
||||||
/**
|
|
||||||
* Class AsideActivityBundle
|
|
||||||
*/
|
|
||||||
class AsideActivityController extends CRUDController
|
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param QueryBuilder $query
|
||||||
|
*/
|
||||||
|
protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $query) {
|
||||||
|
|
||||||
|
$usr = $this->getUser();
|
||||||
|
$id = $usr->getId();
|
||||||
|
$criteria = Criteria::create()->andWhere(Criteria::expr()->eq('agent', $id));
|
||||||
|
|
||||||
|
$query
|
||||||
|
->addCriteria($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Faker\Factory as FakerFactory;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||||
|
use Chill\AsideActivityBundle\DataFixtures\LoadAsideActivityCategory;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load reports into DB
|
||||||
|
*
|
||||||
|
* @author Champs-Libres Coop
|
||||||
|
*/
|
||||||
|
class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
|
||||||
|
{
|
||||||
|
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Faker\Generator
|
||||||
|
*/
|
||||||
|
private $faker;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->faker = FakerFactory::create('fr_FR');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 16400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a random asideActivityCategory
|
||||||
|
*
|
||||||
|
* @return \Chill\AsideActivityBundle\Entity\AsideActivityCategory
|
||||||
|
*/
|
||||||
|
private function getRandomAsideActivityCategory()
|
||||||
|
{
|
||||||
|
$catRef = LoadAsideActivityCategory::$references[array_rand(LoadAsideActivityCategory::$references)];
|
||||||
|
return $this->getReference($catRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a random user
|
||||||
|
*
|
||||||
|
* @return \Chill\MainBundle\Entity\User
|
||||||
|
*/
|
||||||
|
private function getRandomUser()
|
||||||
|
{
|
||||||
|
$userRef = array_rand(LoadUsers::$refs);
|
||||||
|
return $this->getReference($userRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newRandomActivity()
|
||||||
|
{
|
||||||
|
$asideactivity = (new AsideActivity())
|
||||||
|
->setAgent($this->getRandomUser())
|
||||||
|
->setDate($this->faker->dateTimeThisYear())
|
||||||
|
->setDuration($this->faker->dateTime(36000))
|
||||||
|
->setType($this->getRandomAsideActivityCategory());
|
||||||
|
|
||||||
|
return $asideactivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
$users = $this->container->get('doctrine.orm.entity_manager')
|
||||||
|
->getRepository('ChillMainBundle:User')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
foreach($users as $user) {
|
||||||
|
$activityNbr = rand(0,3);
|
||||||
|
$ref = 'activity_'.$user->getUsernameCanonical();
|
||||||
|
|
||||||
|
for($i = 0; $i < $activityNbr; $i ++) {
|
||||||
|
print "Creating an aside activity for : ".$user." (ref: ".$ref.") \n";
|
||||||
|
$asideactivity = $this->newRandomActivity($user);
|
||||||
|
$manager->persist($asideactivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setReference($ref, $asideactivity);
|
||||||
|
}
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
Namespace Chill\AsideActivityBundle\DataFixtures;
|
||||||
|
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixtures for AsideActivityCategory
|
||||||
|
*
|
||||||
|
* @author Champs-Libres Coop
|
||||||
|
*/
|
||||||
|
class LoadAsideActivityCategory extends Fixture implements OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
public static $references = array();
|
||||||
|
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return 16050;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
$categories = [
|
||||||
|
[
|
||||||
|
'title' => ['fr' => 'Formation', 'en' => 'Training'],
|
||||||
|
'ref' => 'training',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => ['fr' => 'Team building', 'en' => 'Team building'],
|
||||||
|
'ref' => 'teambuilding',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($categories as $cat) {
|
||||||
|
print "Creating aside activity type category : " . $cat['ref'] . "\n";
|
||||||
|
|
||||||
|
$newCat = (new AsideActivityCategory())
|
||||||
|
->setTitle(($cat['title']));
|
||||||
|
|
||||||
|
$manager->persist($newCat);
|
||||||
|
$reference = 'activity_type_cat_'.$cat['ref'];
|
||||||
|
|
||||||
|
$this->addReference($reference, $newCat);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Faker\Factory as FakerFactory;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||||
|
use Chill\AsideActivityBundle\DataFixtures\ORM\LoadAsideActivityCategory;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Repository\UserRepository;
|
||||||
|
use DateTime;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load reports into DB
|
||||||
|
*
|
||||||
|
* @author Champs-Libres Coop
|
||||||
|
*/
|
||||||
|
class LoadAsideActivity extends AbstractFixture implements DependentFixtureInterface, ContainerAwareInterface
|
||||||
|
{
|
||||||
|
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Faker\Generator
|
||||||
|
*/
|
||||||
|
private $faker;
|
||||||
|
|
||||||
|
private array $cacheUsers = [];
|
||||||
|
|
||||||
|
private UserRepository $userRepository;
|
||||||
|
|
||||||
|
public function __construct(UserRepository $userRepository)
|
||||||
|
{
|
||||||
|
$this->faker = FakerFactory::create('fr_FR');
|
||||||
|
$this->userRepository = $userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDependencies()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
LoadAsideActivityCategory::class,
|
||||||
|
LoadUsers::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a random asideActivityCategory
|
||||||
|
*
|
||||||
|
* @return \Chill\AsideActivityBundle\Entity\AsideActivityCategory
|
||||||
|
*/
|
||||||
|
private function getRandomAsideActivityCategory(): AsideActivityCategory
|
||||||
|
{
|
||||||
|
$catRef = LoadAsideActivityCategory::$references[array_rand(LoadAsideActivityCategory::$references)];
|
||||||
|
|
||||||
|
return $this->getReference($catRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a random user
|
||||||
|
*
|
||||||
|
* @return \Chill\MainBundle\Entity\User
|
||||||
|
*/
|
||||||
|
private function getRandomUser(): User
|
||||||
|
{
|
||||||
|
if (0 === count($this->cacheUsers)){
|
||||||
|
$this->cacheUsers = $this->container->get('doctrine.orm.entity_manager')
|
||||||
|
->getRepository('ChillMainBundle:User')
|
||||||
|
->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->cacheUsers[array_rand($this->cacheUsers)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newRandomActivity()
|
||||||
|
{
|
||||||
|
$asideactivity = ($activity = new AsideActivity())
|
||||||
|
->setAgent($this->getRandomUser())
|
||||||
|
->setDate($this->faker->dateTimeThisYear())
|
||||||
|
->setCreatedAt(new DateTime())
|
||||||
|
->setCreatedBy($activity->getAgent())
|
||||||
|
//->setDuration(3600)
|
||||||
|
->setType($this->getRandomAsideActivityCategory());
|
||||||
|
|
||||||
|
return $asideactivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
for($i = 0; $i < 100; $i ++) {
|
||||||
|
$asideactivity = $this->newRandomActivity();
|
||||||
|
$manager->persist($asideactivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
Namespace Chill\AsideActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Chill\ActivityBundle\Entity\ActivityTypeCategory;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixtures for AsideActivityCategory
|
||||||
|
*
|
||||||
|
* @author Champs-Libres Coop
|
||||||
|
*/
|
||||||
|
class LoadAsideActivityCategory extends Fixture
|
||||||
|
{
|
||||||
|
public static $references = array();
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
$categories = [
|
||||||
|
[
|
||||||
|
'title' => ['fr' => 'Formation', 'en' => 'Training'],
|
||||||
|
'ref' => 'training',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => ['fr' => 'Team building', 'en' => 'Team building'],
|
||||||
|
'ref' => 'teambuilding',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($categories as $cat) {
|
||||||
|
print "Creating aside activity type category : " . $cat['ref'] . "\n";
|
||||||
|
|
||||||
|
$newCat = (new AsideActivityCategory())
|
||||||
|
->setTitle(($cat['title']));
|
||||||
|
|
||||||
|
$manager->persist($newCat);
|
||||||
|
$reference = 'activity_type_cat_'.$cat['ref'];
|
||||||
|
|
||||||
|
$this->addReference($reference, $newCat);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -25,8 +25,9 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
|
|||||||
public function load(array $configs, ContainerBuilder $container): void
|
public function load(array $configs, ContainerBuilder $container): void
|
||||||
{
|
{
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||||
// $loader->load('services.yaml');
|
$loader->load('services.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
|
$loader->load('services/menu.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@@ -13,7 +13,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(schema="chill_asideactivity")
|
* @ORM\Table(schema="chill_asideactivity")
|
||||||
*/
|
*/
|
||||||
final class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
|
class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
@@ -200,10 +200,4 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function __toString()
|
|
||||||
// {
|
|
||||||
// // dump($this->type->getTitle());
|
|
||||||
// return $this->type->getTitle();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
||||||
@@ -34,6 +35,7 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
|
dump($options);
|
||||||
$timeChoices = [];
|
$timeChoices = [];
|
||||||
|
|
||||||
foreach ($this->timeChoices as $e) {
|
foreach ($this->timeChoices as $e) {
|
||||||
@@ -53,6 +55,9 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'class' => User::class,
|
'class' => User::class,
|
||||||
'data' => $this->storage->getToken()->getUser(),
|
'data' => $this->storage->getToken()->getUser(),
|
||||||
|
'query_builder' => function(EntityRepository $er){
|
||||||
|
return $er->createQueryBuilder('u')->where('u.enabled = true');
|
||||||
|
},
|
||||||
'attr' => array('class' => 'select2 '),
|
'attr' => array('class' => 'select2 '),
|
||||||
'placeholder' => 'Choose the agent for whom this activity is created',
|
'placeholder' => 'Choose the agent for whom this activity is created',
|
||||||
'choice_label' => 'username'
|
'choice_label' => 'username'
|
||||||
@@ -108,7 +113,6 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
$seconds = $data->getTimezone()->getOffset($data);
|
$seconds = $data->getTimezone()->getOffset($data);
|
||||||
$data->setTimeZone($timezoneUTC);
|
$data->setTimeZone($timezoneUTC);
|
||||||
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
||||||
dump($data);
|
|
||||||
|
|
||||||
// test if the timestamp is in the choices.
|
// test if the timestamp is in the choices.
|
||||||
// If not, recreate the field with the new timestamp
|
// If not, recreate the field with the new timestamp
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SectionMenuBuilder
|
||||||
|
*
|
||||||
|
* @package Chill\AsideActivityBundle\Menu
|
||||||
|
*/
|
||||||
|
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
protected TranslatorInterface $translator;
|
||||||
|
|
||||||
|
public function __construct(TranslatorInterface $translator)
|
||||||
|
{
|
||||||
|
$this->translator = $translator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $menuId
|
||||||
|
* @param MenuItem $menu
|
||||||
|
* @param array $parameters
|
||||||
|
*/
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
{
|
||||||
|
|
||||||
|
$menu->addChild($this->translator->trans('Create an aside activity'), [
|
||||||
|
'route' => 'chill_crud_aside_activity_new'
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 11,
|
||||||
|
'icons' => [ 'plus' ]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return [ 'section' ];
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
||||||
|
|
||||||
|
{% block vertical_menu_content %}
|
||||||
|
{{ chill_menu('admin_aside_activity', {
|
||||||
|
'layout': '@ChillAsideActivity/Admin/menu_asideactivity.html.twig',
|
||||||
|
}) }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% block admin_content %}
|
||||||
|
<!-- block personcontent empty -->
|
||||||
|
<h1>{{ 'Aside activity configuration' |trans }}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,4 @@
|
|||||||
|
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
|
||||||
|
{% block v_menu_title %}
|
||||||
|
{{ 'Aside activity configuration menu'|trans }}
|
||||||
|
{% endblock %}
|
@@ -16,15 +16,6 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content_form_actions_before %}{% endblock %}
|
{% block content_form_actions_before %}{% endblock %}
|
||||||
{% block content_form_actions_view %}
|
|
||||||
{% if is_granted(chill_crud_config('role', crud_name, 'view'), entity) %}
|
|
||||||
<li class="">
|
|
||||||
<a class="btn btn-show" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_view', { 'id': entity.id }) }}">
|
|
||||||
{{ 'crud.edit.back_to_view'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
{% block content_form_actions_confirm_delete %}
|
{% block content_form_actions_confirm_delete %}
|
||||||
<li>
|
<li>
|
||||||
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
||||||
|
@@ -1,26 +1,26 @@
|
|||||||
{% extends "@ChillMain/layout.html.twig" %}
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ 'Aside activity list' |trans }}{% endblock title %}
|
{% block title %}
|
||||||
|
{{ 'Aside activity list' |trans }}
|
||||||
|
{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-md-10 col-xxl asideactivity-list">
|
<div class="col-md-10 col-xxl asideactivity-list">
|
||||||
<h2>{{ 'My aside activities' |trans }}</h2>
|
<h2>{{ 'My aside activities' |trans }}</h2>
|
||||||
|
|
||||||
{% if entities|length == 0 %}
|
{% if entities|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
{{ "There aren't any aside activities."|trans }}
|
{{ "There aren't any aside activities."|trans }}
|
||||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
|
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div class="flex-table my-4 list-records">
|
<div
|
||||||
|
class="flex-table my-4 list-records">
|
||||||
{# Sort activities according to date in descending order #}
|
{# Sort activities according to date in descending order #}
|
||||||
{% for entity in entities|sort ((a, b) => b.date <=> a.date) %}
|
{% for entity in entities|sort ((a, b) => b.date <=> a.date) %}
|
||||||
{% set t = entity.type %}
|
{% set t = entity.type %}
|
||||||
|
|
||||||
{# only load aside activities of current user. #}
|
|
||||||
{% if entity.agent == app.user %}
|
|
||||||
|
|
||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
<div class="item-row main">
|
<div class="item-row main">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
@@ -74,8 +74,7 @@
|
|||||||
{# TOOD
|
{# TOOD
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||||
#}
|
#}
|
||||||
<li>
|
<li><a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "> </a>
|
||||||
<a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "></a>
|
|
||||||
</li>
|
</li>
|
||||||
{# TOOD
|
{# TOOD
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -91,9 +90,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
||||||
@@ -101,7 +100,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
<h1>{{ 'ActivityType list'|trans }}</h1>
|
<h1>{{ 'ActivityType list'|trans }}</h1>
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
</li>
|
</li>
|
||||||
@@ -41,4 +41,4 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Tests\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
|
||||||
|
class AccompanyingCourseControllerTest extends WebTestCase
|
||||||
|
{
|
||||||
|
use PrepareClientTrait;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
$this->client = $this->getClientAuthenticated();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIndexWithoutUsers()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/fr/asideactivity');
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNewWithoutUsers()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/fr/asideactivity/new');
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider generateAsideActivityId
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function testEditWithoutUsers(int $asideActivityId)
|
||||||
|
{
|
||||||
|
$this->client->request('GET', "/fr/asideactivity/{$asideActivityId}/edit");
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateAsideActivityId()
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$qb = self::$container->get(EntityManagerInterface::class)
|
||||||
|
->createQueryBuilder();
|
||||||
|
|
||||||
|
$asideActivityIds = $qb
|
||||||
|
->select('DISTINCT asideactivity.id')
|
||||||
|
->from(AsideActivity::class, 'asideactivity')
|
||||||
|
->innerJoin('asideactivity.agent', 'agent')
|
||||||
|
->where($qb->expr()->eq('agent.username', ':center_name'))
|
||||||
|
->setParameter('center_name', 'center a_social')
|
||||||
|
->setMaxResults(100)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
|
||||||
|
\shuffle($asideActivityIds);
|
||||||
|
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,3 +1,12 @@
|
|||||||
chill_asideactivities_controllers:
|
chill_asideactivities_controllers:
|
||||||
resource: "@ChillAsideActivityBundle/Controller"
|
resource: "@ChillAsideActivityBundle/Controller"
|
||||||
type: annotation
|
type: annotation
|
||||||
|
|
||||||
|
chill_admin_aside_activity_redirect_to_admin_index:
|
||||||
|
path: /{_locale}/admin/activity_redirect_to_main
|
||||||
|
controller: Chill\ActivityBundle\Controller\AdminController::redirectToAdminIndexAction
|
||||||
|
options:
|
||||||
|
menus:
|
||||||
|
admin_aside_activity:
|
||||||
|
order: 0
|
||||||
|
label: Main admin menu
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
# services:
|
|
||||||
# chill.asideactivity.form.type.asideactivity:
|
|
||||||
# class: Chill\AsideActivityBundle\Form\AsideActivityFormType
|
|
||||||
# arguments:
|
|
||||||
# - "@chill.main.helper.translatable_string"
|
|
||||||
# # - "%chill_activity.form.time_duration%"
|
|
||||||
# tags:
|
|
||||||
# - { name: form.type, alias: chill_asideactivitybundle_asideactivity }
|
|
@@ -0,0 +1,6 @@
|
|||||||
|
services:
|
||||||
|
Chill\AsideActivityBundle\Menu\SectionMenuBuilder:
|
||||||
|
arguments:
|
||||||
|
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||||
|
tags:
|
||||||
|
- { name: "chill.menu_builder" }
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\AsideActivity;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\AsideActivity;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\AsideActivity;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\Migrations\AsideActivity;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#general
|
#general
|
||||||
Show the aside activity: Voir l'activité annexe
|
Show the aside activity: Voir l'activité annexe
|
||||||
Edit the aside activity: Modifier l'activité annexe
|
Edit the aside activity: Modifier l'activité annexe
|
||||||
|
Remove aside activity: Supprimer l'activité annexe
|
||||||
Aside activity: Activité annexe
|
Aside activity: Activité annexe
|
||||||
Duration time: Durée
|
Duration time: Durée
|
||||||
durationTime: durée
|
durationTime: durée
|
||||||
@@ -25,7 +26,7 @@ Required: Obligatoire
|
|||||||
Persons: Personnes
|
Persons: Personnes
|
||||||
Users: Utilisateurs
|
Users: Utilisateurs
|
||||||
Emergency: Urgent
|
Emergency: Urgent
|
||||||
by: 'Par '
|
by: "Par "
|
||||||
location: Lieu
|
location: Lieu
|
||||||
|
|
||||||
# Crud
|
# Crud
|
||||||
@@ -75,8 +76,12 @@ My aside activities: Mes activités annexes
|
|||||||
Date: Date
|
Date: Date
|
||||||
Created by: Creér par
|
Created by: Creér par
|
||||||
|
|
||||||
|
|
||||||
#Aside activity delete
|
#Aside activity delete
|
||||||
Delete aside activity: Supprimer une activité annexe
|
Delete aside activity: Supprimer une activité annexe
|
||||||
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
|
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
|
||||||
The activity has been successfully removed.: L'activité a été supprimée.
|
The activity has been successfully removed.: L'activité a été supprimée.
|
||||||
|
|
||||||
|
#Menu
|
||||||
|
Create an aside activity: "Creér une activité annexe"
|
||||||
|
Aside activity configuration menu: "Menu de configuration des activités annexes"
|
||||||
|
Aside activity configuration: "Configuration des activités annexes"
|
||||||
|
11
src/Bundle/ChillDocGeneratorBundle/.gitignore
vendored
11
src/Bundle/ChillDocGeneratorBundle/.gitignore
vendored
@@ -1,11 +0,0 @@
|
|||||||
composer.lock
|
|
||||||
vendor/*
|
|
||||||
parameters.yml
|
|
||||||
*~
|
|
||||||
*.DS_Store
|
|
||||||
*.sass-cache
|
|
||||||
Resources/node_modules/
|
|
||||||
Tests/Fixtures/App/app/config/parameters.yml
|
|
||||||
/nbproject/private/
|
|
||||||
Resources/test/Fixtures/App/bootstrap.php.cache
|
|
||||||
|
|
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|
||||||
|
|
||||||
class ChillDocGeneratorBundle extends Bundle
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Context;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface for context for for document generation
|
|
||||||
*/
|
|
||||||
interface DocGeneratorContextInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* has form
|
|
||||||
*/
|
|
||||||
public function hasForm(): bool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the form that display
|
|
||||||
*/
|
|
||||||
public function getForm($entity);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True of false which entity supports
|
|
||||||
*/
|
|
||||||
public function supports(string $entityClass): bool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the data that will be injected to the generated document
|
|
||||||
*/
|
|
||||||
public function getData($entity): array;
|
|
||||||
}
|
|
@@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Context;
|
|
||||||
|
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Context that display a form to select a member of a houseHold
|
|
||||||
*/
|
|
||||||
class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* has form
|
|
||||||
*/
|
|
||||||
public function hasForm(): bool {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the form that display
|
|
||||||
*/
|
|
||||||
public function getForm($entity) {
|
|
||||||
// TODO Get FormFactory and create a form
|
|
||||||
|
|
||||||
|
|
||||||
// access to the house hold for the AccompanyingPeriod pr the SocialAction
|
|
||||||
// and configure the form to select member of the family
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True of false which entity supports
|
|
||||||
*/
|
|
||||||
public function supports(string $entityClass): bool {
|
|
||||||
return
|
|
||||||
($entityClass == AccompanyingPeriod::class) ||
|
|
||||||
($entityClass == SocialAction::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the data that will be injected to the generated document
|
|
||||||
*/
|
|
||||||
public function getData($entity): array {
|
|
||||||
$ret = [];
|
|
||||||
|
|
||||||
if(get_class($entity) == AccompanyingPeriod::class) {
|
|
||||||
// TODO mettre ça dans un service
|
|
||||||
$ret = ['AccompanyingPeriod' => $entity];
|
|
||||||
} elseif(get_class($entity) == SocialAction::class) {
|
|
||||||
$ret = ['SocialAction' => $entity];
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO AJOUTER LES DONNES DU FORMULAIRE
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Controller;
|
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
|
||||||
|
|
||||||
class AdminDocGeneratorTemplateController extends CRUDController
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,76 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\HeaderUtils;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlOpenstackGenerator;
|
|
||||||
use PhpOffice\PhpWord\TemplateProcessor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DocGeneratorController
|
|
||||||
*
|
|
||||||
* @package Chill\DocGenerator\Controller
|
|
||||||
*/
|
|
||||||
class DocGeneratorController extends AbstractController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "{_locale}/doc/gen/test",
|
|
||||||
* name="chill_docgenerator_test"
|
|
||||||
* )
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function testAction()
|
|
||||||
{
|
|
||||||
return (new Response())
|
|
||||||
->setContent('Test');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route(
|
|
||||||
* "{_locale}/doc/gen/test",
|
|
||||||
* name="chill_docgenerator_test"
|
|
||||||
* )
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function getDoc(Request $request, TempUrlOpenstackGenerator $tempUrlGenerator)
|
|
||||||
{
|
|
||||||
$p = $tempUrlGenerator->generate(
|
|
||||||
'GET',
|
|
||||||
'FORMULAIRE_AEB.docx',
|
|
||||||
$request->query->has('expires_delay') ? $request->query->getInt('expires_delay', 0) : null
|
|
||||||
);
|
|
||||||
|
|
||||||
$tmpfname = tempnam(sys_get_temp_dir(), 'DOC_TEMPLATE');
|
|
||||||
file_put_contents($tmpfname, file_get_contents($p->{"url"}));
|
|
||||||
|
|
||||||
$templateProcessor = new TemplateProcessor($tmpfname);
|
|
||||||
$templateProcessor->setValues(array('firstname' => 'John', 'lastname' => 'Doe'));
|
|
||||||
|
|
||||||
$tmpfname2 = tempnam(sys_get_temp_dir(), 'DOC_GENERATED');
|
|
||||||
$templateProcessor->saveAs($tmpfname2);
|
|
||||||
|
|
||||||
unlink($tmpfname);
|
|
||||||
|
|
||||||
$fileContent = fopen($tmpfname2, 'r'); // the generated file content
|
|
||||||
$response = new Response(fread($fileContent, filesize($tmpfname2)));
|
|
||||||
|
|
||||||
$disposition = HeaderUtils::makeDisposition(
|
|
||||||
HeaderUtils::DISPOSITION_ATTACHMENT,
|
|
||||||
'foo.docx'
|
|
||||||
);
|
|
||||||
|
|
||||||
$response->headers->set('Content-Disposition', $disposition);
|
|
||||||
unlink($tmpfname2);
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\DataFixtures\ORM;
|
|
||||||
|
|
||||||
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
||||||
use Doctrine\Persistence\ObjectManager;
|
|
||||||
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
||||||
|
|
||||||
|
|
||||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load DocGeneratorTemplate
|
|
||||||
*
|
|
||||||
* @author Champs-Libres Coop
|
|
||||||
*/
|
|
||||||
class LoadDocGeneratorTemplate extends AbstractFixture
|
|
||||||
{
|
|
||||||
|
|
||||||
public function load(ObjectManager $manager)
|
|
||||||
{
|
|
||||||
$templates = [
|
|
||||||
[
|
|
||||||
'name' => ['fr' => 'FORMULAIRE AEB'],
|
|
||||||
'desc' => 'stocké sur openstack comedienbe',
|
|
||||||
'file' => 'FORMULAIRE_AEB.docx',
|
|
||||||
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
|
|
||||||
'entities' => ['Chill\PersonBundle\Entity\AccompanyingPeriod', 'Chill\PersonBundle\Entity\SocialWork\SocialAction'],
|
|
||||||
], [
|
|
||||||
'name' => ['fr' => 'AIDE ALIMENTAIRE'],
|
|
||||||
'desc' => 'stocké sur openstack comedienbe',
|
|
||||||
'file' => 'AIDE_ALIMENTAIRE.docx',
|
|
||||||
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
|
|
||||||
'entities' => ['Chill\PersonBundle\Entity\AccompanyingPeriod', 'Chill\PersonBundle\Entity\SocialWork\SocialAction'],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($templates as $template) {
|
|
||||||
|
|
||||||
print('Adding doc generator templates '.$template['file'].")\n");
|
|
||||||
|
|
||||||
$newTemplate = (new DocGeneratorTemplate())
|
|
||||||
->setName($template['name'])
|
|
||||||
->setDescription($template['desc'])
|
|
||||||
->setFile($template['file'])
|
|
||||||
->setContext($template['context'])
|
|
||||||
->setEntities($template['entities'])
|
|
||||||
;
|
|
||||||
|
|
||||||
$manager->persist($newTemplate);
|
|
||||||
|
|
||||||
$manager->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,81 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\DependencyInjection;
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
|
||||||
use Symfony\Component\DependencyInjection\Loader;
|
|
||||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the class that loads and manages your bundle configuration.
|
|
||||||
*
|
|
||||||
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
|
|
||||||
*/
|
|
||||||
class ChillDocGeneratorExtension extends Extension implements PrependExtensionInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
$configuration = new Configuration();
|
|
||||||
$config = $this->processConfiguration($configuration, $configs);
|
|
||||||
|
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
|
||||||
$loader->load('services.yml');
|
|
||||||
$loader->load('services/controller.yml');
|
|
||||||
$loader->load('services/fixtures.yml');
|
|
||||||
$loader->load('services/form.yml');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
$this->preprendRoutes($container);
|
|
||||||
$this->prependCruds($container);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function preprendRoutes(ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
$container->prependExtensionConfig('chill_main', array(
|
|
||||||
'routing' => array(
|
|
||||||
'resources' => array(
|
|
||||||
'@ChillDocGeneratorBundle/Resources/config/routes.yml'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContainerBuilder $container
|
|
||||||
*/
|
|
||||||
protected function prependCruds(ContainerBuilder $container)
|
|
||||||
{
|
|
||||||
$container->prependExtensionConfig('chill_main', [
|
|
||||||
'cruds' => [
|
|
||||||
[
|
|
||||||
'class' => \Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate::class,
|
|
||||||
'name' => 'docgen_template',
|
|
||||||
'base_path' => '/admin/docgen/template',
|
|
||||||
'form_class' => \Chill\DocGeneratorBundle\Form\DocGeneratorTemplateType::class,
|
|
||||||
'controller' => \Chill\DocGeneratorBundle\Controller\AdminDocGeneratorTemplateController::class,
|
|
||||||
'actions' => [
|
|
||||||
'index' => [
|
|
||||||
'template' => '@ChillDocGenerator/Admin/DocGeneratorTemplate/index.html.twig',
|
|
||||||
'role' => 'ROLE_ADMIN'
|
|
||||||
],
|
|
||||||
'new' => [
|
|
||||||
'role' => 'ROLE_ADMIN',
|
|
||||||
'template' => '@ChillDocGenerator/Admin/DocGeneratorTemplate/new.html.twig',
|
|
||||||
],
|
|
||||||
'edit' => [
|
|
||||||
'role' => 'ROLE_ADMIN',
|
|
||||||
'template' => '@ChillDocGenerator/Admin/DocGeneratorTemplate/edit.html.twig',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\DependencyInjection;
|
|
||||||
|
|
||||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
|
||||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the class that validates and merges configuration from your app/config files.
|
|
||||||
*
|
|
||||||
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
|
|
||||||
*/
|
|
||||||
class Configuration implements ConfigurationInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getConfigTreeBuilder()
|
|
||||||
{
|
|
||||||
$treeBuilder = new TreeBuilder('chill_calendar');
|
|
||||||
$rootNode = $treeBuilder->getRootNode('chill_calendar');
|
|
||||||
|
|
||||||
// Here you should define the parameters that are allowed to
|
|
||||||
// configure your bundle. See the documentation linked above for
|
|
||||||
// more information on that topic.
|
|
||||||
|
|
||||||
return $treeBuilder;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,123 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Entity;
|
|
||||||
|
|
||||||
use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Entity(repositoryClass=DocGeneratorTemplateRepository::class)
|
|
||||||
* @ORM\Table(name="chill_docgen_template")
|
|
||||||
|
|
||||||
*/
|
|
||||||
class DocGeneratorTemplate
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @ORM\Id
|
|
||||||
* @ORM\GeneratedValue
|
|
||||||
* @ORM\Column(type="integer")
|
|
||||||
*/
|
|
||||||
private int $id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="json_array")
|
|
||||||
*/
|
|
||||||
private array $name = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text", nullable=true)
|
|
||||||
*/
|
|
||||||
private string $description;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="simple_array")
|
|
||||||
*
|
|
||||||
* Class name of the entities for which this template can be used
|
|
||||||
*
|
|
||||||
* so if $entities = ['Chill\PersonBundle\Entity\AccompanyingPeriod', 'Chill\PersonBundle\Entity\SocialWork\SocialAction']
|
|
||||||
* this template can be selected for an AccompanyingPeriod or a SocialAction
|
|
||||||
*/
|
|
||||||
private array $entities = [];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=255)
|
|
||||||
*
|
|
||||||
* Class name of the context to use
|
|
||||||
*
|
|
||||||
* so if $context = ''
|
|
||||||
* this template will use '' as context
|
|
||||||
*/
|
|
||||||
private string $context;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="string", length=255)
|
|
||||||
*/
|
|
||||||
private string $file;
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(): ?array
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setName(array $name): self
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDescription(): ?string
|
|
||||||
{
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDescription(?string $description): self
|
|
||||||
{
|
|
||||||
$this->description = $description;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFile(): ?string
|
|
||||||
{
|
|
||||||
return $this->file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFile(string $file): self
|
|
||||||
{
|
|
||||||
$this->file = $file;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEntities(): ?array
|
|
||||||
{
|
|
||||||
return $this->entities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEntities(array $entities): self
|
|
||||||
{
|
|
||||||
$this->entities = $entities;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getContext(): ?string
|
|
||||||
{
|
|
||||||
return $this->context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setContext(string $context): self
|
|
||||||
{
|
|
||||||
$this->context = $context;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Form;
|
|
||||||
|
|
||||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
|
||||||
|
|
||||||
|
|
||||||
class DocGeneratorTemplateType extends AbstractType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param FormBuilderInterface $builder
|
|
||||||
* @param array $options
|
|
||||||
*/
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$builder
|
|
||||||
->add('name', TranslatableStringFormType::class, [
|
|
||||||
'label' => 'Nom'
|
|
||||||
])
|
|
||||||
->add('description')
|
|
||||||
->add('file')
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OptionsResolver $resolver
|
|
||||||
*/
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
|
||||||
{
|
|
||||||
$resolver
|
|
||||||
->setDefault('class', DocGeneratorTemplate::class)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
@@ -1,5 +0,0 @@
|
|||||||
Doc generator bundle
|
|
||||||
====================
|
|
||||||
|
|
||||||
This bundle generates documents (from templates)
|
|
||||||
|
|
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\DocGeneratorBundle\Repository;
|
|
||||||
|
|
||||||
use App\Entity\DocGeneratorTemplate;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method DocGeneratorTemplate|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method DocGeneratorTemplate|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method DocGeneratorTemplate[] findAll()
|
|
||||||
* @method DocGeneratorTemplate[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class DocGeneratorTemplateRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, DocGeneratorTemplate::class);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,3 +0,0 @@
|
|||||||
chill_docgen_controllers:
|
|
||||||
resource: '../../Controller/'
|
|
||||||
type: annotation
|
|
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
||||||
|
|
||||||
Chill\DocGeneratorBundle\Repository\:
|
|
||||||
autowire: true
|
|
||||||
resource: '../../Repository/'
|
|
||||||
tags:
|
|
||||||
- { name: 'doctrine.repository_service' }
|
|
@@ -1,5 +0,0 @@
|
|||||||
services:
|
|
||||||
Chill\DocGeneratorBundle\Controller\:
|
|
||||||
autowire: true
|
|
||||||
resource: '../../../Controller'
|
|
||||||
tags: ['controller.service_arguments']
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
||||||
Chill\DocGeneratorBundle\DataFixtures\ORM\:
|
|
||||||
autowire: true
|
|
||||||
resource: ../../DataFixtures/ORM
|
|
||||||
tags: [ 'doctrine.fixture.orm' ]
|
|
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
services:
|
|
@@ -1,12 +0,0 @@
|
|||||||
{% extends '@ChillPerson/Admin/layout.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}
|
|
||||||
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block layout_wvm_content %}
|
|
||||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
|
||||||
{% block content_form_actions_view %}{% endblock %}
|
|
||||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
|
||||||
{% endembed %}
|
|
||||||
{% endblock %}
|
|
@@ -1,19 +0,0 @@
|
|||||||
{% extends '@ChillPerson/Admin/layout.html.twig' %}
|
|
||||||
|
|
||||||
{% block layout_wvm_content %}
|
|
||||||
{% embed '@ChillMain/CRUD/_index.html.twig' %}
|
|
||||||
{% block table_entities_thead_tr %}
|
|
||||||
<th>{{ 'Title'|trans }}</th>
|
|
||||||
<th>{{ 'File'|trans }}</th>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block table_entities_tbody %}
|
|
||||||
{% for entity in entities %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ entity.name | localize_translatable_string }}</td>
|
|
||||||
<td>{{ entity.file }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
|
||||||
{% endembed %}
|
|
||||||
{% endblock %}
|
|
@@ -1,11 +0,0 @@
|
|||||||
{% extends '@ChillPerson/Admin/layout.html.twig' %}
|
|
||||||
|
|
||||||
{% block title %}
|
|
||||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block layout_wvm_content %}
|
|
||||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
|
|
||||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
|
||||||
{% endembed %}
|
|
||||||
{% endblock %}
|
|
@@ -1,6 +0,0 @@
|
|||||||
// this file loads all assets from the Chill DocGenerator bundle
|
|
||||||
module.exports = function(encore, entries) {
|
|
||||||
encore.addAliases({
|
|
||||||
ChillDocGeneratorAssets: __dirname + '/Resources/public'
|
|
||||||
});
|
|
||||||
};
|
|
@@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "chill-project/docgen",
|
|
||||||
"description": "This bundle extends chill for generation of documents",
|
|
||||||
"type": "symfony-bundle",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"keywords" : ["chill", "social work"],
|
|
||||||
"homepage" : "hhttps://gitlab.com/Chill-Projet/chill-bundles/",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": { "Chill\\DocGeneratorBundle\\": "" }
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"classmap": [ "Resources/test/Fixtures/App/app/AppKernel.php" ]
|
|
||||||
},
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Champs-Libres",
|
|
||||||
"email": "info@champs-libres.coop"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"require": {
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"app-migrations-dir": "Resources/test/Fixtures/App/app/DoctrineMigrations",
|
|
||||||
"symfony-app-dir": "Test/Fixtures/App/app/"
|
|
||||||
},
|
|
||||||
"minimum-stability": "dev",
|
|
||||||
"prefer-stable": true
|
|
||||||
}
|
|
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\Migrations\DocGenerator;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creation of table for storing DocGenTemplate
|
|
||||||
*/
|
|
||||||
final class Version20210805162522 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return 'Creation of table for storing DocGenTemplate';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('CREATE SEQUENCE chill_docgen_template_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
||||||
$this->addSql('CREATE TABLE chill_docgen_template (id INT NOT NULL, name JSON NOT NULL, description TEXT DEFAULT NULL, file VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('DROP SEQUENCE chill_docgen_template_id_seq CASCADE');
|
|
||||||
$this->addSql('DROP TABLE chill_docgen_template');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\Migrations\DocGenerator;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add entities and context fields to DocGenTemplate
|
|
||||||
*/
|
|
||||||
final class Version20210812214310 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return 'Add entities and context fields to DocGenTemplate';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE chill_docgen_template ADD entities TEXT');
|
|
||||||
$this->addSql('ALTER TABLE chill_docgen_template ADD context VARCHAR(255)');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_docgen_template.entities IS \'(DC2Type:simple_array)\'');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_docgen_template.name IS \'(DC2Type:json_array)\'');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
$this->addSql('ALTER TABLE chill_docgen_template DROP entities');
|
|
||||||
$this->addSql('ALTER TABLE chill_docgen_template DROP context');
|
|
||||||
$this->addSql('COMMENT ON COLUMN chill_docgen_template.name IS NULL');
|
|
||||||
}
|
|
||||||
}
|
|
@@ -22,9 +22,7 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle\Controller;
|
namespace Chill\MainBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\Search\SearchApiNoQueryException;
|
|
||||||
use Chill\MainBundle\Serializer\Model\Collection;
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
use GuzzleHttp\Psr7\Response;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Chill\MainBundle\Search\UnknowSearchDomainException;
|
use Chill\MainBundle\Search\UnknowSearchDomainException;
|
||||||
@@ -35,7 +33,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Chill\MainBundle\Search\SearchProvider;
|
use Chill\MainBundle\Search\SearchProvider;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Search\SearchApi;
|
use Chill\MainBundle\Search\SearchApi;
|
||||||
@@ -162,13 +159,9 @@ class SearchController extends AbstractController
|
|||||||
." one type");
|
." one type");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
$collection = $this->searchApi->getResults($query, $types, []);
|
$collection = $this->searchApi->getResults($query, $types, []);
|
||||||
} catch (SearchApiNoQueryException $e) {
|
|
||||||
throw new BadRequestHttpException($e->getMessage(), $e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->json($collection, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], [ "groups" => ["read"]]);
|
return $this->json($collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function advancedSearchListAction(Request $request)
|
public function advancedSearchListAction(Request $request)
|
||||||
|
@@ -15,7 +15,6 @@ trait LoadAbstractNotificationsTrait
|
|||||||
{
|
{
|
||||||
public function load(ObjectManager $manager)
|
public function load(ObjectManager $manager)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
foreach ($this->notifs as $notif) {
|
foreach ($this->notifs as $notif) {
|
||||||
$entityId = $this->getReference($notif['entityRef'])->getId();
|
$entityId = $this->getReference($notif['entityRef'])->getId();
|
||||||
|
|
||||||
|
@@ -32,8 +32,9 @@ use Chill\MainBundle\Doctrine\DQL\JsonAggregate;
|
|||||||
use Chill\MainBundle\Doctrine\DQL\JsonbExistsInArray;
|
use Chill\MainBundle\Doctrine\DQL\JsonbExistsInArray;
|
||||||
use Chill\MainBundle\Doctrine\DQL\Similarity;
|
use Chill\MainBundle\Doctrine\DQL\Similarity;
|
||||||
use Chill\MainBundle\Doctrine\DQL\OverlapsI;
|
use Chill\MainBundle\Doctrine\DQL\OverlapsI;
|
||||||
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Chill\MainBundle\Doctrine\DQL\Replace;
|
use Chill\MainBundle\Doctrine\DQL\Replace;
|
||||||
use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator;
|
|
||||||
use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType;
|
use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType;
|
||||||
use Chill\MainBundle\Doctrine\Type\PointType;
|
use Chill\MainBundle\Doctrine\Type\PointType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@@ -185,9 +186,6 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
|
|||||||
'OVERLAPSI' => OverlapsI::class,
|
'OVERLAPSI' => OverlapsI::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'hydrators' => [
|
|
||||||
'chill_flat_hierarchy_list' => FlatHierarchyEntityHydrator::class,
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Doctrine\ORM\Hydration;
|
|
||||||
|
|
||||||
use Doctrine\ORM\Internal\Hydration\ObjectHydrator;
|
|
||||||
use Generator;
|
|
||||||
|
|
||||||
final class FlatHierarchyEntityHydrator extends ObjectHydrator
|
|
||||||
{
|
|
||||||
public const LIST = 'chill_flat_hierarchy_list';
|
|
||||||
|
|
||||||
protected function hydrateAllData()
|
|
||||||
{
|
|
||||||
return array_values(iterator_to_array($this->flatListGenerator($this->buildChildrenHashmap(parent::hydrateAllData()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function flatListGenerator(array $hashMap, ?object $parent = null): Generator
|
|
||||||
{
|
|
||||||
$parent = null === $parent ? null : spl_object_id($parent);
|
|
||||||
$hashMap += [$parent => []];
|
|
||||||
|
|
||||||
foreach ($hashMap[$parent] as $node) {
|
|
||||||
yield spl_object_id($node) => $node;
|
|
||||||
yield from $this->flatListGenerator($hashMap, $node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildChildrenHashmap(array $nodes): array
|
|
||||||
{
|
|
||||||
return array_reduce(
|
|
||||||
$nodes,
|
|
||||||
static function (array $collect, $node): array {
|
|
||||||
$parentId = (null === $parent = $node->getParent()) ?
|
|
||||||
null :
|
|
||||||
spl_object_id($parent);
|
|
||||||
|
|
||||||
$collect[$parentId][] = $node;
|
|
||||||
|
|
||||||
return $collect;
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS,
|
|
||||||
* <http://www.champs-libres.coop>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Pagination;
|
|
||||||
|
|
||||||
use Twig\Environment;
|
|
||||||
use Twig\Extension\AbstractExtension;
|
|
||||||
use Twig\TwigFunction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add twig function to render pagination
|
|
||||||
*
|
|
||||||
* @author Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
|
|
||||||
* @author Champs Libres <info@champs-libres.coop>
|
|
||||||
*/
|
|
||||||
class ChillItemsPerPageTwig extends AbstractExtension
|
|
||||||
{
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return 'chill_items_per_page';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFunctions()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
new TwigFunction(
|
|
||||||
'chill_items_per_page',
|
|
||||||
array($this, 'paginationRender'),
|
|
||||||
array(
|
|
||||||
'needs_environment' => true,
|
|
||||||
'is_safe' => ['html']
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function paginationRender(
|
|
||||||
Environment $env,
|
|
||||||
PaginatorInterface $paginator,
|
|
||||||
$template = '@ChillMain/Pagination/items_per_page.html.twig'
|
|
||||||
) {
|
|
||||||
|
|
||||||
return $env->render($template, array(
|
|
||||||
'paginator' => $paginator,
|
|
||||||
'current' => $paginator->getItemsPerPage()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -61,7 +61,7 @@ class PaginatorFactory
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
RequestStack $requestStack,
|
RequestStack $requestStack,
|
||||||
RouterInterface $router,
|
RouterInterface $router,
|
||||||
$itemPerPage = 20
|
$itemPerPage = 50
|
||||||
) {
|
) {
|
||||||
$this->itemPerPage = $itemPerPage;
|
$this->itemPerPage = $itemPerPage;
|
||||||
$this->requestStack = $requestStack;
|
$this->requestStack = $requestStack;
|
||||||
|
@@ -4,153 +4,23 @@
|
|||||||
// Chill mixins
|
// Chill mixins
|
||||||
@import './scss/mixins';
|
@import './scss/mixins';
|
||||||
|
|
||||||
// Chill buttons
|
|
||||||
@import './scss/buttons';
|
|
||||||
|
|
||||||
// Chill forms
|
|
||||||
@import './scss/forms';
|
|
||||||
|
|
||||||
// Chill record_actions
|
|
||||||
@import './scss/record_actions';
|
|
||||||
|
|
||||||
// Chill entity render box system
|
// Chill entity render box system
|
||||||
@import './scss/render_box';
|
@import './scss/render_box';
|
||||||
|
|
||||||
// Chill flex responsive table/block presentation
|
// Chill flex responsive table/block presentation
|
||||||
@import './scss/flex_table';
|
@import './scss/flex_table';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BASE LAYOUT POSITION
|
* Specific rules
|
||||||
*/
|
*/
|
||||||
|
|
||||||
body {
|
.custom_field_no_data,
|
||||||
display: flex;
|
.chill-no-data-statement {
|
||||||
flex-direction: column;
|
font-style: italic;
|
||||||
min-height: 100vh;
|
|
||||||
footer {
|
|
||||||
margin-top: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
nav.navbar {
|
|
||||||
padding: 0;
|
|
||||||
a.navbar-brand img {
|
|
||||||
height: 50px;
|
|
||||||
margin: 8px 0;
|
|
||||||
}
|
|
||||||
div.navbar-collapse {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
ul.navbar-nav {
|
|
||||||
display: flex;
|
|
||||||
align-items: stretch;
|
|
||||||
li.nav-item {
|
|
||||||
display: flex;
|
|
||||||
&.btn {
|
|
||||||
padding-top: 0;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
|
||||||
& > a {
|
|
||||||
align-self: center;
|
|
||||||
}
|
|
||||||
form.form-inline {
|
|
||||||
align-self: center;
|
|
||||||
display: flex;
|
|
||||||
input.form-control {
|
|
||||||
align-self: center;
|
|
||||||
height: 32px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div.dropdown-menu {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
border-radius: 0;
|
|
||||||
a.dropdown-item {
|
|
||||||
width: 120%;
|
|
||||||
border: 0;
|
|
||||||
border-bottom: 1px solid $gray-200;
|
|
||||||
font-size: smaller;
|
|
||||||
i {
|
|
||||||
float: right; }
|
|
||||||
&:hover {
|
|
||||||
color: $gray-500 !important; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// fullwidth menu when navbar is collapsed
|
|
||||||
@media (max-width: 767px) {
|
|
||||||
& {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
button.navbar-toggler {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
div.navbar-collapse {
|
|
||||||
float: none;
|
|
||||||
position: absolute;
|
|
||||||
top: 4em;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 2;
|
|
||||||
padding: 1em;
|
|
||||||
border-top: 1px solid shade-color($primary, 25%);
|
|
||||||
ul.navbar-nav {
|
|
||||||
display: grid;
|
|
||||||
grid-template-areas:
|
|
||||||
"sear sear sear"
|
|
||||||
"sect user lang";
|
|
||||||
li.nav-item {
|
|
||||||
flex-direction: column;
|
|
||||||
border: 0;
|
|
||||||
a.nav-link {}
|
|
||||||
&.navigation-search {
|
|
||||||
grid-area: sear;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
form {
|
|
||||||
width: 100%;
|
|
||||||
input.form-control {}
|
|
||||||
button.btn {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.nav-section { grid-area: sect; }
|
|
||||||
&.nav-user { grid-area: user; }
|
|
||||||
&.nav-language { grid-area: lang; }
|
|
||||||
}
|
|
||||||
li.dropdown {
|
|
||||||
&, & > * {
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
a.dropdown-toggle {}
|
|
||||||
div.dropdown-menu {
|
|
||||||
display: block;
|
|
||||||
border: 0;
|
|
||||||
a.dropdown-item {
|
|
||||||
width: 100%;
|
|
||||||
border: 0;
|
|
||||||
border-top: 1px dotted $gray-200;
|
|
||||||
background-color: transparent !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// styles communs pour tous les bandeaux
|
||||||
div.banner {
|
div.banner {
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
&.phone,
|
|
||||||
&.email {
|
|
||||||
color: $white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.id-number {
|
.id-number {
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
font-size: 50%;
|
font-size: 50%;
|
||||||
@@ -158,230 +28,17 @@ div.banner {
|
|||||||
&:before { content: '(n°'; }
|
&:before { content: '(n°'; }
|
||||||
&:after { content: ')'; }
|
&:after { content: ')'; }
|
||||||
}
|
}
|
||||||
|
a.phone,
|
||||||
|
a.email {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
ul.list-content {
|
||||||
|
//margin: 0 auto;
|
||||||
|
}
|
||||||
span.age {
|
span.age {
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
&:before { content: '('; }
|
&:before { content: '('; }
|
||||||
&:after { content: ')'; }
|
&:after { content: ')'; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
div.vertical-menu {
|
|
||||||
border-radius: 0;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
a.list-group-item {
|
|
||||||
background-color: $chill-yellow;
|
|
||||||
border: 0;
|
|
||||||
margin-bottom: 0.25rem;
|
|
||||||
&:hover {
|
|
||||||
background-color: tint-color($chill-yellow, 20%)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
footer.footer {
|
|
||||||
background: $dark;
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
width: 100%;
|
|
||||||
p {
|
|
||||||
font-family: Open Sans;
|
|
||||||
font-weight: 300;
|
|
||||||
clear: both;
|
|
||||||
color: $white;
|
|
||||||
font-size: 0.9em;
|
|
||||||
line-height: 1.5em;
|
|
||||||
margin: auto;
|
|
||||||
max-width: 35em;
|
|
||||||
text-align: center;
|
|
||||||
a, a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SPECIFIC RULES
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// titles
|
|
||||||
h1, h2,
|
|
||||||
.h1, .h2 {
|
|
||||||
font-weight: $headings-font-weight + 200;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// typography
|
|
||||||
.open_sansbold {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// no borders on head table
|
|
||||||
table.table-bordered {
|
|
||||||
thead, thead * {
|
|
||||||
border: 0 !important;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// comments quotes
|
|
||||||
.chill-user-quote {
|
|
||||||
border-left: 10px solid $yellow;
|
|
||||||
margin: 1.5em 10px;
|
|
||||||
padding: 0.5em 15px;
|
|
||||||
background-color: $gray-200;
|
|
||||||
color: $gray-800;
|
|
||||||
font-size: 90%;
|
|
||||||
|
|
||||||
// test a bottom right decoration (to be confirmed)
|
|
||||||
&.test {
|
|
||||||
position: relative;
|
|
||||||
&:after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
width: 0px; height: 0px;
|
|
||||||
bottom: 0; right: 0;
|
|
||||||
background: $white;
|
|
||||||
border-top: 10px solid $gray-200;
|
|
||||||
border-left: 10px solid $gray-200;
|
|
||||||
border-right: 10px solid $white;
|
|
||||||
border-bottom: 10px solid $white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ckeditor citation
|
|
||||||
blockquote p {
|
|
||||||
font-style: italic;
|
|
||||||
padding-left: 2em;
|
|
||||||
quotes: "“" "„";
|
|
||||||
position: relative;
|
|
||||||
&:before {
|
|
||||||
content: open-quote;
|
|
||||||
font-size: 400%;
|
|
||||||
color: $gray-400;
|
|
||||||
position: absolute;
|
|
||||||
top: -25px;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div.metadata {
|
|
||||||
font-size: smaller;
|
|
||||||
color: $gray-600;
|
|
||||||
span.user, span.date {
|
|
||||||
text-decoration: underline dotted;
|
|
||||||
&:hover {
|
|
||||||
color: $gray-700;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// display definition list
|
|
||||||
// with dt and dd on same line
|
|
||||||
|
|
||||||
dl.definition-inline {
|
|
||||||
dd {
|
|
||||||
display: inline;
|
|
||||||
margin: 0;
|
|
||||||
&:after{
|
|
||||||
display: block;
|
|
||||||
content: '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dt{
|
|
||||||
display: inline-block;
|
|
||||||
min-width: 200px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// when there is no data
|
|
||||||
.custom_field_no_data,
|
|
||||||
.chill-no-data-statement {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
//// still used ?
|
|
||||||
// move from chillmain.css, converted to sass
|
|
||||||
|
|
||||||
div#usefulbar {
|
|
||||||
background-color: $yellow;
|
|
||||||
z-index: 1000;
|
|
||||||
padding-right: 15px;
|
|
||||||
|
|
||||||
form {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
i.menu {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin: 0;
|
|
||||||
padding-top: 5px;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
color: $white;
|
|
||||||
margin-left: 10px;
|
|
||||||
a {
|
|
||||||
color: $white;
|
|
||||||
text-shadow: 0px 0px 1px $gray-600;
|
|
||||||
}
|
|
||||||
i.icon-user-add {
|
|
||||||
&:before {
|
|
||||||
vertical-align: -5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&#search_element {
|
|
||||||
text-align: right;
|
|
||||||
div#search_form {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
div, .field {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
color: $white;
|
|
||||||
border: none;
|
|
||||||
bottom: -2px;
|
|
||||||
height: 35px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div#flashMessages {
|
|
||||||
margin-top: 20px;
|
|
||||||
.flash-notice {
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.personName {
|
|
||||||
font-variant: small-caps;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// probably used in client chill.
|
|
||||||
// think to rename like above
|
|
||||||
input.belgian_national_number_inversed_date {
|
|
||||||
width: 7em;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
input.belgian_national_number_daily_counter {
|
|
||||||
width: 4em;
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
input.belgian_national_number_control_digit {
|
|
||||||
width: 3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
input.belgian_national_number {
|
|
||||||
&.inversed_date {}
|
|
||||||
&.daily_counter {}
|
|
||||||
&.control_digit {}
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
div#usefulbar { background-color: #fbba3a; z-index: 1000; padding-right: 15px; }
|
||||||
|
div#usefulbar form { margin: 0; }
|
||||||
|
div#usefulbar i.menu { font-size: 2em; }
|
||||||
|
div#usefulbar ul { display: flex; justify-content: flex-end; margin: 0; padding-top: 5px; padding-right: 10px; }
|
||||||
|
div#usefulbar li { color: white; margin-left: 10px; }
|
||||||
|
div#usefulbar li a { color: white; text-shadow: 0px 0px 1px #555; }
|
||||||
|
div#usefulbar li i.icon-user-add:before { vertical-align: -5px; }
|
||||||
|
div#usefulbar li#search_element { text-align: right; }
|
||||||
|
div#usefulbar li#search_element div#search_form { margin: 0; padding: 0; }
|
||||||
|
div#usefulbar li#search_element div#search_form div { margin: 0; }
|
||||||
|
div#usefulbar li#search_element div#search_form .field { margin: 0; }
|
||||||
|
div#usefulbar li#search_element div#search_form button { color: white; border: none; bottom: -2px; height: 35px; }
|
||||||
|
|
||||||
|
div#flashMessages { margin-top: 20px; }
|
||||||
|
div#flashMessages .flash-notice { margin-top: 10px; margin-bottom: 10px; }
|
||||||
|
|
||||||
|
.personName { font-variant: small-caps; text-transform: capitalize; }
|
||||||
|
|
||||||
|
.personName { text-transform: capitalize; }
|
||||||
|
|
||||||
|
input.belgian_national_number_inversed_date { width: 7em; margin-right: 1em; }
|
||||||
|
|
||||||
|
input.belgian_national_number_daily_counter { width: 4em; margin-right: 1em; }
|
||||||
|
|
||||||
|
input.belgian_national_number_control_digit { width: 3em; }
|
@@ -14,12 +14,12 @@ global.select2 = select2;
|
|||||||
require('select2/dist/css/select2.css');
|
require('select2/dist/css/select2.css');
|
||||||
require('select2-bootstrap-theme/dist/select2-bootstrap.css');
|
require('select2-bootstrap-theme/dist/select2-bootstrap.css');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load Chill themes assets
|
* Load Chill themes assets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('./chillmain.scss');
|
require('./chillmain.scss');
|
||||||
|
require('./css/chillmain.css');
|
||||||
|
|
||||||
import { chill } from './js/chill.js';
|
import { chill } from './js/chill.js';
|
||||||
global.chill = chill;
|
global.chill = chill;
|
||||||
@@ -34,7 +34,6 @@ require('./img/favicon.ico');
|
|||||||
require('./img/logo-chill-sans-slogan_white.png');
|
require('./img/logo-chill-sans-slogan_white.png');
|
||||||
require('./img/logo-chill-outil-accompagnement_white.png');
|
require('./img/logo-chill-outil-accompagnement_white.png');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load local libs
|
* Load local libs
|
||||||
* Some libs are only used in a few pages, they are loaded on a case by case basis
|
* Some libs are only used in a few pages, they are loaded on a case by case basis
|
||||||
@@ -46,6 +45,7 @@ require('../lib/breadcrumb/index.js');
|
|||||||
require('../lib/download-report/index.js');
|
require('../lib/download-report/index.js');
|
||||||
require('../lib/select_interactive_loading/index.js');
|
require('../lib/select_interactive_loading/index.js');
|
||||||
require('../lib/export-list/index.js');
|
require('../lib/export-list/index.js');
|
||||||
|
require('../lib/entity/index.js');
|
||||||
|
|
||||||
//require('../lib/show_hide/index.js');
|
//require('../lib/show_hide/index.js');
|
||||||
//require('../lib/tabs/index.js');
|
//require('../lib/tabs/index.js');
|
||||||
|
@@ -1,81 +1,59 @@
|
|||||||
/*
|
/*
|
||||||
* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION
|
* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION
|
||||||
*/
|
*/
|
||||||
|
|
||||||
div.flex-bloc,
|
div.flex-bloc,
|
||||||
div.flex-table {
|
div.flex-table {
|
||||||
display: flex;
|
|
||||||
align-items: stretch;
|
|
||||||
align-content: stretch;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 1.5em 0;
|
|
||||||
|
|
||||||
div.item-bloc {
|
|
||||||
display: flex;
|
|
||||||
@include border-collapse;
|
|
||||||
padding: 1em;
|
|
||||||
|
|
||||||
div.item-row {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
div.item-col:last-child {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
h2, h3, h4, dl, p {
|
h2, h3, h4, dl, p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
h2, h3, h4 {
|
h2, h3, h4 {
|
||||||
color: $blue;
|
color: var(--bs-chill-blue);
|
||||||
}
|
|
||||||
|
|
||||||
ul.record_actions {
|
|
||||||
margin: 0;
|
|
||||||
li {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
}
|
||||||
|
div.item-bloc {
|
||||||
|
@include border-collapse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bloc appearance
|
* Bloc appearance
|
||||||
*/
|
*/
|
||||||
|
|
||||||
div.flex-bloc {
|
div.flex-bloc {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
align-items: stretch;
|
||||||
|
align-content: stretch;
|
||||||
|
|
||||||
div.item-bloc {
|
div.item-bloc {
|
||||||
flex-grow: 0; flex-shrink: 1; flex-basis: auto;
|
flex-grow: 0; flex-shrink: 1; flex-basis: auto;
|
||||||
flex-direction: column;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
hyphens: auto;
|
padding: 1em;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
div.item-row {
|
div.item-row {
|
||||||
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
||||||
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
div.item-col {
|
div.item-col {
|
||||||
&.separator {
|
|
||||||
margin-top: 0.5em;
|
|
||||||
border-top: 1px dotted $gray-900;
|
|
||||||
padding-top: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
flex-grow: 0; flex-shrink: 0; flex-basis: auto;
|
flex-grow: 0; flex-shrink: 0; flex-basis: auto;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
border-bottom: 1px dotted #0000004f;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.list-content { // ul, dl, or div
|
||||||
|
}
|
||||||
ul.record_actions {
|
ul.record_actions {
|
||||||
|
margin: 0;
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
flex-grow: 1; flex-shrink: 0; flex-basis: auto;
|
flex-grow: 1; flex-shrink: 0; flex-basis: auto;
|
||||||
margin: 0;
|
|
||||||
|
|
||||||
li {
|
li {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
@@ -89,47 +67,51 @@ div.flex-bloc {
|
|||||||
/*
|
/*
|
||||||
* Table appearance
|
* Table appearance
|
||||||
*/
|
*/
|
||||||
|
|
||||||
div.flex-table {
|
div.flex-table {
|
||||||
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
align-content: stretch;
|
||||||
|
|
||||||
div.item-bloc {
|
div.item-bloc {
|
||||||
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
padding: 1em;
|
||||||
&:nth-child(even) {
|
&:nth-child(even) {
|
||||||
background-color: $gray-200;
|
background-color: $gray-200;
|
||||||
|
|
||||||
.chill-user-quote {
|
|
||||||
background-color: shade-color($gray-200, 5%)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.item-row {
|
div.item-row {
|
||||||
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
&:not(:first-child) {
|
||||||
&.separator {
|
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
border-top: 1px dotted $gray-900;
|
border-top: 1px dotted #0000004f;
|
||||||
padding-top: 0.5em;
|
padding-top: 0.5em;
|
||||||
//flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.item-col {
|
div.item-col {
|
||||||
&:first-child {
|
&:first-child {
|
||||||
flex-grow: 0; flex-shrink: 0; flex-basis: auto;
|
flex-grow: 0; flex-shrink: 0; flex-basis: 33%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
flex-grow: 1; flex-shrink: 1; flex-basis: auto;
|
||||||
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
.list-content { // ul, dl, or div
|
||||||
|
}
|
||||||
ul.record_actions {
|
ul.record_actions {
|
||||||
flex-grow: 1; flex-shrink: 0; flex-basis: auto;
|
margin: 0;
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
|
flex-grow: 1; flex-shrink: 0; flex-basis: auto;
|
||||||
|
li {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 900px) {
|
@media only screen and (max-width: 900px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
div.item-col {
|
div.item-col {
|
||||||
@@ -140,6 +122,9 @@ div.flex-table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// neutralize
|
||||||
|
div.chill_address div.chill_address_address p { text-indent: 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,44 +0,0 @@
|
|||||||
/// forms
|
|
||||||
form {
|
|
||||||
|
|
||||||
/* avoid useless html in first level of the custom fields row loop in forms
|
|
||||||
* (better should to improve the loop)
|
|
||||||
*/
|
|
||||||
& > div.container-fluid {
|
|
||||||
& > div.row > .parent {
|
|
||||||
padding: 0;
|
|
||||||
& div.cf-fields span.cf-title {
|
|
||||||
margin: 1em -15px 0;
|
|
||||||
width: calc(100% + 30px);
|
|
||||||
@include title_in_form;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldset {
|
|
||||||
margin-top: 1em;
|
|
||||||
& > legend {
|
|
||||||
@include title_in_form;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// customfields titles in form
|
|
||||||
span.cf-title {
|
|
||||||
@include title_in_form;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
display: inline;
|
|
||||||
&.required:after {
|
|
||||||
content: " *";
|
|
||||||
color: $red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-form-label {
|
|
||||||
padding-top: .5em;
|
|
||||||
padding-bottom: .5em;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-bottom: .375em;
|
|
||||||
}
|
|
@@ -1,18 +1,4 @@
|
|||||||
|
|
||||||
//
|
|
||||||
// Titles in forms
|
|
||||||
//
|
|
||||||
|
|
||||||
@mixin title_in_form {
|
|
||||||
font-size: 1.438em;
|
|
||||||
font-weight: 700;
|
|
||||||
width: 100%;
|
|
||||||
border-bottom: 3px solid $gray-200;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// We use box-shadow instead of border
|
// We use box-shadow instead of border
|
||||||
// to avoid to manage border double-width
|
// to avoid to manage border double-width
|
||||||
// Then we can simulate border-collapse: collapse (table)
|
// Then we can simulate border-collapse: collapse (table)
|
||||||
|
@@ -13,18 +13,12 @@ section.chill-entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// specific rules
|
// specific rules
|
||||||
// all render box doesn't use a section tag !
|
|
||||||
.chill-entity {
|
.chill-entity {
|
||||||
|
|
||||||
// used for: entity-person, entity-thirdparty
|
// used for: entity-person, entity-thirdparty
|
||||||
&.entity-person,
|
&.entity-person,
|
||||||
&.entity-thirdparty {
|
&.entity-thirdparty {
|
||||||
|
|
||||||
span.entity-raw {
|
|
||||||
& > span:not(:first-child):before {
|
|
||||||
content: " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
div.entity-label {
|
div.entity-label {
|
||||||
div.denomination {
|
div.denomination {
|
||||||
&.h3 {
|
&.h3 {
|
||||||
@@ -93,25 +87,9 @@ section.chill-entity {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.address-valid {
|
span.address-valid {
|
||||||
margin-top: 2em;
|
&.address-since {}
|
||||||
&.date-since {}
|
&.address-until {}
|
||||||
&.date-until {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// used for comment-embeddable
|
|
||||||
&.entity-comment-embeddable {
|
|
||||||
width: 100%;
|
|
||||||
div.metadata {
|
|
||||||
font-size: smaller;
|
|
||||||
color: $gray-600;
|
|
||||||
span.user, span.date {
|
|
||||||
text-decoration: underline dotted;
|
|
||||||
&:hover {
|
|
||||||
color: $gray-700;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
.chill-entity__comment-embeddable {
|
||||||
|
.chill-entity__comment-embeddable__metadata {
|
||||||
|
font-size: smaller;
|
||||||
|
color: var(--chill-light-gray);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,2 @@
|
|||||||
|
// css classes to render entities
|
||||||
|
require('./comment_embeddable.scss');
|
@@ -1,6 +1,284 @@
|
|||||||
/*
|
/*
|
||||||
* These custom styles will override bootstrap enabled stylesheets
|
* These custom styles will override bootstrap enabled stylesheets
|
||||||
* in mod_bootstrap entrypoint
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// chill buttons
|
||||||
|
@import 'custom/_buttons';
|
||||||
|
|
||||||
|
// chill record_actions
|
||||||
|
@import 'custom/_record_actions';
|
||||||
|
|
||||||
|
/// titles
|
||||||
|
h1, h2, .h1, .h2 {
|
||||||
|
font-weight: $headings-font-weight + 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// typography
|
||||||
|
.open_sansbold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// forms
|
||||||
|
|
||||||
|
@mixin title_in_form {
|
||||||
|
font-size: 1.438em;
|
||||||
|
font-weight: 700;
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 3px solid $gray-200;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-form-label {
|
||||||
|
padding-top: .5em;
|
||||||
|
padding-bottom: .5em;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: .375em;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
/* avoid useless html in first level of the custom fields row loop in forms
|
||||||
|
* (better should to improve the loop)
|
||||||
|
*/
|
||||||
|
& > div.container-fluid {
|
||||||
|
& > div.row > .parent {
|
||||||
|
padding: 0;
|
||||||
|
& div.cf-fields span.cf-title {
|
||||||
|
margin: 1em -15px 0;
|
||||||
|
width: calc(100% + 30px);
|
||||||
|
@include title_in_form;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldset {
|
||||||
|
margin-top: 1em;
|
||||||
|
& > legend {
|
||||||
|
@include title_in_form;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
display: inline;
|
||||||
|
&.required:after {
|
||||||
|
content: " *";
|
||||||
|
color: $red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// table
|
||||||
|
|
||||||
|
table.table-bordered {
|
||||||
|
thead, thead * {
|
||||||
|
border: 0 !important;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// chill elements of design
|
||||||
|
|
||||||
|
.sticky-form-buttons {
|
||||||
|
margin-top: 4em;
|
||||||
|
background-color: $beige;
|
||||||
|
position: sticky;
|
||||||
|
bottom: 0.3em;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
padding: 0.8em 1.6em;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chill-user-quote {
|
||||||
|
border-left: 10px solid $yellow;
|
||||||
|
margin: 1.5em 10px;
|
||||||
|
padding: 0.5em 15px;
|
||||||
|
quotes: "\201C" "\201D" "\2018" "\2019";
|
||||||
|
background-color: $gray-200;
|
||||||
|
blockquote {
|
||||||
|
border-left: 0.4em solid $gray-400;
|
||||||
|
padding-left: 0.9em;
|
||||||
|
margin-left: 0.9em;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div.chill_address {
|
||||||
|
div.chill_address_address {
|
||||||
|
margin: 0.7em 0;
|
||||||
|
font-size: 98%;
|
||||||
|
font-variant: small-caps;
|
||||||
|
p {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 0 0 1.5em;
|
||||||
|
text-indent: -1.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// base layout positions
|
||||||
|
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
footer {
|
||||||
|
margin-top: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
nav.navbar {
|
||||||
|
padding: 0;
|
||||||
|
a.navbar-brand img {
|
||||||
|
height: 50px;
|
||||||
|
margin: 8px 0;
|
||||||
|
}
|
||||||
|
div.navbar-collapse {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
ul.navbar-nav {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
li.nav-item {
|
||||||
|
display: flex;
|
||||||
|
&.btn {
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
& > a {
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
form.form-inline {
|
||||||
|
align-self: center;
|
||||||
|
display: flex;
|
||||||
|
input.form-control {
|
||||||
|
align-self: center;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
div.dropdown-menu {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
a.dropdown-item {
|
||||||
|
width: 120%;
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px solid $gray-200;
|
||||||
|
font-size: smaller;
|
||||||
|
i {
|
||||||
|
float: right; }
|
||||||
|
&:hover {
|
||||||
|
color: $gray-500 !important; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fullwidth menu when navbar is collapsed
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
& {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
button.navbar-toggler {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
div.navbar-collapse {
|
||||||
|
float: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 4em;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 1em;
|
||||||
|
border-top: 1px solid shade-color($primary, 25%);
|
||||||
|
ul.navbar-nav {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"sear sear sear"
|
||||||
|
"sect user lang";
|
||||||
|
li.nav-item {
|
||||||
|
flex-direction: column;
|
||||||
|
border: 0;
|
||||||
|
a.nav-link {}
|
||||||
|
&.navigation-search {
|
||||||
|
grid-area: sear;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
form {
|
||||||
|
width: 100%;
|
||||||
|
input.form-control {}
|
||||||
|
button.btn {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.nav-section { grid-area: sect; }
|
||||||
|
&.nav-user { grid-area: user; }
|
||||||
|
&.nav-language { grid-area: lang; }
|
||||||
|
}
|
||||||
|
li.dropdown {
|
||||||
|
&, & > * {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
a.dropdown-toggle {}
|
||||||
|
div.dropdown-menu {
|
||||||
|
display: block;
|
||||||
|
border: 0;
|
||||||
|
a.dropdown-item {
|
||||||
|
width: 100%;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px dotted $gray-200;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div.banner {
|
||||||
|
div.header-name,
|
||||||
|
div.header-details {
|
||||||
|
div.row > div:first-child {
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
//margin-left: 1.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div.vertical-menu {
|
||||||
|
border-radius: 0;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
a.list-group-item {
|
||||||
|
background-color: $chill-yellow;
|
||||||
|
border: 0;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
&:hover {
|
||||||
|
background-color: tint-color($chill-yellow, 20%)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer.footer {
|
||||||
|
background: $dark;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
width: 100%;
|
||||||
|
p {
|
||||||
|
font-family: Open Sans;
|
||||||
|
font-weight: 300;
|
||||||
|
clear: both;
|
||||||
|
color: $white;
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.5em;
|
||||||
|
margin: auto;
|
||||||
|
max-width: 35em;
|
||||||
|
text-align: center;
|
||||||
|
a, a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -62,10 +62,10 @@ $chill-theme-buttons: (
|
|||||||
&.btn-view::before,
|
&.btn-view::before,
|
||||||
&.btn-save::before,
|
&.btn-save::before,
|
||||||
&.btn-duplicate::before,
|
&.btn-duplicate::before,
|
||||||
// &.btn-not-duplicate::before,
|
&.btn-not-duplicate::before,
|
||||||
// &.btn-submit::before,
|
&.btn-submit::before,
|
||||||
// &.btn-reset::before,
|
&.btn-reset::before,
|
||||||
// &.btn-action::before,
|
&.btn-action::before,
|
||||||
&.btn-delete::before,
|
&.btn-delete::before,
|
||||||
&.btn-remove::before,
|
&.btn-remove::before,
|
||||||
&.btn-cancel::before {
|
&.btn-cancel::before {
|
||||||
@@ -101,18 +101,3 @@ $chill-theme-buttons: (
|
|||||||
color: $light;
|
color: $light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// allow to hide icon (herited from scratch)
|
|
||||||
.btn {
|
|
||||||
&.change-icon {
|
|
||||||
&::before {
|
|
||||||
content: '';
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// fix min-width on small pictos buttons
|
|
||||||
.btn-sm, .btn-group-sm > .btn {
|
|
||||||
min-width: 36px;
|
|
||||||
}
|
|
@@ -1,22 +1,13 @@
|
|||||||
ul.record_actions {
|
ul.record_actions,
|
||||||
|
ul.record_actions_column {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap-reverse;
|
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
padding: 0.5em 0;
|
|
||||||
|
|
||||||
&.column {
|
&.record_actions--left {
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.left {
|
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
padding: 0.5em 0;
|
||||||
&.sticky-form-buttons {
|
flex-wrap: wrap-reverse;
|
||||||
padding-left: 1em;
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -27,34 +18,37 @@ ul.record_actions {
|
|||||||
&:last-child {
|
&:last-child {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.cancel {
|
li.cancel {
|
||||||
order: 1;
|
order: 1;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
.sticky-form-buttons {
|
|
||||||
margin-top: 4em;
|
|
||||||
background-color: $beige;
|
|
||||||
position: sticky;
|
|
||||||
bottom: 0.3em;
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
padding: 0.8em 1.6em;
|
|
||||||
border-radius: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EXCEPTIONS
|
ul.record_actions {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.record_actions_column {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.record_actions.sticky-form-buttons {
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
// inside table exceptions
|
// inside table exceptions
|
||||||
table {
|
table {
|
||||||
|
|
||||||
td ul.record_actions,
|
td ul.record_actions,
|
||||||
ul.record_actions_small {
|
ul.record_actions_small {
|
||||||
li {
|
li {
|
||||||
margin-right: 0.2em;
|
margin-right: 0.2em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.record_actions {
|
ul.record_actions {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
@@ -14,7 +14,7 @@ $gray-400: #ced4da !default;
|
|||||||
$gray-500: #b2b2b2 !default;
|
$gray-500: #b2b2b2 !default;
|
||||||
$gray-600: #6c757d !default;
|
$gray-600: #6c757d !default;
|
||||||
$gray-700: #495057 !default;
|
$gray-700: #495057 !default;
|
||||||
$gray-800: #2c2d2f !default;
|
$gray-800: #333333 !default;
|
||||||
$gray-900: #212529 !default;
|
$gray-900: #212529 !default;
|
||||||
$black: #111 !default;
|
$black: #111 !default;
|
||||||
// scss-docs-end gray-color-variables
|
// scss-docs-end gray-color-variables
|
||||||
|
@@ -1,86 +1,147 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="chill-entity entity-address">
|
||||||
|
|
||||||
<div v-for="error in displayErrors" class="alert alert-danger my-2">
|
<h2 v-if="!edit">{{ $t('create_a_new_address') }}</h2>
|
||||||
{{ error }}
|
<h2 v-else>{{ $t('edit_address') }}</h2>
|
||||||
</div>
|
|
||||||
|
<show-address
|
||||||
|
v-if="address"
|
||||||
|
v-bind:address="address">
|
||||||
|
</show-address>
|
||||||
|
|
||||||
<add-address
|
<add-address
|
||||||
v-bind:key="context.entity.type"
|
@addNewAddress="addNewAddress">
|
||||||
v-bind:context="context"
|
|
||||||
v-bind:options="addAddress.options"
|
|
||||||
v-bind:result="addAddress.result"
|
|
||||||
@submitAddress="submitAddress"
|
|
||||||
ref="addAddress">
|
|
||||||
</add-address>
|
</add-address>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="!edit" class='person-address__valid'>
|
||||||
|
<h2>{{ $t('date') }}</h2>
|
||||||
|
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<span class="input-group-text" id="validFrom"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
<input type="date" class="form-control form-control-lg" name="validFrom"
|
||||||
|
v-bind:placeholder="$t('validFrom')"
|
||||||
|
v-model="validFrom"
|
||||||
|
aria-describedby="validFrom" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="errors.length > 0">
|
||||||
|
{{ errors }}
|
||||||
|
</div>
|
||||||
|
<div v-if="loading">
|
||||||
|
{{ $t('loading') }}
|
||||||
|
</div>
|
||||||
|
<div v-if="success">
|
||||||
|
{{ $t('person_address_creation_success') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="cancel">
|
||||||
|
<a :href="backUrl" class="btn btn-cancel">{{ $t('back_to_the_list') }}</a>
|
||||||
|
</li>
|
||||||
|
<li v-if="!edit">
|
||||||
|
<button type="submit" class="btn btn-update" @click="addToPerson">
|
||||||
|
{{ $t('add_an_address_to_person') }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/*
|
|
||||||
* Address component is a uniq component for many contexts.
|
|
||||||
* Allow to create/attach/edit an address to
|
|
||||||
* - a person (new or edit address),
|
|
||||||
* - a household (move or edit address)
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
import AddAddress from './components/AddAddress.vue';
|
import AddAddress from './components/AddAddress.vue';
|
||||||
|
import ShowAddress from './components/ShowAddress.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
AddAddress
|
AddAddress,
|
||||||
|
ShowAddress
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
context: {
|
|
||||||
edit: window.mode === 'edit',
|
edit: window.mode === 'edit',
|
||||||
entity: {
|
personId: window.personId,
|
||||||
type: window.entityType,
|
addressId: window.addressId,
|
||||||
id: window.entityId
|
backUrl: `/fr/person/${window.personId}/address/list`, //TODO better way to pass this
|
||||||
},
|
validFrom: new Date().toISOString().split('T')[0]
|
||||||
addressId: window.addressId | null,
|
|
||||||
backUrl: window.backUrl,
|
|
||||||
},
|
|
||||||
addAddress: {
|
|
||||||
options: {
|
|
||||||
|
|
||||||
/// Options override default.
|
|
||||||
/// null value take default component value defined in AddAddress data()
|
|
||||||
button: {
|
|
||||||
text: {
|
|
||||||
create: window.buttonText || null,
|
|
||||||
edit: window.buttonText || null
|
|
||||||
},
|
|
||||||
size: window.buttonSize || null,
|
|
||||||
displayText: window.buttonDisplayText //boolean, default: true
|
|
||||||
},
|
|
||||||
|
|
||||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
|
||||||
title: {
|
|
||||||
create: window.modalTitle || null,
|
|
||||||
edit: window.modalTitle || null
|
|
||||||
},
|
|
||||||
|
|
||||||
/// Display each step in page or Modal
|
|
||||||
bindModal: {
|
|
||||||
step1: window.binModalStep1, //boolean, default: true
|
|
||||||
step2: window.binModalStep2 //boolean, default: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
address() {
|
||||||
|
return this.$store.state.address;
|
||||||
|
},
|
||||||
|
errors() {
|
||||||
|
return this.$store.state.errorMsg;
|
||||||
|
},
|
||||||
|
loading() {
|
||||||
|
return this.$store.state.loading;
|
||||||
|
},
|
||||||
|
success() {
|
||||||
|
return this.$store.state.success;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
displayErrors() {
|
addNewAddress({ address, modal }) {
|
||||||
return this.$refs.addAddress.errorMsg;
|
console.log('@@@ CLICK button addNewAdress', address);
|
||||||
},
|
|
||||||
submitAddress() {
|
|
||||||
console.log('@@@ click on Submit Address Button');
|
|
||||||
|
|
||||||
// Cast child method
|
let newAddress = {
|
||||||
this.$refs.addAddress.submitNewAddress();
|
'isNoAddress': address.isNoAddress,
|
||||||
// it fetch post request only for person and household
|
'street': address.isNoAddress ? '' : address.street,
|
||||||
// else get returned payload then dispatch from here (parent)
|
'streetNumber': address.isNoAddress ? '' : address.streetNumber,
|
||||||
|
'postcode': {'id': address.selected.city.id},
|
||||||
|
'floor': address.floor,
|
||||||
|
'corridor': address.corridor,
|
||||||
|
'steps': address.steps,
|
||||||
|
'flat': address.flat,
|
||||||
|
'buildingName': address.buildingName,
|
||||||
|
'distribution': address.distribution,
|
||||||
|
'extra': address.extra
|
||||||
|
};
|
||||||
|
|
||||||
|
if (address.selected.address.point !== undefined){
|
||||||
|
newAddress = Object.assign(newAddress, {
|
||||||
|
'point': address.selected.address.point.coordinates
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (address.writeNewPostalCode){
|
||||||
|
let newPostalCode = address.newPostalCode;
|
||||||
|
newPostalCode = Object.assign(newPostalCode, {
|
||||||
|
'country': {'id': address.selected.country.id },
|
||||||
|
});
|
||||||
|
newAddress = Object.assign(newAddress, {
|
||||||
|
'newPostalCode': newPostalCode
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (this.edit){
|
||||||
|
this.$store.dispatch('updateAddress', {
|
||||||
|
addressId: this.addressId,
|
||||||
|
newAddress: newAddress
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$store.dispatch('addAddress', newAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
modal.showModal = false;
|
||||||
|
},
|
||||||
|
addToPerson() {
|
||||||
|
this.$store.dispatch('addDateToAddressAndAddressToPerson', {
|
||||||
|
personId: this.personId,
|
||||||
|
addressId: this.$store.state.address.address_id,
|
||||||
|
body: { validFrom: {datetime: `${this.validFrom}T00:00:00+0100`}},
|
||||||
|
backUrl: this.backUrl
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getEditAddress() {
|
||||||
|
this.$store.dispatch('getEditAddress', this.addressId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.edit) {
|
||||||
|
this.getEditAddress();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* @returns {Promise} a promise containing all Country object
|
* @returns {Promise} a promise containing all Country object
|
||||||
*/
|
*/
|
||||||
const fetchCountries = () => {
|
const fetchCountries = () => {
|
||||||
//console.log('<<< fetching countries');
|
console.log('<<< fetching countries');
|
||||||
|
|
||||||
const url = `/api/1.0/main/country.json?item_per_page=1000`;
|
const url = `/api/1.0/main/country.json?item_per_page=1000`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
@@ -20,7 +20,7 @@ const fetchCountries = () => {
|
|||||||
* @returns {Promise} a promise containing all Postal Code objects filtered with country
|
* @returns {Promise} a promise containing all Postal Code objects filtered with country
|
||||||
*/
|
*/
|
||||||
const fetchCities = (country) => {
|
const fetchCities = (country) => {
|
||||||
//console.log('<<< fetching cities for', country);
|
console.log('<<< fetching cities for', country);
|
||||||
const url = `/api/1.0/main/postal-code.json?item_per_page=1000&country=${country.id}`;
|
const url = `/api/1.0/main/postal-code.json?item_per_page=1000&country=${country.id}`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@@ -35,7 +35,7 @@ const fetchCities = (country) => {
|
|||||||
* @returns {Promise} a promise containing all AddressReference objects filtered with postal code
|
* @returns {Promise} a promise containing all AddressReference objects filtered with postal code
|
||||||
*/
|
*/
|
||||||
const fetchReferenceAddresses = (postalCode) => {
|
const fetchReferenceAddresses = (postalCode) => {
|
||||||
//console.log('<<< fetching references addresses for', postalCode);
|
console.log('<<< fetching references addresses for', postalCode);
|
||||||
const url = `/api/1.0/main/address-reference.json?item_per_page=1000&postal_code=${postalCode.id}`;
|
const url = `/api/1.0/main/address-reference.json?item_per_page=1000&postal_code=${postalCode.id}`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@@ -50,7 +50,7 @@ const fetchReferenceAddresses = (postalCode) => {
|
|||||||
* @returns {Promise} a promise containing all AddressReference objects filtered with postal code
|
* @returns {Promise} a promise containing all AddressReference objects filtered with postal code
|
||||||
*/
|
*/
|
||||||
const fetchAddresses = () => {
|
const fetchAddresses = () => {
|
||||||
//console.log('<<< fetching addresses');
|
console.log('<<< fetching addresses');
|
||||||
//TODO deal with huge number of addresses... we should do suggestion...
|
//TODO deal with huge number of addresses... we should do suggestion...
|
||||||
const url = `/api/1.0/main/address.json?item_per_page=1000`;
|
const url = `/api/1.0/main/address.json?item_per_page=1000`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
@@ -125,6 +125,31 @@ const postPostalCode = (postalCode) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Endpoint chill_api_single_person_address
|
||||||
|
* method POST, post Person instance
|
||||||
|
*
|
||||||
|
* @id integer - id of Person
|
||||||
|
* @body Object - dictionary with changes to post
|
||||||
|
*/
|
||||||
|
const postAddressToPerson = (personId, addressId) => {
|
||||||
|
console.log(personId);
|
||||||
|
console.log(addressId);
|
||||||
|
const body = {
|
||||||
|
'id': addressId
|
||||||
|
};
|
||||||
|
const url = `/api/1.0/person/person/${personId}/address.json`
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/json;charset=utf-8'},
|
||||||
|
body: JSON.stringify(body)
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Endpoint chill_api_single_address__index
|
* Endpoint chill_api_single_address__index
|
||||||
* method GET, get Address Object
|
* method GET, get Address Object
|
||||||
@@ -132,7 +157,7 @@ const postPostalCode = (postalCode) => {
|
|||||||
* @returns {Promise} a promise containing a Address object
|
* @returns {Promise} a promise containing a Address object
|
||||||
*/
|
*/
|
||||||
const getAddress = (id) => {
|
const getAddress = (id) => {
|
||||||
//console.log('<< get address');
|
console.log('<<< get address');
|
||||||
const url = `/api/1.0/main/address/${id}.json`;
|
const url = `/api/1.0/main/address/${id}.json`;
|
||||||
return fetch(url)
|
return fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@@ -149,5 +174,6 @@ export {
|
|||||||
postAddress,
|
postAddress,
|
||||||
patchAddress,
|
patchAddress,
|
||||||
postPostalCode,
|
postPostalCode,
|
||||||
|
postAddressToPerson,
|
||||||
getAddress
|
getAddress
|
||||||
};
|
};
|
||||||
|
@@ -1,618 +1,273 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<button v-if="!edit" class="btn btn-create mt-4" @click="openModal">
|
||||||
<!-- start with a button -->
|
{{ $t('add_an_address_title') }}
|
||||||
<button v-if="step1WithModal"
|
</button>
|
||||||
@click="openShowPane"
|
<button v-else class="btn btn-create mt-4" @click="openModal">
|
||||||
class="btn" :class="getClassButton"
|
{{ $t('edit_address') }}
|
||||||
type="button" name="button" :title="$t(getTextButton)">
|
|
||||||
<span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- step 1 -->
|
<teleport to="body">
|
||||||
<teleport to="body" v-if="step1WithModal">
|
<modal v-if="modal.showModal"
|
||||||
<modal v-if="flag.showPane"
|
v-bind:modalDialogClass="modal.modalDialogClass"
|
||||||
modalDialogClass="modal-dialog-scrollable modal-xl"
|
@close="modal.showModal = false">
|
||||||
@close="flag.showPane = false">
|
|
||||||
|
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<h2 class="modal-title">{{ $t(getTextTitle) }}
|
<h3 v-if="!edit" class="modal-title">{{ $t('add_an_address_title') }}</h3>
|
||||||
<span v-if="flag.loading" class="loading">
|
<h3 v-if="edit" class="modal-title">{{ $t('edit_an_address_title') }}</h3>
|
||||||
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
|
|
||||||
<span class="sr-only">{{ $t('loading') }}</span>
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
<show-address-pane
|
<div class="address-form">
|
||||||
v-bind:context="this.context"
|
|
||||||
v-bind:options="this.options"
|
<h4 class="h3">{{ $t('select_an_address_title') }}
|
||||||
v-bind:default="this.default"
|
<span v-if="loading">
|
||||||
v-bind:entity="this.entity"
|
<i class="fa fa-circle-o-notch fa-spin fa-lg"></i>
|
||||||
v-bind:valid="this.valid"
|
</span>
|
||||||
v-bind:flag="this.flag"
|
</h4>
|
||||||
ref="showAddress">
|
|
||||||
</show-address-pane>
|
<div class="row my-3">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox"
|
||||||
|
class="form-check-input"
|
||||||
|
id="isNoAddress"
|
||||||
|
v-model="isNoAddress"
|
||||||
|
v-bind:value="value" />
|
||||||
|
<label class="form-check-label" for="isNoAddress">
|
||||||
|
{{ $t('isNoAddress') }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<country-selection
|
||||||
|
v-bind:address="address"
|
||||||
|
v-bind:getCities="getCities">
|
||||||
|
</country-selection>
|
||||||
|
|
||||||
|
<city-selection
|
||||||
|
v-bind:address="address"
|
||||||
|
v-bind:focusOnAddress="focusOnAddress"
|
||||||
|
v-bind:getReferenceAddresses="getReferenceAddresses">
|
||||||
|
</city-selection>
|
||||||
|
|
||||||
|
<address-selection
|
||||||
|
v-if="!isNoAddress"
|
||||||
|
v-bind:address="address"
|
||||||
|
v-bind:updateMapCenter="updateMapCenter">
|
||||||
|
</address-selection>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mt-3 mt-lg-0">
|
||||||
|
|
||||||
|
<address-map
|
||||||
|
v-bind:address="address"
|
||||||
|
ref="addressMap">
|
||||||
|
</address-map>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<address-more
|
||||||
|
v-if="!isNoAddress"
|
||||||
|
v-bind:address="address">
|
||||||
|
</address-more>
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<button @click="openEditPane"
|
<button class="btn btn-create"
|
||||||
class="btn btn-update">
|
@click.prevent="$emit('addNewAddress', { address, modal })">
|
||||||
{{ $t('action.edit')}}
|
{{ $t('action.add')}}
|
||||||
</button>
|
|
||||||
<button class="btn btn-save"
|
|
||||||
@click.prevent="$emit('submitAddress')">
|
|
||||||
{{ $t('action.save')}}
|
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</modal>
|
</modal>
|
||||||
</teleport>
|
</teleport>
|
||||||
<div class="mt-4" v-else>
|
|
||||||
|
|
||||||
<show-address-pane v-if="flag.showPane"
|
|
||||||
v-bind:context="this.context"
|
|
||||||
v-bind:options="this.options"
|
|
||||||
v-bind:default="this.default"
|
|
||||||
v-bind:entity="this.entity"
|
|
||||||
v-bind:valid="this.valid"
|
|
||||||
v-bind:flag="this.flag"
|
|
||||||
ref="showAddress"
|
|
||||||
v-bind:insideModal="false" @openEditPane="openEditPane"
|
|
||||||
@submitAddress="$emit('submitAddress')">
|
|
||||||
</show-address-pane>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- step 2 -->
|
|
||||||
<teleport to="body" v-if="step2WithModal">
|
|
||||||
<modal v-if="flag.editPane"
|
|
||||||
modalDialogClass="modal-dialog-scrollable modal-xl"
|
|
||||||
@close="flag.editPane = false">
|
|
||||||
|
|
||||||
<template v-slot:header>
|
|
||||||
<h2 class="modal-title">{{ $t(getTextTitle) }}
|
|
||||||
<span v-if="flag.loading" class="loading">
|
|
||||||
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
|
|
||||||
<span class="sr-only">{{ $t('loading') }}</span>
|
|
||||||
</span>
|
|
||||||
</h2>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-slot:body>
|
|
||||||
<edit-address-pane
|
|
||||||
v-bind:context="this.context"
|
|
||||||
v-bind:options="this.options"
|
|
||||||
v-bind:default="this.default"
|
|
||||||
v-bind:entity="this.entity"
|
|
||||||
v-bind:flag="this.flag"
|
|
||||||
@getCities="getCities"
|
|
||||||
@getReferenceAddresses="getReferenceAddresses">
|
|
||||||
</edit-address-pane>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-slot:footer>
|
|
||||||
<button class="btn btn-cancel change-icon" @click="flag.showPane = true; flag.editPane = false;">
|
|
||||||
{{ $t('action.cancel') }}
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-update"
|
|
||||||
@click="closeEditPane">
|
|
||||||
{{ $t('action.valid')}}
|
|
||||||
</button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</modal>
|
|
||||||
</teleport>
|
|
||||||
<div class="mt-4" v-else>
|
|
||||||
|
|
||||||
<edit-address-pane v-if="flag.editPane"
|
|
||||||
v-bind:context="this.context"
|
|
||||||
v-bind:options="this.options"
|
|
||||||
v-bind:default="this.default"
|
|
||||||
v-bind:entity="this.entity"
|
|
||||||
v-bind:flag="this.flag"
|
|
||||||
v-bind:insideModal="false" @closeEditPane="closeEditPane"
|
|
||||||
@getCities="getCities"
|
|
||||||
@getReferenceAddresses="getReferenceAddresses">
|
|
||||||
</edit-address-pane>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||||
import { getAddress, fetchCountries, fetchCities, fetchReferenceAddresses, patchAddress, postAddress, postPostalCode } from '../api';
|
import { fetchCountries, fetchCities, fetchReferenceAddresses } from '../api'
|
||||||
import { postAddressToPerson, postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress.js";
|
|
||||||
import ShowAddressPane from './ShowAddressPane.vue';
|
import CountrySelection from './AddAddress/CountrySelection';
|
||||||
import EditAddressPane from './EditAddressPane.vue';
|
import CitySelection from './AddAddress/CitySelection';
|
||||||
|
import AddressSelection from './AddAddress/AddressSelection';
|
||||||
|
import AddressMap from './AddAddress/AddressMap';
|
||||||
|
import AddressMore from './AddAddress/AddressMore'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AddAddress",
|
name: 'AddAddresses',
|
||||||
props: ['context', 'options', 'result'],
|
|
||||||
emits: ['submitAddress'],
|
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
ShowAddressPane,
|
CountrySelection,
|
||||||
EditAddressPane,
|
CitySelection,
|
||||||
|
AddressSelection,
|
||||||
|
AddressMap,
|
||||||
|
AddressMore
|
||||||
},
|
},
|
||||||
|
props: [
|
||||||
|
],
|
||||||
|
emits: ['addNewAddress'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
flag: {
|
edit: window.mode === 'edit',
|
||||||
showPane: false,
|
modal: {
|
||||||
editPane: false,
|
showModal: false,
|
||||||
|
modalDialogClass: "modal-dialog-scrollable modal-xl"
|
||||||
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
success: false
|
address: {
|
||||||
},
|
writeNewAddress: false,
|
||||||
default: {
|
writeNewPostalCode: false,
|
||||||
button: {
|
|
||||||
text: { create: 'add_an_address_title', edit: 'edit_address' },
|
|
||||||
type: { create: 'btn-create', edit: 'btn-update'},
|
|
||||||
displayText: true
|
|
||||||
},
|
|
||||||
title: { create: 'add_an_address_title', edit: 'edit_address' },
|
|
||||||
bindModal: {
|
|
||||||
step1: true,
|
|
||||||
step2: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
entity: {
|
|
||||||
address: {}, // <== loaded and returned
|
|
||||||
loaded: {
|
loaded: {
|
||||||
countries: [],
|
countries: [],
|
||||||
cities: [],
|
cities: [],
|
||||||
addresses: [],
|
addresses: [],
|
||||||
},
|
},
|
||||||
selected: { // <== make temporary changes
|
selected: {
|
||||||
isNoAddress: false,
|
|
||||||
country: {},
|
country: {},
|
||||||
city: {},
|
city: {},
|
||||||
postcode: {
|
address: {},
|
||||||
|
},
|
||||||
|
newPostalCode: {
|
||||||
code: null,
|
code: null,
|
||||||
name: null
|
name: null
|
||||||
},
|
},
|
||||||
address: {},
|
|
||||||
writeNew: {
|
|
||||||
address: false,
|
|
||||||
postcode: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addressMap: {
|
addressMap: {
|
||||||
// Note: LeafletJs demands [lat, lon]
|
center : [48.8589, 2.3469], // Note: LeafletJs demands [lat, lon] cfr https://macwright.com/lonlat/
|
||||||
// cfr https://macwright.com/lonlat/
|
|
||||||
center : [48.8589, 2.3469],
|
|
||||||
zoom: 12
|
zoom: 12
|
||||||
},
|
},
|
||||||
|
isNoAddress: false,
|
||||||
|
street: null,
|
||||||
|
streetNumber: null,
|
||||||
|
floor: null,
|
||||||
|
corridor: null,
|
||||||
|
steps: null,
|
||||||
|
floor: null,
|
||||||
|
flat: null,
|
||||||
|
buildingName: null,
|
||||||
|
extra: null,
|
||||||
|
distribution: null,
|
||||||
},
|
},
|
||||||
valid: {
|
errorMsg: {},
|
||||||
from: new Date(),
|
|
||||||
to: null
|
|
||||||
},
|
|
||||||
errorMsg: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
step1WithModal() {
|
isNoAddress: {
|
||||||
return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ?
|
set(value) {
|
||||||
this.options.bindModal.step1 : this.default.bindModal.step1;
|
console.log('value', value);
|
||||||
|
this.address.isNoAddress = value;
|
||||||
},
|
},
|
||||||
step2WithModal() {
|
get() {
|
||||||
let step2 = (this.options.bindModal !== null && typeof this.options.bindModal.step2 !== 'undefined') ?
|
return this.address.isNoAddress;
|
||||||
this.options.bindModal.step2 : this.default.bindModal.step2;
|
|
||||||
|
|
||||||
if (step2 === false && this.step1WithModal === true) {
|
|
||||||
console.log("step2 must open in a Modal");
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return step2;
|
|
||||||
},
|
|
||||||
getTextTitle() {
|
|
||||||
if ( typeof this.options.title !== 'undefined'
|
|
||||||
&& ( this.options.title.edit !== null
|
|
||||||
|| this.options.title.create !== null
|
|
||||||
)) {
|
|
||||||
return (this.context.edit) ? this.options.title.edit : this.options.title.create;
|
|
||||||
}
|
|
||||||
return (this.context.edit) ? this.default.title.edit : this.default.title.create;
|
|
||||||
},
|
|
||||||
getTextButton() {
|
|
||||||
if ( typeof this.options.button.text !== 'undefined'
|
|
||||||
&& ( this.options.button.text.edit !== null
|
|
||||||
|| this.options.button.text.create !== null
|
|
||||||
)) {
|
|
||||||
return (this.context.edit) ? this.options.button.text.edit : this.options.button.text.create;
|
|
||||||
}
|
|
||||||
return (this.context.edit) ? this.default.button.text.edit : this.default.button.text.create;
|
|
||||||
},
|
|
||||||
getClassButton() {
|
|
||||||
let type = (this.context.edit) ? this.default.button.type.edit : this.default.button.type.create;
|
|
||||||
let size = (typeof this.options.button !== 'undefined' && this.options.button.size !== null) ?
|
|
||||||
`${this.options.button.size} ` : '';
|
|
||||||
return `${size}${type}`;
|
|
||||||
},
|
|
||||||
displayTextButton() {
|
|
||||||
return (typeof this.options.button !== 'undefined' && typeof this.options.button.displayText !== 'undefined') ?
|
|
||||||
this.options.button.displayText : this.default.button.displayText;
|
|
||||||
},
|
|
||||||
context() {
|
|
||||||
return this.context;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.step1WithModal) {
|
|
||||||
//console.log('Mounted now !');
|
|
||||||
this.openShowPane();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Opening and closing Panes when interacting with buttons
|
|
||||||
*/
|
|
||||||
openShowPane() {
|
|
||||||
console.log('open the Show Panel');
|
|
||||||
|
|
||||||
if (this.context.edit) {
|
|
||||||
this.getInitialAddress(this.context.addressId);
|
|
||||||
}
|
|
||||||
|
|
||||||
// when create new address, start first with editPane
|
|
||||||
if ( this.context.edit === false
|
|
||||||
&& this.flag.editPane === false
|
|
||||||
) {
|
|
||||||
this.openEditPane();
|
|
||||||
this.flag.editPane = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.flag.showPane = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
openEditPane() {
|
|
||||||
console.log('open the Edit panel');
|
|
||||||
this.initForm();
|
|
||||||
this.getCountries();
|
this.getCountries();
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
closeEditPane() {
|
openModal() {
|
||||||
console.log('close the Edit Panel');
|
this.modal.showModal = true;
|
||||||
this.applyChanges();
|
this.resetAll();
|
||||||
this.flag.showPane = true;
|
//this.$nextTick(function() {
|
||||||
this.flag.editPane = false;
|
// this.$refs.search.focus(); // positionner le curseur à l'ouverture de la modale
|
||||||
|
//})
|
||||||
},
|
},
|
||||||
|
focusOnCity() {
|
||||||
/*
|
const citySelector = document.getElementById('citySelector');
|
||||||
* Async Fetch datas
|
citySelector.focus();
|
||||||
*/
|
},
|
||||||
getInitialAddress(id) {
|
focusOnAddress() {
|
||||||
this.flag.loading = true;
|
const addressSelector = document.getElementById('addressSelector');
|
||||||
getAddress(id).then(
|
addressSelector.focus();
|
||||||
address => new Promise((resolve, reject) => {
|
|
||||||
this.entity.address = address;
|
|
||||||
this.flag.loading = false;
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error.message);
|
|
||||||
this.flag.loading = false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getCountries() {
|
getCountries() {
|
||||||
this.flag.loading = true;
|
console.log('getCountries');
|
||||||
fetchCountries().then(
|
this.loading = true;
|
||||||
countries => new Promise((resolve, reject) => {
|
fetchCountries().then(countries => new Promise((resolve, reject) => {
|
||||||
this.entity.loaded.countries = countries.results;
|
this.address.loaded.countries = countries.results;
|
||||||
this.flag.showPane = false;
|
|
||||||
this.flag.editPane = true;
|
|
||||||
this.flag.loading = false;
|
|
||||||
resolve()
|
resolve()
|
||||||
|
this.loading = false;
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
this.flag.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getCities(country) {
|
getCities(country) {
|
||||||
this.flag.loading = true;
|
console.log('getCities for', country.name);
|
||||||
fetchCities(country).then(
|
this.loading = true;
|
||||||
cities => new Promise((resolve, reject) => {
|
fetchCities(country).then(cities => new Promise((resolve, reject) => {
|
||||||
this.entity.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities
|
||||||
this.flag.loading = false;
|
|
||||||
resolve();
|
resolve();
|
||||||
|
this.loading = false;
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
this.flag.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getReferenceAddresses(city) {
|
getReferenceAddresses(city) {
|
||||||
this.flag.loading = true;
|
this.loading = true;
|
||||||
fetchReferenceAddresses(city).then(
|
console.log('getReferenceAddresses for', city.name);
|
||||||
addresses => new Promise((resolve, reject) => {
|
fetchReferenceAddresses(city).then(addresses => new Promise((resolve, reject) => {
|
||||||
this.entity.loaded.addresses = addresses.results;
|
console.log('addresses', addresses);
|
||||||
this.flag.loading = false;
|
this.address.loaded.addresses = addresses.results;
|
||||||
resolve();
|
resolve();
|
||||||
|
this.loading = false;
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.errorMsg.push(error.message);
|
this.errorMsg.push(error.message);
|
||||||
this.flag.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
updateMapCenter(point) {
|
||||||
/*
|
console.log('point', point);
|
||||||
* Make form ready for new changes
|
this.address.addressMap.center[0] = point.coordinates[1]; // TODO use reverse()
|
||||||
*/
|
this.address.addressMap.center[1] = point.coordinates[0];
|
||||||
initForm() {
|
this.$refs.addressMap.update(); // cast child methods
|
||||||
console.log('init form');
|
|
||||||
|
|
||||||
this.entity.loaded.addresses = [];
|
|
||||||
this.entity.loaded.cities = [];
|
|
||||||
this.entity.loaded.countries = [];
|
|
||||||
|
|
||||||
this.entity.selected.isNoAddress = (this.context.edit && this.entity.address.text === '') ? true : false;
|
|
||||||
|
|
||||||
this.entity.selected.country = this.context.edit ? this.entity.address.country : {};
|
|
||||||
this.entity.selected.postcode = this.context.edit ? this.entity.address.postcode : {};
|
|
||||||
this.entity.selected.city = {};
|
|
||||||
|
|
||||||
this.entity.selected.address = {};
|
|
||||||
this.entity.selected.address.street = this.context.edit ? this.entity.address.street: null;
|
|
||||||
this.entity.selected.address.streetNumber = this.context.edit ? this.entity.address.streetNumber: null;
|
|
||||||
this.entity.selected.address.floor = this.context.edit ? this.entity.address.floor: null;
|
|
||||||
this.entity.selected.address.corridor = this.context.edit ? this.entity.address.corridor: null;
|
|
||||||
this.entity.selected.address.steps = this.context.edit ? this.entity.address.steps: null;
|
|
||||||
this.entity.selected.address.flat = this.context.edit ? this.entity.address.flat: null;
|
|
||||||
this.entity.selected.address.buildingName = this.context.edit ? this.entity.address.buildingName: null;
|
|
||||||
this.entity.selected.address.distribution = this.context.edit ? this.entity.address.distribution: null;
|
|
||||||
this.entity.selected.address.extra = this.context.edit ? this.entity.address.extra: null;
|
|
||||||
|
|
||||||
this.entity.selected.writeNew.address = this.context.edit;
|
|
||||||
this.entity.selected.writeNew.postcode = this.context.edit;
|
|
||||||
},
|
},
|
||||||
|
resetAll() {
|
||||||
/*
|
console.log('reset all selected');
|
||||||
* When changes are validated (get out step2 edit pane, button valid),
|
this.address.loaded.addresses = [];
|
||||||
* apply some transformations before asyncing with backend
|
this.address.selected.address = {};
|
||||||
* from entity.selected to entity.address
|
this.address.loaded.cities = [];
|
||||||
*/
|
this.address.selected.city = {};
|
||||||
applyChanges()
|
this.address.selected.country = {};
|
||||||
|
this.address.isNoAddress = this.edit ? this.$store.state.editAddress.isNoAddress: false;;
|
||||||
|
this.address.street = this.edit ? this.$store.state.editAddress.street: null;
|
||||||
|
this.address.streetNumber = this.edit ? this.$store.state.editAddress.streetNumber: null;
|
||||||
|
this.address.floor = this.edit ? this.$store.state.editAddress.floor: null;
|
||||||
|
this.address.corridor = this.edit ? this.$store.state.editAddress.corridor: null;
|
||||||
|
this.address.steps = this.edit ? this.$store.state.editAddress.steps: null;
|
||||||
|
this.address.flat = this.edit ? this.$store.state.editAddress.flat: null;
|
||||||
|
this.address.buildingName = this.edit ? this.$store.state.editAddress.buildingName: null;
|
||||||
|
this.address.distribution = this.edit ? this.$store.state.editAddress.distribution: null;
|
||||||
|
this.address.extra = this.edit ? this.$store.state.editAddress.extra: null;
|
||||||
|
this.address.writeNewAddress = this.edit;
|
||||||
|
this.address.writeNewPostalCode = this.edit;
|
||||||
|
this.address.newPostalCode = this.edit ?
|
||||||
{
|
{
|
||||||
let newAddress = {
|
code: this.$store.state.editAddress.postcode !== undefined ? this.$store.state.editAddress.postcode.code : null,
|
||||||
'isNoAddress': this.entity.selected.isNoAddress,
|
name: this.$store.state.editAddress.postcode !== undefined ? this.$store.state.editAddress.postcode.name : null
|
||||||
'street': this.entity.selected.isNoAddress ? '' : this.entity.selected.address.street,
|
} : {};
|
||||||
'streetNumber': this.entity.selected.isNoAddress ? '' : this.entity.selected.address.streetNumber,
|
console.log('cities and addresses', this.address.loaded.cities, this.address.loaded.addresses);
|
||||||
'postcode': {'id': this.entity.selected.city.id },
|
|
||||||
'floor': this.entity.selected.address.floor,
|
|
||||||
'corridor': this.entity.selected.address.corridor,
|
|
||||||
'steps': this.entity.selected.address.steps,
|
|
||||||
'flat': this.entity.selected.address.flat,
|
|
||||||
'buildingName': this.entity.selected.address.buildingName,
|
|
||||||
'distribution': this.entity.selected.address.distribution,
|
|
||||||
'extra': this.entity.selected.address.extra
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.entity.selected.address.point !== undefined) {
|
|
||||||
newAddress = Object.assign(newAddress, {
|
|
||||||
'point': this.entity.selected.address.point.coordinates
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (this.entity.selected.writeNew.postcode) {
|
|
||||||
let newPostcode = this.entity.selected.postcode;
|
|
||||||
newPostcode = Object.assign(newPostcode, {
|
|
||||||
'country': {'id': this.entity.selected.country.id },
|
|
||||||
});
|
|
||||||
newAddress = Object.assign(newAddress, {
|
|
||||||
'newPostcode': newPostcode
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.context.edit) {
|
|
||||||
this.updateAddress({
|
|
||||||
addressId: this.context.addressId,
|
|
||||||
newAddress: newAddress
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.addAddress(newAddress);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Async POST transactions,
|
|
||||||
* creating new address, and receive backend datas when promise is resolved
|
|
||||||
*/
|
|
||||||
addAddress(payload)
|
|
||||||
{
|
|
||||||
this.flag.loading = true;
|
|
||||||
if ('newPostcode' in payload) {
|
|
||||||
|
|
||||||
let postcodeBody = payload.newPostcode;
|
|
||||||
if (this.context.entity.type === 'person') {
|
|
||||||
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
|
||||||
}
|
|
||||||
|
|
||||||
postPostalCode(postcodeBody)
|
|
||||||
.then(postalCode => {
|
|
||||||
let body = payload;
|
|
||||||
body.postcode = {'id': postalCode.id },
|
|
||||||
postAddress(body)
|
|
||||||
.then(address => new Promise((resolve, reject) => {
|
|
||||||
this.entity.address = address;
|
|
||||||
this.flag.loading = false;
|
|
||||||
this.flag.success = true;
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
} else {
|
|
||||||
postAddress(payload)
|
|
||||||
.then(address => new Promise((resolve, reject) => {
|
|
||||||
this.entity.address = address;
|
|
||||||
this.flag.loading = false;
|
|
||||||
this.flag.success = true;
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Async PATCH transactions,
|
|
||||||
* then update existing address with backend datas when promise is resolved
|
|
||||||
*/
|
|
||||||
updateAddress(payload)
|
|
||||||
{
|
|
||||||
// TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
|
|
||||||
this.flag.loading = true;
|
|
||||||
if ('newPostcode' in payload.newAddress) {
|
|
||||||
|
|
||||||
let postcodeBody = payload.newAddress.newPostcode;
|
|
||||||
postcodeBody = Object.assign(postcodeBody, {'origin': 3});
|
|
||||||
|
|
||||||
postPostalCode(postcodeBody)
|
|
||||||
.then(postalCode => {
|
|
||||||
let body = payload.newAddress;
|
|
||||||
body.postcode = {'id': postalCode.id },
|
|
||||||
patchAddress(payload.addressId, body)
|
|
||||||
.then(address => new Promise((resolve, reject) => {
|
|
||||||
this.entity.address = address;
|
|
||||||
this.flag.loading = false;
|
|
||||||
this.flag.success = true;
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
} else {
|
|
||||||
patchAddress(payload.addressId, payload.newAddress)
|
|
||||||
.then(address => new Promise((resolve, reject) => {
|
|
||||||
this.entity.address = address;
|
|
||||||
this.flag.loading = false;
|
|
||||||
this.flag.success = true;
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When submit address
|
|
||||||
* (get out step1 show pane, submit button)
|
|
||||||
*/
|
|
||||||
submitNewAddress()
|
|
||||||
{
|
|
||||||
let payload = {
|
|
||||||
entity: this.context.entity.type,
|
|
||||||
entityId: this.context.entity.id,
|
|
||||||
addressId: this.entity.address.address_id,
|
|
||||||
body: {
|
|
||||||
validFrom: {
|
|
||||||
datetime: `${this.valid.from.toISOString().split('T')[0]}T00:00:00+0100`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
backUrl: this.context.backUrl
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( payload.entity !== 'person' && payload.entity !== 'household' ) {
|
|
||||||
|
|
||||||
// just return payload to parent
|
|
||||||
// (changes will be patched in parent store)
|
|
||||||
this.initForm();
|
|
||||||
this.flag.showPane = false;
|
|
||||||
return payload;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('submitNewAddress with', payload);
|
|
||||||
this.addDateToAddressAndAddressTo(payload);
|
|
||||||
|
|
||||||
this.initForm();
|
|
||||||
this.flag.showPane = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
addDateToAddressAndAddressTo(payload)
|
|
||||||
{
|
|
||||||
console.log('addDateToAddressAndAddressTo', payload.entity)
|
|
||||||
this.flag.loading = true;
|
|
||||||
return patchAddress(payload.addressId, payload.body)
|
|
||||||
.then(address => new Promise((resolve, reject) => {
|
|
||||||
this.valid.from = address.validFrom;
|
|
||||||
resolve();
|
|
||||||
})
|
|
||||||
.then(this.postAddressTo(payload))
|
|
||||||
)
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
postAddressTo(payload)
|
|
||||||
{
|
|
||||||
console.log('postAddressTo', payload.entity);
|
|
||||||
if (!this.context.edit) {
|
|
||||||
switch (payload.entity) {
|
|
||||||
case 'household':
|
|
||||||
postAddressToHousehold(payload.entityId, payload.addressId)
|
|
||||||
.then(household => new Promise((resolve, reject) => {
|
|
||||||
console.log('postAddressToHousehold', household);
|
|
||||||
this.flag.loading = false;
|
|
||||||
this.flag.success = true;
|
|
||||||
window.location.assign(payload.backUrl);
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
})
|
|
||||||
;
|
|
||||||
break;
|
|
||||||
case 'person':
|
|
||||||
postAddressToPerson(payload.entityId, payload.addressId)
|
|
||||||
.then(person => new Promise((resolve, reject) => {
|
|
||||||
console.log('postAddressToPerson', person);
|
|
||||||
this.flag.loading = false;
|
|
||||||
this.flag.success = true;
|
|
||||||
window.location.assign(payload.backUrl);
|
|
||||||
resolve();
|
|
||||||
}))
|
|
||||||
.catch((error) => {
|
|
||||||
this.errorMsg.push(error);
|
|
||||||
this.flag.loading = false;
|
|
||||||
})
|
|
||||||
;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.errorMsg.push('That entity is not managed by address !');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// address is already linked, just finish !
|
|
||||||
window.location.assign(payload.backUrl);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
div.entity-address {
|
|
||||||
position: relative;
|
div.address-form {
|
||||||
div.loading {
|
h4.h3 {
|
||||||
position: absolute;
|
font-weight: bold;
|
||||||
right: 0; top: -55px;
|
}
|
||||||
|
div#address_map {
|
||||||
|
height: 400px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -13,18 +13,16 @@ let marker;
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AddressMap',
|
name: 'AddressMap',
|
||||||
props: ['entity'],
|
props: ['address'],
|
||||||
computed: {
|
computed: {
|
||||||
center() {
|
center() {
|
||||||
return this.entity.selected.addressMap.center;
|
return this.address.addressMap.center;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
init() {
|
init() {
|
||||||
map = L.map('address_map').setView([46.67059, -1.42683], 12);
|
map = L.map('address_map').setView([46.67059, -1.42683], 12);
|
||||||
|
|
||||||
map.scrollWheelZoom.disable();
|
|
||||||
|
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
@@ -38,9 +36,9 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
update() {
|
update() {
|
||||||
//console.log('update map with : ', this.address.addressMap.center)
|
console.log('update map with : ', this.address.addressMap.center)
|
||||||
marker.setLatLng(this.entity.addressMap.center);
|
marker.setLatLng(this.address.addressMap.center);
|
||||||
map.setView(this.entity.addressMap.center, 15);
|
map.setView(this.address.addressMap.center, 15);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
@@ -74,62 +74,69 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "AddressMore",
|
name: "AddressMore",
|
||||||
props: ['entity'],
|
props: ['address'],
|
||||||
computed: {
|
computed: {
|
||||||
floor: {
|
floor: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.floor = value;
|
console.log('value', value);
|
||||||
|
this.address.floor = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.floor;
|
return this.address.floor;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
corridor: {
|
corridor: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.corridor = value;
|
console.log('value', value);
|
||||||
|
this.address.corridor = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.corridor;
|
return this.address.corridor;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
steps: {
|
steps: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.steps = value;
|
console.log('value', value);
|
||||||
|
this.address.steps = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.steps;
|
return this.address.steps;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
flat: {
|
flat: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.flat = value;
|
console.log('value', value);
|
||||||
|
this.address.flat = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.flat;
|
return this.address.flat;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buildingName: {
|
buildingName: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.buildingName = value;
|
console.log('value', value);
|
||||||
|
this.address.buildingName = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.buildingName;
|
return this.address.buildingName;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
extra: {
|
extra: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.extra = value;
|
console.log('value', value);
|
||||||
|
this.address.extra = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.extra;
|
return this.address.extra;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
distribution: {
|
distribution: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.distribution = value;
|
console.log('value', value);
|
||||||
|
this.address.distribution = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.distribution;
|
return this.address.distribution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ import VueMultiselect from 'vue-multiselect';
|
|||||||
export default {
|
export default {
|
||||||
name: 'AddressSelection',
|
name: 'AddressSelection',
|
||||||
components: { VueMultiselect },
|
components: { VueMultiselect },
|
||||||
props: ['entity', 'updateMapCenter'],
|
props: ['address', 'updateMapCenter'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: null
|
value: null
|
||||||
@@ -55,28 +55,28 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
writeNewAddress() {
|
writeNewAddress() {
|
||||||
return this.entity.selected.writeNew.address;
|
return this.address.writeNewAddress;
|
||||||
},
|
},
|
||||||
writeNewPostalCode() {
|
writeNewPostalCode() {
|
||||||
return this.entity.selected.writeNew.postCode;
|
return this.address.writeNewPostalCode;
|
||||||
},
|
},
|
||||||
addresses() {
|
addresses() {
|
||||||
return this.entity.loaded.addresses;
|
return this.address.loaded.addresses;
|
||||||
},
|
},
|
||||||
street: {
|
street: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.street = value;
|
this.address.street = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.street;
|
return this.address.street;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
streetNumber: {
|
streetNumber: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.address.streetNumber = value;
|
this.address.streetNumber = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.address.streetNumber;
|
return this.address.streetNumber;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -85,13 +85,13 @@ export default {
|
|||||||
return value.streetNumber === undefined ? value.street : `${value.streetNumber}, ${value.street}`
|
return value.streetNumber === undefined ? value.street : `${value.streetNumber}, ${value.street}`
|
||||||
},
|
},
|
||||||
selectAddress(value) {
|
selectAddress(value) {
|
||||||
this.entity.selected.address = value;
|
this.address.selected.address = value;
|
||||||
this.entity.selected.address.street = value.street;
|
this.address.street = value.street;
|
||||||
this.entity.selected.address.streetNumber = value.streetNumber;
|
this.address.streetNumber = value.streetNumber;
|
||||||
this.updateMapCenter(value.point);
|
this.updateMapCenter(value.point);
|
||||||
},
|
},
|
||||||
addAddress() {
|
addAddress() {
|
||||||
this.entity.selected.writeNew.address = true;
|
this.address.writeNewAddress = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -12,13 +12,13 @@
|
|||||||
:placeholder="$t('select_city')"
|
:placeholder="$t('select_city')"
|
||||||
:taggable="true"
|
:taggable="true"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
@tag="addPostcode"
|
@tag="addPostalCode"
|
||||||
:tagPlaceholder="$t('create_postal_code')"
|
:tagPlaceholder="$t('create_postal_code')"
|
||||||
:options="cities">
|
:options="cities">
|
||||||
</VueMultiselect>
|
</VueMultiselect>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="custom-postcode row g-1" v-if="writeNewPostcode">
|
<div class="custom-postcode row g-1" v-if="writeNewPostalCode">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input class="form-control"
|
<input class="form-control"
|
||||||
@@ -48,34 +48,33 @@ import VueMultiselect from 'vue-multiselect';
|
|||||||
export default {
|
export default {
|
||||||
name: 'CitySelection',
|
name: 'CitySelection',
|
||||||
components: { VueMultiselect },
|
components: { VueMultiselect },
|
||||||
props: ['entity', 'focusOnAddress'],
|
props: ['address', 'getReferenceAddresses', 'focusOnAddress'],
|
||||||
emits: ['getReferenceAddresses'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: null
|
value: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
writeNewPostcode() {
|
writeNewPostalCode() {
|
||||||
return this.entity.selected.writeNew.postcode;
|
return this.address.writeNewPostalCode;
|
||||||
},
|
},
|
||||||
cities() {
|
cities() {
|
||||||
return this.entity.loaded.cities;
|
return this.address.loaded.cities;
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.postcode.name = value;
|
this.address.newPostalCode.name = value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.postcode.name;
|
return this.address.newPostalCode.name;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
code: {
|
code: {
|
||||||
set(value) {
|
set(value) {
|
||||||
this.entity.selected.postcode.code= value;
|
this.address.newPostalCode.code= value;
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.entity.selected.postcode.code;
|
return this.address.newPostalCode.code;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -84,14 +83,14 @@ export default {
|
|||||||
return `${value.code}-${value.name}`
|
return `${value.code}-${value.name}`
|
||||||
},
|
},
|
||||||
selectCity(value) {
|
selectCity(value) {
|
||||||
this.entity.selected.city = value;
|
this.address.selected.city = value;
|
||||||
this.entity.selected.postcode.name = value.name;
|
this.address.newPostalCode.name = value.name;
|
||||||
this.entity.selected.postcode.code = value.code;
|
this.address.newPostalCode.code = value.code;
|
||||||
this.$emit('getReferenceAddresses', value);
|
this.getReferenceAddresses(value);
|
||||||
this.focusOnAddress();
|
this.focusOnAddress();
|
||||||
},
|
},
|
||||||
addPostcode() {
|
addPostalCode() {
|
||||||
this.entity.selected.writeNew.postcode = true;
|
this.address.writeNewPostalCode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
<div class="my-1">
|
<div class="my-1">
|
||||||
<label class="col-form-label" for="countrySelect">{{ $t('country') }}</label>
|
<label class="col-form-label" for="countrySelect">{{ $t('country') }}</label>
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
id="countrySelect"
|
|
||||||
label="name"
|
|
||||||
track-by="id"
|
|
||||||
v-bind:custom-label="transName"
|
|
||||||
v-bind:placeholder="$t('select_country')"
|
|
||||||
v-bind:options="sortedCountries"
|
|
||||||
v-model="value"
|
v-model="value"
|
||||||
|
id="countrySelect"
|
||||||
|
track-by="id"
|
||||||
|
label="name"
|
||||||
|
:custom-label="transName"
|
||||||
|
:placeholder="$t('select_country')"
|
||||||
|
:options="countries"
|
||||||
@select="selectCountry">
|
@select="selectCountry">
|
||||||
</VueMultiselect>
|
</VueMultiselect>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,47 +20,43 @@ import VueMultiselect from 'vue-multiselect';
|
|||||||
export default {
|
export default {
|
||||||
name: 'CountrySelection',
|
name: 'CountrySelection',
|
||||||
components: { VueMultiselect },
|
components: { VueMultiselect },
|
||||||
props: ['context', 'entity'],
|
props: ['address', 'getCities'],
|
||||||
emits: ['getCities'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
value: this.selectCountryByCode(
|
edit: window.mode === 'edit',
|
||||||
this.context.edit ? this.entity.selected.country.code : 'FR'
|
defaultCountry: this.edit ? this.$store.state.editAddress.country.code : 'FR',
|
||||||
)
|
value: this.address.loaded.countries.filter(c => c.countryCode === this.defaultCountry)[0]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
sortedCountries() {
|
|
||||||
//console.log('sorted countries');
|
|
||||||
const countries = this.entity.loaded.countries;
|
|
||||||
let sortedCountries = [];
|
|
||||||
sortedCountries.push(...countries.filter(c => c.countryCode === 'FR'))
|
|
||||||
sortedCountries.push(...countries.filter(c => c.countryCode === 'BE'))
|
|
||||||
sortedCountries.push(...countries.filter(c => c.countryCode !== 'FR').filter(c => c.countryCode !== 'BE'))
|
|
||||||
return sortedCountries;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.init();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
|
this.value = this.edit ?
|
||||||
|
this.address.loaded.countries.filter(c => c.countryCode === this.$store.state.editAddress.country.code)[0]:
|
||||||
|
this.address.loaded.countries.filter(c => c.countryCode === 'FR')[0]
|
||||||
if (this.value !== undefined) {
|
if (this.value !== undefined) {
|
||||||
this.selectCountry(this.value);
|
this.selectCountry(this.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectCountryByCode(countryCode) {
|
|
||||||
return this.entity.loaded.countries.filter(c => c.countryCode === countryCode)[0];
|
|
||||||
},
|
|
||||||
transName ({ name }) {
|
transName ({ name }) {
|
||||||
return name.fr //TODO multilang
|
return name.fr //TODO multilang
|
||||||
},
|
},
|
||||||
selectCountry(value) {
|
selectCountry(value) {
|
||||||
//console.log('select country', value);
|
this.address.selected.country = value;
|
||||||
this.entity.selected.country = value;
|
this.getCities(value);
|
||||||
this.$emit('getCities', value);
|
},
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
countries() {
|
||||||
|
const countries = this.address.loaded.countries;
|
||||||
|
let orderedCountries = [];
|
||||||
|
orderedCountries.push(...countries.filter(c => c.countryCode === 'FR'))
|
||||||
|
orderedCountries.push(...countries.filter(c => c.countryCode === 'BE'))
|
||||||
|
orderedCountries.push(...countries.filter(c => c.countryCode !== 'FR').filter(c => c.countryCode !== 'BE'))
|
||||||
|
return orderedCountries;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,160 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="address-form">
|
|
||||||
|
|
||||||
<!-- Not display in modal -->
|
|
||||||
<div v-if="insideModal == false" class="loading">
|
|
||||||
<i v-if="flag.loading" class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>
|
|
||||||
<span class="sr-only">Loading...</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4 class="h3">{{ $t('select_an_address_title') }}</h4>
|
|
||||||
<div class="row my-3">
|
|
||||||
<div class="col-lg-6">
|
|
||||||
|
|
||||||
<div class="form-check">
|
|
||||||
<input type="checkbox"
|
|
||||||
class="form-check-input"
|
|
||||||
id="isNoAddress"
|
|
||||||
v-model="isNoAddress"
|
|
||||||
v-bind:value="value" />
|
|
||||||
<label class="form-check-label" for="isNoAddress">
|
|
||||||
{{ $t('isNoAddress') }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<country-selection
|
|
||||||
v-bind:context="context"
|
|
||||||
v-bind:entity="entity"
|
|
||||||
@getCities="$emit('getCities', selected.country)">
|
|
||||||
</country-selection>
|
|
||||||
|
|
||||||
<city-selection
|
|
||||||
v-bind:entity="entity"
|
|
||||||
v-bind:focusOnAddress="focusOnAddress"
|
|
||||||
@getReferenceAddresses="$emit('getReferenceAddresses', selected.city)">
|
|
||||||
</city-selection>
|
|
||||||
|
|
||||||
<address-selection v-if="!isNoAddress"
|
|
||||||
v-bind:entity="entity"
|
|
||||||
v-bind:updateMapCenter="updateMapCenter">
|
|
||||||
</address-selection>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 mt-3 mt-lg-0">
|
|
||||||
|
|
||||||
<address-map
|
|
||||||
v-bind:entity="entity"
|
|
||||||
ref="addressMap">
|
|
||||||
</address-map>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<address-more v-if="!isNoAddress"
|
|
||||||
v-bind:entity="entity">
|
|
||||||
</address-more>
|
|
||||||
|
|
||||||
<!-- Not display in modal -->
|
|
||||||
<ul v-if="insideModal == false"
|
|
||||||
class="record_actions sticky-form-buttons">
|
|
||||||
<li class="cancel">
|
|
||||||
<a class="btn btn-cancel" v-bind:href="context.backUrl">
|
|
||||||
{{ $t('back_to_the_list') }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-cancel change-icon" @click="flag.showPane = true; flag.editPane = false;">
|
|
||||||
{{ $t('action.cancel') }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-update" @click.prevent="$emit('closeEditPane')">
|
|
||||||
{{ $t('action.valid_and_see')}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import CountrySelection from './AddAddress/CountrySelection';
|
|
||||||
import CitySelection from './AddAddress/CitySelection';
|
|
||||||
import AddressSelection from './AddAddress/AddressSelection';
|
|
||||||
import AddressMap from './AddAddress/AddressMap';
|
|
||||||
import AddressMore from './AddAddress/AddressMore'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "EditAddressPane",
|
|
||||||
components: {
|
|
||||||
CountrySelection,
|
|
||||||
CitySelection,
|
|
||||||
AddressSelection,
|
|
||||||
AddressMap,
|
|
||||||
AddressMore
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
'context',
|
|
||||||
'options',
|
|
||||||
'default',
|
|
||||||
'flag',
|
|
||||||
'entity',
|
|
||||||
'errorMsg',
|
|
||||||
'insideModal'
|
|
||||||
],
|
|
||||||
emits: ['closeEditPane', 'getCities', 'getReferenceAddresses'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
value: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
address() {
|
|
||||||
return this.entity.address;
|
|
||||||
},
|
|
||||||
loaded() {
|
|
||||||
return this.entity.loaded;
|
|
||||||
},
|
|
||||||
selected() {
|
|
||||||
return this.entity.selected;
|
|
||||||
},
|
|
||||||
addressMap() {
|
|
||||||
return this.entity.addressMap;
|
|
||||||
},
|
|
||||||
isNoAddress: {
|
|
||||||
set(value) {
|
|
||||||
console.log('isNoAddress value', value);
|
|
||||||
this.entity.selected.isNoAddress = value;
|
|
||||||
},
|
|
||||||
get() {
|
|
||||||
return this.entity.selected.isNoAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
focusOnAddress() {
|
|
||||||
const addressSelector = document.getElementById('addressSelector');
|
|
||||||
addressSelector.focus();
|
|
||||||
},
|
|
||||||
updateMapCenter(point) {
|
|
||||||
//console.log('point', point);
|
|
||||||
this.addressMap.center[0] = point.coordinates[1]; // TODO use reverse()
|
|
||||||
this.addressMap.center[1] = point.coordinates[0];
|
|
||||||
this.$refs.addressMap.update(); // cast child methods
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
|
|
||||||
div.address-form {
|
|
||||||
h4.h3 {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
div#address_map {
|
|
||||||
height: 400px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@@ -1,43 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<component :is="component" class="chill-entity entity-address my-3">
|
<div class="address multiline">
|
||||||
|
|
||||||
<component :is="component" class="address" :class="multiline">
|
|
||||||
<p v-if="address.text"
|
<p v-if="address.text"
|
||||||
class="street">
|
class="street">
|
||||||
{{ address.text }},
|
{{ address.text }}
|
||||||
</p>
|
</p>
|
||||||
<p v-if="address.postcode"
|
<p v-if="address.postcode"
|
||||||
class="postcode">
|
class="postcode">
|
||||||
{{ address.postcode.code }} {{ address.postcode.name }}
|
{{ address.postcode.name }}
|
||||||
</p>
|
</p>
|
||||||
<p v-if="address.country"
|
<p v-if="address.country"
|
||||||
class="country">
|
class="country">
|
||||||
{{ address.country.name.fr }}
|
{{ address.country.name.fr }}
|
||||||
</p>
|
</p>
|
||||||
</component>
|
|
||||||
|
|
||||||
<div v-if="isMultiline">
|
|
||||||
<div v-if="address.floor">
|
|
||||||
<span class="floor">
|
|
||||||
<b>{{ $t('floor') }}</b>: {{ address.floor }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.corridor">
|
|
||||||
<span class="corridor">
|
|
||||||
<b>{{ $t('corridor') }}</b>: {{ address.corridor }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.steps">
|
|
||||||
<span class="steps">
|
|
||||||
<b>{{ $t('steps') }}</b>: {{ address.steps }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="address.flat">
|
|
||||||
<span class="flat">
|
|
||||||
<b>{{ $t('flat') }}</b>: {{ address.flat }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div v-if="address.floor">
|
<div v-if="address.floor">
|
||||||
<span class="floor">
|
<span class="floor">
|
||||||
<b>{{ $t('floor') }}</b>: {{ address.floor }}
|
<b>{{ $t('floor') }}</b>: {{ address.floor }}
|
||||||
@@ -74,39 +49,16 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</component>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ShowAddress',
|
name: 'ShowAddress',
|
||||||
props: {
|
props: ['address'],
|
||||||
address: {
|
data() {
|
||||||
type: Object
|
return {
|
||||||
},
|
|
||||||
isMultiline: {
|
|
||||||
default: true,
|
|
||||||
type: Boolean
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
component(){
|
|
||||||
return this.isMultiline == true ? "div" : "span";
|
|
||||||
},
|
|
||||||
multiline(){
|
|
||||||
return this.isMultiline == true ? "multiline" : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
p {
|
|
||||||
&:after {
|
|
||||||
content: " ";
|
|
||||||
margin-right: 0.3em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@@ -1,101 +0,0 @@
|
|||||||
<template>
|
|
||||||
|
|
||||||
<div v-if="insideModal == false" class="loading">
|
|
||||||
<i v-if="flag.loading" class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>
|
|
||||||
<span class="sr-only">{{ $t('loading') }}</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="errorMsg && errorMsg.length > 0" class="alert alert-danger">
|
|
||||||
{{ errorMsg }}
|
|
||||||
</div>
|
|
||||||
<div v-if="flag.success" class="alert alert-success">
|
|
||||||
{{ $t(getSuccessText) }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<show-address :address="address"></show-address>
|
|
||||||
|
|
||||||
<div v-if="showDateFrom" class='address-valid date-since'>
|
|
||||||
<h3>{{ $t(getValidFromDateText) }}</h3>
|
|
||||||
<div class="input-group mb-3">
|
|
||||||
<span class="input-group-text" id="validFrom"><i class="fa fa-fw fa-calendar"></i></span>
|
|
||||||
<input type="date" class="form-control form-control-lg" name="validFrom"
|
|
||||||
v-bind:placeholder="$t(getValidFromDateText)"
|
|
||||||
v-model="validFrom"
|
|
||||||
aria-describedby="validFrom"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul v-if="insideModal == false"
|
|
||||||
class="record_actions sticky-form-buttons">
|
|
||||||
<li class="cancel">
|
|
||||||
<a class="btn btn-cancel" v-bind:href="context.backUrl">
|
|
||||||
{{ $t('back_to_the_list') }}</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a @click.prevent="$emit('openEditPane')"
|
|
||||||
class="btn btn-update">
|
|
||||||
{{ $t('action.edit')}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="btn btn-save"
|
|
||||||
@click.prevent="$emit('submitAddress')">
|
|
||||||
{{ $t('action.save')}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { dateToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js';
|
|
||||||
import ShowAddress from './ShowAddress.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'ShowAddressPane',
|
|
||||||
components: {
|
|
||||||
ShowAddress
|
|
||||||
},
|
|
||||||
props: [
|
|
||||||
'context',
|
|
||||||
'options',
|
|
||||||
'default',
|
|
||||||
'flag',
|
|
||||||
'entity',
|
|
||||||
'valid',
|
|
||||||
'errorMsg',
|
|
||||||
'insideModal'
|
|
||||||
],
|
|
||||||
emits: ['openEditPane', 'submitAddress'], //?
|
|
||||||
computed: {
|
|
||||||
address() {
|
|
||||||
return this.entity.address;
|
|
||||||
},
|
|
||||||
validFrom: {
|
|
||||||
set(value) {
|
|
||||||
this.valid.from = ISOToDate(value);
|
|
||||||
},
|
|
||||||
get() {
|
|
||||||
return dateToISO(this.valid.from);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getValidFromDateText() {
|
|
||||||
return (this.context.entity.type === 'household') ? 'move_date' : 'validFrom';
|
|
||||||
},
|
|
||||||
getSuccessText() {
|
|
||||||
switch (this.context.entity.type) {
|
|
||||||
/*
|
|
||||||
case 'household':
|
|
||||||
return (this.context.edit) ? 'household_address_edit_success' : 'household_address_move_success';
|
|
||||||
case 'person':
|
|
||||||
return (this.context.edit) ? 'person_address_edit_success' : 'person_address_creation_success';
|
|
||||||
*/
|
|
||||||
default:
|
|
||||||
return (this.context.edit) ? 'address_edit_success' : 'address_new_success';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
showDateFrom() {
|
|
||||||
return !this.context.edit && !this.options.hideDateFrom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
@@ -1,55 +0,0 @@
|
|||||||
const addressMessages = {
|
|
||||||
fr: {
|
|
||||||
add_an_address_title: 'Créer une adresse',
|
|
||||||
edit_an_address_title: 'Modifier une adresse',
|
|
||||||
create_a_new_address: 'Créer une nouvelle adresse',
|
|
||||||
edit_address: 'Modifier l\'adresse',
|
|
||||||
select_an_address_title: 'Sélectionner une adresse',
|
|
||||||
fill_an_address: 'Compléter l\'adresse',
|
|
||||||
select_country: 'Choisir le pays',
|
|
||||||
country: 'Pays',
|
|
||||||
select_city: 'Choisir une localité',
|
|
||||||
city: 'Localité',
|
|
||||||
other_city: 'Autre localité',
|
|
||||||
select_address: 'Choisir une adresse',
|
|
||||||
address: 'Adresse',
|
|
||||||
other_address: 'Autre adresse',
|
|
||||||
create_address: 'Adresse inconnue. Cliquez ici pour créer une nouvelle adresse',
|
|
||||||
isNoAddress: 'Pas d\'adresse complète',
|
|
||||||
street: 'Nom de rue',
|
|
||||||
streetNumber: 'Numéro',
|
|
||||||
floor: 'Étage',
|
|
||||||
corridor: 'Couloir',
|
|
||||||
steps: 'Escalier',
|
|
||||||
flat: 'Appartement',
|
|
||||||
buildingName: 'Nom du bâtiment',
|
|
||||||
extra: 'Complément d\'adresse',
|
|
||||||
distribution: 'Service particulier de distribution',
|
|
||||||
create_postal_code: 'Localité inconnue. Cliquez ici pour créer une nouvelle localité',
|
|
||||||
postalCode_name: 'Nom',
|
|
||||||
postalCode_code: 'Code postal',
|
|
||||||
date: 'Date de la nouvelle adresse',
|
|
||||||
validFrom: 'Date de la nouvelle adresse',
|
|
||||||
back_to_the_list: 'Retour à la liste',
|
|
||||||
loading: 'chargement en cours...',
|
|
||||||
address_new_success: 'La nouvelle adresse est enregistrée',
|
|
||||||
address_edit_success: 'L\'adresse a été mise à jour',
|
|
||||||
|
|
||||||
// person specific
|
|
||||||
add_an_address_to_person: 'Ajouter l\'adresse à la personne',
|
|
||||||
person_address_creation_success: 'La nouvelle adresse de la personne est enregistrée',
|
|
||||||
person_address_edit_success: 'L\'adresse de la personne a été mise à jour',
|
|
||||||
|
|
||||||
// household specific
|
|
||||||
move_date: 'Date du déménagement',
|
|
||||||
select_a_existing_address: 'Sélectionner une adresse existante',
|
|
||||||
add_an_address_to_household: 'Enregistrer',
|
|
||||||
household_address_move_success: 'La nouvelle adresse du ménage est enregistrée',
|
|
||||||
household_address_edit_success: 'L\'adresse du ménage a été mise à jour',
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
addressMessages
|
|
||||||
};
|
|
@@ -1,13 +1,16 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue';
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
|
import { addressMessages } from './js/i18n'
|
||||||
import { addressMessages } from './i18n';
|
import { store } from './store'
|
||||||
|
|
||||||
const i18n = _createI18n( addressMessages );
|
import App from './App.vue';
|
||||||
|
|
||||||
|
const i18n = _createI18n(addressMessages);
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app></app>`,
|
template: `<app></app>`,
|
||||||
})
|
})
|
||||||
|
.use(store)
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
.component('app', App)
|
.component('app', App)
|
||||||
.mount('#address');
|
.mount('#address');
|
||||||
|
@@ -0,0 +1,42 @@
|
|||||||
|
const addressMessages = {
|
||||||
|
fr: {
|
||||||
|
add_an_address_title: 'Créer une adresse',
|
||||||
|
edit_an_address_title: 'Modifier une adresse',
|
||||||
|
create_a_new_address: 'Créer une nouvelle adresse',
|
||||||
|
edit_address: 'Modifier l\'adresse',
|
||||||
|
select_an_address_title: 'Sélectionner une adresse',
|
||||||
|
fill_an_address: 'Compléter l\'adresse',
|
||||||
|
select_country: 'Choisir le pays',
|
||||||
|
country: 'Pays',
|
||||||
|
select_city: 'Choisir une localité',
|
||||||
|
city: 'Localité',
|
||||||
|
other_city: 'Autre localité',
|
||||||
|
select_address: 'Choisir une adresse',
|
||||||
|
address: 'Adresse',
|
||||||
|
other_address: 'Autre adresse',
|
||||||
|
create_address: 'Adresse inconnue. Cliquez ici pour créer une nouvelle adresse',
|
||||||
|
isNoAddress: 'Pas d\'adresse complète',
|
||||||
|
street: 'Nom de rue',
|
||||||
|
streetNumber: 'Numéro',
|
||||||
|
floor: 'Étage',
|
||||||
|
corridor: 'Couloir',
|
||||||
|
steps: 'Escalier',
|
||||||
|
flat: 'Appartement',
|
||||||
|
buildingName: 'Nom du bâtiment',
|
||||||
|
extra: 'Complément d\'adresse',
|
||||||
|
distribution: 'Service particulier de distribution',
|
||||||
|
create_postal_code: 'Localité inconnue. Cliquez ici pour créer une nouvelle localité',
|
||||||
|
postalCode_name: 'Nom',
|
||||||
|
postalCode_code: 'Code postal',
|
||||||
|
date: 'Date de la nouvelle adresse',
|
||||||
|
add_an_address_to_person: 'Ajouter l\'adresse à la personne',
|
||||||
|
validFrom: 'Date de la nouvelle adresse',
|
||||||
|
back_to_the_list: 'Retour à la liste',
|
||||||
|
person_address_creation_success: 'La nouvelle adresse de la personne est enregistrée',
|
||||||
|
loading: 'chargement en cours...'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
addressMessages
|
||||||
|
};
|
@@ -1,14 +0,0 @@
|
|||||||
import 'es6-promise/auto';
|
|
||||||
import { createStore } from 'vuex';
|
|
||||||
|
|
||||||
const debug = process.env.NODE_ENV !== 'production';
|
|
||||||
|
|
||||||
const store = createStore({
|
|
||||||
strict: debug,
|
|
||||||
state: {},
|
|
||||||
getters: {},
|
|
||||||
mutations: {},
|
|
||||||
actions: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
export { store };
|
|
@@ -0,0 +1,158 @@
|
|||||||
|
import 'es6-promise/auto';
|
||||||
|
import { createStore } from 'vuex';
|
||||||
|
|
||||||
|
import { patchAddress, postAddress, postPostalCode, postAddressToPerson, getAddress } from '../api'
|
||||||
|
|
||||||
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
strict: debug,
|
||||||
|
state: {
|
||||||
|
address: {},
|
||||||
|
editAddress: {}, //TODO or should be address?
|
||||||
|
person: {},
|
||||||
|
errorMsg: [],
|
||||||
|
loading: false,
|
||||||
|
success: false
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
catchError(state, error) {
|
||||||
|
state.errorMsg.push(error);
|
||||||
|
},
|
||||||
|
addAddress(state, address) {
|
||||||
|
console.log('@M addAddress address', address);
|
||||||
|
state.address = address;
|
||||||
|
},
|
||||||
|
updateAddress(state, address) {
|
||||||
|
console.log('@M updateAddress address', address);
|
||||||
|
state.address = address;
|
||||||
|
},
|
||||||
|
addAddressToPerson(state, person) {
|
||||||
|
console.log('@M addAddressToPerson person', person);
|
||||||
|
state.person = person;
|
||||||
|
},
|
||||||
|
addDateToAddress(state, validFrom) {
|
||||||
|
console.log('@M addDateToAddress address.validFrom', validFrom);
|
||||||
|
state.validFrom = validFrom;
|
||||||
|
},
|
||||||
|
getEditAddress(state, address) {
|
||||||
|
console.log('@M getEditAddress address', address);
|
||||||
|
state.editAddress = address;
|
||||||
|
},
|
||||||
|
setLoading(state, b) {
|
||||||
|
state.loading = b;
|
||||||
|
},
|
||||||
|
setSuccess(state, b) {
|
||||||
|
state.success = b;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addAddress({ commit }, payload) {
|
||||||
|
console.log('@A addAddress payload', payload);
|
||||||
|
commit('setLoading', true);
|
||||||
|
if('newPostalCode' in payload){
|
||||||
|
let postalCodeBody = payload.newPostalCode;
|
||||||
|
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
||||||
|
postPostalCode(postalCodeBody)
|
||||||
|
.then(postalCode => {
|
||||||
|
let body = payload;
|
||||||
|
body.postcode = {'id': postalCode.id},
|
||||||
|
postAddress(body)
|
||||||
|
.then(address => new Promise((resolve, reject) => {
|
||||||
|
commit('addAddress', address);
|
||||||
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
postAddress(payload)
|
||||||
|
.then(address => new Promise((resolve, reject) => {
|
||||||
|
commit('addAddress', address);
|
||||||
|
resolve();
|
||||||
|
commit('setLoading', false);
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addDateToAddressAndAddressToPerson({ commit }, payload) {
|
||||||
|
console.log('@A addDateToAddressAndAddressToPerson payload', payload);
|
||||||
|
commit('setLoading', true);
|
||||||
|
patchAddress(payload.addressId, payload.body)
|
||||||
|
.then(address => new Promise((resolve, reject) => {
|
||||||
|
commit('addDateToAddress', address.validFrom);
|
||||||
|
resolve();
|
||||||
|
}).then(
|
||||||
|
postAddressToPerson(payload.personId, payload.addressId)
|
||||||
|
.then(person => new Promise((resolve, reject) => {
|
||||||
|
commit('addAddressToPerson', person);
|
||||||
|
commit('setLoading', false);
|
||||||
|
commit('setSuccess', true);
|
||||||
|
window.location.assign(payload.backUrl);
|
||||||
|
resolve();
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
|
})
|
||||||
|
))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
commit('setLoading', false);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateAddress({ commit }, payload) {
|
||||||
|
console.log('@A updateAddress payload', payload);
|
||||||
|
|
||||||
|
if('newPostalCode' in payload.newAddress){ // TODO change the condition because it writes new postal code in edit mode now: !writeNewPostalCode
|
||||||
|
let postalCodeBody = payload.newAddress.newPostalCode;
|
||||||
|
postalCodeBody = Object.assign(postalCodeBody, {'origin': 3});
|
||||||
|
postPostalCode(postalCodeBody)
|
||||||
|
.then(postalCode => {
|
||||||
|
let body = payload.newAddress;
|
||||||
|
body.postcode = {'id': postalCode.id },
|
||||||
|
patchAddress(payload.addressId, body)
|
||||||
|
.then(address => new Promise((resolve, reject) => {
|
||||||
|
commit('updateAddress', address);
|
||||||
|
resolve();
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
patchAddress(payload.addressId, payload.newAddress)
|
||||||
|
.then(address => new Promise((resolve, reject) => {
|
||||||
|
commit('updateAddress', address);
|
||||||
|
resolve();
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getEditAddress({ commit }, payload) {
|
||||||
|
console.log('@A getEditAddress payload', payload);
|
||||||
|
|
||||||
|
getAddress(payload).then(address => new Promise((resolve, reject) => {
|
||||||
|
commit('getEditAddress', address);
|
||||||
|
resolve();
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
commit('catchError', error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export { store };
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user