Implement sync_from_state method for Area, Brand, Item, RoomFunction, and Room models; streamline entity management in settings

This commit is contained in:
Yaro Kasear 2025-06-24 13:09:41 -05:00
parent 87fa623cde
commit 8a5c5db9e0
11 changed files with 204 additions and 70 deletions

View file

@ -1,6 +1,8 @@
{% import "fragments/_icon_fragment.html" as icons %}
{% macro breadcrumb_header(breadcrumbs=[], title=None, submit_button=False) %}
<!-- Breadcrumb Fragment -->
<nav class="row d-flex mb-3 justify-content-between">
<div class="col">
<ol class="breadcrumb">

View file

@ -1,6 +1,8 @@
{% import "fragments/_icon_fragment.html" as icons %}
{% macro render_combobox(id, options, label=none, placeholder=none, onAdd=none, onRemove=none, onEdit=none) %}
<!-- Combobox Widget Fragment -->
{% if label %}
<label for="{{ id }}-input" class="form-label">{{ label }}</label>
{% endif %}

View file

@ -1,4 +1,6 @@
{% macro render_icon(icon, size=24, extra_class='') %}
<!-- Icon Fragment -->
<i class="bi bi-{{ icon }} {{ extra_class }}" style="font-size: {{ size }}px;"></i>
{% endmacro %}

View file

@ -1,6 +1,8 @@
{% import "fragments/_icon_fragment.html" as icons %}
{% macro category_link(endpoint, label, icon_html=none, arguments={}) %}
<!-- Category Link Fragment -->
<div class="col text-center">
<a href="{{ url_for('main.' + endpoint, **arguments) }}"
class="d-flex flex-column justify-content-center link-success link-underline-opacity-0">
@ -13,6 +15,12 @@
{% endmacro %}
{% macro navigation_link(endpoint, label, icon_html=none, arguments={}, active=false) %}
<!-- Navigation Link Fragment -->
{% if not active %}
{% set active = request.endpoint == 'main.' + endpoint %}
{% endif %}
<li class="nav-item">
<a href="{{ url_for('main.' + endpoint, **arguments) }}" class="nav-link{% if active %} active{% endif %}">
{% if icon_html %}
@ -24,6 +32,8 @@
{% endmacro %}
{% macro entry_link(endpoint, id) %}
<!-- Entry Link Fragment -->
<a href="{{ url_for('main.' + endpoint, id=id) }}" class="link-success link-underline-opacity-0">
{{ icons.render_icon('link', 12) }}
</a>

View file

@ -1,4 +1,6 @@
{% macro render_table(headers, rows, id, entry_route=None, title=None, per_page=15) %}
<!-- Table Fragment -->
{% if rows %}
{% if title %}
<label for="datatable-{{ id|default('table')|replace(' ', '-')|lower }}" class="form-label">{{ title }}</label>