{% load custom_tags_and_filters %}
<div class="panel-body">
    <h3 class="customization-section-title">Projects & accounts</h3>
    <form method="POST" action="{% url 'customize' 'projects_and_accounts' %}" class="form-horizontal">
        {% csrf_token %}
        <div class="form-group" style="margin-bottom: 0">
            <label class="control-label col-md-3" for="account_list_active_only">Projects/accounts list</label>
            <div class="col-md-9">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="account_list_active_only"
                               name="account_list_active_only"
                               {% if account_list_active_only %}checked{% endif %}
                               value="enabled">
                        Hide inactive accounts
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-9 help-block light-grey">
                Check this box to only show active accounts in the account list.
            </div>
        </div>
        <div class="form-group" style="margin-bottom: 0">
            <div class="col-md-offset-3 col-md-9">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="account_project_list_active_only"
                               name="account_project_list_active_only"
                               {% if account_project_list_active_only %}checked{% endif %}
                               value="enabled">
                        Hide inactive projects in individual account page
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-9 help-block light-grey">
                Check this box to only show active projects when looking at an individual account.
            </div>
        </div>
        <div class="form-group" style="margin-bottom: 0">
            <div class="col-md-offset-3 col-md-9">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="project_list_active_only"
                               name="project_list_active_only"
                               {% if project_list_active_only %}checked{% endif %}
                               value="enabled">
                        Hide inactive projects
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-9 help-block light-grey">
                Check this box to only show active projects in the project list.
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-offset-3 col-md-9">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="account_list_collapse"
                               name="account_list_collapse"
                               {% if account_list_collapse %}checked{% endif %}
                               value="enabled">
                        Collapse project list by default
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-9 help-block light-grey">
                Check this box to collapse account projects by default.
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3" for="project_allow_transferring_charges">Transfer charges</label>
            <div class="col-md-8">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="project_allow_transferring_charges"
                               name="project_allow_transferring_charges"
                               {% if project_allow_transferring_charges %}checked{% endif %}
                               value="enabled">
                        Allow
                        accounting officers and managers to transfer charges to another project
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-8 help-block light-grey">
                Check this box to enable the transfer charges feature (available in the Administration menu or <a href="{% url 'transfer_charges' %}">here</a>).
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3" for="project_allow_pi_manage_users">Project PIs</label>
            <div class="col-md-8">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="project_allow_pi_manage_users"
                               name="project_allow_pi_manage_users"
                               {% if project_allow_pi_manage_users %}checked{% endif %}
                               value="enabled">
                        Allow project PIs to manage users
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-8 help-block light-grey">
                Check this box to allow project PIs to add/remove users to/from projects.
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3" for="project_type_allow_multiple">Project types</label>
            <div class="col-md-8">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               id="project_type_allow_multiple"
                               name="project_type_allow_multiple"
                               {% if project_type_allow_multiple %}checked{% endif %}
                               value="enabled">
                        Allow multiple project types per project
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-8 help-block light-grey">
                Check this box to allow multiple project types per project.
            </div>
        </div>
        <div class="form-group {% if errors.project_application_identifier_name %}has-error{% endif %}">
            <label class="control-label col-md-3" for="project_application_identifier_name">Project identifier name</label>
            <div class="col-md-8">
                <input type="text"
                       id="project_application_identifier_name"
                       name="project_application_identifier_name"
                       class="form-control"
                       value="{{ project_application_identifier_name }}">
            </div>
            <div class="col-md-offset-3 col-md-8 help-block light-grey">
                {% if errors.project_application_identifier_name %}
                    {{ errors.project_application_identifier_name.error }}
                {% else %}
                    The name of the project identifier property (Application, ID, Reference, PO etc.).
                {% endif %}
            </div>
        </div>
        <div class="form-group {% if errors.project_selection_template %}has-error{% endif %}">
            <label class="control-label col-md-3" for="project_selection_template">Project selection template</label>
            <div class="col-md-8">
                <textarea oninput="auto_size_textarea(this);"
                          id="project_selection_template"
                          name="project_selection_template"
                          class="form-control">{% if errors.project_selection_template %}{{ errors.project_selection_template.value }}{% else %}{{ project_selection_template }}{% endif %}</textarea>
            </div>
            <div class="col-md-offset-3 col-md-8 help-block light-grey">
                {% if errors.project_selection_template %}
                    {{ errors.project_selection_template.error }}
                {% else %}
                    The django template used for rendering project selection when enabling tools and making reservations. The context variable <b>project</b> is provided.
                {% endif %}
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3">Document upload</label>
            <div class="col-md-5">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"
                               name="project_allow_document_upload"
                               {% if project_allow_document_upload %}checked{% endif %}
                               value="enabled">
                        Enable project document upload
                    </label>
                </div>
            </div>
        </div>
        <div class="customization-separation" style="margin-bottom: 15px"></div>
        <div class="text-center">{% button type="save" value="Save settings" %}</div>
    </form>
    <script type="text/javascript">
        $("#projects_and_accounts-tab-link").click(function() {setTimeout(on_project_tab_show, 50)});
        function on_project_tab_show()
        {
            auto_size_textarea(document.getElementById('project_selection_template'))
        }
        on_project_tab_show();
    </script>
</div>
