Completed first-found updates for the account creation view.

This commit is contained in:
Matt Scott 2023-02-20 09:07:07 -05:00
parent 8c6fc5e262
commit 0e67366c5f

View File

@ -1,28 +1,26 @@
{% extends "base.html" %}
{% set active_page = "admin_accounts" %}
{% block title %}
<title>
Edit Account - {{ SITE_NAME }}
</title>
{% endblock %}
{% if create %}
{% set action_label = 'Create' %}
{% set form_action = url_for('admin.edit_account') %}
{% else %}
{% set action_label = 'Edit' %}
{% set form_action = url_for('admin.edit_account', account_name=account.name) %}
{% endif %}
{% block title %}<title>{{ action_label }} Account - {{ SITE_NAME }}</title>{% endblock %}
{% block dashboard_stat %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">
{% if create %}Add Account{% else %}Edit Account{% endif %}
<small>{% if create %}Account{% else %}{{ account.name }}{% endif %}</small>
</h1>
<h1 class="m-0 text-dark">{{ action_label }} Account</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>
<li class="breadcrumb-item active">{% if create %}Add Account{% else %}Edit Account: {{ account.name }}{% endif %}</li>
<li class="breadcrumb-item active">{{ action_label }} Account</li>
</ol>
</div>
</div>
@ -31,30 +29,35 @@
{% endblock %}
{% block content %}
<section class="content">
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-4">
<div class="card">
<div class="card-header">
<h3 class="card-title">{% if create %}Add{% else %}Edit{% endif %} Account</h3>
</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 %}">
<div class="col-12 col-sm-6 col-lg-4">
<form role="form" method="post" action="{{ form_action }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="create" value="{{ create }}">
<div class="card card-outline card-primary shadow">
<div class="card-header">
<h3 class="card-title">Account Editor</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
{% if error %}
<div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
&times;
</button>
<h4><i class="fa-solid fa-ban"></i> Error!</h4>
{{ error }}
</div>
<span class="help-block">{{ error }}</span>
{% endif %}
<div class="form-group has-feedback {% if invalid_accountname or duplicate_accountname %}has-error{% 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 %}
name="accountname" id="accountname"
{% if account %}value="{{ account.name }}" {% endif %}
{% if not create %}disabled{% endif %} required>
<span class="form-control-feedback"></span>
{% if invalid_accountname %}
@ -68,25 +71,30 @@
<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 %}>
name="accountdescription" id="accountdescription"
{% if account %}value="{{ account.description }}" {% endif %}>
<span class="orm-control-feedback"></span>
</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 %}>
name="accountcontact" id="accountcontact"
{% if account %}value="{{ account.contact }}" {% endif %}>
<span class="form-control-feedback"></span>
</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 %}>
name="accountmail" id="accountmail"
{% if account %}value="{{ account.mail }}" {% endif %}>
<span class="form-control-feedback"></span>
</div>
</div>
<!-- /.card-body -->
<div class="card-header">
<h3 class="card-title">Access Control</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<p>Users on the right have access to manage records in all domains
associated with the account.
@ -103,22 +111,30 @@
</select>
</div>
</div>
<!-- /.card-body -->
<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>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>
<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">
<select multiple="multiple" class="form-control" id="account_domains" name="account_domains">
<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 }}">
<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 }}">
<option {% if account.id == domain.account_id %}selected{% endif %}
value="{{ domain.name }}">
{{ domain.name }}
</option>
{% endif %}
@ -126,48 +142,67 @@
</select>
</div>
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="button" class="btn btn-secondary float-left" onclick="window.location.href='{{ url_for('admin.manage_account') }}'">
<button type="button" class="btn btn-secondary float-left" title="Cancel"
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
<button type="submit" class="btn btn-primary float-right"
title="{{ action_label }} Account">
{{ action_label }} Account
</button>
</div>
<!-- /.card-footer -->
</div>
<!-- /.card -->
</form>
</div>
</div>
<div class="col-8">
<div class="card">
<!-- /.col -->
<div class="col-12 col-sm-6 col-lg-8">
<div class="card card-outline card-secondary shadow">
<div class="card-header">
<h3 class="card-title">Help with creating a new account</h3>
<h3 class="card-title">Account Editor Help</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<p>
An account allows grouping of domains belonging to a particular entity, such as a customer or
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
</p>
<p>
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>Name</strong> is an account identifier. It will be lowercase 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>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
</section>
<!-- /.container-fluid -->
</section>
{% endblock %}
{% block extrascripts %}
<script>
<script>
function addMultiSelect(id, placeholder) {
$(id).multiSelect({
selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
@ -205,7 +240,8 @@
}
});
}
addMultiSelect("#account_multi_user", "Username")
addMultiSelect("#account_domains", "Domain")
</script>
</script>
{% endblock %}