mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 09:18:24 +00:00 
			
		
		
		
	Compare commits
	
		
			11 Commits
		
	
	
		
			fixtures/f
			...
			102_activi
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| d248d7e8af | |||
| d58c0efae9 | |||
| 1283ea4010 | |||
| 3f01986234 | |||
| f751d6abca | |||
| f4962f86a0 | |||
| 1db69cdfe9 | |||
| f41e27d75a | |||
| 158effe232 | |||
| 8b30652b6b | |||
| 39e8af48b4 | 
| @@ -5,13 +5,11 @@ image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4 | ||||
| cache: | ||||
|   paths: | ||||
|     - tests/app/vendor/ | ||||
|     - .composer | ||||
|  | ||||
| before_script: | ||||
|   # 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;" | ||||
|   # Install and run Composer | ||||
|   - mkdir -p $COMPOSER_HOME | ||||
|   - curl -sS https://getcomposer.org/installer | php | ||||
|   - php -d memory_limit=2G composer.phar install | ||||
|   - php tests/app/bin/console doctrine:migrations:migrate -n | ||||
| @@ -36,10 +34,6 @@ variables: | ||||
|   REDIS_HOST: redis | ||||
|   REDIS_PORT: 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 | ||||
|   | ||||
| @@ -20,8 +20,7 @@ | ||||
|             "Chill\\ReportBundle\\": "src/Bundle/ChillReportBundle", | ||||
|             "Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle", | ||||
|             "Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle", | ||||
|             "Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src", | ||||
|             "Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle" | ||||
|             "Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src" | ||||
|         } | ||||
|     }, | ||||
|     "autoload-dev": { | ||||
| @@ -91,4 +90,4 @@ | ||||
|     "config": { | ||||
|         "bin-dir": "bin" | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -28,7 +28,7 @@ Then, render the pagination using the dedicated twig function. | ||||
|  | ||||
| .. code-block:: html+twig | ||||
|  | ||||
|    {% extends "@ChillPerson/Person/layout.html.twig"  %} | ||||
|    {% extends "ChillPersonBundle::layout.html.twig"  %} | ||||
|  | ||||
|    {% block title 'Item list'|trans %} | ||||
|  | ||||
|   | ||||
| @@ -149,7 +149,7 @@ It proposes a new block : | ||||
|  | ||||
|   * 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. | ||||
|   | ||||
| @@ -1,105 +1,14 @@ | ||||
| // Access to Bootstrap variables and mixins | ||||
| @import '~ChillMainAssets/module/bootstrap/shared'; | ||||
|  | ||||
| // activity creation first step: select type page | ||||
| div.new-activity-select-type { | ||||
|    div.activity-row { | ||||
|       display: flex; | ||||
|       flex-direction: row; | ||||
|       flex-wrap: wrap; | ||||
|       justify-content: center; | ||||
|       gap: 12px; | ||||
| //@import '~ChillMainSass/custom/mixins/entity'; | ||||
|  | ||||
|       div.bloc { | ||||
|          width: 200px; | ||||
|          align-self: flex-end; | ||||
|          height: 140px; | ||||
|          display: flex; | ||||
|          justify-content: center; | ||||
|          align-items: center; | ||||
|       } | ||||
|    } | ||||
| } | ||||
| //.chill-entity.chill-entity__activity-reason { | ||||
| //    @include entity($chill-pink, white); | ||||
| //} | ||||
|  | ||||
| // exceptions for flex-table in list-records | ||||
| div.activity-list { | ||||
|    div.flex-table { | ||||
|       div.item-bloc { | ||||
|          div.item-row.main { | ||||
|             div.item-col { | ||||
|                &:first-child { | ||||
|                   flex-basis: 27%; | ||||
|                } | ||||
|                ul.list-content { | ||||
|                   li.social-issues, li.social-actions { | ||||
|                      .badge-primary { | ||||
|                         font-variant: small-caps; | ||||
|                         font-weight: bold; | ||||
|                         font-size: 88%; | ||||
|                         margin-bottom: 0.2em; | ||||
|                      } | ||||
|                   } | ||||
|                   li.social-issues .badge-primary { | ||||
|                      background-color: $orange; | ||||
|                   } | ||||
|                   li.social-actions .badge-primary { | ||||
|                      background-color: $green; | ||||
|                   } | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|          div.item-row.details { | ||||
|             flex-direction: row; | ||||
|             & > div.item-col { | ||||
|                justify-content: flex-start; | ||||
|                align-self: center; | ||||
|                &:nth-child(1) { | ||||
|                   flex-grow: 1; flex-shrink: 0; flex-basis: 30%; | ||||
|                } | ||||
|                &:nth-child(2) { | ||||
|                   flex-grow: 0; flex-shrink: 1; flex-basis: 70%; | ||||
|                } | ||||
|  | ||||
|                &:only-child { | ||||
|                   flex-grow: 0; flex-shrink: 0; flex-basis: 100%; | ||||
|                   & > div.concerned-groups { | ||||
|                      flex-grow: 0; flex-shrink: 0; flex-basis: 100%; | ||||
|                      display: flex; | ||||
|                      flex-direction: column; // TODO pas fini | ||||
|                      div.group { | ||||
|                         flex-grow: 1; flex-shrink: 0; flex-basis: 30%; | ||||
|                         h4 {} | ||||
|                         ul.list-content { | ||||
|                            li { | ||||
|                               display: inline; | ||||
|                            } | ||||
|                         } | ||||
|                      } | ||||
|                   } | ||||
|                } | ||||
|             } | ||||
|             div.concerned-groups { | ||||
|                font-size: 85%; | ||||
|                h4 { | ||||
|                   text-transform: uppercase; | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|          ul.list-content { | ||||
|             list-style-type: none; | ||||
|             padding-left: 1em; | ||||
|             margin: 0 0; | ||||
|             li { | ||||
|                margin-bottom: 0.2em; | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|       div.duration { | ||||
|          font-size: smaller; | ||||
|          padding-left: 1em; | ||||
|          margin-top: 1em; | ||||
|       } | ||||
|    } | ||||
| .activity { | ||||
|     //color: $chill-green; | ||||
| } | ||||
|  | ||||
| // exceptions for flex-bloc in concerned-groups | ||||
| @@ -113,7 +22,7 @@ div.flex-bloc.concerned-groups { | ||||
|          li { | ||||
|             margin-bottom: 0.2em; | ||||
|             a { | ||||
|                color: $white; | ||||
|                color: white; | ||||
|                cursor: pointer; | ||||
|                &:hover { | ||||
|                   color: #ffffffab; | ||||
| @@ -127,3 +36,97 @@ div.flex-bloc.concerned-groups { | ||||
|    } | ||||
| } | ||||
|  | ||||
| // exceptions for flex-table in list-records | ||||
| div.flex-table.list-records { | ||||
|    div.item-bloc { | ||||
|       div.item-row.main { | ||||
|          div.item-col { | ||||
|             &:first-child { | ||||
|                flex-basis: 27%; | ||||
|             } | ||||
|             ul.list-content { | ||||
|                li.social-issues, li.social-actions { | ||||
|                   .badge-primary { | ||||
|                      font-variant: small-caps; | ||||
|                      font-weight: bold; | ||||
|                      font-size: 88%; | ||||
|                      margin-bottom: 0.2em; | ||||
|                   } | ||||
|                } | ||||
|                li.social-issues .badge-primary { | ||||
|                   background-color: var(--chill-orange); | ||||
|                } | ||||
|                li.social-actions .badge-primary { | ||||
|                   background-color: var(--chill-green); | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|       div.item-row.details { | ||||
|          flex-direction: row; | ||||
|          & > div.item-col { | ||||
|             justify-content: flex-start; | ||||
|             align-self: center; | ||||
|             &:nth-child(1) { | ||||
|                flex-grow: 1; flex-shrink: 0; flex-basis: 30%; | ||||
|             } | ||||
|             &:nth-child(2) { | ||||
|                flex-grow: 0; flex-shrink: 1; flex-basis: 70%; | ||||
|             } | ||||
|  | ||||
|             &:only-child { | ||||
|                flex-grow: 0; flex-shrink: 0; flex-basis: 100%; | ||||
|                & > div.concerned-groups { | ||||
|                   flex-grow: 0; flex-shrink: 0; flex-basis: 100%; | ||||
|                   display: flex; | ||||
|                   flex-direction: column; // TODO pas fini | ||||
|                   div.group { | ||||
|                      flex-grow: 1; flex-shrink: 0; flex-basis: 30%; | ||||
|                      h4 {} | ||||
|                      ul.list-content { | ||||
|                         li { | ||||
|                            display: inline; | ||||
|                         } | ||||
|                      } | ||||
|                   } | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|          div.concerned-groups { | ||||
|             font-size: 85%; | ||||
|             h4 { | ||||
|                text-transform: uppercase; | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|       ul.list-content { | ||||
|          list-style-type: none; | ||||
|          padding-left: 1em; | ||||
|          margin: 0 0; | ||||
|          li { | ||||
|             margin-bottom: 0.2em; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|    div.duration { | ||||
|       font-size: smaller; | ||||
|       padding-left: 1em; | ||||
|       margin-top: 1em; | ||||
|    } | ||||
| } | ||||
|  | ||||
| div.activity-row { | ||||
|    display: flex; | ||||
|    flex-direction: row; | ||||
|    flex-wrap: wrap; | ||||
|    justify-content: center; | ||||
|    gap: 12px; | ||||
|    div.bloc { | ||||
|       width: 200px; | ||||
|       align-self: flex-end; | ||||
|       height: 140px; | ||||
|       display: flex; | ||||
|       justify-content: center; | ||||
|       align-items: center; | ||||
|    } | ||||
| } | ||||
|   | ||||
| @@ -60,10 +60,7 @@ | ||||
|                     <li> | ||||
|                         <a href="{{ _self.href(bloc.path, bloc.key, item.id) }}"> | ||||
|                             <span class="badge bg-primary"> | ||||
|                                 {{ item|chill_entity_render_box({ | ||||
|                                     'render': 'raw', | ||||
|                                     'addAltNames': false | ||||
|                                 }) }} | ||||
|                                 {{ item|chill_entity_render_box({'render': 'raw'}) }} | ||||
|                             </span> | ||||
|                         </a> | ||||
|                     </li> | ||||
| @@ -75,7 +72,7 @@ | ||||
|     {% endfor %} | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
|      | ||||
| {% if (with_display == 'row') %} | ||||
| <div class="concerned-groups"> | ||||
|     {% for bloc in blocs %} | ||||
| @@ -87,10 +84,7 @@ | ||||
|                 <li> | ||||
|                     <a href="{{ _self.href(bloc.path, bloc.key, item.id) }}"> | ||||
|                         <span class="badge bg-primary"> | ||||
|                             {{ item|chill_entity_render_box({ | ||||
|                                 'render': 'raw', | ||||
|                                 'addAltNames': false | ||||
|                             }) }} | ||||
|                             {{ item|chill_entity_render_box({'only_denomination': true}) }} | ||||
|                         </span> | ||||
|                     </a> | ||||
|                 </li> | ||||
|   | ||||
| @@ -1,163 +1,184 @@ | ||||
| <div class="activity-list context-{{ context }}"> | ||||
| {% set person_id = null %} | ||||
| {% if person %} | ||||
|     {% set person_id = person.id %} | ||||
| {% endif %} | ||||
|  | ||||
|     {% if activities|length == 0 %} | ||||
|         <p class="chill-no-data-statement"> | ||||
|             {{ "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> | ||||
|         </p> | ||||
| {% set accompanying_course_id = null %} | ||||
| {% if accompanyingCourse %} | ||||
|     {% set accompanying_course_id = accompanyingCourse.id %} | ||||
| {% endif %} | ||||
|  | ||||
|     {% else %} | ||||
|         <div class="flex-table"> | ||||
|             {% for activity in activities %} | ||||
|                 {% set t = activity.type %} | ||||
|                 <div class="item-bloc"> | ||||
|                     <div class="item-row main"> | ||||
|                         <div class="item-col"> | ||||
| <h2>{{ 'Activity list' |trans }}</h2> | ||||
|  | ||||
|                             {% if activity.date %} | ||||
|                                 <h3>{{ activity.date|format_date('long') }}</h3> | ||||
|                             {% endif %} | ||||
| {% if activities|length == 0 %} | ||||
|     <p class="chill-no-data-statement"> | ||||
|         {{ "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-create button-small"></a> | ||||
|     </p> | ||||
| {% else %} | ||||
|  | ||||
|                             <div class="duration"> | ||||
|                                 {% if t.durationTimeVisible > 0 %} | ||||
|                                     <p> | ||||
|                                         <i class="fa fa-fw fa-hourglass-end"></i> | ||||
|                                         {{ activity.durationTime|date('H:i') }} | ||||
|                                     </p> | ||||
|                                 {% endif %} | ||||
|                                 {% if activity.travelTime and t.travelTimeVisible %} | ||||
|                                     <p> | ||||
|                                         <i class="fa fa-fw fa-car"></i> | ||||
|                                         {{ activity.travelTime|date('H:i') }} | ||||
|                                     </p> | ||||
|                                 {% endif %} | ||||
|                             </div> | ||||
| <div class="flex-table list-records context-{{ context }}"> | ||||
|  | ||||
|                             {% if context == 'person' and activity.accompanyingPeriod is not empty %} | ||||
|                                 <div class="accompanyingPeriodLink" style="margin-top: 1rem"> | ||||
|                                     <a href="{{ chill_path_add_return_path( | ||||
|                                         "chill_person_accompanying_course_index", | ||||
|                                         { 'accompanying_period_id': activity.accompanyingPeriod.id } | ||||
|                                     ) }}"> | ||||
|                                         <i class="fa fa-random"></i> | ||||
|                                         {{ activity.accompanyingPeriod.id }} | ||||
|                                     </a> | ||||
|                                 </div> | ||||
|                             {% endif %} | ||||
|     {% for activity in activities %} | ||||
|         {% set t = activity.type %} | ||||
|         <div class="item-bloc"> | ||||
|             <div class="item-row main"> | ||||
|                 <div class="item-col"> | ||||
|  | ||||
|                         </div> | ||||
|                         <div class="item-col"> | ||||
|                             <ul class="list-content"> | ||||
|                                 {% if activity.user and t.userVisible %} | ||||
|                                     <li> | ||||
|                                         <b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b> | ||||
|                                     </li> | ||||
|                                 {% endif %} | ||||
|                     {% if activity.date %} | ||||
|                         <h3>{{ activity.date|format_date('long') }}</h3> | ||||
|                     {% endif %} | ||||
|  | ||||
|                                 <li> | ||||
|                                     <b>{{ activity.type.name | localize_translatable_string }}</b> | ||||
|  | ||||
|                                     {% if activity.attendee is not null and t.attendeeVisible %} | ||||
|                                         {% if activity.attendee %} | ||||
|                                             {{ '→ ' ~ 'present'|trans|capitalize }} | ||||
|                                         {% else %} | ||||
|                                             {{ '→ ' ~ 'not present'|trans|capitalize }} | ||||
|                                         {% endif %} | ||||
|                                     {% endif %} | ||||
|                                 </li> | ||||
|  | ||||
|                                 <li> | ||||
|                                     <b>{{ 'location'|trans ~ ': ' }}</b> | ||||
|                                     Domicile de l'usager | ||||
|                                     {# | ||||
|                                     {% if activity.location %}{{ activity.location }}{% endif %} | ||||
|                                     #} | ||||
|                                 </li> | ||||
|  | ||||
|                                 {%- if t.reasonsVisible -%} | ||||
|                                     <li> | ||||
|                                         {%- if activity.reasons is not empty -%} | ||||
|                                             {% for r in activity.reasons %} | ||||
|                                                 {{ r|chill_entity_render_box }} | ||||
|                                             {% endfor %} | ||||
|                                         {%- endif -%} | ||||
|                                     </li> | ||||
|                                 {% endif %} | ||||
|  | ||||
|                                 {%- if t.socialIssuesVisible %} | ||||
|                                     <li class="social-issues"> | ||||
|                                         {%- if activity.socialIssues is not empty -%} | ||||
|                                             {% for r in activity.socialIssues %} | ||||
|                                                 {{ r|chill_entity_render_box }} | ||||
|                                             {% endfor %} | ||||
|                                         {%- endif -%} | ||||
|                                     </li> | ||||
|                                 {% endif %} | ||||
|  | ||||
|                                 {%- if t.socialActionsVisible -%} | ||||
|                                     <li class="social-actions"> | ||||
|                                         {%- if activity.socialActions is not empty -%} | ||||
|                                             {% for r in activity.socialActions %} | ||||
|                                                 <span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span> | ||||
|                                             {% endfor %} | ||||
|                                         {%- endif -%} | ||||
|                                     </li> | ||||
|                                 {% endif %} | ||||
|  | ||||
|  | ||||
|                             </ul> | ||||
|                             <ul class="record_actions"> | ||||
|                                 <li> | ||||
|                                     <a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" | ||||
|                                        class="btn btn-sm btn-show "></a> | ||||
|                                 </li> | ||||
|                                 {# TOOD | ||||
|                         {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} | ||||
|                                 #} | ||||
|                                 <li> | ||||
|                                     <a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" | ||||
|                                        class="btn btn-sm btn-update "></a> | ||||
|                                 </li> | ||||
|                                 {# TOOD | ||||
|                     <div class="duration"> | ||||
|                         {% if t.durationTimeVisible > 0 %} | ||||
|                             <p> | ||||
|                                 <i class="fa fa-fw fa-hourglass-end"></i> | ||||
|                                 {{ activity.durationTime|date('H:i') }} | ||||
|                             </p> | ||||
|                         {% endif %} | ||||
|                         {% if activity.travelTime and t.travelTimeVisible %} | ||||
|                             <p> | ||||
|                                 <i class="fa fa-fw fa-car"></i> | ||||
|                                 {{ activity.travelTime|date('H:i') }} | ||||
|                             </p> | ||||
|                         {% endif %} | ||||
|                         {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} | ||||
|                                 #} | ||||
|                                 <li> | ||||
|                                     <a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" | ||||
|                                        class="btn btn-sm btn-delete "></a> | ||||
|                                 </li> | ||||
|                                 {# | ||||
|                                 {% endif %} | ||||
|                                 #} | ||||
|                             </ul> | ||||
|                         </div> | ||||
|                     </div> | ||||
|  | ||||
|                     {%  if activity.comment.comment is not empty | ||||
|                         or activity.persons|length > 0 | ||||
|                         or activity.thirdParties|length > 0 | ||||
|                         or activity.users|length > 0 | ||||
|                     %} | ||||
|                         <div class="item-row details"> | ||||
|                             <div class="item-col"> | ||||
|                                 {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %} | ||||
|                             </div> | ||||
|  | ||||
|                             {% if activity.comment.comment is not empty %} | ||||
|                                 <div class="item-col"> | ||||
|                                     {{ activity.comment|chill_entity_render_box({ | ||||
|                                         'disable_markdown': false, | ||||
|                                         'limit_lines': 3, | ||||
|                                         'metadata': false, | ||||
|                                     }) }} | ||||
|                                 </div> | ||||
|                             {% endif %} | ||||
|                         </div> | ||||
|                     {% if context == 'person' and activity.accompanyingPeriod is not empty %} | ||||
|                     <div class="accompanyingPeriodLink" style="margin-top: 1rem"> | ||||
|                         <a href="{{ chill_path_add_return_path( | ||||
|                                 "chill_person_accompanying_course_index", | ||||
|                                 { 'accompanying_period_id': activity.accompanyingPeriod.id } | ||||
|                             ) }}"> | ||||
|                             <i class="fa fa-random"></i> | ||||
|                             {{ activity.accompanyingPeriod.id }} | ||||
|                         </a> | ||||
|                     </div> | ||||
|                     {% endif %} | ||||
|  | ||||
|                 </div> | ||||
|             {% endfor %} | ||||
|         </div> | ||||
|     {% endif %} | ||||
|                 <div class="item-col"> | ||||
|                     <ul class="list-content"> | ||||
|                         {% if activity.user and t.userVisible %} | ||||
|                         <li> | ||||
|                             <b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b> | ||||
|                         </li> | ||||
|                         {% endif %} | ||||
|  | ||||
|                         <li> | ||||
|                             <b>{{ activity.type.name | localize_translatable_string }}</b> | ||||
|  | ||||
|                             {% if activity.attendee is not null and t.attendeeVisible %} | ||||
|                                 {% if activity.attendee %} | ||||
|                                     {{ '→ ' ~ 'present'|trans|capitalize }} | ||||
|                                 {% else %} | ||||
|                                     {{ '→ ' ~ 'not present'|trans|capitalize }} | ||||
|                                 {% endif %} | ||||
|                             {% endif %} | ||||
|                         </li> | ||||
|  | ||||
|                         <li> | ||||
|                             <b>{{ 'location'|trans ~ ': ' }}</b> | ||||
|                             Domicile de l'usager | ||||
|                             {# | ||||
|                                 {% if activity.location %}{{ activity.location }}{% endif %} | ||||
|                             #} | ||||
|                         </li> | ||||
|  | ||||
|                         {%- if t.reasonsVisible -%} | ||||
|                         <li> | ||||
|                             {%- if activity.reasons is empty -%} | ||||
|                                 <span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span> | ||||
|                             {%- else -%} | ||||
|                                 {% for r in activity.reasons %} | ||||
|                                     {{ r|chill_entity_render_box }} | ||||
|                                 {% endfor %} | ||||
|                             {%- endif -%} | ||||
|                         </li> | ||||
|                         {% endif %} | ||||
|  | ||||
|                         {%- if t.socialIssuesVisible %} | ||||
|                             <li class="social-issues"> | ||||
|                                 {%- if activity.socialIssues is empty -%} | ||||
|                                     <span class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</span> | ||||
|                                 {%- else -%} | ||||
|                                     {% for r in activity.socialIssues %} | ||||
|                                       {{ r|chill_entity_render_box }} | ||||
|                                     {% endfor %} | ||||
|                                 {%- endif -%} | ||||
|                             </li> | ||||
|                         {% endif %} | ||||
|  | ||||
|                         {%- if t.socialActionsVisible -%} | ||||
|                             <li class="social-actions"> | ||||
|                                 {%- if activity.socialActions is empty -%} | ||||
|                                     <span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span> | ||||
|                                 {%- else -%} | ||||
|                                     {% for r in activity.socialActions %} | ||||
|                                         <span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span> | ||||
|                                     {% endfor %} | ||||
|                                 {%- endif -%} | ||||
|                             </li> | ||||
|                         {% endif %} | ||||
|  | ||||
|  | ||||
|                     </ul> | ||||
|                     <ul class="record_actions"> | ||||
|                         <li> | ||||
|                             <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> | ||||
|                         </li> | ||||
|                         {# TOOD | ||||
|                         {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} | ||||
|                         #} | ||||
|                         <li> | ||||
|                             <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> | ||||
|                         </li> | ||||
|                         {# TOOD | ||||
|                         {% endif %} | ||||
|                         {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} | ||||
|                         #} | ||||
|                         <li> | ||||
|                             <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> | ||||
|                         </li> | ||||
|                         {# | ||||
|                         {% endif %} | ||||
|                         #} | ||||
|                     </ul> | ||||
|                 </div> | ||||
|             </div> | ||||
|  | ||||
|             {% | ||||
|                 if activity.comment.comment is not empty | ||||
|                 or activity.persons|length > 0 | ||||
|                 or activity.thirdParties|length > 0 | ||||
|                 or activity.users|length > 0 | ||||
|             %} | ||||
|             <div class="item-row details"> | ||||
|                 <div class="item-col"> | ||||
|  | ||||
|                     {% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %} | ||||
|                 </div> | ||||
|  | ||||
|                 {% if activity.comment.comment is not empty %} | ||||
|                 <div class="item-col comment"> | ||||
|                     {{ activity.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }} | ||||
|                 </div> | ||||
|                 {% endif %} | ||||
|             </div> | ||||
|             {% endif %} | ||||
|  | ||||
|         </div> | ||||
|     {% endfor %} | ||||
| </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 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'} %} | ||||
|  | ||||
|     <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 %} | ||||
|   | ||||
| @@ -21,27 +21,5 @@ | ||||
| {% block title %}{{ 'Activity list' |trans }}{% endblock title %} | ||||
|  | ||||
| {% 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'} %} | ||||
|  | ||||
|     <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 %} | ||||
|   | ||||
| @@ -1,30 +1,28 @@ | ||||
| <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 %} | ||||
|         <h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3> | ||||
|         <div class="activity-row"> | ||||
|             {% for activityType in row.activityTypes %} | ||||
| {% for row in data %} | ||||
|     <h3>{{ row.activityTypeCategory.name|localize_translatable_string }}</h3> | ||||
|     <div class="activity-row"> | ||||
|         {% for activityType in row.activityTypes %} | ||||
|  | ||||
|                 {% set person_id = null %} | ||||
|                 {% if person %} | ||||
|                     {% set person_id = person.id %} | ||||
|                 {% endif %} | ||||
|             {% 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 %} | ||||
|             {% set accompanying_course_id = null %} | ||||
|             {% if accompanyingCourse %} | ||||
|                 {% set accompanying_course_id = accompanyingCourse.id %} | ||||
|             {% endif %} | ||||
|  | ||||
|                 <a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}"> | ||||
|             <a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}"> | ||||
|  | ||||
|                     <div class="bloc btn btn-primary btn-lg btn-block"> | ||||
|                         {{ activityType.name|localize_translatable_string }} | ||||
|                     </div> | ||||
|                 </a> | ||||
|             {% endfor %} | ||||
|         </div> | ||||
|     {% endfor %} | ||||
| </div> | ||||
|                 <div class="bloc btn btn-primary btn-lg btn-block"> | ||||
|                     {{ activityType.name|localize_translatable_string }} | ||||
|                 </div> | ||||
|             </a> | ||||
|         {% endfor %} | ||||
|     </div> | ||||
| {% endfor %} | ||||
|   | ||||
| @@ -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 | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\AsideActivityBundle\Controller; | ||||
|  | ||||
| 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; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Class AsideActivityBundle | ||||
|  */ | ||||
| class AsideActivityController extends CRUDController | ||||
| final 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 | ||||
|     { | ||||
|         $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/menu.yaml'); | ||||
|     } | ||||
|  | ||||
|     public function prepend(ContainerBuilder $container) | ||||
|   | ||||
| @@ -13,7 +13,7 @@ use Symfony\Component\Validator\Constraints as Assert; | ||||
|  * @ORM\Entity | ||||
|  * @ORM\Table(schema="chill_asideactivity") | ||||
|  */ | ||||
| final class AsideActivity implements TrackUpdateInterface, TrackCreationInterface | ||||
| class AsideActivity implements TrackUpdateInterface, TrackCreationInterface | ||||
| { | ||||
|     /** | ||||
|      * @ORM\Id | ||||
| @@ -200,10 +200,4 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac | ||||
|  | ||||
|         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\ChillTextareaType; | ||||
| use Chill\MainBundle\Templating\TranslatableStringHelper; | ||||
| use Doctrine\ORM\EntityRepository; | ||||
| use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
| use Symfony\Component\Form\AbstractType; | ||||
| use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; | ||||
| @@ -17,19 +18,24 @@ use Symfony\Component\OptionsResolver\OptionsResolver; | ||||
| use Symfony\Component\Form\Extension\Core\Type\TextareaType; | ||||
| use Symfony\Component\Form\FormEvent; | ||||
| use Symfony\Component\Form\FormEvents; | ||||
| use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | ||||
| use Symfony\Component\Security\Core\Security; | ||||
|  | ||||
| final class AsideActivityFormType extends AbstractType | ||||
| { | ||||
|     protected array $timeChoices; | ||||
|     private TranslatableStringHelper $translatableStringHelper; | ||||
|     private TokenStorageInterface $storage; | ||||
|  | ||||
|     public function __construct (TranslatableStringHelper $translatableStringHelper, array $timeChoices){ | ||||
|     public function __construct (TranslatableStringHelper $translatableStringHelper, array $timeChoices, TokenStorageInterface $storage){ | ||||
|         $this->timeChoices = $timeChoices; | ||||
|         $this->translatableStringHelper = $translatableStringHelper; | ||||
|         $this->storage = $storage; | ||||
|     } | ||||
|  | ||||
|     public function buildForm(FormBuilderInterface $builder, array $options) | ||||
|     { | ||||
|         dump($options); | ||||
|         $timeChoices = []; | ||||
|  | ||||
|         foreach ($this->timeChoices as $e) { | ||||
| @@ -48,7 +54,11 @@ final class AsideActivityFormType extends AbstractType | ||||
|                 'label' => 'Agent', | ||||
|                 'required' => true, | ||||
|                 'class' => User::class, | ||||
|                 //translate | ||||
|                 'data' => $this->storage->getToken()->getUser(), | ||||
|                 'query_builder' => function(EntityRepository $er){ | ||||
|                     return $er->createQueryBuilder('u')->where('u.enabled = true'); | ||||
|                 }, | ||||
|                 'attr' => array('class' => 'select2 '), | ||||
|                 'placeholder' => 'Choose the agent for whom this activity is created', | ||||
|                 'choice_label' => 'username' | ||||
|             ]) | ||||
| @@ -103,7 +113,6 @@ final class AsideActivityFormType extends AbstractType | ||||
|                     $seconds = $data->getTimezone()->getOffset($data); | ||||
|                     $data->setTimeZone($timezoneUTC); | ||||
|                     $data->add(new \DateInterval('PT'.$seconds.'S')); | ||||
|                     dump($data); | ||||
|  | ||||
|                     // test if the timestamp is in the choices. | ||||
|                     // 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 %} | ||||
| @@ -1,37 +1,28 @@ | ||||
| <div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}"> | ||||
|     {% block crud_content_header %} | ||||
|         <h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1> | ||||
|     {% endblock crud_content_header %} | ||||
| 	{% block crud_content_header %} | ||||
| 		<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1> | ||||
| 	{% endblock crud_content_header %} | ||||
|  | ||||
|     <p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</p> | ||||
| 	<p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</p> | ||||
|  | ||||
|     {{ form_start(form) }} | ||||
| 	{{ form_start(form) }} | ||||
|  | ||||
|     <ul class="record_actions"> | ||||
|             {% block content_form_actions_back %} | ||||
|                 <li class="cancel"> | ||||
|                     <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}"> | ||||
|                         {{ 'Cancel'|trans }} | ||||
|                     </a> | ||||
|                 </li> | ||||
|             {% 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 %} | ||||
|                 <li> | ||||
|                     <button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button> | ||||
|                 </li> | ||||
|             {% endblock content_form_actions_confirm_delete %} | ||||
|             {% block content_form_actions_after %}{% endblock %} | ||||
|     </ul> | ||||
| 	<ul class="record_actions"> | ||||
| 		{% block content_form_actions_back %} | ||||
| 			<li class="cancel"> | ||||
| 				<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}"> | ||||
| 					{{ 'Cancel'|trans }} | ||||
| 				</a> | ||||
| 			</li> | ||||
| 		{% endblock %} | ||||
| 		{% block content_form_actions_before %}{% endblock %} | ||||
| 		{% block content_form_actions_confirm_delete %} | ||||
| 			<li> | ||||
| 				<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button> | ||||
| 			</li> | ||||
| 		{% endblock content_form_actions_confirm_delete %} | ||||
| 		{% block content_form_actions_after %}{% endblock %} | ||||
| 	</ul> | ||||
|  | ||||
|     {{ form_end(form) }} | ||||
| </div> | ||||
| 	{{ form_end(form) }} | ||||
| </div> | ||||
|   | ||||
| @@ -1,108 +1,106 @@ | ||||
| {% extends "@ChillMain/layout.html.twig" %} | ||||
|  | ||||
| {% block title %} | ||||
| 	{{ 'Aside activity list' |trans }} | ||||
| {% endblock title %} | ||||
|  | ||||
| {% block content %} | ||||
| <div class="col-md-10 col-xxl asideactivity-list"> | ||||
| <h2>{{ 'My aside activities' |trans }}</h2> | ||||
| 	<div class="col-md-10 col-xxl asideactivity-list"> | ||||
| 		<h2>{{ 'My aside activities' |trans }}</h2> | ||||
|  | ||||
| {% if entities|length == 0 %} | ||||
|     <p class="chill-no-data-statement"> | ||||
|         {{ "There isn't any activities."|trans }} | ||||
|         <a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a> | ||||
|     </p> | ||||
| {% else %} | ||||
| 		{% if entities|length == 0 %} | ||||
| 			<p class="chill-no-data-statement"> | ||||
| 				{{ "There aren't any aside activities."|trans }} | ||||
| 				<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a> | ||||
| 			</p> | ||||
| 		{% else %} | ||||
|  | ||||
| <div class="flex-table my-4 list-records"> | ||||
|     {# Sort activities according to date in descending order #} | ||||
|     {% for entity in entities|sort ((a, b) => b.date <=> a.date) %} | ||||
|         {% set t = entity.type %} | ||||
| 			<div | ||||
| 				class="flex-table my-4 list-records"> | ||||
| 				{# Sort activities according to date in descending order #} | ||||
| 				{% for entity in entities|sort ((a, b) => b.date <=> a.date) %} | ||||
| 					{% set t = entity.type %} | ||||
|  | ||||
|         {# only load aside activities of current user. #} | ||||
|         {% if entity.agent == app.user %} | ||||
| 					<div class="item-bloc"> | ||||
| 						<div class="item-row main"> | ||||
| 							<div class="item-col"> | ||||
|  | ||||
|         <div class="item-bloc"> | ||||
|             <div class="item-row main"> | ||||
|                 <div class="item-col"> | ||||
| 								<h3> | ||||
| 									<b>{{ entity.type.title | localize_translatable_string }}</b> | ||||
| 								</h3> | ||||
|  | ||||
|                     <h3> | ||||
|                         <b>{{ entity.type.title | localize_translatable_string }}</b> | ||||
|                     </h3> | ||||
| 								{% if entity.date %} | ||||
| 									<p>{{ entity.date|format_date('long') }}</p> | ||||
| 								{% endif %} | ||||
|  | ||||
|                     {% if entity.date %} | ||||
|                         <p>{{ entity.date|format_date('long') }}</p> | ||||
|                     {% endif %} | ||||
| {#  | ||||
|                     <div class="duration"> | ||||
|                             <p> | ||||
|                                 <i class="fa fa-fw fa-hourglass-end"></i> | ||||
|                                 {{ entity.duration|date('H:i') }} | ||||
|                             </p> | ||||
|                     </div> #} | ||||
| 								<div class="duration"> | ||||
| 									<p> | ||||
| 										<i class="fa fa-fw fa-hourglass-end"></i> | ||||
| 										{{ entity.duration|date('H:i') }} | ||||
| 									</p> | ||||
| 								</div> | ||||
|  | ||||
|                 </div> | ||||
|                 <div class="item-col"> | ||||
|                     <ul class="list-content"> | ||||
|                         {% if entity.createdBy %} | ||||
|                         <li> | ||||
|                             <b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b> | ||||
|                         </li> | ||||
|                         {% endif %} | ||||
|                     </ul> | ||||
|                 </div> | ||||
|             </div> | ||||
| 							</div> | ||||
| 							<div class="item-col"> | ||||
| 								<ul class="list-content"> | ||||
| 									{% if entity.createdBy %} | ||||
| 										<li> | ||||
| 											<b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b> | ||||
| 										</li> | ||||
| 									{% endif %} | ||||
| 								</ul> | ||||
| 							</div> | ||||
| 						</div> | ||||
|  | ||||
|             {# {% | ||||
|                 if entity.note is not empty | ||||
|                 or entity.createdBy|length > 0 | ||||
|             %} | ||||
|             <div class="item-row details"> | ||||
|                 {% if entity.note is not empty %} | ||||
|                 <div class="item-col comment"> | ||||
|                     {{ entity.note|chill_markdown_to_html }} | ||||
|                 </div> | ||||
|                 {% endif %} | ||||
| 						{# {% | ||||
| 												                if entity.note is not empty | ||||
| 												                or entity.createdBy|length > 0 | ||||
| 												            %} | ||||
| 												            <div class="item-row details"> | ||||
| 												                {% if entity.note is not empty %} | ||||
| 												                <div class="item-col comment"> | ||||
| 												                    {{ entity.note|chill_markdown_to_html }} | ||||
| 												                </div> | ||||
| 												                {% endif %} | ||||
| 												 | ||||
| 												            </div> | ||||
| 												            {% endif %} #} | ||||
| 						<div class="item-col"> | ||||
| 							<ul class="list-content"> | ||||
| 								<ul class="record_actions"> | ||||
| 									{# <li> | ||||
| 																		                            <a href="{{ path('chill_crud_aside_activity_view', { 'id': entity.id} ) }}" class="btn btn-show "></a> | ||||
| 																		                        </li> #} | ||||
| 									{# TOOD | ||||
| 																		                        {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} | ||||
| 																		                        #} | ||||
| 										<li><a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "> </a> | ||||
| 									</li> | ||||
| 									{# TOOD | ||||
| 																		                        {% endif %} | ||||
| 																		                        {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} | ||||
| 																		                        #} | ||||
| 									<li> | ||||
| 										<a href="{{ path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a> | ||||
| 									</li> | ||||
| 									{# | ||||
| 																		                        {% endif %} | ||||
| 																		                        #} | ||||
| 								</ul> | ||||
| 							</ul> | ||||
| 						</div> | ||||
| 					</div> | ||||
|  | ||||
|             </div> | ||||
|             {% endif %} #} | ||||
|             <div class="item-col"> | ||||
|                 <ul class="list-content"> | ||||
|                     <ul class="record_actions"> | ||||
|                         <li> | ||||
|                             <a href="{{ path('chill_crud_aside_activity_view', { 'id': entity.id} ) }}" class="btn btn-show "></a> | ||||
|                         </li> | ||||
|                         {# TOOD | ||||
|                         {% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %} | ||||
|                         #} | ||||
|                         <li> | ||||
|                             <a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "></a> | ||||
|                         </li> | ||||
|                         {# TOOD | ||||
|                         {% endif %} | ||||
|                         {% if is_granted('CHILL_ACTIVITY_DELETE', activity) %} | ||||
|                         #} | ||||
|                         <li> | ||||
|                             <a href="{{ path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a> | ||||
|                         </li> | ||||
|                         {# | ||||
|                         {% endif %} | ||||
|                         #} | ||||
|                     </ul> | ||||
|                 </ul> | ||||
|             </div> | ||||
|         </div> | ||||
|         {% endif %} | ||||
|     {% endfor %} | ||||
| </div> | ||||
| {% endif %} | ||||
| 				{% endfor %} | ||||
| 			</div> | ||||
| 			<ul class="record_actions"> | ||||
| 				<li> | ||||
| 					<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create"> | ||||
| 						{{ 'Add a new aside activity' | trans }} | ||||
| 					</a> | ||||
| 				</li> | ||||
| 			</ul> | ||||
| 		</div> | ||||
| 	{% endif %} | ||||
|  | ||||
|  | ||||
|  | ||||
| {# TODO set this condition in configuration #} | ||||
|   <ul class="record_actions"> | ||||
|       <li> | ||||
|           <a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create"> | ||||
|               {{ 'Add a new activity' | trans }} | ||||
|           </a> | ||||
|       </li> | ||||
|   </ul> | ||||
| </div> | ||||
|    {% endblock %} | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -1,44 +1,44 @@ | ||||
| {% extends "@ChillActivity/Admin/layout_activity.html.twig" %} | ||||
| {% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %} | ||||
|  | ||||
| {% block admin_content %} | ||||
|     <h1>{{ 'ActivityType list'|trans }}</h1> | ||||
| 	<h1>{{ 'ActivityType list'|trans }}</h1> | ||||
|  | ||||
|     <table class="records_list table table-bordered border-dark"> | ||||
|         <thead> | ||||
|             <tr> | ||||
|                 <th>{{ 'Name'|trans }}</th> | ||||
|                 <th>{{ 'Active'|trans }}</th> | ||||
|                 <th>{{ 'Actions'|trans }}</th> | ||||
|             </tr> | ||||
|         </thead> | ||||
|         <tbody> | ||||
|         {% for entity in entities %} | ||||
|             <tr> | ||||
|                 <td>{{ entity.title|localize_translatable_string }}</td> | ||||
|                 <td style="text-align:center;"> | ||||
|                 {%- if entity.isActive -%} | ||||
|                     <i class="fa fa-check-square-o"></i> | ||||
|                 {%- else -%} | ||||
|                     <i class="fa fa-square-o"></i> | ||||
|                 {%- endif -%} | ||||
|             </td> | ||||
|                 <td> | ||||
|                 <ul class="record_actions sticky-form-buttons"> | ||||
|                     <li> | ||||
|                         <a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a> | ||||
|                     </li> | ||||
|                 </ul> | ||||
|                 </td> | ||||
|             </tr> | ||||
|         {% endfor %} | ||||
|         </tbody> | ||||
|     </table> | ||||
| 	<table class="records_list table table-bordered border-dark"> | ||||
| 		<thead> | ||||
| 			<tr> | ||||
| 				<th>{{ 'Name'|trans }}</th> | ||||
| 				<th>{{ 'Active'|trans }}</th> | ||||
| 				<th>{{ 'Actions'|trans }}</th> | ||||
| 			</tr> | ||||
| 		</thead> | ||||
| 		<tbody> | ||||
| 			{% for entity in entities %} | ||||
| 				<tr> | ||||
| 					<td>{{ entity.title|localize_translatable_string }}</td> | ||||
| 					<td style="text-align:center;"> | ||||
| 						{%- if entity.isActive -%} | ||||
| 							<i class="fa fa-check-square-o"></i> | ||||
| 						{%- else -%} | ||||
| 							<i class="fa fa-square-o"></i> | ||||
| 						{%- endif -%} | ||||
| 					</td> | ||||
| 					<td> | ||||
| 						<ul class="record_actions"> | ||||
| 							<li> | ||||
| 								<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a> | ||||
| 							</li> | ||||
| 						</ul> | ||||
| 					</td> | ||||
| 				</tr> | ||||
| 			{% endfor %} | ||||
| 		</tbody> | ||||
| 	</table> | ||||
|  | ||||
|         <ul class="record_actions"> | ||||
|         <li> | ||||
|             <a href="{{ path('chill_crud_activity_type_new') }}" class="btn btn-create"> | ||||
|                 {{ 'Create a new activity type'|trans }} | ||||
|             </a> | ||||
|         </li> | ||||
|     </ul> | ||||
|     {% endblock %} | ||||
| 	<ul class="record_actions"> | ||||
| 		<li> | ||||
| 			<a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create"> | ||||
| 				{{ 'Create a new aside activity type'|trans }} | ||||
| 			</a> | ||||
| 		</li> | ||||
| 	</ul> | ||||
| {% 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: | ||||
|     resource: "@ChillAsideActivityBundle/Controller" | ||||
|     type: annotation | ||||
|   resource: "@ChillAsideActivityBundle/Controller" | ||||
|   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 } | ||||
| @@ -5,5 +5,6 @@ services: | ||||
|         arguments: | ||||
|             - "@chill.main.helper.translatable_string" | ||||
|             - "%chill_activity.form.time_duration%" | ||||
|             - "@security.token_storage" | ||||
|         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); | ||||
|  | ||||
| namespace Chill\Migrations\AsideActivity; | ||||
| namespace Application\Migrations; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\AsideActivity; | ||||
| namespace Application\Migrations; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\AsideActivity; | ||||
| namespace Application\Migrations; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
| declare(strict_types=1); | ||||
|  | ||||
| namespace Chill\Migrations\AsideActivity; | ||||
| namespace Application\Migrations; | ||||
|  | ||||
| use Doctrine\DBAL\Schema\Schema; | ||||
| use Doctrine\Migrations\AbstractMigration; | ||||
| @@ -43,6 +43,6 @@ final class Version20210810084456 extends AbstractMigration | ||||
|         $this->addSql('COMMENT ON COLUMN chill_asideactivity.AsideActivity.createdat IS \'(DC2Type:datetime_immutable)\''); | ||||
|         $this->addSql('COMMENT ON COLUMN chill_asideactivity.AsideActivity.updatedat IS \'(DC2Type:datetime_immutable)\''); | ||||
|         $this->addSql('COMMENT ON COLUMN chill_asideactivity.AsideActivity.date IS \'(DC2Type:datetime_immutable)\''); | ||||
|  | ||||
|      | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,14 +1,15 @@ | ||||
| #general | ||||
| Show the aside activity: Voir l'activité annexe | ||||
| Edit the aside activity: Modifier l'activité annexe | ||||
| Remove aside activity: Supprimer l'activité annexe | ||||
| Aside activity: Activité annexe | ||||
| Duration time: Durée | ||||
| durationTime:  durée | ||||
| durationTime: durée | ||||
| user_username: nom de l'utilisateur | ||||
| Remark: Commentaire | ||||
| No comments: Aucun commentaire | ||||
| Add a new aside activity: Ajouter une nouvelle activité annexe | ||||
| Aside activity list: Liste des activités annexes | ||||
| Aside activity list: Activités annexes | ||||
| present: présent | ||||
| not present: absent | ||||
| Delete: Supprimer | ||||
| @@ -25,14 +26,14 @@ Required: Obligatoire | ||||
| Persons: Personnes | ||||
| Users: Utilisateurs | ||||
| Emergency: Urgent | ||||
| by: 'Par ' | ||||
| by: "Par " | ||||
| location: Lieu | ||||
|  | ||||
| # Crud | ||||
| crud: | ||||
|   aside_activity: | ||||
|     title_view: Détail de l'activité annexe | ||||
|     title_new: Nouveau activité annexe | ||||
|     title_new: Nouvelle activité annexe | ||||
|     title_edit: Edition d'une activité annexe | ||||
|     title_delete: Supprimation d'une activité annexe | ||||
|     button_delete: Supprimer | ||||
| @@ -43,14 +44,20 @@ crud: | ||||
|  | ||||
| #forms | ||||
| Activity creation: Nouvelle activité annexe | ||||
| Create a new aside activity type: Nouvelle categorie d'activité annexe | ||||
| Create: Créer | ||||
| Back to the list: Retour à la liste | ||||
| Save activity: Sauver l'activité | ||||
| Reset form: Remise à zéro du formulaire | ||||
| Choose the agent for whom this activity is created: Choissisez l'agent pour qui l'activitée est creeé. | ||||
| Choose the agent for whom this activity is created: Choissisez l'utilisateur pour qui l'activité est creéé. | ||||
| Choose the activity category: Choissisez le type d'activité | ||||
| Choose the duration: Choisir la durée | ||||
| Choose a category: Choisir un categorie | ||||
| Is active: Actif | ||||
| Agent: Utilisateur | ||||
| date: Date | ||||
| Duration: Durée | ||||
| Note: Note | ||||
| 5 minutes: 5 minutes | ||||
| 10 minutes: 10 minutes | ||||
| 15 minutes: 15 minutes | ||||
| @@ -69,8 +76,12 @@ My aside activities: Mes activités annexes | ||||
| Date: Date | ||||
| Created by: Creér par | ||||
|  | ||||
|  | ||||
| #Aside activity delete | ||||
| 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%" ? | ||||
| 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; | ||||
|  | ||||
| use Chill\MainBundle\Search\SearchApiNoQueryException; | ||||
| use Chill\MainBundle\Serializer\Model\Collection; | ||||
| use GuzzleHttp\Psr7\Response; | ||||
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| 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\HttpFoundation\JsonResponse; | ||||
| use Chill\MainBundle\Search\SearchProvider; | ||||
| use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||||
| use Symfony\Contracts\Translation\TranslatorInterface; | ||||
| use Chill\MainBundle\Pagination\PaginatorFactory; | ||||
| use Chill\MainBundle\Search\SearchApi; | ||||
| @@ -49,15 +46,15 @@ use Symfony\Component\HttpFoundation\Exception\BadRequestException; | ||||
| class SearchController extends AbstractController | ||||
| { | ||||
|     protected SearchProvider $searchProvider; | ||||
|  | ||||
|      | ||||
|     protected TranslatorInterface $translator; | ||||
|  | ||||
|      | ||||
|     protected PaginatorFactory $paginatorFactory; | ||||
|  | ||||
|     protected SearchApi $searchApi; | ||||
|  | ||||
|      | ||||
|     function __construct( | ||||
|         SearchProvider $searchProvider, | ||||
|         SearchProvider $searchProvider,  | ||||
|         TranslatorInterface $translator, | ||||
|         PaginatorFactory $paginatorFactory, | ||||
|         SearchApi $searchApi | ||||
| @@ -68,14 +65,14 @@ class SearchController extends AbstractController | ||||
|         $this->searchApi = $searchApi; | ||||
|     } | ||||
|  | ||||
|  | ||||
|      | ||||
|     public function searchAction(Request $request, $_format) | ||||
|     { | ||||
|         $pattern = $request->query->get('q', ''); | ||||
|  | ||||
|          | ||||
|         if ($pattern === ''){ | ||||
|             switch($_format) { | ||||
|                 case 'html': | ||||
|                 case 'html':  | ||||
|                     return $this->render('@ChillMain/Search/error.html.twig', | ||||
|                           array( | ||||
|                              'message' => $this->translator->trans("Your search is empty. " | ||||
| @@ -89,16 +86,16 @@ class SearchController extends AbstractController | ||||
|                     ]); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|          | ||||
|         $name = $request->query->get('name', NULL); | ||||
|  | ||||
|          | ||||
|         try { | ||||
|             if ($name === NULL) { | ||||
|                 if ($_format === 'json') { | ||||
|                     return new JsonResponse('Currently, we still do not aggregate results ' | ||||
|                         . 'from different providers', JsonResponse::HTTP_BAD_REQUEST); | ||||
|                 } | ||||
|  | ||||
|                  | ||||
|                 // no specific search selected. Rendering result in "preview" mode | ||||
|                 $results = $this->searchProvider | ||||
|                     ->getSearchResults( | ||||
| @@ -122,7 +119,7 @@ class SearchController extends AbstractController | ||||
|                                 ), | ||||
|                             $_format | ||||
|                             )]; | ||||
|  | ||||
|                  | ||||
|                 if ($_format === 'json') { | ||||
|                     return new JsonResponse(\reset($results)); | ||||
|                 } | ||||
| @@ -144,8 +141,8 @@ class SearchController extends AbstractController | ||||
|                      'pattern' => $pattern | ||||
|                   )); | ||||
|         } | ||||
|  | ||||
|  | ||||
|          | ||||
|      | ||||
|         return $this->render('@ChillMain/Search/list.html.twig', | ||||
|               array('results' => $results, 'pattern' => $pattern) | ||||
|               ); | ||||
| @@ -162,33 +159,29 @@ class SearchController extends AbstractController | ||||
|                 ." one type"); | ||||
|         } | ||||
|  | ||||
|         try { | ||||
|             $collection = $this->searchApi->getResults($query, $types, []); | ||||
|         } catch (SearchApiNoQueryException $e) { | ||||
|             throw new BadRequestHttpException($e->getMessage(), $e); | ||||
|         } | ||||
|         $collection = $this->searchApi->getResults($query, $types, []); | ||||
|  | ||||
|         return $this->json($collection, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], [ "groups" =>  ["read"]]); | ||||
|         return $this->json($collection); | ||||
|     } | ||||
|  | ||||
|      | ||||
|     public function advancedSearchListAction(Request $request) | ||||
|     { | ||||
|         /* @var $variable Chill\MainBundle\Search\SearchProvider */ | ||||
|         $searchProvider = $this->searchProvider; | ||||
|         $advancedSearchProviders = $searchProvider | ||||
|             ->getHasAdvancedFormSearchServices(); | ||||
|  | ||||
|          | ||||
|         if(\count($advancedSearchProviders) === 1) { | ||||
|             \reset($advancedSearchProviders); | ||||
|  | ||||
|              | ||||
|             return $this->redirectToRoute('chill_main_advanced_search', [ | ||||
|                 'name' => \key($advancedSearchProviders) | ||||
|             ]); | ||||
|         } | ||||
|  | ||||
|          | ||||
|         return $this->render('@ChillMain/Search/choose_list.html.twig'); | ||||
|     } | ||||
|  | ||||
|      | ||||
|     public function advancedSearchAction($name, Request $request) | ||||
|     { | ||||
|         try { | ||||
| @@ -197,22 +190,22 @@ class SearchController extends AbstractController | ||||
|             /* @var $variable Chill\MainBundle\Search\HasAdvancedSearchFormInterface */ | ||||
|             $search = $this->searchProvider | ||||
|                         ->getHasAdvancedFormByName($name); | ||||
|  | ||||
|          | ||||
|         } catch (\Chill\MainBundle\Search\UnknowSearchNameException $e) { | ||||
|             throw $this->createNotFoundException("no advanced search for " | ||||
|                 . "$name"); | ||||
|         } | ||||
|  | ||||
|          | ||||
|         if ($request->query->has('q')) { | ||||
|             $data = $search->convertTermsToFormData($searchProvider->parse( | ||||
|                 $request->query->get('q'))); | ||||
|         } | ||||
|  | ||||
|          | ||||
|         $form = $this->createAdvancedSearchForm($name, $data ?? []); | ||||
|  | ||||
|          | ||||
|         if ($request->isMethod(Request::METHOD_POST)) { | ||||
|             $form->handleRequest($request); | ||||
|  | ||||
|              | ||||
|             if ($form->isValid()) { | ||||
|                 $pattern = $this->searchProvider | ||||
|                     ->getHasAdvancedFormByName($name) | ||||
| @@ -222,8 +215,8 @@ class SearchController extends AbstractController | ||||
|                     'q' => $pattern, 'name' => $name | ||||
|                 ]); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         }  | ||||
|          | ||||
|         return $this->render('@ChillMain/Search/advanced_search.html.twig', | ||||
|             [ | ||||
|                 'form' => $form->createView(), | ||||
| @@ -231,15 +224,15 @@ class SearchController extends AbstractController | ||||
|                 'title' => $search->getAdvancedSearchTitle() | ||||
|             ]); | ||||
|     } | ||||
|  | ||||
|      | ||||
|     protected function createAdvancedSearchForm($name, array $data = []) | ||||
|     { | ||||
|         $builder = $this | ||||
|             ->get('form.factory') | ||||
|             ->createNamedBuilder( | ||||
|                 null, | ||||
|                 FormType::class, | ||||
|                 $data, | ||||
|                 FormType::class,  | ||||
|                 $data,  | ||||
|                 [ 'method' => Request::METHOD_POST ] | ||||
|             ); | ||||
|  | ||||
| @@ -247,12 +240,12 @@ class SearchController extends AbstractController | ||||
|             ->getHasAdvancedFormByName($name) | ||||
|             ->buildForm($builder) | ||||
|             ; | ||||
|  | ||||
|          | ||||
|         $builder->add('submit', SubmitType::class, [ | ||||
|             'label' => 'Search' | ||||
|         ]); | ||||
|  | ||||
|          | ||||
|         return $builder->getForm(); | ||||
|     } | ||||
|  | ||||
|      | ||||
| } | ||||
|   | ||||
| @@ -15,7 +15,6 @@ trait LoadAbstractNotificationsTrait | ||||
| { | ||||
|     public function load(ObjectManager $manager) | ||||
|     { | ||||
|         return; | ||||
|         foreach ($this->notifs as $notif) { | ||||
|             $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\Similarity; | ||||
| 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\ORM\Hydration\FlatHierarchyEntityHydrator; | ||||
| use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType; | ||||
| use Chill\MainBundle\Doctrine\Type\PointType; | ||||
| use Symfony\Component\HttpFoundation\Request; | ||||
| @@ -185,9 +186,6 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface, | ||||
|                                 '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; | ||||
|             }, | ||||
|             [] | ||||
|         ); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -4,153 +4,23 @@ | ||||
| // Chill 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 | ||||
| @import './scss/render_box'; | ||||
|  | ||||
| // Chill flex responsive table/block presentation | ||||
| @import './scss/flex_table'; | ||||
|  | ||||
|  | ||||
| /* | ||||
|  *    BASE LAYOUT POSITION | ||||
|  * Specific rules | ||||
|  */ | ||||
|  | ||||
| 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; | ||||
|                      } | ||||
|                   } | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|       } | ||||
|  | ||||
|    } | ||||
| .custom_field_no_data, | ||||
| .chill-no-data-statement { | ||||
|    font-style: italic; | ||||
| } | ||||
|  | ||||
| // styles communs pour tous les bandeaux | ||||
| div.banner { | ||||
|    a { | ||||
|       text-decoration: none; | ||||
|       &.phone, | ||||
|       &.email { | ||||
|          color: $white; | ||||
|       } | ||||
|    } | ||||
|    .id-number { | ||||
|       font-weight: lighter; | ||||
|       font-size: 50%; | ||||
| @@ -158,230 +28,17 @@ div.banner { | ||||
|       &:before { content: '(n°'; } | ||||
|       &:after { content: ')'; } | ||||
|    } | ||||
|    a.phone, | ||||
|    a.email { | ||||
|       color: white; | ||||
|    } | ||||
|    ul.list-content { | ||||
|       //margin: 0 auto; | ||||
|    } | ||||
|    span.age { | ||||
|       margin-left: 0.5em; | ||||
|       &:before { 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-bootstrap-theme/dist/select2-bootstrap.css'); | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Load Chill themes assets | ||||
|  */ | ||||
|  | ||||
| require('./chillmain.scss'); | ||||
| require('./css/chillmain.css'); | ||||
|  | ||||
| import { chill } from './js/chill.js'; | ||||
| global.chill = chill; | ||||
| @@ -34,7 +34,6 @@ require('./img/favicon.ico'); | ||||
| require('./img/logo-chill-sans-slogan_white.png'); | ||||
| require('./img/logo-chill-outil-accompagnement_white.png'); | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Load local libs | ||||
|  * 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/select_interactive_loading/index.js'); | ||||
| require('../lib/export-list/index.js'); | ||||
| require('../lib/entity/index.js'); | ||||
|  | ||||
| //require('../lib/show_hide/index.js'); | ||||
| //require('../lib/tabs/index.js'); | ||||
|   | ||||
| @@ -1,80 +1,59 @@ | ||||
| /* | ||||
| *  FLEX RESPONSIVE TABLE/BLOCK PRESENTATION | ||||
| */ | ||||
|  | ||||
| div.flex-bloc, | ||||
| 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 { | ||||
|         margin: 0; | ||||
|     } | ||||
|     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 | ||||
| */ | ||||
|  | ||||
| div.flex-bloc { | ||||
|     box-sizing: border-box; | ||||
|     display: flex; | ||||
|     flex-direction: row; | ||||
|     flex-wrap: wrap; | ||||
|     align-items: stretch; | ||||
|     align-content: stretch; | ||||
|  | ||||
|     div.item-bloc { | ||||
|         flex-grow: 0; flex-shrink: 1; flex-basis: auto; | ||||
|         flex-direction: column; | ||||
|         margin: 0; | ||||
|         padding: 1em; | ||||
|         display: flex; | ||||
|         flex-direction: column; | ||||
|  | ||||
|         div.item-row { | ||||
|             flex-grow: 1; flex-shrink: 1; flex-basis: auto; | ||||
|             display: flex; | ||||
|             flex-direction: column; | ||||
|  | ||||
|             div.item-col { | ||||
|                 &.separator { | ||||
|                     margin-top: 0.5em; | ||||
|                     border-top: 1px dotted $gray-900; | ||||
|                     padding-top: 0.5em; | ||||
|                 } | ||||
|  | ||||
|                 &:first-child { | ||||
|                     flex-grow: 0; flex-shrink: 0; flex-basis: auto; | ||||
|                     padding-bottom: 0.5em; | ||||
|                     border-bottom: 1px dotted #0000004f; | ||||
|                     margin-bottom: 0.5em; | ||||
|                 } | ||||
|  | ||||
|                 &:last-child { | ||||
|                     flex-grow: 1; flex-shrink: 1; flex-basis: auto; | ||||
|                     display: flex; | ||||
|  | ||||
|                     .list-content { // ul, dl, or div | ||||
|                     } | ||||
|                     ul.record_actions { | ||||
|                         margin: 0; | ||||
|                         align-self: flex-end; | ||||
|                         flex-grow: 1; flex-shrink: 0; flex-basis: auto; | ||||
|                         margin: 0; | ||||
|  | ||||
|                         li { | ||||
|                             margin-right: 5px; | ||||
|                         } | ||||
| @@ -88,47 +67,51 @@ div.flex-bloc { | ||||
| /* | ||||
| * Table appearance | ||||
| */ | ||||
|  | ||||
| div.flex-table { | ||||
|     display: flex; | ||||
|     flex-direction: column; | ||||
|     align-items: stretch; | ||||
|     align-content: stretch; | ||||
|  | ||||
|     div.item-bloc { | ||||
|         display: flex; | ||||
|         flex-direction: column; | ||||
|  | ||||
|         padding: 1em; | ||||
|         &:nth-child(even) { | ||||
|             background-color: $gray-200; | ||||
|  | ||||
|             .chill-user-quote { | ||||
|                 background-color: shade-color($gray-200, 5%) | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         div.item-row { | ||||
|             display: flex; | ||||
|             flex-direction: row; | ||||
|  | ||||
|             &.separator { | ||||
|             &:not(:first-child) { | ||||
|                 margin-top: 0.5em; | ||||
|                 border-top: 1px dotted $gray-900; | ||||
|                 border-top: 1px dotted #0000004f; | ||||
|                 padding-top: 0.5em; | ||||
|                 //flex-direction: column; | ||||
|                 flex-direction: column; | ||||
|             } | ||||
|  | ||||
|             div.item-col { | ||||
|                 &:first-child { | ||||
|                     flex-grow: 0; flex-shrink: 0; flex-basis: auto; | ||||
|                     flex-grow: 0; flex-shrink: 0; flex-basis: 33%; | ||||
|                 } | ||||
|  | ||||
|                 &:last-child { | ||||
|                     flex-grow: 1; flex-shrink: 1; flex-basis: auto; | ||||
|                     display: flex; | ||||
|                     justify-content: flex-end; | ||||
|  | ||||
|                     .list-content { // ul, dl, or div | ||||
|                     } | ||||
|                     ul.record_actions { | ||||
|                         flex-grow: 1; flex-shrink: 0; flex-basis: auto; | ||||
|                         margin: 0; | ||||
|                         align-self: flex-start; | ||||
|                         flex-grow: 1; flex-shrink: 0; flex-basis: auto; | ||||
|                         li { | ||||
|                             margin-right: 5px; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             @media only screen and (max-width: 900px) { | ||||
|                 flex-direction: column; | ||||
|                 div.item-col { | ||||
| @@ -139,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 | ||||
| // to avoid to manage border double-width | ||||
| // Then we can simulate border-collapse: collapse (table) | ||||
|   | ||||
| @@ -13,18 +13,12 @@ section.chill-entity { | ||||
| } | ||||
|  | ||||
| // specific rules | ||||
| // all render box doesn't use a section tag ! | ||||
| .chill-entity { | ||||
|  | ||||
|     // used for: entity-person, entity-thirdparty | ||||
|     &.entity-person, | ||||
|     &.entity-thirdparty { | ||||
|  | ||||
|         span.entity-raw { | ||||
|             & > span:not(:first-child):before { | ||||
|                 content: " "; | ||||
|             } | ||||
|         } | ||||
|         div.entity-label { | ||||
|             div.denomination { | ||||
|                 &.h3 { | ||||
| @@ -93,25 +87,9 @@ section.chill-entity { | ||||
|             font-style: italic; | ||||
|         } | ||||
|  | ||||
|         .address-valid { | ||||
|             margin-top: 2em; | ||||
|             &.date-since {} | ||||
|             &.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; | ||||
|                 } | ||||
|             } | ||||
|         span.address-valid { | ||||
|             &.address-since {} | ||||
|             &.address-until {} | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
|  *  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-save::before, | ||||
|    &.btn-duplicate::before, | ||||
|       // &.btn-not-duplicate::before, | ||||
|       // &.btn-submit::before, | ||||
|       // &.btn-reset::before, | ||||
|       // &.btn-action::before, | ||||
|       &.btn-not-duplicate::before, | ||||
|       &.btn-submit::before, | ||||
|       &.btn-reset::before, | ||||
|       &.btn-action::before, | ||||
|    &.btn-delete::before, | ||||
|    &.btn-remove::before, | ||||
|    &.btn-cancel::before { | ||||
| @@ -101,13 +101,3 @@ $chill-theme-buttons: ( | ||||
|       color: $light; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| /// allow to hide icon (herited from scratch) | ||||
| .btn { | ||||
|    &.change-icon { | ||||
|       &::before { | ||||
|          content: ''; | ||||
|          margin-right: 0; | ||||
|       } | ||||
|    } | ||||
| } | ||||
| @@ -1,22 +1,13 @@ | ||||
| ul.record_actions { | ||||
| ul.record_actions, | ||||
| ul.record_actions_column { | ||||
|    display: flex; | ||||
|    flex-direction: row; | ||||
|    flex-wrap: wrap-reverse; | ||||
|    justify-content: flex-end; | ||||
|    padding: 0.5em 0; | ||||
| 
 | ||||
|    &.column { | ||||
|       flex-direction: column; | ||||
|    } | ||||
| 
 | ||||
|    &.left { | ||||
|    &.record_actions--left { | ||||
|       justify-content: flex-start; | ||||
|    } | ||||
| 
 | ||||
|    &.sticky-form-buttons { | ||||
|       padding-left: 1em; | ||||
|       padding-right: 1em; | ||||
|    } | ||||
|    padding: 0.5em 0; | ||||
|    flex-wrap: wrap-reverse; | ||||
| 
 | ||||
|    li { | ||||
|       display: inline-block; | ||||
| @@ -27,34 +18,37 @@ ul.record_actions { | ||||
|       &:last-child { | ||||
|          margin-right: 0; | ||||
|       } | ||||
|    } | ||||
| 
 | ||||
|       &.cancel { | ||||
|          order: 1; | ||||
|          margin-right: auto; | ||||
|       } | ||||
|    li.cancel { | ||||
|       order: 1; | ||||
|       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; | ||||
| 
 | ||||
| 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; | ||||
| } | ||||
| 
 | ||||
| /// EXCEPTIONS | ||||
| // inside table exceptions | ||||
| table { | ||||
| 
 | ||||
|    td ul.record_actions, | ||||
|    ul.record_actions_small { | ||||
|       li { | ||||
|          margin-right: 0.2em; | ||||
|       } | ||||
|    } | ||||
| 
 | ||||
|    ul.record_actions { | ||||
|       margin: 0; | ||||
|       padding: 0.5em; | ||||
| @@ -14,7 +14,7 @@ $gray-400: #ced4da !default; | ||||
| $gray-500: #b2b2b2 !default; | ||||
| $gray-600: #6c757d !default; | ||||
| $gray-700: #495057 !default; | ||||
| $gray-800: #2c2d2f !default; | ||||
| $gray-800: #333333 !default; | ||||
| $gray-900: #212529 !default; | ||||
| $black:    #111 !default; | ||||
| // scss-docs-end gray-color-variables | ||||
| @@ -160,7 +160,7 @@ $chill-pink:         $pink; | ||||
| $chill-gray:         $gray-600; | ||||
| $chill-dark-gray:    $gray-800; | ||||
| $chill-light-gray:   $gray-200; | ||||
| $chill-llight-gray:  $gray-100; | ||||
| $chill-llight-gray:  $gray-100;      | ||||
| // scss-docs-end theme-color-variables | ||||
|  | ||||
| // scss-docs-start theme-colors-map | ||||
| @@ -176,7 +176,7 @@ $theme-colors: ( | ||||
| ) !default; | ||||
| // scss-docs-end theme-colors-map | ||||
|  | ||||
| $chill-colors: ( | ||||
| $chill-colors: (   | ||||
|   "chill-blue":         $chill-blue, | ||||
|   "chill-green":        $chill-green, | ||||
|   "chill-green-dark":   $chill-green-dark, | ||||
| @@ -382,7 +382,7 @@ $border-color:                $gray-300 !default; | ||||
| // scss-docs-end border-variables | ||||
|  | ||||
| // scss-docs-start border-radius-variables | ||||
| $border-radius:               .25rem !default;  // <== | ||||
| $border-radius:               .25rem !default;  // <==  | ||||
| $border-radius-sm:            .2rem !default; | ||||
| $border-radius-lg:            .3rem !default; | ||||
| $border-radius-pill:          50rem !default; | ||||
|   | ||||
| @@ -1,86 +1,147 @@ | ||||
| <template> | ||||
|    <div class="chill-entity entity-address"> | ||||
|  | ||||
|    <div v-for="error in displayErrors" class="alert alert-danger my-2"> | ||||
|       {{ error }} | ||||
|       <h2 v-if="!edit">{{ $t('create_a_new_address') }}</h2> | ||||
|       <h2 v-else>{{ $t('edit_address') }}</h2> | ||||
|  | ||||
|       <show-address | ||||
|          v-if="address" | ||||
|          v-bind:address="address"> | ||||
|       </show-address> | ||||
|  | ||||
|       <add-address | ||||
|          @addNewAddress="addNewAddress"> | ||||
|       </add-address> | ||||
|    </div> | ||||
|  | ||||
|    <add-address | ||||
|       v-bind:key="context.entity.type" | ||||
|       v-bind:context="context" | ||||
|       v-bind:options="addAddress.options" | ||||
|       v-bind:result="addAddress.result" | ||||
|       @submitAddress="submitAddress" | ||||
|       ref="addAddress"> | ||||
|    </add-address> | ||||
|    <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> | ||||
|  | ||||
| <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 ShowAddress from './components/ShowAddress.vue'; | ||||
|  | ||||
| export default { | ||||
|    name: "App", | ||||
|    name: 'App', | ||||
|    components: { | ||||
|       AddAddress | ||||
|       AddAddress, | ||||
|       ShowAddress | ||||
|    }, | ||||
|    data() { | ||||
|       return { | ||||
|          context: { | ||||
|             edit: window.mode === 'edit', | ||||
|             entity: { | ||||
|                type: window.entityType, | ||||
|                id: window.entityId | ||||
|             }, | ||||
|             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 | ||||
|                } | ||||
|             } | ||||
|          } | ||||
|          edit: window.mode === 'edit', | ||||
|          personId: window.personId, | ||||
|          addressId: window.addressId, | ||||
|          backUrl: `/fr/person/${window.personId}/address/list`, //TODO better way to pass this | ||||
|          validFrom: new Date().toISOString().split('T')[0] | ||||
|       } | ||||
|    }, | ||||
|    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: { | ||||
|       displayErrors() { | ||||
|          return this.$refs.addAddress.errorMsg; | ||||
|       }, | ||||
|       submitAddress() { | ||||
|          console.log('@@@ click on Submit Address Button'); | ||||
|       addNewAddress({ address, modal }) { | ||||
|          console.log('@@@ CLICK button addNewAdress', address); | ||||
|  | ||||
|          // Cast child method | ||||
|          this.$refs.addAddress.submitNewAddress(); | ||||
|          // it fetch post request only for person and household | ||||
|          // else get returned payload then dispatch from here (parent) | ||||
|          let newAddress = { | ||||
|             'isNoAddress': address.isNoAddress, | ||||
|             'street': address.isNoAddress ? '' : address.street, | ||||
|             '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> | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| * @returns {Promise} a promise containing all Country object | ||||
| */ | ||||
| const fetchCountries = () => { | ||||
|    //console.log('<<< fetching countries'); | ||||
|    console.log('<<< fetching countries'); | ||||
|  | ||||
|    const url = `/api/1.0/main/country.json?item_per_page=1000`; | ||||
|    return fetch(url) | ||||
| @@ -20,7 +20,7 @@ const fetchCountries = () => { | ||||
| * @returns {Promise} a promise containing all Postal Code objects filtered with 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}`; | ||||
|    return fetch(url) | ||||
|       .then(response => { | ||||
| @@ -35,7 +35,7 @@ const fetchCities = (country) => { | ||||
| * @returns {Promise} a promise containing all AddressReference objects filtered with postal code | ||||
| */ | ||||
| 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}`; | ||||
|     return fetch(url) | ||||
|        .then(response => { | ||||
| @@ -50,7 +50,7 @@ const fetchReferenceAddresses = (postalCode) => { | ||||
| * @returns {Promise} a promise containing all AddressReference objects filtered with postal code | ||||
| */ | ||||
| const fetchAddresses = () => { | ||||
|    //console.log('<<< fetching addresses'); | ||||
|    console.log('<<< fetching addresses'); | ||||
|   //TODO deal with huge number of addresses... we should do suggestion... | ||||
|    const url = `/api/1.0/main/address.json?item_per_page=1000`; | ||||
|    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 | ||||
| * method GET, get Address Object | ||||
| @@ -132,7 +157,7 @@ const postPostalCode = (postalCode) => { | ||||
| * @returns {Promise} a promise containing a Address object | ||||
| */ | ||||
| const getAddress = (id) => { | ||||
|    //console.log('<< get address'); | ||||
|    console.log('<<< get address'); | ||||
|    const url = `/api/1.0/main/address/${id}.json`; | ||||
|    return fetch(url) | ||||
|       .then(response => { | ||||
| @@ -149,5 +174,6 @@ export { | ||||
|    postAddress, | ||||
|    patchAddress, | ||||
|    postPostalCode, | ||||
|    postAddressToPerson, | ||||
|    getAddress | ||||
| }; | ||||
|   | ||||
| @@ -1,618 +1,273 @@ | ||||
| <template> | ||||
|  | ||||
|    <!-- start with a button --> | ||||
|    <button v-if="step1WithModal" | ||||
|       @click="openShowPane" | ||||
|       class="btn" :class="getClassButton" | ||||
|       type="button" name="button" :title="$t(getTextButton)"> | ||||
|       <span v-if="displayTextButton">{{ $t(getTextButton) }}</span> | ||||
|    <button v-if="!edit" class="btn btn-create mt-4" @click="openModal"> | ||||
|       {{ $t('add_an_address_title') }} | ||||
|    </button> | ||||
|    <button v-else class="btn btn-create mt-4" @click="openModal"> | ||||
|       {{ $t('edit_address') }} | ||||
|    </button> | ||||
|  | ||||
|    <!-- step 1 --> | ||||
|    <teleport to="body" v-if="step1WithModal"> | ||||
|       <modal v-if="flag.showPane" | ||||
|          modalDialogClass="modal-dialog-scrollable modal-xl" | ||||
|          @close="flag.showPane = false"> | ||||
|    <teleport to="body"> | ||||
|       <modal v-if="modal.showModal" | ||||
|          v-bind:modalDialogClass="modal.modalDialogClass" | ||||
|          @close="modal.showModal = 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> | ||||
|             <h3 v-if="!edit" class="modal-title">{{ $t('add_an_address_title') }}</h3> | ||||
|             <h3 v-if="edit" class="modal-title">{{ $t('edit_an_address_title') }}</h3> | ||||
|          </template> | ||||
|  | ||||
|          <template v-slot:body> | ||||
|             <show-address-pane | ||||
|                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"> | ||||
|             </show-address-pane> | ||||
|             <div class="address-form"> | ||||
|  | ||||
|                <h4 class="h3">{{ $t('select_an_address_title') }} | ||||
|                   <span v-if="loading"> | ||||
|                      <i class="fa fa-circle-o-notch fa-spin fa-lg"></i> | ||||
|                   </span> | ||||
|                </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: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 v-slot:footer> | ||||
|             <button @click="openEditPane" | ||||
|                class="btn btn-update"> | ||||
|                {{ $t('action.edit')}} | ||||
|             </button> | ||||
|             <button class="btn btn-save" | ||||
|                @click.prevent="$emit('submitAddress')"> | ||||
|                {{ $t('action.save')}} | ||||
|             <button class="btn btn-create" | ||||
|                @click.prevent="$emit('addNewAddress', { address, modal })"> | ||||
|                {{ $t('action.add')}} | ||||
|             </button> | ||||
|          </template> | ||||
|  | ||||
|       </modal> | ||||
|    </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> | ||||
|  | ||||
| <script> | ||||
| import Modal from 'ChillMainAssets/vuejs/_components/Modal'; | ||||
| import { getAddress, fetchCountries, fetchCities, fetchReferenceAddresses, patchAddress, postAddress, postPostalCode } from '../api'; | ||||
| import { postAddressToPerson, postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress.js"; | ||||
| import ShowAddressPane from './ShowAddressPane.vue'; | ||||
| import EditAddressPane from './EditAddressPane.vue'; | ||||
| import { fetchCountries, fetchCities, fetchReferenceAddresses } from '../api' | ||||
|  | ||||
| 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: "AddAddress", | ||||
|    props: ['context', 'options', 'result'], | ||||
|    emits: ['submitAddress'], | ||||
|    name: 'AddAddresses', | ||||
|    components: { | ||||
|       Modal, | ||||
|       ShowAddressPane, | ||||
|       EditAddressPane, | ||||
|       CountrySelection, | ||||
|       CitySelection, | ||||
|       AddressSelection, | ||||
|       AddressMap, | ||||
|       AddressMore | ||||
|    }, | ||||
|    props: [ | ||||
|    ], | ||||
|    emits: ['addNewAddress'], | ||||
|    data() { | ||||
|       return { | ||||
|          flag: { | ||||
|             showPane: false, | ||||
|             editPane: false, | ||||
|             loading: false, | ||||
|             success: false | ||||
|          edit: window.mode === 'edit', | ||||
|          modal: { | ||||
|             showModal: false, | ||||
|             modalDialogClass: "modal-dialog-scrollable modal-xl" | ||||
|          }, | ||||
|          default: { | ||||
|             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 | ||||
|          loading: false, | ||||
|          address: { | ||||
|             writeNewAddress: false, | ||||
|             writeNewPostalCode: false, | ||||
|             loaded: { | ||||
|                countries: [], | ||||
|                cities: [], | ||||
|                addresses: [], | ||||
|             }, | ||||
|             selected: {  // <== make temporary changes | ||||
|                isNoAddress: false, | ||||
|             selected: { | ||||
|                country: {}, | ||||
|                city: {}, | ||||
|                postcode: { | ||||
|                   code: null, | ||||
|                   name: null | ||||
|                }, | ||||
|                address: {}, | ||||
|                writeNew: { | ||||
|                   address: false, | ||||
|                   postcode: false | ||||
|                } | ||||
|             }, | ||||
|             newPostalCode: { | ||||
|                code: null, | ||||
|                name: null | ||||
|             }, | ||||
|             addressMap: { | ||||
|                // Note: LeafletJs demands [lat, lon] | ||||
|                // cfr https://macwright.com/lonlat/ | ||||
|                center : [48.8589, 2.3469], | ||||
|                center : [48.8589, 2.3469], // Note: LeafletJs demands [lat, lon] cfr https://macwright.com/lonlat/ | ||||
|                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: { | ||||
|             from: new Date(), | ||||
|             to: null | ||||
|          }, | ||||
|          errorMsg: [] | ||||
|          errorMsg: {}, | ||||
|       } | ||||
|    }, | ||||
|    computed: { | ||||
|       step1WithModal() { | ||||
|          return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ? | ||||
|             this.options.bindModal.step1 : this.default.bindModal.step1; | ||||
|       }, | ||||
|       step2WithModal() { | ||||
|          let step2 = (this.options.bindModal !== null && typeof this.options.bindModal.step2 !== 'undefined') ? | ||||
|             this.options.bindModal.step2 : this.default.bindModal.step2; | ||||
|  | ||||
|          if (step2 === false && this.step1WithModal === true) { | ||||
|             console.log("step2 must open in a Modal"); | ||||
|             return true; | ||||
|       isNoAddress: { | ||||
|          set(value) { | ||||
|             console.log('value', value); | ||||
|             this.address.isNoAddress = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.address.isNoAddress; | ||||
|          } | ||||
|          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() { | ||||
|       if (!this.step1WithModal) { | ||||
|          //console.log('Mounted now !'); | ||||
|          this.openShowPane(); | ||||
|       } | ||||
|        this.getCountries(); | ||||
|    }, | ||||
|    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; | ||||
|          } | ||||
|       openModal() { | ||||
|          this.modal.showModal = true; | ||||
|          this.resetAll(); | ||||
|          //this.$nextTick(function() { | ||||
|          //   this.$refs.search.focus(); // positionner le curseur à l'ouverture de la modale | ||||
|          //}) | ||||
|       }, | ||||
|  | ||||
|       openEditPane() { | ||||
|          console.log('open the Edit panel'); | ||||
|          this.initForm(); | ||||
|          this.getCountries(); | ||||
|       focusOnCity() { | ||||
|           const citySelector = document.getElementById('citySelector'); | ||||
|           citySelector.focus(); | ||||
|       }, | ||||
|  | ||||
|       closeEditPane() { | ||||
|          console.log('close the Edit Panel'); | ||||
|          this.applyChanges(); | ||||
|          this.flag.showPane = true; | ||||
|          this.flag.editPane = false; | ||||
|       focusOnAddress() { | ||||
|           const addressSelector = document.getElementById('addressSelector'); | ||||
|           addressSelector.focus(); | ||||
|       }, | ||||
|  | ||||
|       /* | ||||
|       *  Async Fetch datas | ||||
|       */ | ||||
|       getInitialAddress(id) { | ||||
|          this.flag.loading = true; | ||||
|          getAddress(id).then( | ||||
|             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() { | ||||
|          this.flag.loading = true; | ||||
|          fetchCountries().then( | ||||
|             countries => new Promise((resolve, reject) => { | ||||
|                this.entity.loaded.countries = countries.results; | ||||
|                this.flag.showPane = false; | ||||
|                this.flag.editPane = true; | ||||
|                this.flag.loading = false; | ||||
|                resolve() | ||||
|          })) | ||||
|          .catch((error) => { | ||||
|             this.errorMsg.push(error.message); | ||||
|             this.flag.loading = false; | ||||
|          }); | ||||
|          console.log('getCountries'); | ||||
|          this.loading = true; | ||||
|          fetchCountries().then(countries => new Promise((resolve, reject) => { | ||||
|              this.address.loaded.countries = countries.results; | ||||
|              resolve() | ||||
|              this.loading = false; | ||||
|           })) | ||||
|           .catch((error) => { | ||||
|              this.errorMsg.push(error.message); | ||||
|              this.loading = false; | ||||
|           }); | ||||
|       }, | ||||
|  | ||||
|       getCities(country) { | ||||
|          this.flag.loading = true; | ||||
|          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.flag.loading = false; | ||||
|                resolve(); | ||||
|          console.log('getCities for', country.name); | ||||
|          this.loading = true; | ||||
|          fetchCities(country).then(cities => new Promise((resolve, reject) => { | ||||
|             this.address.loaded.cities = cities.results.filter(c => c.origin !== 3); // filter out user-defined cities | ||||
|             resolve(); | ||||
|             this.loading = false; | ||||
|          })) | ||||
|          .catch((error) => { | ||||
|             this.errorMsg.push(error.message); | ||||
|             this.flag.loading = false; | ||||
|             this.loading = false; | ||||
|          }); | ||||
|       }, | ||||
|  | ||||
|       getReferenceAddresses(city) { | ||||
|          this.flag.loading = true; | ||||
|          fetchReferenceAddresses(city).then( | ||||
|             addresses => new Promise((resolve, reject) => { | ||||
|                this.entity.loaded.addresses = addresses.results; | ||||
|                this.flag.loading = false; | ||||
|          this.loading = true; | ||||
|          console.log('getReferenceAddresses for', city.name); | ||||
|          fetchReferenceAddresses(city).then(addresses => new Promise((resolve, reject) => { | ||||
|                console.log('addresses', addresses); | ||||
|                this.address.loaded.addresses = addresses.results; | ||||
|                resolve(); | ||||
|          })) | ||||
|          .catch((error) => { | ||||
|             this.errorMsg.push(error.message); | ||||
|             this.flag.loading = false; | ||||
|          }); | ||||
|       }, | ||||
|  | ||||
|       /* | ||||
|       *   Make form ready for new changes | ||||
|       */ | ||||
|       initForm() { | ||||
|          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; | ||||
|       }, | ||||
|  | ||||
|       /* | ||||
|       *  When changes are validated (get out step2 edit pane, button valid), | ||||
|       *  apply some transformations before asyncing with backend | ||||
|       *  from entity.selected to entity.address | ||||
|       */ | ||||
|       applyChanges() | ||||
|       { | ||||
|          let newAddress = { | ||||
|             'isNoAddress': this.entity.selected.isNoAddress, | ||||
|             'street': this.entity.selected.isNoAddress ? '' : this.entity.selected.address.street, | ||||
|             'streetNumber': this.entity.selected.isNoAddress ? '' : this.entity.selected.address.streetNumber, | ||||
|             '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)) | ||||
|             ) | ||||
|                this.loading = false; | ||||
|             })) | ||||
|             .catch((error) => { | ||||
|                this.errorMsg.push(error); | ||||
|                this.flag.loading = false; | ||||
|                this.errorMsg.push(error.message); | ||||
|                this.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); | ||||
|          } | ||||
|       updateMapCenter(point) { | ||||
|          console.log('point', point); | ||||
|          this.address.addressMap.center[0] = point.coordinates[1];  // TODO use reverse() | ||||
|          this.address.addressMap.center[1] = point.coordinates[0]; | ||||
|          this.$refs.addressMap.update(); // cast child methods | ||||
|       }, | ||||
|  | ||||
|       resetAll() { | ||||
|          console.log('reset all selected'); | ||||
|          this.address.loaded.addresses = []; | ||||
|          this.address.selected.address = {}; | ||||
|          this.address.loaded.cities = []; | ||||
|          this.address.selected.city = {}; | ||||
|          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 ? | ||||
|              { | ||||
|                  code: this.$store.state.editAddress.postcode !== undefined ? this.$store.state.editAddress.postcode.code : null, | ||||
|                  name: this.$store.state.editAddress.postcode !== undefined ? this.$store.state.editAddress.postcode.name : null | ||||
|              } : {}; | ||||
|          console.log('cities and addresses', this.address.loaded.cities, this.address.loaded.addresses); | ||||
|       } | ||||
|    } | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
| div.entity-address { | ||||
|    position: relative; | ||||
|    div.loading { | ||||
|       position: absolute; | ||||
|       right: 0; top: -55px; | ||||
|  | ||||
| div.address-form { | ||||
|    h4.h3 { | ||||
|       font-weight: bold; | ||||
|    } | ||||
|    div#address_map { | ||||
|       height: 400px; | ||||
|       width: 100%; | ||||
|    } | ||||
| } | ||||
| </style> | ||||
|   | ||||
| @@ -13,18 +13,16 @@ let marker; | ||||
|  | ||||
| export default { | ||||
|    name: 'AddressMap', | ||||
|    props: ['entity'], | ||||
|    props: ['address'], | ||||
|    computed: { | ||||
|       center() { | ||||
|          return this.entity.selected.addressMap.center; | ||||
|          return this.address.addressMap.center; | ||||
|       }, | ||||
|    }, | ||||
|    methods:{ | ||||
|       init() { | ||||
|          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', { | ||||
|             attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | ||||
|          }).addTo(map); | ||||
| @@ -38,9 +36,9 @@ export default { | ||||
|  | ||||
|       }, | ||||
|       update() { | ||||
|          //console.log('update map with : ', this.address.addressMap.center) | ||||
|          marker.setLatLng(this.entity.addressMap.center); | ||||
|          map.setView(this.entity.addressMap.center, 15); | ||||
|          console.log('update map with : ', this.address.addressMap.center) | ||||
|          marker.setLatLng(this.address.addressMap.center); | ||||
|          map.setView(this.address.addressMap.center, 15); | ||||
|       } | ||||
|    }, | ||||
|    mounted(){ | ||||
|   | ||||
| @@ -74,62 +74,69 @@ | ||||
| <script> | ||||
| export default { | ||||
|    name: "AddressMore", | ||||
|    props: ['entity'], | ||||
|    props: ['address'], | ||||
|    computed: { | ||||
|       floor: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.floor = value; | ||||
|             console.log('value', value); | ||||
|             this.address.floor = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.floor; | ||||
|             return this.address.floor; | ||||
|          } | ||||
|       }, | ||||
|       corridor: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.corridor = value; | ||||
|             console.log('value', value); | ||||
|             this.address.corridor = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.corridor; | ||||
|             return this.address.corridor; | ||||
|          } | ||||
|       }, | ||||
|       steps: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.steps = value; | ||||
|             console.log('value', value); | ||||
|             this.address.steps = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.steps; | ||||
|             return this.address.steps; | ||||
|          } | ||||
|       }, | ||||
|       flat: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.flat = value; | ||||
|             console.log('value', value); | ||||
|             this.address.flat = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.flat; | ||||
|             return this.address.flat; | ||||
|          } | ||||
|       }, | ||||
|       buildingName: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.buildingName = value; | ||||
|             console.log('value', value); | ||||
|             this.address.buildingName = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.buildingName; | ||||
|             return this.address.buildingName; | ||||
|          } | ||||
|       }, | ||||
|       extra: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.extra = value; | ||||
|             console.log('value', value); | ||||
|             this.address.extra = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.extra; | ||||
|             return this.address.extra; | ||||
|          } | ||||
|       }, | ||||
|       distribution: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.distribution = value; | ||||
|             console.log('value', value); | ||||
|             this.address.distribution = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.distribution; | ||||
|             return this.address.distribution; | ||||
|          } | ||||
|       } | ||||
|    } | ||||
|   | ||||
| @@ -47,7 +47,7 @@ import VueMultiselect from 'vue-multiselect'; | ||||
| export default { | ||||
|    name: 'AddressSelection', | ||||
|    components: { VueMultiselect }, | ||||
|    props: ['entity', 'updateMapCenter'], | ||||
|    props: ['address', 'updateMapCenter'], | ||||
|    data() { | ||||
|       return { | ||||
|          value: null | ||||
| @@ -55,28 +55,28 @@ export default { | ||||
|    }, | ||||
|    computed: { | ||||
|       writeNewAddress() { | ||||
|          return this.entity.selected.writeNew.address; | ||||
|          return this.address.writeNewAddress; | ||||
|       }, | ||||
|       writeNewPostalCode() { | ||||
|          return this.entity.selected.writeNew.postCode; | ||||
|          return this.address.writeNewPostalCode; | ||||
|       }, | ||||
|       addresses() { | ||||
|          return this.entity.loaded.addresses; | ||||
|          return this.address.loaded.addresses; | ||||
|       }, | ||||
|       street: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.street = value; | ||||
|             this.address.street = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.address.street; | ||||
|             return this.address.street; | ||||
|          } | ||||
|       }, | ||||
|       streetNumber: { | ||||
|          set(value) { | ||||
|             this.entity.selected.address.streetNumber = value; | ||||
|             this.address.streetNumber = value; | ||||
|          }, | ||||
|          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}` | ||||
|       }, | ||||
|       selectAddress(value) { | ||||
|          this.entity.selected.address = value; | ||||
|          this.entity.selected.address.street = value.street; | ||||
|          this.entity.selected.address.streetNumber = value.streetNumber; | ||||
|          this.address.selected.address = value; | ||||
|          this.address.street = value.street; | ||||
|          this.address.streetNumber = value.streetNumber; | ||||
|          this.updateMapCenter(value.point); | ||||
|       }, | ||||
|       addAddress() { | ||||
|          this.entity.selected.writeNew.address = true; | ||||
|          this.address.writeNewAddress = true; | ||||
|       } | ||||
|    } | ||||
| }; | ||||
|   | ||||
| @@ -12,13 +12,13 @@ | ||||
|          :placeholder="$t('select_city')" | ||||
|          :taggable="true" | ||||
|          :multiple="false" | ||||
|          @tag="addPostcode" | ||||
|          @tag="addPostalCode" | ||||
|          :tagPlaceholder="$t('create_postal_code')" | ||||
|          :options="cities"> | ||||
|       </VueMultiselect> | ||||
|    </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="form-floating"> | ||||
|             <input class="form-control" | ||||
| @@ -28,7 +28,7 @@ | ||||
|                v-model="code"/> | ||||
|             <label for="code">{{ $t('postalCode_code') }}</label> | ||||
|          </div> | ||||
|       </div> | ||||
|       </div>  | ||||
|       <div class="col-8"> | ||||
|          <div class="form-floating"> | ||||
|             <input class="form-control" | ||||
| @@ -48,34 +48,33 @@ import VueMultiselect from 'vue-multiselect'; | ||||
| export default { | ||||
|    name: 'CitySelection', | ||||
|    components: { VueMultiselect }, | ||||
|    props: ['entity', 'focusOnAddress'], | ||||
|    emits: ['getReferenceAddresses'], | ||||
|    props: ['address', 'getReferenceAddresses', 'focusOnAddress'], | ||||
|    data() { | ||||
|       return { | ||||
|          value: null | ||||
|       } | ||||
|    }, | ||||
|    computed: { | ||||
|       writeNewPostcode() { | ||||
|          return this.entity.selected.writeNew.postcode; | ||||
|       writeNewPostalCode() { | ||||
|          return this.address.writeNewPostalCode; | ||||
|       }, | ||||
|       cities() { | ||||
|          return this.entity.loaded.cities; | ||||
|          return this.address.loaded.cities; | ||||
|       }, | ||||
|       name: { | ||||
|          set(value) { | ||||
|             this.entity.selected.postcode.name = value; | ||||
|             this.address.newPostalCode.name = value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.postcode.name; | ||||
|             return this.address.newPostalCode.name; | ||||
|          } | ||||
|       }, | ||||
|       code: { | ||||
|          set(value) { | ||||
|             this.entity.selected.postcode.code= value; | ||||
|             this.address.newPostalCode.code= value; | ||||
|          }, | ||||
|          get() { | ||||
|             return this.entity.selected.postcode.code; | ||||
|             return this.address.newPostalCode.code; | ||||
|          } | ||||
|       }, | ||||
|    }, | ||||
| @@ -84,14 +83,14 @@ export default { | ||||
|          return `${value.code}-${value.name}` | ||||
|       }, | ||||
|       selectCity(value) { | ||||
|          this.entity.selected.city = value; | ||||
|          this.entity.selected.postcode.name = value.name; | ||||
|          this.entity.selected.postcode.code = value.code; | ||||
|          this.$emit('getReferenceAddresses', value); | ||||
|          this.address.selected.city = value; | ||||
|          this.address.newPostalCode.name = value.name; | ||||
|          this.address.newPostalCode.code = value.code; | ||||
|          this.getReferenceAddresses(value); | ||||
|          this.focusOnAddress(); | ||||
|       }, | ||||
|       addPostcode() { | ||||
|          this.entity.selected.writeNew.postcode = true; | ||||
|       addPostalCode() { | ||||
|          this.address.writeNewPostalCode = true; | ||||
|       } | ||||
|    } | ||||
| }; | ||||
|   | ||||
| @@ -2,13 +2,13 @@ | ||||
|    <div class="my-1"> | ||||
|       <label class="col-form-label" for="countrySelect">{{ $t('country') }}</label> | ||||
|       <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" | ||||
|          id="countrySelect" | ||||
|          track-by="id" | ||||
|          label="name" | ||||
|          :custom-label="transName" | ||||
|          :placeholder="$t('select_country')" | ||||
|          :options="countries" | ||||
|          @select="selectCountry"> | ||||
|       </VueMultiselect> | ||||
|    </div> | ||||
| @@ -20,47 +20,43 @@ import VueMultiselect from 'vue-multiselect'; | ||||
| export default { | ||||
|    name: 'CountrySelection', | ||||
|    components: { VueMultiselect }, | ||||
|    props: ['context', 'entity'], | ||||
|    emits: ['getCities'], | ||||
|    props: ['address', 'getCities'], | ||||
|    data() { | ||||
|       return { | ||||
|          value: this.selectCountryByCode( | ||||
|             this.context.edit ? this.entity.selected.country.code : 'FR' | ||||
|          ) | ||||
|          edit: window.mode === 'edit', | ||||
|          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: { | ||||
|       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) { | ||||
|             this.selectCountry(this.value); | ||||
|          } | ||||
|       }, | ||||
|       selectCountryByCode(countryCode) { | ||||
|          return this.entity.loaded.countries.filter(c => c.countryCode === countryCode)[0]; | ||||
|       }, | ||||
|       transName ({ name }) { | ||||
|          return name.fr //TODO multilang | ||||
|       }, | ||||
|       selectCountry(value) { | ||||
|          //console.log('select country', value); | ||||
|          this.entity.selected.country = value; | ||||
|          this.$emit('getCities', value); | ||||
|          this.address.selected.country = value; | ||||
|          this.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> | ||||
|   | ||||
| @@ -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,62 +1,64 @@ | ||||
| <template> | ||||
|    <div class="chill-entity entity-address my-3"> | ||||
|       <div class="address multiline"> | ||||
|          <p v-if="address.text" | ||||
|             class="street"> | ||||
|             {{ address.text }} | ||||
|          </p> | ||||
|          <p v-if="address.postcode" | ||||
|             class="postcode"> | ||||
|             {{ address.postcode.code }} {{ address.postcode.name }} | ||||
|          </p> | ||||
|          <p v-if="address.country" | ||||
|             class="country"> | ||||
|             {{ address.country.name.fr }} | ||||
|          </p> | ||||
|    <div class="address multiline"> | ||||
|       <p v-if="address.text" | ||||
|          class="street"> | ||||
|          {{ address.text }} | ||||
|       </p> | ||||
|       <p v-if="address.postcode" | ||||
|          class="postcode"> | ||||
|          {{ address.postcode.name }} | ||||
|       </p> | ||||
|       <p v-if="address.country" | ||||
|          class="country"> | ||||
|          {{ address.country.name.fr }} | ||||
|       </p> | ||||
|  | ||||
|       <div v-if="address.floor"> | ||||
|          <span class="floor"> | ||||
|             <b>{{ $t('floor') }}</b>: {{ address.floor }} | ||||
|          </span> | ||||
|       </div> | ||||
|       <div> | ||||
|          <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 v-if="address.buildingName"> | ||||
|             <span class="buildingName"> | ||||
|                <b>{{ $t('buildingName') }}</b>: {{ address.buildingName }} | ||||
|             </span> | ||||
|          </div> | ||||
|          <div v-if="address.extra"> | ||||
|             <span class="extra"> | ||||
|                <b>{{ $t('extra') }}</b>: {{ address.extra }} | ||||
|             </span> | ||||
|          </div> | ||||
|          <div v-if="address.distribution"> | ||||
|             <span class="distribution"> | ||||
|                <b>{{ $t('distribution') }}</b>: {{ address.distribution }} | ||||
|             </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 v-if="address.buildingName"> | ||||
|          <span class="buildingName"> | ||||
|             <b>{{ $t('buildingName') }}</b>: {{ address.buildingName }} | ||||
|          </span> | ||||
|       </div> | ||||
|       <div v-if="address.extra"> | ||||
|          <span class="extra"> | ||||
|             <b>{{ $t('extra') }}</b>: {{ address.extra }} | ||||
|          </span> | ||||
|       </div> | ||||
|       <div v-if="address.distribution"> | ||||
|          <span class="distribution"> | ||||
|             <b>{{ $t('distribution') }}</b>: {{ address.distribution }} | ||||
|          </span> | ||||
|       </div> | ||||
|    </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|  | ||||
| export default { | ||||
|    name: "ShowAddress", | ||||
|    props: ['address'] | ||||
| } | ||||
|    name: 'ShowAddress', | ||||
|    props: ['address'], | ||||
|    data() { | ||||
|       return { | ||||
|       } | ||||
|    }, | ||||
| }; | ||||
| </script> | ||||
|   | ||||
| @@ -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 App from './App.vue'; | ||||
| import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'; | ||||
| import { addressMessages } from './i18n'; | ||||
| import { createApp } from 'vue' | ||||
| import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' | ||||
| import { addressMessages } from './js/i18n' | ||||
| import { store } from './store' | ||||
|  | ||||
| const i18n = _createI18n( addressMessages ); | ||||
| import App from './App.vue'; | ||||
|  | ||||
| const i18n = _createI18n(addressMessages); | ||||
|  | ||||
| const app = createApp({ | ||||
|     template: `<app></app>`, | ||||
|    template: `<app></app>`, | ||||
| }) | ||||
| .use(store) | ||||
| .use(i18n) | ||||
| .component('app', App) | ||||
| .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 }; | ||||
| @@ -24,16 +24,16 @@ | ||||
|          <!-- :: end styles bootstrap :: --> | ||||
|       </div> | ||||
|    </transition> | ||||
| </template> | ||||
| </template>  | ||||
|  | ||||
| <script> | ||||
| /* | ||||
|  *    This Modal component is a mix between Vue3 modal implementation | ||||
|  *    This Modal component is a mix between Vue3 modal implementation  | ||||
|  *    [+] with 'v-if:showModal' directive:parameter, html scope is added/removed not just shown/hidden | ||||
|  *    [+] with slot we can pass content from parent component | ||||
|  *    [+] some classes are passed from parent component | ||||
|  *    and Bootstrap 4.6 _modal.scss module | ||||
|  *    [+] using bootstrap css classes, the modal have a responsive behaviour, | ||||
|  *    [+] using bootstrap css classes, the modal have a responsive behaviour,  | ||||
|  *    [+] modal design can be configured using css classes (size, scroll) | ||||
|  */ | ||||
| export default { | ||||
| @@ -54,7 +54,7 @@ export default { | ||||
|       background-color: rgba(0, 0, 0, 0.75); | ||||
|       transition: opacity 0.3s ease; | ||||
|    } | ||||
|    .modal-header .close { | ||||
|    .modal-header .close {  | ||||
|       border-top-right-radius: 0.3rem; | ||||
|    } | ||||
|    /* | ||||
| @@ -71,8 +71,7 @@ export default { | ||||
|    .modal-leave-active { | ||||
|       opacity: 0; | ||||
|    } | ||||
|    .modal-enter | ||||
|    .modal-container, | ||||
|    .modal-enter .modal-container, | ||||
|    .modal-leave-active .modal-container { | ||||
|       -webkit-transform: scale(1.1); | ||||
|       transform: scale(1.1); | ||||
| @@ -81,9 +80,4 @@ export default { | ||||
|       font-size: 1.5rem; | ||||
|       font-weight: bold; | ||||
|    } | ||||
|    div.modal-footer { | ||||
|       button:first-child { | ||||
|          margin-right: auto; | ||||
|       } | ||||
|    } | ||||
| </style> | ||||
|   | ||||
| @@ -1,21 +1,21 @@ | ||||
| <template> | ||||
|  | ||||
|    <a class="btn btn-sm" target="_blank" | ||||
|    | ||||
|    <a class="btn" target="_blank" | ||||
|       :class="classAction" | ||||
|       :title="$t(titleAction)" | ||||
|       @click="openModal"> | ||||
|       {{ buttonText }} | ||||
|    </a> | ||||
|  | ||||
|    | ||||
|    <teleport to="body"> | ||||
|       <modal v-if="modal.showModal" | ||||
|          :modalDialogClass="modal.modalDialogClass" | ||||
|          @close="modal.showModal = false"> | ||||
|  | ||||
|           | ||||
|          <template v-slot:header> | ||||
|             <h3 class="modal-title">{{ $t(titleModal) }}</h3> | ||||
|          </template> | ||||
|  | ||||
|           | ||||
|          <template v-slot:body v-if="type === 'person'"> | ||||
|             <on-the-fly-person | ||||
|                v-bind:id="id" | ||||
| @@ -24,7 +24,7 @@ | ||||
|                ref="castPerson"> | ||||
|             </on-the-fly-person> | ||||
|          </template> | ||||
|  | ||||
|           | ||||
|          <template v-slot:body v-else-if="type === 'thirdparty'"> | ||||
|             <on-the-fly-thirdparty | ||||
|                v-bind:id="id" | ||||
| @@ -33,29 +33,31 @@ | ||||
|                ref="castThirdparty"> | ||||
|             </on-the-fly-thirdparty> | ||||
|          </template> | ||||
|  | ||||
|           | ||||
|          <template v-slot:body v-else> | ||||
|             <on-the-fly-create | ||||
|                v-bind:action="action" | ||||
|                ref="castNew"> | ||||
|             </on-the-fly-create> | ||||
|          </template> | ||||
|  | ||||
|              | ||||
|          <template v-slot:footer> | ||||
|             <button v-if="action === 'show'" | ||||
|                @click="changeActionTo('edit')" | ||||
|                class="btn btn-update"> | ||||
|                class="btn btn-update"> <!-- @click.prevent="$emit('..', ..)" --> | ||||
|             </button> | ||||
|             <button v-else | ||||
|                class="btn btn-save" | ||||
|                @click="saveAction"> | ||||
|                @click="saveAction" | ||||
|                > <!--   | ||||
|                --> | ||||
|                {{ $t('action.save')}} | ||||
|             </button> | ||||
|          </template> | ||||
|  | ||||
|           | ||||
|       </modal> | ||||
|    </teleport> | ||||
|  | ||||
|     | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
| @@ -126,7 +128,7 @@ export default { | ||||
|       }, | ||||
|       changeActionTo(action) { | ||||
|          // [BUG] clic first on show item button; in modal clic edit button; close modal; clic again on show item button | ||||
|          this.$data.action = action; | ||||
|          this.$data.action = action;  | ||||
|       }, | ||||
|       saveAction() { | ||||
|          console.log('saveAction'); | ||||
|   | ||||
| @@ -32,8 +32,6 @@ const messages = { | ||||
|          remove: "Enlever", | ||||
|          delete: "Supprimer", | ||||
|          save: "Enregistrer", | ||||
|          valid: "Valider", | ||||
|          valid_and_see: "Valider et voir", | ||||
|          add: "Ajouter", | ||||
|          show_modal: "Ouvrir une modale", | ||||
|          ok: "OK", | ||||
| @@ -63,7 +61,7 @@ const messages = { | ||||
|             title: "Création d'un nouvel usager ou d'un tiers professionnel", | ||||
|             person: "un nouvel usager", | ||||
|             thirdparty: "un nouveau tiers professionnel" | ||||
|          }, | ||||
|          },          | ||||
|       }, | ||||
|    } | ||||
| }; | ||||
|   | ||||
| @@ -1,45 +1,36 @@ | ||||
| {# | ||||
|     Template to render a comment | ||||
|  | ||||
|     OPTIONS | ||||
|     * disable_markdown  bool | ||||
|     * limit_lines       integer|null | ||||
|     * metadata          bool | ||||
|  | ||||
| #} | ||||
| {{ opening_box|raw }} | ||||
|     {%- if options['limit_lines'] is not null -%} | ||||
|         {% set content = comment.comment|split('\n')|slice(0, options['limit_lines'])|join('\n') %} | ||||
|     {%- else -%} | ||||
|         {% set content = comment.comment %} | ||||
|     {%- endif -%} | ||||
| <div class=""> | ||||
|     <div class="comment-embeddable_comment"> | ||||
|          | ||||
|         {%- if options['limit_lines'] is not null -%} | ||||
|             {% set content = comment.comment|split('\n')|slice(0, options['limit_lines'])|join('\n') %} | ||||
|         {%- else -%} | ||||
|             {% set content = comment.comment %} | ||||
|         {%- endif -%} | ||||
|  | ||||
|     <blockquote class="chill-user-quote"> | ||||
|         <blockquote class="chill-user-quote"> | ||||
|         {% if options['disable_markdown'] %} | ||||
|             {{ content|nl2br }} | ||||
|         {% else %} | ||||
|             {{ content|chill_markdown_to_html }} | ||||
|         {% endif %} | ||||
|  | ||||
|         {% if options['metadata'] %} | ||||
|             <div class="metadata"> | ||||
|                 {% if user is not empty %} | ||||
|                     {{ 'Last updated by'| trans }} | ||||
|                     <span class="user"> | ||||
|                         {{ user|chill_entity_render_box(options['user']) }} | ||||
|                     </span> | ||||
|                 {% endif %} | ||||
|                 {% if comment.date is not empty %} | ||||
|                     {% if user is empty %} | ||||
|                         {{ 'Last updated on'|trans ~ ' ' }} | ||||
|                     {% else %} | ||||
|                         {{ 'on'|trans ~ ' ' }} | ||||
|                     {% endif %} | ||||
|                     <span class="date"> | ||||
|                         {{ comment.date|format_datetime("medium", "short") }} | ||||
|                     </span> | ||||
|                 {% endif %} | ||||
|             </div> | ||||
|         {% endif %} | ||||
|     </blockquote> | ||||
| {{ closing_box|raw }} | ||||
|         </blockquote> | ||||
|     </div> | ||||
| </div> | ||||
| {% if options['metadata'] %} | ||||
| <div class="chill-entity__comment-embeddable__metadata"> | ||||
|     {% if user is not empty %} | ||||
|         <span class="chill-entity__comment-embeddable__user"> | ||||
|             {{ 'Last updated by'| trans }} {{ user|chill_entity_render_box(options['user']) }} | ||||
|         </span>'; | ||||
|     {% endif %} | ||||
|      | ||||
|     {% if comment.date is not empty %} | ||||
|         <span class="chill-entity__comment-embeddable__date"> | ||||
|             {% if user is empty %}{{ 'Last updated on'|trans ~ ' ' }}{% else %}{{ 'on'|trans ~ ' ' }}{% endif %} | ||||
|             {{ comment.date|format_datetime("medium", "short") }} | ||||
|         </span> | ||||
|     {% endif %} | ||||
| </div> | ||||
| {% endif %} | ||||
| {{ closing_box|raw }} | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user