117 lines
4.3 KiB
Twig

{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %}
{% block title %}{{ 'CustomFieldsGroup details'|trans }}{% endblock %}
{% block admin_content %}
<h1>{{ 'CustomFieldsGroup details'|trans }}</h1>
<table class="record_properties">
<tbody>
<tr>
<th>{{ 'Name'|trans }}</th>
<td>{{ entity.getName|localize_translatable_string }}</td>
</tr>
<tr>
<th>{{ 'Entity'|trans }}</th>
<td>{{ entity.entity|trans }}</td>
</tr>
{%- for key in options -%}
<tr>
<th>{{ key ~ '_label'|trans }}</th>
<td>
{%- if entity.options[key] is not defined -%}
{{ 'No value defined for this option'|trans }}
{%- elseif entity.options[key] is iterable -%}
{{ entity.options[key]|join(', ') }}
{% else %}
{{ entity.options[key] }}
{%- endif -%}
</td>
</tr>
{%- else -%}
<!-- no option available for this entity -->
{%- endfor -%}
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('customfieldsgroup') }}" class="sc-button bt-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
<a href="{{ path('customfieldsgroup_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">
{{ 'Edit'|trans }}
</a>
</li>
</ul>
<h2>{{ 'Fields associated with this group'|trans }}</h2>
{%- if entity.customFields|length > 0 -%}
<table>
<thead>
<tr>
<th>{{ 'ordering'|trans|capitalize }}</th>
<th>{{ 'label_field'|trans|capitalize }}</th>
<th>{{ 'type'|trans|capitalize }}</th>
<th>{{ 'active'|trans|capitalize }}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{%- for field in entity.customFields -%}
<tr>
<td>{{ field.ordering }}</td>
<td>{{ field.name|localize_translatable_string }}</td>
<td>{{ field.type|trans }}</td>
<td style="text-align:center;">
{%- if field.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td style="text-align:center">
<a href="{{ path('customfield_edit', { 'id' : field.id }) }}" class="sc-button bt-edit">{{ 'edit'|trans|capitalize }}</a>
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
{{ form_start(create_field_form) }}
<div class="grid-4">
{{ form_widget(create_field_form.type) }}
</div>
{{ form_widget(create_field_form.submit, { 'attr': { 'class': 'sc-button bt-create' }, 'label': 'Add a new field' } ) }}
{{ form_end(create_field_form) }}
{%- else -%}
<p>
{{ 'Any field is currently associated with this group'|trans }}
</p>
{{ form_start(create_field_form) }}
<div class="grid-4">
{{ form_widget(create_field_form.type) }}
</div>
{{ form_widget(create_field_form.submit, { 'attr': { 'class': 'sc-button bt-create' }, 'label': 'Create a new field' } ) }}
{{ form_end(create_field_form) }}
{%- endif -%}
{% endblock %}