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" %} {% extends "base.html" %}
{% set active_page = "admin_accounts" %} {% set active_page = "admin_accounts" %}
{% if create %}
{% block title %} {% set action_label = 'Create' %}
<title> {% set form_action = url_for('admin.edit_account') %}
Edit Account - {{ SITE_NAME }} {% else %}
</title> {% set action_label = 'Edit' %}
{% endblock %} {% 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 %} {% block dashboard_stat %}
<div class="content-header"> <div class="content-header">
<div class="container-fluid"> <div class="container-fluid">
<div class="row mb-2"> <div class="row mb-2">
<div class="col-sm-6"> <div class="col-sm-6">
<h1 class="m-0 text-dark"> <h1 class="m-0 text-dark">{{ action_label }} Account</h1>
{% if create %}Add Account{% else %}Edit Account{% endif %}
<small>{% if create %}Account{% else %}{{ account.name }}{% endif %}</small>
</h1>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<ol class="breadcrumb float-sm-right"> <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('dashboard.dashboard') }}">Home</a></li>
<li class="breadcrumb-item"><a href="{{ url_for('admin.manage_account') }}">Accounts</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> </ol>
</div> </div>
</div> </div>
@ -31,30 +29,35 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-12 col-sm-6 col-lg-4">
<div class="card"> <form role="form" method="post" action="{{ form_action }}">
<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 %}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="create" value="{{ create }}"> <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"> <div class="card-body">
{% if error %} {% if error %}
<div class="alert alert-danger alert-dismissible"> <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> <h4><i class="fa-solid fa-ban"></i> Error!</h4>
{{ error }} {{ error }}
</div> </div>
<span class="help-block">{{ error }}</span> <span class="help-block">{{ error }}</span>
{% endif %} {% 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> <label class="control-label" for="accountname">Name</label>
<input type="text" class="form-control" placeholder="Account Name (required)" <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> {% if not create %}disabled{% endif %} required>
<span class="form-control-feedback"></span> <span class="form-control-feedback"></span>
{% if invalid_accountname %} {% if invalid_accountname %}
@ -68,25 +71,30 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<label class="control-label" for="accountdescription">Description</label> <label class="control-label" for="accountdescription">Description</label>
<input type="text" class="form-control" placeholder="Account Description (optional)" <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> <span class="orm-control-feedback"></span>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<label class="control-label" for="accountcontact">Contact Person</label> <label class="control-label" for="accountcontact">Contact Person</label>
<input type="text" class="form-control" placeholder="Contact Person (optional)" <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> <span class="form-control-feedback"></span>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<label class="control-label" for="accountmail">Mail Address</label> <label class="control-label" for="accountmail">Mail Address</label>
<input type="email" class="form-control" placeholder="Mail Address (optional)" <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> <span class="form-control-feedback"></span>
</div> </div>
</div> </div>
<!-- /.card-body -->
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Access Control</h3> <h3 class="card-title">Access Control</h3>
</div> </div>
<!-- /.card-header -->
<div class="card-body"> <div class="card-body">
<p>Users on the right have access to manage records in all domains <p>Users on the right have access to manage records in all domains
associated with the account. associated with the account.
@ -103,22 +111,30 @@
</select> </select>
</div> </div>
</div> </div>
<!-- /.card-body -->
<div class="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. <p>Domains on the right are associated with the account. Red marked domain names are
Moving already associated domains to this account will overwrite the previous associated account. already associated with other accounts.
Moving already associated domains to this account will overwrite the previous
associated account.
</p> </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"> <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 %} {% for domain in domains %}
{% if account != None and domain.account_id != None and account.id != domain.account_id %} {% if account != None and domain.account_id != None and account.id != domain.account_id %}
{% with 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 }} {{ domain.name }}
</option> </option>
{% endwith %} {% endwith %}
{% else %} {% 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 }} {{ domain.name }}
</option> </option>
{% endif %} {% endif %}
@ -126,48 +142,67 @@
</select> </select>
</div> </div>
</div> </div>
<!-- /.card-body -->
<div class="card-footer"> <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 Cancel
</button> </button>
<button type="submit" class="btn btn-primary float-right"> <button type="submit" class="btn btn-primary float-right"
{% if create %}Create{% else %}Update{% endif %} Account title="{{ action_label }} Account">
{{ action_label }} Account
</button> </button>
</div> </div>
<!-- /.card-footer -->
</div>
<!-- /.card -->
</form> </form>
</div> </div>
</div> <!-- /.col -->
<div class="col-8">
<div class="card"> <div class="col-12 col-sm-6 col-lg-8">
<div class="card card-outline card-secondary shadow">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Help with creating a new account</h3> <h3 class="card-title">Account Editor Help</h3>
</div> </div>
<!-- /.card-header -->
<div class="card-body"> <div class="card-body">
<p> <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. department.
<br /> </p>
A domain can be assigned to an account upon domain creation or through the domain administration <p>
A domain can be assigned to an account upon domain creation or through the domain
administration
page. page.
</p> </p>
<p>Fill in all the fields to the in the form to the left.</p> <p>Fill in all the fields to the in the form to the left.</p>
<p> <p>
<strong>Name</strong> is an account identifier. It will be lowercased and can contain alphanumeric <strong>Name</strong> is an account identifier. It will be lowercase and can contain
characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens and underscores (no space or other special character is allowed) alphanumeric
{% else %} (no extra character is allowed){% endif %}.<br /> characters{% if SETTING.get('account_name_extra_chars') %}, dots, hyphens and
<strong>Description</strong> is a user friendly name for this account.<br /> underscores (no space or other special character is allowed)
<strong>Contact person</strong> is the name of a contact person at the account.<br /> {% 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. <strong>Mail Address</strong> is an e-mail address for the contact person.
</p> </p>
</div> </div>
<!-- /.card-body -->
</div> </div>
<!-- /.card -->
</div> </div>
<!-- /.col -->
</div> </div>
<!-- /.row -->
</div> </div>
</section> <!-- /.container-fluid -->
</section>
{% endblock %} {% endblock %}
{% block extrascripts %} {% block extrascripts %}
<script> <script>
function addMultiSelect(id, placeholder) { function addMultiSelect(id, placeholder) {
$(id).multiSelect({ $(id).multiSelect({
selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`, selectableHeader: `<input type='text' class='search-input' autocomplete='off' placeholder='${placeholder}'>`,
@ -205,7 +240,8 @@
} }
}); });
} }
addMultiSelect("#account_multi_user", "Username") addMultiSelect("#account_multi_user", "Username")
addMultiSelect("#account_domains", "Domain") addMultiSelect("#account_domains", "Domain")
</script> </script>
{% endblock %} {% endblock %}