Prepend all the HTML ID and class names with "accounting-" to avoid name conflict.

This commit is contained in:
依瑪貓 2023-02-07 17:57:26 +08:00
parent b1c7bc61c4
commit 1d61fa93d3
13 changed files with 108 additions and 123 deletions

View File

@ -21,65 +21,50 @@
* First written: 2023/2/1 * First written: 2023/2/1
*/ */
.clickable { .accounting-clickable {
cursor: pointer; cursor: pointer;
} }
.btn-group .btn .search-input { .btn-group .btn .accounting-search-input {
min-height: calc(1em + .5rem + 2px); min-height: calc(1em + .5rem + 2px);
padding: 0 0.5rem; padding: 0 0.5rem;
} }
.btn-group .btn .search-label button { .btn-group .btn .accounting-search-label button {
border: none; border: none;
background-color: transparent; background-color: transparent;
color: inherit; color: inherit;
padding-right: 0; padding-right: 0;
} }
/** The account management */ /** The card layout */
.account { .accounting-card {
padding: 2em 1.5em; padding: 2em 1.5em;
margin: 1em; margin: 1em;
background-color: #E9ECEF; background-color: #E9ECEF;
border-radius: 0.3em; border-radius: 0.3em;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
} }
.account .account-title { .accounting-card-title {
font-size: 1.8rem; font-size: 1.8rem;
font-weight: bolder; font-weight: bolder;
} }
.account .account-code { .accounting-card-code {
font-size: 1.4rem; font-size: 1.4rem;
color: #373b3e; color: #373b3e;
} }
.list-base-selector {
/** The option selector */
.accounting-selector-list {
height: 20rem; height: 20rem;
overflow-y: scroll; overflow-y: scroll;
} }
/** The currency management. */
.currency {
padding: 2em 1.5em;
margin: 1em;
background-color: #E9ECEF;
border-radius: 0.3em;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.currency .currency-name {
font-size: 1.8rem;
font-weight: bolder;
}
.currency .currency-code {
font-size: 1.4rem;
color: #373b3e;
}
/* The Material Design text field (floating form control in Bootstrap) */ /* The Material Design text field (floating form control in Bootstrap) */
.material-text-field { .accounting-material-text-field {
position: relative; position: relative;
min-height: calc(3.5rem + 2px); min-height: calc(3.5rem + 2px);
padding-top: 1.625rem; padding-top: 1.625rem;
} }
.material-text-field > .form-label { .accounting-material-text-field > .form-label {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
@ -88,27 +73,27 @@
transform-origin: 0 0; transform-origin: 0 0;
transition: opacity .1s ease-in-out,transform .1s ease-in-out; transition: opacity .1s ease-in-out,transform .1s ease-in-out;
} }
.material-text-field.not-empty > .form-label { .accounting-material-text-field.accounting-not-empty > .form-label {
opacity: 0.65; opacity: 0.65;
transform: scale(.85) translateY(-.5rem) translateX(.15rem); transform: scale(.85) translateY(-.5rem) translateX(.15rem);
} }
/* The Material Design floating action buttons */ /* The Material Design floating action buttons */
.material-fab { .accounting-material-fab {
position: fixed; position: fixed;
right: 2rem; right: 2rem;
bottom: 1rem; bottom: 1rem;
z-index: 10; z-index: 10;
flex-direction: column-reverse; flex-direction: column-reverse;
} }
.material-fab .btn { .accounting-material-fab .btn {
border-radius: 50%; border-radius: 50%;
transform: scale(1.5); transform: scale(1.5);
box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0,0,0,.12); box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0,0,0,.12);
display: block; display: block;
margin-top: 2.5rem; margin-top: 2.5rem;
} }
.material-fab .btn:hover, .material-fab .btn:focus { .accounting-material-fab .btn:hover, .accounting-material-fab .btn:focus {
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0,0,0,.12); box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0,0,0,.12);
} }

View File

@ -24,11 +24,11 @@
// Initializes the page JavaScript. // Initializes the page JavaScript.
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
initializeBaseAccountSelector(); initializeBaseAccountSelector();
document.getElementById("account-base-code") document.getElementById("accounting-base-code")
.onchange = validateBase; .onchange = validateBase;
document.getElementById("account-title") document.getElementById("accounting-title")
.onchange = validateTitle; .onchange = validateTitle;
document.getElementById("account-form") document.getElementById("accounting-form")
.onsubmit = validateForm; .onsubmit = validateForm;
}); });
@ -38,25 +38,25 @@ document.addEventListener("DOMContentLoaded", function () {
* @private * @private
*/ */
function initializeBaseAccountSelector() { function initializeBaseAccountSelector() {
const selector = document.getElementById("select-base-modal"); const selector = document.getElementById("accounting-base-selector-model");
const base = document.getElementById("account-base"); const base = document.getElementById("accounting-base");
const baseCode = document.getElementById("account-base-code"); const baseCode = document.getElementById("accounting-base-code");
const baseContent = document.getElementById("account-base-content"); const baseContent = document.getElementById("accounting-base-content");
const options = Array.from(document.getElementsByClassName("list-group-item-base")); const options = Array.from(document.getElementsByClassName("accounting-base-option"));
const btnClear = document.getElementById("btn-clear-base"); const btnClear = document.getElementById("accounting-btn-clear-base");
selector.addEventListener("show.bs.modal", function () { selector.addEventListener("show.bs.modal", function () {
base.classList.add("not-empty"); base.classList.add("accounting-not-empty");
options.forEach(function (item) { options.forEach(function (item) {
item.classList.remove("active"); item.classList.remove("active");
}); });
const selected = document.getElementById("list-group-item-base-" + baseCode.value); const selected = document.getElementById("accounting-base-option-" + baseCode.value);
if (selected !== null) { if (selected !== null) {
selected.classList.add("active"); selected.classList.add("active");
} }
}); });
selector.addEventListener("hidden.bs.modal", function () { selector.addEventListener("hidden.bs.modal", function () {
if (baseCode.value === "") { if (baseCode.value === "") {
base.classList.remove("not-empty"); base.classList.remove("accounting-not-empty");
} }
}); });
options.forEach(function (option) { options.forEach(function (option) {
@ -101,9 +101,9 @@ function validateForm() {
* @private * @private
*/ */
function validateBase() { function validateBase() {
const field = document.getElementById("account-base-code"); const field = document.getElementById("accounting-base-code");
const error = document.getElementById("account-base-code-error"); const error = document.getElementById("accounting-base-code-error");
const displayField = document.getElementById("account-base"); const displayField = document.getElementById("accounting-base");
field.value = field.value.trim(); field.value = field.value.trim();
if (field.value === "") { if (field.value === "") {
displayField.classList.add("is-invalid"); displayField.classList.add("is-invalid");
@ -122,8 +122,8 @@ function validateBase() {
* @private * @private
*/ */
function validateTitle() { function validateTitle() {
const field = document.getElementById("account-title"); const field = document.getElementById("accounting-title");
const error = document.getElementById("account-title-error"); const error = document.getElementById("accounting-title-error");
field.value = field.value.trim(); field.value = field.value.trim();
if (field.value === "") { if (field.value === "") {
field.classList.add("is-invalid"); field.classList.add("is-invalid");

View File

@ -23,13 +23,13 @@
// Initializes the page JavaScript. // Initializes the page JavaScript.
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const list = document.getElementById("account-order-list"); const list = document.getElementById("accounting-order-list");
if (list !== null) { if (list !== null) {
const onReorder = function () { const onReorder = function () {
const accounts = Array.from(list.children); const accounts = Array.from(list.children);
for (let i = 0; i < accounts.length; i++) { for (let i = 0; i < accounts.length; i++) {
const no = document.getElementById("account-order-" + accounts[i].dataset.id + "-no"); const no = document.getElementById("accounting-order-" + accounts[i].dataset.id + "-no");
const code = document.getElementById("account-order-" + accounts[i].dataset.id + "-code"); const code = document.getElementById("accounting-order-" + accounts[i].dataset.id + "-code");
no.value = String(i + 1); no.value = String(i + 1);
code.innerText = list.dataset.baseCode + "-" + ("000" + (i + 1)).slice(-3); code.innerText = list.dataset.baseCode + "-" + ("000" + (i + 1)).slice(-3);
} }

View File

@ -23,11 +23,11 @@
// Initializes the page JavaScript. // Initializes the page JavaScript.
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
document.getElementById("currency-code") document.getElementById("accounting-code")
.onchange = validateCode; .onchange = validateCode;
document.getElementById("currency-name") document.getElementById("accounting-name")
.onchange = validateName; .onchange = validateName;
document.getElementById("currency-form") document.getElementById("accounting-form")
.onsubmit = validateForm; .onsubmit = validateForm;
}); });
@ -69,7 +69,7 @@ function submitFormIfAllAsyncValid() {
isValid = isAsyncValid[key] && isValid; isValid = isAsyncValid[key] && isValid;
}); });
if (isValid) { if (isValid) {
document.getElementById("currency-form").submit() document.getElementById("accounting-form").submit()
} }
} }
@ -84,8 +84,8 @@ function validateCode(changeEvent = null) {
const key = "code"; const key = "code";
const isSubmission = changeEvent === null; const isSubmission = changeEvent === null;
let hasAsyncValidation = false; let hasAsyncValidation = false;
const field = document.getElementById("currency-code"); const field = document.getElementById("accounting-code");
const error = document.getElementById("currency-code-error"); const error = document.getElementById("accounting-code-error");
field.value = field.value.trim(); field.value = field.value.trim();
if (field.value === "") { if (field.value === "") {
field.classList.add("is-invalid"); field.classList.add("is-invalid");
@ -125,8 +125,8 @@ function validateCode(changeEvent = null) {
* @private * @private
*/ */
function validateAsyncCodeIsDuplicated(isSubmission, key) { function validateAsyncCodeIsDuplicated(isSubmission, key) {
const field = document.getElementById("currency-code"); const field = document.getElementById("accounting-code");
const error = document.getElementById("currency-code-error"); const error = document.getElementById("accounting-code-error");
const url = field.dataset.existsUrl; const url = field.dataset.existsUrl;
const onLoad = function () { const onLoad = function () {
if (this.status === 200) { if (this.status === 200) {
@ -160,8 +160,8 @@ function validateAsyncCodeIsDuplicated(isSubmission, key) {
* @private * @private
*/ */
function validateName() { function validateName() {
const field = document.getElementById("currency-name"); const field = document.getElementById("accounting-name");
const error = document.getElementById("currency-name-error"); const error = document.getElementById("accounting-name-error");
field.value = field.value.trim(); field.value = field.value.trim();
if (field.value === "") { if (field.value === "") {
field.classList.add("is-invalid"); field.classList.add("is-invalid");

View File

@ -41,7 +41,7 @@ First written: 2023/1/31
{{ A_("Order") }} {{ A_("Order") }}
</a> </a>
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal"> <button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#accounting-delete-modal">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
{{ A_("Delete") }} {{ A_("Delete") }}
</button> </button>
@ -49,7 +49,7 @@ First written: 2023/1/31
</div> </div>
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.account.edit", account=obj)|accounting_inherit_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.account.edit", account=obj)|accounting_inherit_next }}">
<i class="fa-solid fa-pen-to-square"></i> <i class="fa-solid fa-pen-to-square"></i>
</a> </a>
@ -57,16 +57,16 @@ First written: 2023/1/31
{% endif %} {% endif %}
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<form id="delete-form" action="{{ url_for("accounting.account.delete", account=obj) }}" method="post"> <form action="{{ url_for("accounting.account.delete", account=obj) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}
<input type="hidden" name="next" value="{{ request.args["next"] }}"> <input type="hidden" name="next" value="{{ request.args["next"] }}">
{% endif %} {% endif %}
<div class="modal fade" id="delete-modal" tabindex="-1" aria-labelledby="delete-model-label" aria-hidden="true"> <div class="modal fade" id="accounting-delete-modal" tabindex="-1" aria-labelledby="accounting-delete-model-label" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h1 class="modal-title fs-5" id="delete-model-label">{{ A_("Delete Account Confirmation") }}</h1> <h1 class="modal-title fs-5" id="accounting-delete-model-label">{{ A_("Delete Account Confirmation") }}</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@ -82,9 +82,9 @@ First written: 2023/1/31
</form> </form>
{% endif %} {% endif %}
<div class="account col-sm-6"> <div class="accounting-card col-sm-6">
<div class="account-title">{{ obj.title }}</div> <div class="accounting-card-title">{{ obj.title }}</div>
<div class="account-code">{{ obj.code }}</div> <div class="accounting-card-code">{{ obj.code }}</div>
{% if obj.is_offset_needed %} {% if obj.is_offset_needed %}
<div> <div>
<span class="badge rounded-pill bg-info">{{ A_("Offset needed") }}</span> <span class="badge rounded-pill bg-info">{{ A_("Offset needed") }}</span>

View File

@ -34,16 +34,16 @@ First written: 2023/2/1
</a> </a>
</div> </div>
<form id="account-form" action="{% block action_url %}{% endblock %}" method="post"> <form id="accounting-form" action="{% block action_url %}{% endblock %}" method="post">
{{ form.csrf_token }} {{ form.csrf_token }}
{% if "next" in request.args %} {% if "next" in request.args %}
<input type="hidden" name="next" value="{{ request.args["next"] }}"> <input type="hidden" name="next" value="{{ request.args["next"] }}">
{% endif %} {% endif %}
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input id="account-base-code" type="hidden" name="base_code" value="{{ "" if form.base_code.data is none else form.base_code.data }}"> <input id="accounting-base-code" type="hidden" name="base_code" value="{{ "" if form.base_code.data is none else form.base_code.data }}">
<div id="account-base" class="form-control clickable material-text-field {% if form.base_code.data %} not-empty {% endif %} {% if form.base_code.errors %} is-invalid {% endif %}" data-bs-toggle="modal" data-bs-target="#select-base-modal"> <div id="accounting-base" class="form-control accounting-clickable accounting-material-text-field {% if form.base_code.data %} accounting-not-empty {% endif %} {% if form.base_code.errors %} is-invalid {% endif %}" data-bs-toggle="modal" data-bs-target="#accounting-base-selector-model">
<label id="account-base-label" class="form-label" for="account-base">{{ A_("Base account") }}</label> <label class="form-label" for="accounting-base">{{ A_("Base account") }}</label>
<div id="account-base-content"> <div id="accounting-base-content">
{% if form.base_code.data %} {% if form.base_code.data %}
{% if form.base_code.errors %} {% if form.base_code.errors %}
{{ A_("(Unknown)") }} {{ A_("(Unknown)") }}
@ -53,18 +53,18 @@ First written: 2023/2/1
{% endif %} {% endif %}
</div> </div>
</div> </div>
<div id="account-base-code-error" class="invalid-feedback">{% if form.base_code.errors %}{{ form.base_code.errors[0] }}{% endif %}</div> <div id="accounting-base-code-error" class="invalid-feedback">{% if form.base_code.errors %}{{ form.base_code.errors[0] }}{% endif %}</div>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input id="account-title" class="form-control {% if form.title.errors %} is-invalid {% endif %}" type="text" name="title" value="{{ "" if form.title.data is none else form.title.data }}" placeholder=" " required="required"> <input id="accounting-title" class="form-control {% if form.title.errors %} is-invalid {% endif %}" type="text" name="title" value="{{ "" if form.title.data is none else form.title.data }}" placeholder=" " required="required">
<label class="form-label" for="account-title">{{ A_("Title") }}</label> <label class="form-label" for="accounting-title">{{ A_("Title") }}</label>
<div id="account-title-error" class="invalid-feedback">{% if form.title.errors %}{{ form.title.errors[0] }}{% endif %}</div> <div id="accounting-title-error" class="invalid-feedback">{% if form.title.errors %}{{ form.title.errors[0] }}{% endif %}</div>
</div> </div>
<div class="form-check form-switch mb-3"> <div class="form-check form-switch mb-3">
<input id="account-is-offset-needed" class="form-check-input" type="checkbox" name="is_offset_needed" value="1" {% if form.is_offset_needed.data %} checked="checked" {% endif %}> <input id="accounting-is-offset-needed" class="form-check-input" type="checkbox" name="is_offset_needed" value="1" {% if form.is_offset_needed.data %} checked="checked" {% endif %}>
<label class="form-check-label" for="account-is-offset-needed"> <label class="form-check-label" for="accounting-is-offset-needed">
{{ A_("The entries in the account need offsets.") }} {{ A_("The entries in the account need offsets.") }}
</label> </label>
</div> </div>
@ -76,32 +76,32 @@ First written: 2023/2/1
</button> </button>
</div> </div>
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<button class="btn btn-primary" type="submit"> <button class="btn btn-primary" type="submit">
<i class="fa-solid fa-floppy-disk"></i> <i class="fa-solid fa-floppy-disk"></i>
</button> </button>
</div> </div>
</form> </form>
<div class="modal fade" id="select-base-modal" tabindex="-1" aria-labelledby="select-base-model-label" aria-hidden="true"> <div class="modal fade" id="accounting-base-selector-model" tabindex="-1" aria-labelledby="accounting-base-selector-model-label" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h1 class="modal-title fs-5" id="base-selector-model-label">{{ A_("Select Base Account") }}</h1> <h1 class="modal-title fs-5" id="accounting-base-selector-model-label">{{ A_("Select Base Account") }}</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="input-group mb-2"> <div class="input-group mb-2">
<input id="select-base-query" class="form-control form-control-sm" type="search" placeholder=" " required="required" aria-label="Search"> <input id="accounting-base-selector-query" class="form-control form-control-sm" type="search" placeholder=" " required="required" aria-label="Search">
<label class="input-group-text" for="select-base-query"> <label class="input-group-text" for="accounting-base-selector-query">
<i class="fa-solid fa-magnifying-glass"></i> <i class="fa-solid fa-magnifying-glass"></i>
{{ A_("Search") }} {{ A_("Search") }}
</label> </label>
</div> </div>
<ul class="list-group list-base-selector"> <ul class="list-group accounting-selector-list">
{% for base in form.base_options %} {% for base in form.base_options %}
<li id="list-group-item-base-{{ base.code }}" class="list-group-item list-group-item-base clickable" data-code="{{ base.code }}" data-content="{{ base }}"> <li id="accounting-base-option-{{ base.code }}" class="list-group-item accounting-base-option accounting-clickable" data-code="{{ base.code }}" data-content="{{ base }}">
{{ base }} {{ base }}
</li> </li>
{% endfor %} {% endfor %}
@ -110,9 +110,9 @@ First written: 2023/2/1
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ A_("Cancel") }}</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ A_("Cancel") }}</button>
{% if form.base_code.data %} {% if form.base_code.data %}
<button id="btn-clear-base" type="button" class="btn btn-danger">{{ A_("Clear") }}</button> <button id="accounting-btn-clear-base" type="button" class="btn btn-danger">{{ A_("Clear") }}</button>
{% else %} {% else %}
<button id="btn-clear-base" type="button" class="btn btn-secondary" disabled="disabled">{{ A_("Clear") }}</button> <button id="accounting-btn-clear-base" type="button" class="btn btn-secondary" disabled="disabled">{{ A_("Clear") }}</button>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -33,8 +33,8 @@ First written: 2023/1/30
</a> </a>
{% endif %} {% endif %}
<form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.account.list") }}" method="get" role="search"> <form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.account.list") }}" method="get" role="search">
<input id="search-input" class="form-control form-control-sm search-input" type="search" name="q" value="{{ request.args["q"] if "q" in request.args else "" }}" placeholder=" " required="required" aria-label="Search"> <input id="accounting-search" class="form-control form-control-sm accounting-search-input" type="search" name="q" value="{{ request.args["q"] if "q" in request.args else "" }}" placeholder=" " required="required" aria-label="Search">
<label for="search-input" class="search-label"> <label for="accounting-search" class="accounting-search-label">
<button type="submit"> <button type="submit">
<i class="fa-solid fa-magnifying-glass"></i> <i class="fa-solid fa-magnifying-glass"></i>
{{ A_("Search") }} {{ A_("Search") }}
@ -44,7 +44,7 @@ First written: 2023/1/30
</div> </div>
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.account.create")|accounting_append_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.account.create")|accounting_append_next }}">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
</a> </a>

View File

@ -39,16 +39,16 @@ First written: 2023/2/2
{% if base.accounts|length > 1 and accounting_can_edit() %} {% if base.accounts|length > 1 and accounting_can_edit() %}
<form action="{{ url_for("accounting.account.sort", base=base) }}" method="post"> <form action="{{ url_for("accounting.account.sort", base=base) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}
<input type="hidden" name="next" value="{{ request.args["next"] }}"> <input type="hidden" name="next" value="{{ request.args["next"] }}">
{% endif %} {% endif %}
<ul id="account-order-list" class="list-group mb-3" data-base-code="{{ base.code }}"> <ul id="accounting-order-list" class="list-group mb-3" data-base-code="{{ base.code }}">
{% for account in base.accounts|sort(attribute="no") %} {% for account in base.accounts|sort(attribute="no") %}
<li class="list-group-item d-flex justify-content-between" data-id="{{ account.id }}"> <li class="list-group-item d-flex justify-content-between" data-id="{{ account.id }}">
<input id="account-order-{{ account.id }}-no" type="hidden" name="{{ account.id }}-no" value="{{ loop.index }}"> <input id="accounting-order-{{ account.id }}-no" type="hidden" name="{{ account.id }}-no" value="{{ loop.index }}">
<div> <div>
<span id="account-order-{{ account.id }}-code">{{ account.code }}</span> <span id="accounting-order-{{ account.id }}-code">{{ account.code }}</span>
{{ account.title }} {{ account.title }}
</div> </div>
<i class="fa-solid fa-bars"></i> <i class="fa-solid fa-bars"></i>
@ -63,7 +63,7 @@ First written: 2023/2/2
</button> </button>
</div> </div>
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<button class="btn btn-primary" type="submit"> <button class="btn btn-primary" type="submit">
<i class="fa-solid fa-floppy-disk"></i> <i class="fa-solid fa-floppy-disk"></i>
</button> </button>

View File

@ -32,9 +32,9 @@ First written: 2023/2/1
</a> </a>
</div> </div>
<div class="account col-sm-6"> <div class="accounting-card col-sm-6">
<div class="account-title">{{ obj.title }}</div> <div class="accounting-card-title">{{ obj.title }}</div>
<div class="account-code">{{ obj.code }}</div> <div class="accounting-card-code">{{ obj.code }}</div>
{% if obj.accounts %} {% if obj.accounts %}
<div> <div>
{% for account in obj.accounts %} {% for account in obj.accounts %}

View File

@ -27,8 +27,8 @@ First written: 2023/1/26
<div class="btn-group mb-2"> <div class="btn-group mb-2">
<form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.base-account.list") }}" method="get" role="search"> <form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.base-account.list") }}" method="get" role="search">
<input id="search-input" class="form-control form-control-sm search-input" type="search" name="q" value="{{ request.args["q"] if "q" in request.args else "" }}" placeholder=" " required="required" aria-label="Search"> <input id="accounting-search" class="form-control form-control-sm accounting-search-input" type="search" name="q" value="{{ request.args["q"] if "q" in request.args else "" }}" placeholder=" " required="required" aria-label="Search">
<label for="search-input" class="search-label"> <label for="accounting-search" class="accounting-search-label">
<button type="submit"> <button type="submit">
<i class="fa-solid fa-magnifying-glass"></i> <i class="fa-solid fa-magnifying-glass"></i>
{{ A_("Search") }} {{ A_("Search") }}

View File

@ -37,7 +37,7 @@ First written: 2023/2/6
</a> </a>
{% endif %} {% endif %}
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#delete-modal"> <button class="btn btn-danger" type="button" data-bs-toggle="modal" data-bs-target="#accounting-delete-modal">
<i class="fa-solid fa-trash"></i> <i class="fa-solid fa-trash"></i>
{{ A_("Delete") }} {{ A_("Delete") }}
</button> </button>
@ -45,7 +45,7 @@ First written: 2023/2/6
</div> </div>
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.currency.edit", currency=obj)|accounting_inherit_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.currency.edit", currency=obj)|accounting_inherit_next }}">
<i class="fa-solid fa-pen-to-square"></i> <i class="fa-solid fa-pen-to-square"></i>
</a> </a>
@ -53,16 +53,16 @@ First written: 2023/2/6
{% endif %} {% endif %}
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<form id="delete-form" action="{{ url_for("accounting.currency.delete", currency=obj) }}" method="post"> <form action="{{ url_for("accounting.currency.delete", currency=obj) }}" method="post">
<input id="csrf_token" type="hidden" name="csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if "next" in request.args %} {% if "next" in request.args %}
<input type="hidden" name="next" value="{{ request.args["next"] }}"> <input type="hidden" name="next" value="{{ request.args["next"] }}">
{% endif %} {% endif %}
<div class="modal fade" id="delete-modal" tabindex="-1" aria-labelledby="delete-model-label" aria-hidden="true"> <div class="modal fade" id="accounting-delete-modal" tabindex="-1" aria-labelledby="accounting-delete-model-label" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h1 class="modal-title fs-5" id="delete-model-label">{{ A_("Delete Currency Confirmation") }}</h1> <h1 class="modal-title fs-5" id="accounting-delete-model-label">{{ A_("Delete Currency Confirmation") }}</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@ -78,9 +78,9 @@ First written: 2023/2/6
</form> </form>
{% endif %} {% endif %}
<div class="currency col-sm-6"> <div class="accounting-card col-sm-6">
<div class="currency-name">{{ obj.name }}</div> <div class="accounting-card-title">{{ obj.name }}</div>
<div class="currency-code">{{ obj.code }}</div> <div class="accounting-card-code">{{ obj.code }}</div>
<div class="small text-secondary fst-italic"> <div class="small text-secondary fst-italic">
<div>{{ A_("Created") }} {{ obj.created_at }} {{ obj.created_by }}</div> <div>{{ A_("Created") }} {{ obj.created_at }} {{ obj.created_by }}</div>
<div>{{ A_("Updated") }} {{ obj.updated_at }} {{ obj.updated_by }}</div> <div>{{ A_("Updated") }} {{ obj.updated_at }} {{ obj.updated_by }}</div>

View File

@ -34,21 +34,21 @@ First written: 2023/2/6
</a> </a>
</div> </div>
<form id="currency-form" action="{% block action_url %}{% endblock %}" method="post"> <form id="accounting-form" action="{% block action_url %}{% endblock %}" method="post">
{{ form.csrf_token }} {{ form.csrf_token }}
{% if "next" in request.args %} {% if "next" in request.args %}
<input type="hidden" name="next" value="{{ request.args["next"] }}"> <input type="hidden" name="next" value="{{ request.args["next"] }}">
{% endif %} {% endif %}
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input id="currency-code" class="form-control {% if form.code.errors %} is-invalid {% endif %}" type="text" name="code" value="{{ "" if form.code.data is none else form.code.data }}" placeholder=" " required="required" data-exists-url="{{ url_for("accounting.currency-api.exists") }}" data-original="{% block original_code %}{% endblock %}" data-blocklist="{{ form.CODE_BLOCKLIST|tojson|forceescape }}"> <input id="accounting-code" class="form-control {% if form.code.errors %} is-invalid {% endif %}" type="text" name="code" value="{{ "" if form.code.data is none else form.code.data }}" placeholder=" " required="required" data-exists-url="{{ url_for("accounting.currency-api.exists") }}" data-original="{% block original_code %}{% endblock %}" data-blocklist="{{ form.CODE_BLOCKLIST|tojson|forceescape }}">
<label class="form-label" for="currency-code">{{ A_("Code") }}</label> <label class="form-label" for="accounting-code">{{ A_("Code") }}</label>
<div id="currency-code-error" class="invalid-feedback">{% if form.code.errors %}{{ form.code.errors[0] }}{% endif %}</div> <div id="accounting-code-error" class="invalid-feedback">{% if form.code.errors %}{{ form.code.errors[0] }}{% endif %}</div>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input id="currency-name" class="form-control {% if form.name.errors %} is-invalid {% endif %}" type="text" name="name" value="{{ "" if form.name.data is none else form.name.data }}" placeholder=" " required="required"> <input id="accounting-name" class="form-control {% if form.name.errors %} is-invalid {% endif %}" type="text" name="name" value="{{ "" if form.name.data is none else form.name.data }}" placeholder=" " required="required">
<label class="form-label" for="currency-name">{{ A_("Name") }}</label> <label class="form-label" for="accounting-name">{{ A_("Name") }}</label>
<div id="currency-name-error" class="invalid-feedback">{% if form.name.errors %}{{ form.name.errors[0] }}{% endif %}</div> <div id="accounting-name-error" class="invalid-feedback">{% if form.name.errors %}{{ form.name.errors[0] }}{% endif %}</div>
</div> </div>
<div class="d-none d-md-block"> <div class="d-none d-md-block">
@ -58,7 +58,7 @@ First written: 2023/2/6
</button> </button>
</div> </div>
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<button class="btn btn-primary" type="submit"> <button class="btn btn-primary" type="submit">
<i class="fa-solid fa-floppy-disk"></i> <i class="fa-solid fa-floppy-disk"></i>
</button> </button>

View File

@ -33,8 +33,8 @@ First written: 2023/2/6
</a> </a>
{% endif %} {% endif %}
<form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.currency.list") }}" method="get" role="search"> <form class="btn btn-primary d-flex input-group" action="{{ url_for("accounting.currency.list") }}" method="get" role="search">
<input id="search-input" class="form-control form-control-sm search-input" type="search" name="q" value="{{ request.args["q"] if "q" in request.args else "" }}" placeholder=" " required="required" aria-label="Search"> <input id="accounting-search" class="form-control form-control-sm accounting-search-input" type="search" name="q" value="{{ request.args["q"] if "q" in request.args else "" }}" placeholder=" " required="required" aria-label="Search">
<label for="search-input" class="search-label"> <label for="accounting-search" class="accounting-search-label">
<button type="submit"> <button type="submit">
<i class="fa-solid fa-magnifying-glass"></i> <i class="fa-solid fa-magnifying-glass"></i>
{{ A_("Search") }} {{ A_("Search") }}
@ -44,7 +44,7 @@ First written: 2023/2/6
</div> </div>
{% if accounting_can_edit() %} {% if accounting_can_edit() %}
<div class="d-md-none material-fab"> <div class="d-md-none accounting-material-fab">
<a class="btn btn-primary" href="{{ url_for("accounting.currency.create")|accounting_append_next }}"> <a class="btn btn-primary" href="{{ url_for("accounting.currency.create")|accounting_append_next }}">
<i class="fa-solid fa-plus"></i> <i class="fa-solid fa-plus"></i>
</a> </a>