{%- set widget = view %}
{%- set view = widget.options.view %}
{%- if view.can_edit %}
  <a class="btn btn-default" href="{{ url_for('.entity_edit', **{view.pk: view.obj.id}) }}">
    <i class="fa fa-edit"></i>{{ _("Edit") }}
  </a>
{%- endif %}
{%- if view.can_delete %}
  <a class="btn btn-danger js-widget" id="delete-button"
     href="{{ url_for('.entity_delete', **{view.pk: view.obj.id}) }}"
     data-init-with="deleteConfirm"
     data-init-params="{{ {
                        'title': 'La suppression est irréversible',
                        'message': _('Do you really want to delete this entity?'),
                        'label': _('Delete'),
                        'cancelLabel': _('Cancel'),
                        }|tojson|forceescape }}">
    <i class="fa fa-trash fa-inverse"></i>
    {{ _("Delete") }}
  </a>
{%- endif %}

{%- for panel, data in panels %}
<div class="panel" style="margin-top: 10px;">
  <h2>{{ panel.label }}</h2>

  <table class="table table-striped table-condensed" style="margin: 10px 0 15px 0;">
    <tbody>
    {%- for row in panel %}
    {%- if row.cols[0] in data %}
      {%- set label, value = data[row.cols[0]] %}
      <tr class="row">
        <td class="col-sm-4">{{ label }}</td>
        <td class="col-sm-8" colspan="3">{{ value }}</td>
      </tr>
    {%- endif %}
    {%- endfor %}
    </tbody>
  </table>
</div>
{% endfor %}
