Files
Cloud-CMS/views/usergroup-form-edit.twig
Matt Batchelder 05ce0da296 Initial Upload
2025-12-02 10:32:59 -05:00

200 lines
12 KiB
Twig

{#
/**
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
#}
{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}
{% block formTitle %}
{% trans "Edit User Group" %}
{% endblock %}
{% block formButtons %}
{% trans "Cancel" %}, XiboDialogClose()
{% trans "Save" %}, $("#userGroupEditForm").submit()
{% endblock %}
{% block callBack %}userGroupFormOpen{% endblock %}
{% block formHtml %}
<div class="row">
<div class="col-md-12">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item"><a class="nav-link active" href="#general-tab" role="tab" data-toggle="tab"><span>{% trans "General" %}</span></a></li>
<li class="nav-item"><a class="nav-link" href="#description-tab" role="tab" data-toggle="tab"><span>{% trans "Description" %}</span></a></li>
{% if currentUser.userTypeId == 1 %}
<li class="nav-item"><a class="nav-link" href="#notifications-tab" role="tab" data-toggle="tab"><span>{% trans "Notifications" %}</span></a></li>
<li class="nav-item"><a class="nav-link" href="#onboarding-tab" role="tab" data-toggle="tab"><span>{% trans "Onboarding Settings" %}</span></a></li>
{% endif %}
</ul>
<form id="userGroupEditForm" class="UserGroupForm form-horizontal" method="put" action="{{ url_for("group.edit", {"id": group.groupId}) }}">
<div class="tab-content">
<div class="tab-pane active" id="general-tab">
{% set title %}{% trans "Name" %}{% endset %}
{% set helpText %}{% trans "The Name for this User Group" %}{% endset %}
{{ forms.input("group", title, group.group, helpText, "", "required maxlength='50'") }}
{% set title %}{% trans "Library Quota" %}{% endset %}
{% set helpText %}{% trans "The quota that should be applied. Enter 0 for no quota." %}{% endset %}
<div class="form-group row">
<label class="col-sm-2 control-label" for="libraryQuota">{{ title }}</label>
<div class="col-sm-6">
<input class="form-control" name="libraryQuota" type="number" id="libraryQuota" value="{{ group.libraryQuota }}" />
<span class="help-block">{{ helpText }}</span>
</div>
<div class="col-sm-4">
<select name="libraryQuotaUnits" class="form-control">
<option value="kb">KiB</option>
<option value="mb">MiB</option>
<option value="gb">GiB</option>
</select>
</div>
</div>
</div>
{% if currentUser.userTypeId == 1 %}
<div class="tab-pane" id="notifications-tab">
<table class="table table-bordered">
<thead>
<tr>
<th>{{ "Notification Type"|trans }}</th>
<th>
{% trans "Enabled?" %}
<i class="fa fa-info-circle" title="{{ "Check this box to give this User access to this Notification." }}"></i>
</th>
</tr>
</thead>
<tbody class="feature-group">
<tr class="feature-row">
<td>
{{ "System"|trans }}<br/>
{{ "Should members of this Group receive Layout notification emails?"|trans }}
</td>
<td>
<input type="checkbox" name="isSystemNotification" {% if group.isSystemNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "Display"|trans }}<br/>
{{ "Should members of this Group receive Display notifications for Displays they have permission to see?"|trans }}
</td>
<td>
<input type="checkbox" name="isDisplayNotification" {% if group.isDisplayNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "DataSet"|trans }}<br/>
{{ "Should members of this Group receive DataSet notification emails?"|trans }}
</td>
<td>
<input type="checkbox" name="isDataSetNotification" {% if group.isDataSetNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "Layout"|trans }}<br/>
{{ "Should members of this Group receive Layout notification emails?"|trans }}
</td>
<td>
<input type="checkbox" name="isLayoutNotification" {% if group.isLayoutNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "Library"|trans }}<br/>
{{ "Should members of this Group receive Library notification emails?"|trans }}
</td>
<td>
<input type="checkbox" name="isLibraryNotification" {% if group.isLibraryNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "Reports"|trans }}<br/>
{{ "Should members of this Group receive Report notification emails?"|trans }}
</td>
<td>
<input type="checkbox" name="isReportNotification" {% if group.isReportNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "Schedule"|trans }}<br/>
{{ "Should members of this Group receive Schedule notification emails?"|trans }}
</td>
<td>
<input type="checkbox" name="isScheduleNotification" {% if group.isScheduleNotification == 1 %}checked{% endif %}>
</td>
</tr>
<tr class="feature-row">
<td>
{{ "Custom"|trans }}<br/>
{{ "Should members of this Group receive notifications emails for Notifications manually created in CMS?"|trans }}
</td>
<td>
<input type="checkbox" name="isCustomNotification" {% if group.isCustomNotification == 1 %}checked{% endif %}>
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
<div class="tab-pane" id="description-tab">
{% set title %}{% trans "Description" %}{% endset %}
{% set helpText %}{% trans "An optional description of the user group. (1 - 500 characters)" %}{% endset %}
{{ forms.textarea("description", title, group.description, helpText, "", "", 15) }}
</div>
{% if currentUser.userTypeId == 1 %}
<div class="tab-pane" id="onboarding-tab">
{% set title %}{% trans "Show when onboarding a new user?" %}{% endset %}
{% set helpText %}{% trans "Should this User Group be available for selection when creating a New User via the onboarding form?" %}{% endset %}
{{ forms.checkbox("isShownForAddUser", title, group.isShownForAddUser, helpText) }}
{% set title %}{% trans "Default Homepage" %}{% endset %}
{% set helpText %}{% trans "Default Homepage for users created with this group." %}{% endset %}
{% set homepagesUrl %}{{ url_for("user.homepages.search") }}?userTypeId=1{% endset %}
{% set attributes = [
{ name: "data-live-search", value: "true" },
{ name: "data-allow-clear", value: "true" },
{ name: "data-placeholder--id", value: null },
{ name: "data-placeholder--value", value: "" },
{ name: "data-search-url", value: homepagesUrl },
{ name: "data-search-term", value: "homepage" },
{ name: "data-id-property", value: "homepage" },
{ name: "data-text-property", value: "title" },
{ name: "data-initial-key", value: "homepage" },
{ name: "data-initial-value", value: group.defaultHomepageId }
] %}
{{ forms.dropdown("defaultHomepageId", "single", title, "", null, "homepage", "title", helpText, "pagedSelect", "", "", "", attributes) }}
</div>
{% endif %}
</div>
</form>
</div>
</div>
{% endblock %}