2019-12-02 03:32:03 +00:00
|
|
|
{% extends "base.html" %}
|
2023-02-13 03:57:21 +00:00
|
|
|
|
2019-12-02 03:32:03 +00:00
|
|
|
{% set active_page = "admin_accounts" %}
|
2023-02-13 03:57:21 +00:00
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
<title>
|
|
|
|
Edit Account - {{ SITE_NAME }}
|
|
|
|
</title>
|
|
|
|
{% endblock %}
|
2019-12-02 03:32:03 +00:00
|
|
|
|
|
|
|
{% block dashboard_stat %}
|
2023-02-02 21:19:15 +00:00
|
|
|
<div class="content-header">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<h1 class="m-0 text-dark">
|
2023-02-17 22:25:11 +00:00
|
|
|
{% if create %}Add Account{% else %}Edit Account{% endif %}
|
|
|
|
<small>{% if create %}Account{% else %}{{ account.name }}{% endif %}</small>
|
2023-02-02 21:19:15 +00:00
|
|
|
</h1>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
|
|
|
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Home</a></li>
|
|
|
|
<li class="breadcrumb-item"><a href="{{ url_for('admin.manage_account') }}">Accounts</a></li>
|
2023-02-17 22:25:11 +00:00
|
|
|
<li class="breadcrumb-item active">{% if create %}Add Account{% else %}Edit Account: {{ account.name }}{% endif %}</li>
|
2023-02-02 21:19:15 +00:00
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-02 03:32:03 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<section class="content">
|
2023-02-06 15:45:13 +00:00
|
|
|
<div class="container-fluid">
|
2019-12-02 03:32:03 +00:00
|
|
|
<div class="row">
|
2023-02-06 15:45:13 +00:00
|
|
|
<div class="col-4">
|
2023-02-17 22:25:11 +00:00
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
|
|
|
<h3 class="card-title">{% if create %}Add{% else %}Edit{% endif %} Account</h3>
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
|
|
|
<form role="form" method="post" action="{% if create %}{{ url_for('admin.edit_account') }}{% else %}{{ url_for('admin.edit_account', account_name=account.name) }}{% endif %}">
|
|
|
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<input type="hidden" name="create" value="{{ create }}">
|
|
|
|
<div class="card-body">
|
|
|
|
{% if error %}
|
|
|
|
<div class="alert alert-danger alert-dismissible">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
2023-02-17 22:25:11 +00:00
|
|
|
<h4><i class="fa-solid fa-ban"></i> Error!</h4>
|
2023-02-06 15:45:13 +00:00
|
|
|
{{ error }}
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-06 15:45:13 +00:00
|
|
|
<span class="help-block">{{ error }}</span>
|
|
|
|
{% endif %}
|
|
|
|
<div class="form-group has-feedback {% if invalid_accountname or duplicate_accountname %}has-error{% endif %}">
|
|
|
|
<label class="control-label" for="accountname">Name</label>
|
|
|
|
<input type="text" class="form-control" placeholder="Account Name (required)"
|
|
|
|
name="accountname" {% if account %}value="{{ account.name }}" {% endif %}
|
2023-02-17 22:25:11 +00:00
|
|
|
{% if not create %}disabled{% endif %} required>
|
|
|
|
<span class="form-control-feedback"></span>
|
2023-02-06 15:45:13 +00:00
|
|
|
{% if invalid_accountname %}
|
2023-02-17 22:25:11 +00:00
|
|
|
<span class="help-block text-danger">Cannot be blank and must only contain alphanumeric
|
2023-02-06 15:45:13 +00:00
|
|
|
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens or underscores{% endif %}.
|
|
|
|
</span>
|
|
|
|
{% elif duplicate_accountname %}
|
2023-02-17 22:25:11 +00:00
|
|
|
<span class="help-block text-danger">Account name already in use.</span>
|
2023-02-06 15:45:13 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
<div class="form-group has-feedback">
|
|
|
|
<label class="control-label" for="accountdescription">Description</label>
|
|
|
|
<input type="text" class="form-control" placeholder="Account Description (optional)"
|
|
|
|
name="accountdescription" {% if account %}value="{{ account.description }}" {% endif %}>
|
2023-02-17 22:25:11 +00:00
|
|
|
<span class="orm-control-feedback"></span>
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group has-feedback">
|
|
|
|
<label class="control-label" for="accountcontact">Contact Person</label>
|
|
|
|
<input type="text" class="form-control" placeholder="Contact Person (optional)"
|
|
|
|
name="accountcontact" {% if account %}value="{{ account.contact }}" {% endif %}>
|
2023-02-17 22:25:11 +00:00
|
|
|
<span class="form-control-feedback"></span>
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group has-feedback">
|
|
|
|
<label class="control-label" for="accountmail">Mail Address</label>
|
|
|
|
<input type="email" class="form-control" placeholder="Mail Address (optional)"
|
|
|
|
name="accountmail" {% if account %}value="{{ account.mail }}" {% endif %}>
|
2023-02-17 22:25:11 +00:00
|
|
|
<span class="form-control-feedback"></span>
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-17 22:25:11 +00:00
|
|
|
<div class="card-header">
|
2023-02-06 15:45:13 +00:00
|
|
|
<h3 class="card-title">Access Control</h3>
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<p>Users on the right have access to manage records in all domains
|
|
|
|
associated with the account.
|
|
|
|
</p>
|
|
|
|
<p>Click on users to move between columns.</p>
|
|
|
|
<div class="form-group col-2">
|
|
|
|
<select multiple="multiple" class="form-control" id="account_multi_user"
|
|
|
|
name="account_multi_user">
|
|
|
|
{% for user in users %}
|
|
|
|
<option {% if user.id in account_user_ids|default([]) %}selected{% endif %}
|
|
|
|
value="{{ user.username }}">{{ user.username }}
|
|
|
|
</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-17 22:53:08 +00:00
|
|
|
<div class="card-body">
|
|
|
|
<p>Domains on the right are associated with the account. Red marked domain names are already associated with other accounts.
|
|
|
|
Moving already associated domains to this account will overwrite the previous associated account.
|
|
|
|
</p>
|
|
|
|
<p>Hover over the red domain names to show the associated account. Click on domains to move between columns.</p>
|
|
|
|
<div class="form-group col-2">
|
2023-02-17 23:07:36 +00:00
|
|
|
<select multiple="multiple" class="form-control" id="account_domains" name="account_domains">
|
|
|
|
{% for domain in domains %}
|
|
|
|
{% if account != None and domain.account_id != None and account.id != domain.account_id %}
|
|
|
|
{% with account_id=domain.account_id %}
|
|
|
|
<option style="color: red" data-toggle="tooltip" title="Associated with: {{ accounts[account_id].name }}" value="{{ domain.name }}">
|
|
|
|
{{ domain.name }}
|
|
|
|
</option>
|
|
|
|
{% endwith %}
|
|
|
|
{% else %}
|
|
|
|
<option {% if account.id == domain.account_id %}selected{% endif %} value="{{ domain.name }}">
|
|
|
|
{{ domain.name }}
|
|
|
|
</option>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
2023-02-17 22:53:08 +00:00
|
|
|
</div>
|
2023-02-06 15:45:13 +00:00
|
|
|
<div class="card-footer">
|
2023-02-17 22:25:11 +00:00
|
|
|
<button type="button" class="btn btn-secondary float-left" onclick="window.location.href='{{ url_for('admin.manage_account') }}'">
|
|
|
|
Cancel
|
|
|
|
</button>
|
|
|
|
<button type="submit" class="btn btn-primary float-right">
|
|
|
|
{% if create %}Create{% else %}Update{% endif %} Account
|
2023-02-06 15:45:13 +00:00
|
|
|
</button>
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-06 15:45:13 +00:00
|
|
|
</form>
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
2023-02-13 03:57:21 +00:00
|
|
|
<div class="col-8">
|
2023-02-17 22:25:11 +00:00
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">
|
2023-02-06 15:45:13 +00:00
|
|
|
<h3 class="card-title">Help with creating a new account</h3>
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
|
|
<p>
|
|
|
|
An account allows grouping of domains belonging to a particular entity, such as a customer or
|
|
|
|
department.
|
|
|
|
<br />
|
|
|
|
A domain can be assigned to an account upon domain creation or through the domain administration
|
|
|
|
page.
|
|
|
|
</p>
|
|
|
|
<p>Fill in all the fields to the in the form to the left.</p>
|
|
|
|
<p>
|
|
|
|
<strong>Name</strong> is an account identifier. It will be lowercased and can contain alphanumeric
|
|
|
|
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens and underscores (no space or other special character is allowed)
|
|
|
|
{% else %} (no extra character is allowed){% endif %}.<br />
|
|
|
|
<strong>Description</strong> is a user friendly name for this account.<br />
|
|
|
|
<strong>Contact person</strong> is the name of a contact person at the account.<br />
|
|
|
|
<strong>Mail Address</strong> is an e-mail address for the contact person.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-02 03:32:03 +00:00
|
|
|
</div>
|
2023-02-06 15:45:13 +00:00
|
|
|
</div>
|
2019-12-02 03:32:03 +00:00
|
|
|
</section>
|
|
|
|
{% endblock %}
|
|
|
|
{% block extrascripts %}
|
|
|
|
<script>
|
2023-02-17 23:07:36 +00:00
|
|
|
function addMultiSelect(id, placeholder) {
|
|
|
|
$(id).multiSelect({
|
|
|
|
selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
|
|
|
|
selectionHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
|
|
|
|
afterInit: function (ms) {
|
|
|
|
var that = this,
|
|
|
|
$selectableSearch = that.$selectableUl.prev(),
|
|
|
|
$selectionSearch = that.$selectionUl.prev(),
|
|
|
|
selectableSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selectable:not(.ms-selected)',
|
|
|
|
selectionSearchString = '#' + that.$container.attr('id') + ' .ms-elem-selection.ms-selected';
|
2020-04-17 14:01:29 +00:00
|
|
|
|
2023-02-17 23:07:36 +00:00
|
|
|
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
|
|
|
|
.on('keydown', function (e) {
|
|
|
|
if (e.which === 40) {
|
|
|
|
that.$selectableUl.focus();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2020-04-17 14:01:29 +00:00
|
|
|
|
2023-02-17 23:07:36 +00:00
|
|
|
that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
|
|
|
|
.on('keydown', function (e) {
|
|
|
|
if (e.which == 40) {
|
|
|
|
that.$selectionUl.focus();
|
|
|
|
return false;
|
2023-02-17 22:53:08 +00:00
|
|
|
}
|
2023-02-17 23:07:36 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
afterSelect: function () {
|
|
|
|
this.qs1.cache();
|
|
|
|
this.qs2.cache();
|
|
|
|
},
|
|
|
|
afterDeselect: function () {
|
|
|
|
this.qs1.cache();
|
|
|
|
this.qs2.cache();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
addMultiSelect("#account_multi_user", "Username")
|
|
|
|
addMultiSelect("#account_domains", "Domain")
|
2019-12-02 03:32:03 +00:00
|
|
|
</script>
|
2021-10-30 19:19:01 +00:00
|
|
|
{% endblock %}
|