rdv: others pages: edit, list

This commit is contained in:
nobohan
2021-07-19 17:18:56 +02:00
parent d4ec5d137e
commit 7e02b284ca
8 changed files with 157 additions and 125 deletions

View File

@@ -0,0 +1,76 @@
<h1>{{ "Update calendar"|trans }}</h1>
{{ form_start(form) }}
{{ form_errors(form) }}
{%- if form.mainUser is defined -%}
{{ form_row(form.mainUser) }}
{% endif %}
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
{%- if form.persons is defined -%}
{{ form_widget(form.persons) }}
{% endif %}
{%- if form.professionals is defined -%}
{{ form_widget(form.professionals) }}
{% endif %}
{%- if form.nonProfessionals is defined -%}
{{ form_widget(form.nonProfessionals) }}
{% endif %}
{%- if form.users is defined -%}
{{ form_widget(form.users) }}
{% endif %}
<div id="add-persons"></div>
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>
{%- if form.startDate is defined -%}
{{ form_row(form.startDate) }}
{% endif %}
{%- if form.endDate is defined -%}
{{ form_row(form.endDate) }}
{% endif %}
.. location
{%- if form.cancelReason is defined -%}
{{ form_row(form.cancelReason) }}
{% endif %}
{%- if form.comment is defined -%}
{{ form_row(form.comment) }}
{% endif %}
{%- if form.sendSMS is defined -%}
{{ form_row(form.sendSMS) }}
{% endif %}
..calendarRange
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a
class="btn btn-cancel"
{%- if context == 'person' -%}
href="{{ chill_return_path_or('chill_calendar_calendar', { 'person_id': person.id } )}}"
{%- else -%}
href="{{ chill_return_path_or('chill_calendar_calendar', { 'accompanying_period_id': accompanyingCourse.id } )}}"
{%- endif -%}
>
{{ 'Cancel'|trans|chill_return_path_label }}
</a>
</li>
<li>
<button class="btn btn-create" type="submit">
{{ 'Create'|trans }}
</button>
</li>
</ul>
{{ form_end(form) }}

View File

@@ -0,0 +1,37 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title 'Update calendar'|trans %}
{% block content %}
<div class="calendar-edit">
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
<div id="calendar"></div> {# <=== vue component #}
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'accompanyingCourse'} %}
</div>
</div>
</div>
{% endblock %}
{% block js %}
{{ parent() }}
{{ encore_entry_link_tags('async_upload') }}
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function (e) {
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
});
window.calendar = {{ entity_json|json_encode|raw }};
</script>
{{ encore_entry_script_tags('vue_calendar') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('async_upload') }}
{{ encore_entry_link_tags('vue_calendar') }}
{% endblock %}

View File

@@ -21,31 +21,22 @@
{% for calendar in calendarItems %}
{% set t = calendar.type %}
<div class="item-bloc">
<div class="item-row main">
<div class="item-col">
{% if calendar.date %}
<h3>{{ calendar.date|format_date('long') }}</h3>
{% if calendar.startDate %}
<h3>{{ calendar.startDate|format_date('long') }} </h3>
{% endif %}
<div class="duration">
{% if t.durationTimeVisible > 0 %}
<p>
<i class="fa fa-fw fa-hourglass-end"></i>
{{ calendar.durationTime|date('H:i') }}
</p>
{% endif %}
{% if calendar.travelTime and t.travelTimeVisible %}
<p>
<i class="fa fa-fw fa-car"></i>
{{ calendar.travelTime|date('H:i') }}
</p>
{% endif %}
</div>
{% if calendar.endDate %}
<h3>{{ calendar.endDate|format_date('long') }}</h3>
{% endif %}
<h3>{{ calendar.endDate.diff(calendar.startDate)|date("%i'%s''") }}</h3>
{% if context == 'user' and calendar.accompanyingPeriod is not empty %}
<div class="accompanyingPeriodLink" style="margin-top: 1rem">
@@ -64,68 +55,27 @@
</div>
<div class="item-col">
<ul class="list-content">
{% if calendar.user and t.userVisible %}
{% if calendar.user %}
<li>
<b>{{ 'by'|trans }}{{ calendar.user.usernameCanonical }}</b>
</li>
{% endif %}
{% if calendar.mainUser is not empty %}
<li>
<b>{{ calendar.type.name | localize_translatable_string }}</b>
{% if calendar.attendee is not null and t.attendeeVisible %}
{% if calendar.attendee %}
{{ '→ ' ~ 'present'|trans|capitalize }}
{% else %}
{{ '→ ' ~ 'not present'|trans|capitalize }}
{% endif %}
{% endif %}
<b>{{ 'main user concerned'|trans }}{{ calendar.mainUser.usernameCanonical }}</b>
</li>
{% endif %}
<li>
<b>{{ 'location'|trans ~ ': ' }}</b>
Domicile de l'usager
{#
{% if calendar.location %}{{ calendar.location }}{% endif %}
#}
</li>
{%- if t.reasonsVisible -%}
<li>
{%- if calendar.reasons is empty -%}
<span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span>
{%- if calendar.comment.isEmpty -%}
<span class="chill-no-data-statement">{{ 'No comments'|trans }}</span>
{%- else -%}
{% for r in calendar.reasons %}
{{ r|chill_entity_render_box }}
{% endfor %}
{{ calendar.comment|chill_entity_render_box }}
{%- endif -%}
</li>
{% endif %}
{%- if t.socialIssuesVisible %}
<li class="social-issues">
{%- if calendar.socialIssues is empty -%}
<span class="chill-no-data-statement">{{ 'No social issues associated'|trans }}</span>
{%- else -%}
{% for r in calendar.socialIssues %}
{{ r|chill_entity_render_box }}
{% endfor %}
{%- endif -%}
</li>
{% endif %}
{%- if t.socialActionsVisible -%}
<li class="social-actions">
{%- if calendar.socialActions is empty -%}
<span class="chill-no-data-statement">{{ 'No social actions associated'|trans }}</span>
{%- else -%}
{% for r in calendar.socialActions %}
<span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span>
{% endfor %}
{%- endif -%}
</li>
{% endif %}
</ul>
<ul class="record_actions">
@@ -161,7 +111,7 @@
<div class="item-row details">
<div class="item-col">
{% include 'ChillCalendarBundle:Calendar:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': calendar } %}
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': calendar } %}
</div>
{% if calendar.comment.comment is not empty %}

View File

@@ -4,7 +4,7 @@
{{ form_errors(form) }}
{%- if form.mainUser is defined -%}
{{ form_widget(form.mainUser) }}
{{ form_row(form.mainUser) }}
{% endif %}
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>

View File

@@ -1,7 +1,8 @@
<h1>{{ "Calendar"|trans }}</h1>
<dl class="chill_view_data">
<dt class="inline">{{ 'main user'|trans }}</dt>
<dd>{{ entity.mainUser }}</dd>
</dl>
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
@@ -19,7 +20,7 @@
<dt class="inline">{{ 'cancel reason'|trans }}</dt>
<dd>
{% if entity.cancelReason is not null %}
{{ entity.cancelReason }}
{{ entity.cancelReason.canceledBy|localize_translatable_string }}
{% else %}
<span class="chill-no-data-statement">{{ 'Unknown'|trans }}</span>
{% endif %}