{#
/*
 * Spring Signage Ltd - http://www.springsignage.com
 * Copyright (C) 2017 Spring Signage Ltd
 * (views/user-form-membership.twig)
 */
#}
{% set randomId = random() %}

{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}

{% block formTitle %}
    {% trans "Manage Membership" %}
{% endblock %}

{% block formButtons %}
    {% trans "Help" %}, XiboHelpRender("{{ help.permissions }}")
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Save" %}, membersFormSubmit("{{ randomId }}")
{% endblock %}

{% block callBack %}membersFormOpen{% endblock %}

{% block formHtml %}
    <div class="row">
        <div class="col-md-12">
            <div id="{{ randomId }}" class="div-horizontal"
                     data-param="userGroupId"
                     data-param-unassign="unassignUserGroupId"
                     data-url="{{ urlFor("user.assign.userGroup", {id: user.userId}) }}"
                    >
                {% set helpText %}{% trans %}Check or un-check the options against each user to control whether they are a member or not.{% endtrans %}{% endset %}
                {{ forms.message(helpText) }}
                <table class="table table-bordered membersTable">
                    <tr>
                        <th>{{ user.user }}</th>
                        <th>{% trans "Member" %}</th>
                    </tr>
                    {% for item in checkboxes %}
                        <tr>
                            <td>{{ item.name }}</td>
                            <td><input type="checkbox" data-member-id="{{ item.id }}" {{ item.value_checked }}></td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    </div>
{% endblock %}