{% extends "SsoBackendBundle:PasswordPolicy:base.html.twig" %}
{% block title %}{{ parent() }} - Index{% endblock %}

{% block body %}
    <br/><br/>

    <h2>Password policy details</h2>

    <hr/><br/>
    <div class="row odd">
        <div class="col-md-4">
            <strong>Default Policy:</strong><br>
        </div>
        <div class="col-md-8">
            {% if policy.isDefault %}YES{% else %}NO{% endif %}
        </div>
    </div>
    <div class="row odd">
        <div class="col-md-4">
            <strong>Title:</strong>
        </div>
        <div class="col-md-8">
            {{ policy.title }}
        </div>
    </div>
    <div class="row odd">
        <div class="col-md-4">
            <strong>Description:</strong><br>
        </div>
        <div class="col-md-8">
            {{ policy.policyDescription }}
        </div>
    </div>
    <div class="row odd">
        <div class="col-md-12">
            <p><strong>errorMessages:</strong></p>
            <table class="table table-striped">
                {% for lang,message in policy.errorMessages %}
                    <tr>
                        <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                        <td>{{ message }}</td>
                    </tr>

                {% endfor %}
            </table>
        </div>
    </div>
    <div class="row odd">
        <div class="col-md-4">
            <p><strong>Validity (days):</strong></p>
        </div>
        <div class="col-md-8">
            {{ policy.validityDuration }}
        </div>
        <div class="col-md-12">
            <p><strong>validityDurationErrorMessages:</strong></p>
            <table class="table table-striped">
                {% for lang,message in policy.validityDurationErrorMessages %}
                    <tr>
                        <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                        <td>{{ message }}</td>
                    </tr>

                {% endfor %}
            </table>
        </div>
    </div>

    <div class="row odd">
        <div class="col-md-4">
            <p><strong>Password History:</strong></p>
        </div>
        <div class="col-md-8">
            {{ policy.historySize }}
        </div>
        <div class="col-md-12">
            <p><strong>historySizeErrorMessages:</strong></p>
            <table class="table table-striped">
                {% for lang,message in policy.historySizeErrorMessages %}
                    <tr>
                        <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                        <td>{{ message }}</td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </div>
    <div class="row odd">
        <div class="col-md-4">
            <p><strong>Edit Distance:</strong></p>
        </div>
        <div class="col-md-8">
            {{ policy.editDistance }}
        </div>
        <div class="col-md-12">
            <p><strong>editDistanceErrorMessages:</strong></p>
            <table class="table table-striped">
                {% for lang,message in policy.editDistanceErrorMessages %}
                    <tr>
                        <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                        <td>{{ message }}</td>
                    </tr>

                {% endfor %}
            </table>
        </div>
    </div>

    <div class="row odd">
        <div class="col-md-4">
            <p><strong>Change Delay (minutes):</strong></p>
        </div>
        <div class="col-md-8">
            {{ policy.changeDelay }}
        </div>
        <div class="col-md-12">
            <p><strong>changeDelayErrorMessages:</strong></p>
            <table class="table table-striped">
                {% for lang,message in policy.changeDelayErrorMessages %}
                    <tr>
                        <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                        <td>{{ message }}</td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </div>

    <h3>Validations</h3>
    <table class="table table-striped">
        {% for validation in policy.passwordPolicyValidations %}
            <tr>
                <td><strong>orderId:</strong></td>
                <td>{{ validation.orderId }}</td>
            </tr>
            <tr>
                <td><strong>regEx:</strong></td>
                <td>{{ validation.regEx }}</td>
            </tr>
            <tr>
                <td colspan="2"><strong>hintMessages:</strong></td>
            </tr>
            {% for lang,message in validation.hintMessages %}
                <tr>
                    <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                    <td>{{ message }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td colspan="2"><strong>errorMessages:</strong></td>
            </tr>
            {% for lang,message in validation.errorMessages %}
                <tr>
                    <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                    <td>{{ message }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td colspan="2">
                    <hr>
                </td>
            </tr>
        {% endfor %}
    </table>

    <h3>Deprecated Fields</h3>
    <div class="row odd">
        <div class="col-md-4">
            <p><strong>Regular Expression:</strong></p>
        </div>
        <div class="col-md-8">
            {{ policy.regEx }}
        </div>
        <div class="col-md-12">
            <p><strong>regexErrorMessages:</strong></p>
            <table class="table table-striped">
                {% for lang,message in policy.regexErrorMessages %}
                    <tr>
                        <td style="width:50px; font-weight: bold;">{{ lang }}</td>
                        <td>{{ message }}</td>
                    </tr>

                {% endfor %}
            </table>
        </div>
    </div>
    <div class="row odd">
        <div class="col-md-11">
        </div>
        <div class="col-md-1">
            <a href="{{ path('_admin_backend_passwordpolicy_list') }}" class="btn btn-success">Back</a>
        </div>
    </div>
    <style>
        .odd {
            background: #fff;
            padding: 15px;
            border-bottom: 1px solid #c5c5c5;
        }
    </style>
{% endblock %}
