{% extends "SsoBackendBundle:token:base.html.twig" %}


{% block title %}Location Show{% endblock %}

{% block body %}
    <div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h2>Do you really want to delete this object?</h2>
                </div>
                <div class="modal-body">
                    <p>You are about to delete one token, this procedure is irreversible.</p>
                    <p>Do you want to proceed?</p>
                    <p>We hope that you know what you do!</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <a href="#" class="btn btn-danger danger">Delete</a>
                </div>
            </div>
        </div>
    </div>
    <h2>Object</h2>
    <ul class="list-group">
        <li class="list-group-item list-group-item-danger">
            <div class="labelview">Parent Name</div>
            {% if null != entity.parent %}
                {{ entity.parent.name }}
            {% endif %}
            &nbsp;
        </li>
        <li class="list-group-item list-group-item-info">
            <div class="labelview">Guid</div>
            {{ entity.guid }}&nbsp;
        </li>
        <li class="list-group-item list-group-item-info">
            <div class="labelview">Reference Id</div>
            {{ entity.referenceId }}&nbsp;
        </li>
        <li class="list-group-item list-group-item-info">
            <div class="labelview">Type Name</div>
            {{ entity.type.name }}&nbsp;
        </li>
        <li class="list-group-item list-group-item-info">
            <div class="labelview">Name</div>
            {{ entity.name }}&nbsp;
        </li>
        <li class="list-group-item list-group-item-info">
            <div class="labelview">LowerName</div>
            {{ entity.lowername }}&nbsp;
        </li>

        <li class="list-group-item list-group-item-info">
            <div class="labelview">Active</div>
            {{ entity.active }}&nbsp;
        </li>
    </ul>

    <h3>Values</h3>

    {% for attributeValue in entity.attributeValues %}
        <ul class="list-group">
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Attribute Group</div>
                {{ attributeValue.attribute.attributeGroup.name }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Attribute Name</div>
                {{ attributeValue.attribute.name }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Value</div>
                {{ attributeValue.value }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Language</div>
                {{ attributeValue.language.name }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Is mandatory</div>
                {{ attributeValue.attribute.mandatory ? 'Yes' : 'No' }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Possible Values</div>
                {{ attributeValue.attribute.possibleValues|join('/') }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Default Value</div>
                {{ attributeValue.attribute.defaultValue }}&nbsp;
            </li>
            <li class="list-group-item list-group-item-success">
                <div class="labelview">Is translatable</div>
                {{ attributeValue.attribute.translatable ? 'Yes' : 'No' }}&nbsp;
            </li>
        </ul>
    {% endfor %}

    <ul class="record_actions clearfix">
        <li>
            <a class="btn btn-success" href="{{ path('_admin_backend_webservice_object') }}">
                Back to the list
            </a>
        </li>
        <li>
            <a class="btn btn-primary"
               href="{{ path('_admin_backend_webservice_object_edit', { 'objectId': entity.guid }) }}">
                Edit Object
            </a>
        </li>
        {#
        <li>
            <a class="btn btn-danger" data-toggle="modal" data-target="#confirm-delete" data-href="{{ path('_admin_backend_webservice_object_delete', { 'objectId': entity.guid}) }}" href="#">Delete Location</a>
            {{ form(delete_form) }}
        </li>
        #}
    </ul>
    <script>
        $(function () {
            $(".show-applications").click(function () {
                var me = $(this),
                    container = $("#applicationContainer");
                if (me.hasClass("btn-pressed")) {
                    me.removeClass("btn-pressed").button("reset");
                    container.slideUp("slow", function () {
                        container.empty();
                    });
                } else {
                    me.addClass("btn-pressed").button("hide");
                    container.hide().load(me.attr("href"), function () {
                        container.slideDown();
                    });
                }
                return false;
            });
            $("body").prepend($('<div id="messageContainer" />'));
        });
        $('#confirm-delete').on('show.bs.modal', function (e) {
            $(this).find('.danger').attr('href', $(e.relatedTarget).data('href'));
            //$('.debug-url').html('Delete URL: <strong>' + $(this).find('.danger').attr('href') + '</strong>');
        });
    </script>
{% endblock %}