Feat(SQL): Location Get Many and Calc Stored Procedures created with logic using Location Link table.

This commit is contained in:
2025-07-15 15:07:40 +01:00
parent 7573f329e9
commit a3fd8b12fe
44 changed files with 2590 additions and 873 deletions

View File

@@ -0,0 +1,7 @@
{% with _attribute_text = '' if (attribute_text is not defined or attribute_text is none) else attribute_text %}
{% set value_previous = '0' if is_blank_row else location_preview.id_location %}
{% set text_previous = '' if is_blank_row else location_preview.name %}
<div class="{{ model.FLAG_LOCATION }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ value_previous }}" {{ model.ATTR_VALUE_CURRENT }}="{{ value_previous }}">{{ text_previous }}</div>
{% endwith %}

View File

@@ -0,0 +1,33 @@
{% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_LOCATION }}" {{ model.ATTR_ID_LOCATION }}>
<td class="{{ model.FLAG_LOCATION_PARENT }} {{ model.FLAG_DDL_PREVIEW }}">
{% set attribute_text = model.FLAG_LOCATION_PARENT %}
{% include 'components/dog/_preview_DDL_location.html' %}
</td>
<td class="{{ model.FLAG_NAME }}">
<input type="text"
class="{{ model.FLAG_NAME }}"
{{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }} />
</td>
{% set active = True %}
{% include 'components/dog/_td_active.html' %}
</tr>
{% else %}
<tr class="{{ model.FLAG_LOCATION }}" {{ model.ATTR_ID_LOCATION }}="{{ location.id_location }}">
{% set location_preview = location.location_parent %}
<td class="{{ model.FLAG_LOCATION_PARENT }} {{ model.FLAG_DDL_PREVIEW }}">
{% set attribute_text = model.FLAG_LOCATION_PARENT %}
{% include 'components/dog/_preview_DDL_location.html' %}
</td>
<td class="{{ model.FLAG_NAME }}">
<input type="text"
class="{{ model.FLAG_NAME }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ model.format_null_string_as_blank(location.name)|escape }}"
{{ model.ATTR_VALUE_PREVIOUS }}="{{ model.format_null_string_as_blank(location.name)|escape }}"
value="{{ model.format_null_string_as_blank(location.name) }}" />
</td>
{% set active = location.active %}
{% include 'components/dog/_td_active.html' %}
</tr>
{% endif %}

View File

@@ -42,6 +42,7 @@
var attrIdCommandCategory = "{{ model.ATTR_ID_COMMAND_CATEGORY }}";
var attrIdDog = "{{ model.ATTR_ID_DOG }}";
var attrIdDogCommandLink = "{{ model.ATTR_ID_DOG_COMMAND_LINK }}";
var attrIdLocation = "{{ model.ATTR_ID_LOCATION }}";
var attrTextCollapsed = "{{ model.ATTR_TEXT_COLLAPSED }}";
var attrTextExpanded = "{{ model.ATTR_TEXT_EXPANDED }}";
var attrValueCurrent = "{{ model.ATTR_VALUE_CURRENT }}";
@@ -85,7 +86,6 @@
var flagCommand = "{{ model.FLAG_COMMAND }}";
var flagCommandCategory = "{{ model.FLAG_COMMAND_CATEGORY }}";
var flagComment = "{{ model.FLAG_COMMENT }}";
// var flagContactUs = "{{ model.FLAG_CONTACT_US }}";
var flagContainer = "{{ model.FLAG_CONTAINER }}";
var flagContainerInput = "{{ model.FLAG_CONTAINER_INPUT }}";
var flagCounty = "{{ model.FLAG_COUNTY }}";
@@ -114,9 +114,9 @@
var flagInitialised = "{{ model.FLAG_INITIALISED }}";
var flagIsChecked = "{{ model.FLAG_IS_CHECKED }}";
var flagIsCollapsed = "{{ model.FLAG_IS_COLLAPSED }}";
// var flagItems = "{{ model.FLAG_ITEMS }}";
// var flagKeyPrimary = "{{ model.FLAG_KEY_PRIMARY }}";
var flagLeftHandStub = "{{ model.FLAG_LEFT_HAND_STUB }}";
var flagLocation = "{{ model.FLAG_LOCATION }}";
var flagLocationParent = "{{ model.FLAG_LOCATION_PARENT }}";
var flagLogo = "{{ model.FLAG_LOGO }}";
var flagMessage = "{{ model.FLAG_MESSAGE }}";
var flagModal = "{{ model.FLAG_MODAL }}";
@@ -125,7 +125,6 @@
var flagNameAttrOptionText = "{{ model.FLAG_NAME_ATTR_OPTION_TEXT}}";
var flagNameAttrOptionValue = "{{ model.FLAG_NAME_ATTR_OPTION_VALUE }}";
var flagNamePlural = "{{ model.FLAG_NAME_PLURAL }}";
{# var flagNameSingular = "{{ model.FLAG_NAME_SINGULAR }}"; #}
var flagNavAdminHome = "{{ model.FLAG_NAV_ADMIN_HOME }}";
var flagNavContact = "{{ model.FLAG_NAV_CONTACT }}";
var flagNavHome = "{{ model.FLAG_NAV_HOME }}";
@@ -172,6 +171,7 @@
var hashPageDogDogCommandLinks = "{{ model.HASH_PAGE_DOG_DOG_COMMAND_LINKS }}";
var hashPageDogDogs = "{{ model.HASH_PAGE_DOG_DOGS }}";
var hashPageDogHome = "{{ model.HASH_PAGE_DOG_HOME }}";
var hashPageDogLocations = "{{ model.HASH_PAGE_DOG_LOCATIONS }}";
var hashPageErrorNoPermission = "{{ model.HASH_PAGE_ERROR_NO_PERMISSION }}";
var hashPageHome = "{{ model.HASH_PAGE_HOME }}";
var hashPageLicense = "{{ model.HASH_PAGE_LICENSE }}";
@@ -183,6 +183,7 @@
var hashSaveDogCommand = "{{ model.HASH_SAVE_DOG_COMMAND }}";
var hashSaveDogCommandCategory = "{{ model.HASH_SAVE_DOG_COMMAND_CATEGORY }}";
var hashSaveDogDogCommandLink = "{{ model.HASH_SAVE_DOG_DOG_COMMAND_LINK }}";
var hashSaveDogLocation = "{{ model.HASH_SAVE_DOG_LOCATION }}";
var idButtonApplyFilters = "#{{ model.ID_BUTTON_APPLY_FILTERS }}";
var idButtonHamburger = "#{{ model.ID_BUTTON_HAMBURGER }}";
var idButtonCancel = "#{{ model.ID_BUTTON_CANCEL }}";

View File

@@ -0,0 +1,74 @@
{% extends 'layouts/layout.html' %}
{% block page_body %}
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/dog_locations.bundle.css') }}">
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
{{ model.form_filters.hidden_tag() }}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_ROW }}">
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }} {{ model.FLAG_FILTER }} {{ model.FLAG_SEARCH }}">
{{ model.form_filters.search.label }}
{{ model.form_filters.search() }}
{% for error in model.form_filters.search.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
</div>
<div class="{{ model.FLAG_CONTAINER_INPUT }} {{ model.FLAG_COLUMN }} {{ model.FLAG_FILTER }} {{ model.FLAG_ACTIVE_ONLY }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.form_filters.active_only.data }}">
{{ model.form_filters.active_only.label }}
{{ model.form_filters.active_only() }}
{% for error in model.form_filters.active_only.errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{% set class_name = model.FLAG_FILTER + ' ' + model.FLAG_ACTIVE_ONLY + ' ' + model.FLAG_CHECKBOX %}
{% include 'components/common/buttons/_icon_checkbox.html' %}
</div>
</div>
</div>
{% set block_id = 'buttons_table_default' %}
{% include 'components/common/buttons/_buttons_save_cancel.html' %}
</form>
<table id="{{ model.ID_TABLE_MAIN }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }} {{ model.FLAG_LOCATION }}">
<thead>
<tr class="{{ model.FLAG_LOCATION }}">
<th class="{{ model.FLAG_LOCATION_PARENT }} {{ model.FLAG_DDL_PREVIEW }}">Parent</th>
<th class="{{ model.FLAG_NAME }}">Name</th>
<th class="{{ model.FLAG_ACTIVE }}">
{% set class_name = model.FLAG_ACTIVE %}
{% set attribute_text = '' %}
{% include 'components/common/buttons/_icon_add.html' %}
</th>
</tr>
</thead>
<tbody>
{% set is_blank_row = False %}
{% for location in model.locations %}
{% include 'components/dog/_row_location.html' %}
{% endfor %}
{% set is_blank_row = True %}
{% include 'components/dog/_row_location.html' %}
</tbody>
</table>
{% include 'components/common/temporary/_overlay_confirm.html' %}
{% include 'components/common/temporary/_overlay_error.html' %}
<div id="{{ model.ID_CONTAINER_TEMPLATE_ELEMENTS }}">
<!-- Active column -->
<!-- Delete -->
{% set class_name = '' %}
{% include 'components/common/buttons/_icon_trash.html' %}
<!-- Undelete -->
{% set class_name = model.FLAG_ACTIVE %}
{% set attribute_text = '' %}
{% include 'components/common/buttons/_icon_add.html' %}
</div>
<script src="{{ url_for('routes_dog.scripts_section_dog') }}"></script>
<script>
var locations = {{ model.convert_list_objects_to_dict_json_by_attribute_key_default(model.locations) | tojson | safe }};
</script>
{% endblock %}