Feat(SQL): Location Get Many and Calc Stored Procedures created with logic using Location Link table.
This commit is contained in:
1
app.py
1
app.py
@@ -22,6 +22,7 @@ from controllers.dog.command_category import routes_dog_command_category
|
||||
from controllers.dog.dog import routes_dog
|
||||
from controllers.dog.dog_command_link import routes_dog_dog_command_link
|
||||
from controllers.dog.home import routes_dog_home
|
||||
from controllers.dog.location import routes_dog_location
|
||||
from controllers.core.home import routes_core_home
|
||||
from controllers.legal.legal import routes_legal
|
||||
from controllers.user.user import routes_user
|
||||
|
||||
274
business_objects/dog/location.py
Normal file
274
business_objects/dog/location.py
Normal file
@@ -0,0 +1,274 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: Business Objects
|
||||
Feature: Location Business Object
|
||||
"""
|
||||
|
||||
# internal
|
||||
from business_objects.base import Base
|
||||
from business_objects.dog.location_category import Location_Category
|
||||
from business_objects.db_base import SQLAlchemy_ABC, Get_Many_Parameters_Base
|
||||
import lib.argument_validation as av
|
||||
from extensions import db
|
||||
from forms.dog.location import Filters_Location
|
||||
from forms.dog.location_category import Filters_Location_Category
|
||||
from helpers.helper_app import Helper_App
|
||||
# external
|
||||
from dataclasses import dataclass
|
||||
from typing import ClassVar
|
||||
|
||||
|
||||
class Location(SQLAlchemy_ABC, Base):
|
||||
ATTR_ID_LOCATION: ClassVar[str] = 'id_location'
|
||||
FLAG_LOCATION: ClassVar[str] = 'location'
|
||||
FLAG_LOCATION_PARENT: ClassVar[str] = 'location_parent'
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = ATTR_ID_LOCATION
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = Base.FLAG_NAME
|
||||
|
||||
__tablename__ = 'DOG_Location'
|
||||
__table_args__ = { 'extend_existing': True }
|
||||
|
||||
id_location = db.Column(db.Integer, primary_key=True)
|
||||
id_location_category = db.Column(db.Integer)
|
||||
name = db.Column(db.String(250))
|
||||
hand_signal_default_description = db.Column(db.Text)
|
||||
can_have_button = db.Column(db.Boolean)
|
||||
notes = db.Column(db.Text)
|
||||
active = db.Column(db.Boolean)
|
||||
created_on = db.Column(db.DateTime)
|
||||
|
||||
def __init__(self):
|
||||
self.id_location = 0
|
||||
self.location_category = None
|
||||
self.is_new = False
|
||||
self.has_button = False
|
||||
super().__init__()
|
||||
|
||||
@classmethod
|
||||
def from_db_location(cls, query_row):
|
||||
_m = f'{cls.__qualname__}.from_db_location'
|
||||
location = cls()
|
||||
location.id_location = query_row[0]
|
||||
location.id_location_category = query_row[1]
|
||||
location.name = query_row[2]
|
||||
location.hand_signal_default_description = query_row[3]
|
||||
location.can_have_button = av.input_bool(query_row[4], 'can_have_button', _m)
|
||||
# location.has_button = av.input_bool(query_row[7], 'has_button', _m)
|
||||
location.notes = query_row[5]
|
||||
location.active = av.input_bool(query_row[6], 'active', _m)
|
||||
# location.created_on = query_row[7]
|
||||
# location.location_category = Location_Category.from_db_location(query_row)
|
||||
return location
|
||||
|
||||
@classmethod
|
||||
def from_db_dog_location_link(cls, query_row):
|
||||
_m = f'{cls.__qualname__}.from_db_dog_location_link'
|
||||
location = cls()
|
||||
location.id_location = query_row[5]
|
||||
location.id_location_category = query_row[3]
|
||||
location.name = query_row[6]
|
||||
# location.hand_signal_default_description = query_row[2]
|
||||
location.can_have_button = av.input_bool(query_row[8], 'can_have_button', _m)
|
||||
# location.has_button = av.input_bool(query_row[7], 'has_button', _m)
|
||||
# location.notes = query_row[4]
|
||||
location.active = True # av.input_bool(True, 'active', _m)
|
||||
# location.created_on = query_row[7]
|
||||
location.location_category = Location_Category.from_db_dog_location_link(query_row) # this is done in datastore get many method using category dictionary
|
||||
return location
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
_m = f'{cls.__qualname__}.from_json'
|
||||
location = cls()
|
||||
if json is None: return location
|
||||
# Helper_App.console_log(f'{_m}\njson: {json}')
|
||||
location.id_location = -1
|
||||
location.id_location_category = json[Location_Category.ATTR_ID_LOCATION_CATEGORY]
|
||||
location.name = json[cls.FLAG_NAME]
|
||||
location.hand_signal_default_description = json[cls.FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION]
|
||||
location.can_have_button = json[cls.FLAG_CAN_HAVE_BUTTON]
|
||||
location.notes = json[cls.FLAG_NOTES]
|
||||
location.active = json[cls.FLAG_ACTIVE]
|
||||
location.created_on = json.get(cls.FLAG_CREATED_ON, None)
|
||||
# Helper_App.console_log(f'Location: {location}')
|
||||
return location
|
||||
|
||||
def to_json(self):
|
||||
as_json = {
|
||||
**self.get_shared_json_attributes(self)
|
||||
, self.ATTR_ID_LOCATION: self.id_location
|
||||
, Location_Category.ATTR_ID_LOCATION_CATEGORY: self.id_location_category
|
||||
, self.FLAG_NAME: self.name
|
||||
, self.FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION: self.hand_signal_default_description
|
||||
, self.FLAG_CAN_HAVE_BUTTON: self.can_have_button
|
||||
, self.FLAG_NOTES: self.notes
|
||||
, self.FLAG_ACTIVE: self.active
|
||||
, self.FLAG_CREATED_ON: self.created_on
|
||||
}
|
||||
# Helper_App.console_log(f'as_json: {as_json}')
|
||||
return as_json
|
||||
|
||||
def __repr__(self):
|
||||
return f'''
|
||||
{self.__class__.__name__}(
|
||||
{self.FLAG_LOCATION}: {self.id_location}
|
||||
{Location_Category.FLAG_LOCATION_CATEGORY}: {self.id_location_category}
|
||||
{self.FLAG_NAME}: {self.name}
|
||||
{self.FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION}: {self.hand_signal_default_description}
|
||||
{self.FLAG_CAN_HAVE_BUTTON}: {self.can_have_button}
|
||||
{self.FLAG_NOTES}: {self.notes}
|
||||
{self.FLAG_ACTIVE}: {self.active}
|
||||
{self.FLAG_CREATED_ON}: {self.created_on}
|
||||
)
|
||||
'''
|
||||
|
||||
class Location_Temp(db.Model, Base):
|
||||
__tablename__ = 'DOG_Location_Temp'
|
||||
__table_args__ = { 'extend_existing': True }
|
||||
id_temp = db.Column(db.Integer, primary_key=True)
|
||||
id_location = db.Column(db.Integer)
|
||||
id_location_category = db.Column(db.Integer)
|
||||
name = db.Column(db.String(250))
|
||||
hand_signal_default_description = db.Column(db.Text)
|
||||
can_have_button = db.Column(db.Boolean)
|
||||
notes = db.Column(db.Text)
|
||||
active = db.Column(db.Boolean)
|
||||
created_on = db.Column(db.DateTime)
|
||||
guid: str = db.Column(db.String(36))
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@classmethod
|
||||
def from_location(cls, location):
|
||||
_m = 'Location_Temp.from_location'
|
||||
temp = cls()
|
||||
temp.id_location = location.id_location
|
||||
temp.id_location_category = location.id_location_category
|
||||
temp.name = location.name
|
||||
temp.hand_signal_default_description = location.hand_signal_default_description
|
||||
temp.can_have_button = location.can_have_button
|
||||
temp.notes = location.notes
|
||||
temp.active = location.active
|
||||
temp.created_on = location.created_on
|
||||
return temp
|
||||
|
||||
|
||||
class Parameters_Location(Get_Many_Parameters_Base):
|
||||
get_all_location_category: bool
|
||||
get_inactive_location_category: bool
|
||||
ids_location_category: str
|
||||
names_location_category: str
|
||||
get_all_location: bool
|
||||
get_inactive_location: bool
|
||||
ids_location: str
|
||||
names_location: str
|
||||
hand_signal_default_descriptions_location: str
|
||||
notes_location: str
|
||||
require_all_id_search_filters_met: bool
|
||||
require_any_id_search_filters_met: bool
|
||||
require_all_non_id_search_filters_met: bool
|
||||
require_any_non_id_search_filters_met: bool
|
||||
output_location_categories: bool
|
||||
output_locations: bool
|
||||
|
||||
@classmethod
|
||||
def get_default(cls):
|
||||
return cls(
|
||||
get_all_location_category = True
|
||||
, get_inactive_location_category = False
|
||||
, ids_location_category = ''
|
||||
, names_location_category = ''
|
||||
, get_all_location = True
|
||||
, get_inactive_location = False
|
||||
, ids_location = ''
|
||||
, names_location = ''
|
||||
, hand_signal_default_descriptions_location = ''
|
||||
, notes_location = ''
|
||||
, require_all_id_search_filters_met = True
|
||||
, require_any_id_search_filters_met = True
|
||||
, require_all_non_id_search_filters_met = False
|
||||
, require_any_non_id_search_filters_met = True
|
||||
, output_location_categories = True
|
||||
, output_locations = True
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
return cls(
|
||||
get_all_location_category = json.get('a_get_all_location_category', False)
|
||||
, get_inactive_location_category = json.get('a_get_inactive_location_category', False)
|
||||
, ids_location_category = json.get('a_ids_location_category', '')
|
||||
, names_location_category = json.get('a_names_location_category', '')
|
||||
, get_all_location = json.get('a_get_all_location', False)
|
||||
, get_inactive_location = json.get('a_get_inactive_location', False)
|
||||
, ids_location = json.get('a_ids_location', '')
|
||||
, names_location = json.get('a_names_location', '')
|
||||
, hand_signal_default_descriptions_location = json.get('a_hand_signal_default_descriptions_location', '')
|
||||
, notes_location = json.get('a_notes_location', '')
|
||||
, require_all_id_search_filters_met = json.get('a_require_all_id_search_filters_met', True)
|
||||
, require_any_id_search_filters_met = json.get('a_require_any_id_search_filters_met', True)
|
||||
, require_all_non_id_search_filters_met = json.get('a_require_all_non_id_search_filters_met', False)
|
||||
, require_any_non_id_search_filters_met = json.get('a_require_any_non_id_search_filters_met', True)
|
||||
, output_location_categories = json.get('a_output_location_categories', False)
|
||||
, output_locations = json.get('a_output_locations', False)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_form_filters_location(cls, form):
|
||||
av.val_instance(form, 'form', 'Parameters_Location.from_form_filters_location', Filters_Location)
|
||||
has_filter_search_text = not (form.search.data == '' or form.search.data is None)
|
||||
has_filter_location_category = not (has_filter_search_text or form.id_location_category.data == '0' or form.id_location_category.data == '' or form.id_location_category.data is None)
|
||||
active_only = av.input_bool(form.active_only.data, "active", "Parameters_Location.from_form_filters_location")
|
||||
filters = cls.get_default()
|
||||
filters.get_all_location_category = not has_filter_location_category
|
||||
filters.get_inactive_location_category = not active_only
|
||||
filters.ids_location_category = form.id_location_category.data if has_filter_location_category else ''
|
||||
filters.names_location_category = form.search.data if has_filter_search_text else ''
|
||||
filters.get_all_location = True
|
||||
filters.get_inactive_location = not active_only
|
||||
filters.ids_location = ''
|
||||
filters.names_location = form.search.data if has_filter_search_text else ''
|
||||
return filters
|
||||
|
||||
@classmethod
|
||||
def from_form_filters_location_category(cls, form):
|
||||
av.val_instance(form, 'form', 'Parameters_Location.from_form_filters_location_category', Filters_Location_Category)
|
||||
has_filter_search_text = not (form.search.data == '' or form.search.data is None)
|
||||
active_only = av.input_bool(form.active_only.data, "active", "Parameters_Location.from_form_filters_location")
|
||||
filters = cls.get_default()
|
||||
filters.get_all_location_category = True
|
||||
filters.get_inactive_location_category = not active_only
|
||||
filters.ids_location_category = ''
|
||||
filters.names_location_category = form.search.data if has_filter_search_text else ''
|
||||
filters.get_all_location = False
|
||||
filters.get_inactive_location = False
|
||||
filters.ids_location = ''
|
||||
filters.names_location = ''
|
||||
filters.require_all_id_search_filters_met = False
|
||||
filters.output_locations = False
|
||||
return filters
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
'a_get_all_location_category': self.get_all_location_category
|
||||
, 'a_get_inactive_location_category': self.get_inactive_location_category
|
||||
, 'a_ids_location_category': self.ids_location_category
|
||||
, 'a_names_location_category': self.names_location_category
|
||||
, 'a_get_all_location': self.get_all_location
|
||||
, 'a_get_inactive_location': self.get_inactive_location
|
||||
, 'a_ids_location': self.ids_location
|
||||
, 'a_names_location': self.names_location
|
||||
, 'a_hand_signal_default_descriptions_location': self.hand_signal_default_descriptions_location
|
||||
, 'a_notes_location': self.notes_location
|
||||
, 'a_require_all_id_search_filters_met': self.require_all_id_search_filters_met
|
||||
, 'a_require_any_id_search_filters_met': self.require_any_id_search_filters_met
|
||||
, 'a_require_all_non_id_search_filters_met': self.require_all_non_id_search_filters_met
|
||||
, 'a_require_any_non_id_search_filters_met': self.require_any_non_id_search_filters_met
|
||||
, 'a_output_location_categories': self.output_location_categories
|
||||
, 'a_output_locations': self.output_locations
|
||||
}
|
||||
|
||||
98
controllers/dog/location.py
Normal file
98
controllers/dog/location.py
Normal file
@@ -0,0 +1,98 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: App Routing
|
||||
Feature: Dog - Command Routes
|
||||
|
||||
Description:
|
||||
Contact Page Controller.
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
# internal
|
||||
from business_objects.api import API
|
||||
from business_objects.dog.command import Command
|
||||
from business_objects.dog.dog_command_link import Dog_Command_Link
|
||||
from datastores.datastore_dog import DataStore_Dog
|
||||
from forms.dog.command import Filters_Command
|
||||
from helpers.helper_app import Helper_App
|
||||
from models.model_view_dog_command import Model_View_Dog_Command
|
||||
from models.model_view_home import Model_View_Home
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session, Blueprint, current_app, flash
|
||||
from flask_mail import Mail, Message
|
||||
from extensions import db, oauth, mail
|
||||
from urllib.parse import quote_plus, urlencode
|
||||
from authlib.integrations.flask_client import OAuth
|
||||
from authlib.integrations.base_client import OAuthError
|
||||
from urllib.parse import quote, urlparse, parse_qs
|
||||
import json
|
||||
import base64
|
||||
import hmac
|
||||
import hashlib
|
||||
import datetime
|
||||
from altcha import ChallengeOptions, create_challenge, verify_solution
|
||||
|
||||
|
||||
routes_dog_command = Blueprint('routes_dog_command', __name__)
|
||||
|
||||
|
||||
@routes_dog_command.route(Model_View_Dog_Command.HASH_PAGE_DOG_COMMANDS, methods=['GET'])
|
||||
def commands():
|
||||
Helper_App.console_log('commands')
|
||||
Helper_App.console_log(f'request_args: {request.args}')
|
||||
try:
|
||||
form_filters = Filters_Command.from_json(request.args)
|
||||
except Exception as e:
|
||||
Helper_App.console_log(f'Error: {e}')
|
||||
form_filters = Filters_Command()
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
model = Model_View_Dog_Command(form_filters_old = form_filters)
|
||||
if not model.is_user_logged_in:
|
||||
return redirect(url_for('routes_core_home.home'))
|
||||
Helper_App.console_log(f'form_filters={form_filters}')
|
||||
return render_template('pages/dog/_commands.html', model = model)
|
||||
|
||||
@routes_dog_command.route(Model_View_Dog_Command.HASH_SAVE_DOG_COMMAND, methods=['POST'])
|
||||
def save_command():
|
||||
data = Helper_App.get_request_data(request)
|
||||
try:
|
||||
form_filters = Filters_Command.from_json(data[Model_View_Dog_Command.FLAG_FORM_FILTERS])
|
||||
if not form_filters.validate_on_submit():
|
||||
return jsonify({
|
||||
Model_View_Dog_Command.FLAG_STATUS: Model_View_Dog_Command.FLAG_FAILURE,
|
||||
Model_View_Dog_Command.FLAG_MESSAGE: f'Filters form invalid.\n{form_filters.errors}'
|
||||
})
|
||||
model_return = Model_View_Dog_Command(form_filters_old=form_filters)
|
||||
if not model_return.is_user_logged_in:
|
||||
raise Exception('User not logged in')
|
||||
|
||||
commands = data[Model_View_Dog_Command.FLAG_COMMAND]
|
||||
if len(commands) == 0:
|
||||
return jsonify({
|
||||
Model_View_Dog_Command.FLAG_STATUS: Model_View_Dog_Command.FLAG_FAILURE,
|
||||
Model_View_Dog_Command.FLAG_MESSAGE: f'No commands.'
|
||||
})
|
||||
objs_command = []
|
||||
for command in commands:
|
||||
objs_command.append(Command.from_json(command))
|
||||
Helper_App.console_log(f'objs_command={objs_command}')
|
||||
errors = DataStore_Dog.save_commands(data.get('comment', 'No comment'), objs_command)
|
||||
|
||||
if (len(errors) > 0):
|
||||
return jsonify({
|
||||
Model_View_Dog_Command.FLAG_STATUS: Model_View_Dog_Command.FLAG_FAILURE,
|
||||
Model_View_Dog_Command.FLAG_MESSAGE: f'Error saving commands.\n{model_return.convert_list_objects_to_json(errors)}'
|
||||
})
|
||||
return jsonify({
|
||||
Model_View_Dog_Command.FLAG_STATUS: Model_View_Dog_Command.FLAG_SUCCESS,
|
||||
Model_View_Dog_Command.FLAG_DATA: Model_View_Dog_Command.convert_list_objects_to_json(model_return.commands)
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({
|
||||
Model_View_Dog_Command.FLAG_STATUS: Model_View_Dog_Command.FLAG_FAILURE,
|
||||
Model_View_Dog_Command.FLAG_MESSAGE: f'Bad data received by controller.\n{e}'
|
||||
})
|
||||
@@ -17,6 +17,7 @@ from business_objects.dog.command import Command, Command_Temp
|
||||
from business_objects.dog.command_category import Command_Category, Command_Category_Temp
|
||||
from business_objects.dog.dog import Dog
|
||||
from business_objects.dog.dog_command_link import Dog_Command_Link, Dog_Command_Link_Temp
|
||||
from business_objects.dog.location import Location
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from helpers.helper_app import Helper_App
|
||||
@@ -72,6 +73,7 @@ class DataStore_Dog(DataStore_Base):
|
||||
|
||||
return dogs, errors
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_many_command(cls, filters_command):
|
||||
_m = f'{cls.__qualname__}.get_many_command'
|
||||
@@ -124,6 +126,95 @@ class DataStore_Dog(DataStore_Base):
|
||||
|
||||
return command_categories, commands, errors
|
||||
|
||||
@classmethod
|
||||
def save_command_categories(cls, comment, command_categories):
|
||||
_m = f'{cls}.save_command_categories'
|
||||
av.val_str(comment, 'comment', _m)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid_str()
|
||||
now = datetime.now()
|
||||
user = cls.get_user_session()
|
||||
|
||||
Helper_App.console_log(f'saving command categories: {command_categories}')
|
||||
|
||||
rows = []
|
||||
for command_category in command_categories:
|
||||
row = Command_Category_Temp.from_command_category(command_category)
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
cls.upload_bulk(Command_Category_Temp.__tablename__, rows, 1000)
|
||||
|
||||
Helper_App.console_log('Commands uploaded')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
'a_guid': guid,
|
||||
'a_id_user': user.id_user,
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_dog_save_command_category', argument_dict_list)
|
||||
|
||||
Helper_App.console_log('Commands saved')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_db_record(row) for row in result_set_e]
|
||||
for error in errors:
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
@classmethod
|
||||
def save_commands(cls, comment, commands):
|
||||
_m = f'{cls}.save_commands'
|
||||
av.val_str(comment, 'comment', _m)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid_str()
|
||||
now = datetime.now()
|
||||
user = cls.get_user_session()
|
||||
|
||||
Helper_App.console_log(f'saving commands: {commands}')
|
||||
|
||||
rows = []
|
||||
for command in commands:
|
||||
row = Command_Temp.from_command(command)
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
cls.upload_bulk(Command_Temp.__tablename__, rows, 1000)
|
||||
|
||||
Helper_App.console_log('Commands uploaded')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
'a_guid': guid,
|
||||
'a_id_user': user.id_user,
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_dog_save_command', argument_dict_list)
|
||||
|
||||
Helper_App.console_log('Commands saved')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_db_record(row) for row in result_set_e]
|
||||
for error in errors:
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_many_dog_command_link(cls, filters_dog_command_link):
|
||||
_m = f'{cls.__qualname__}.get_many_dog_command_link'
|
||||
@@ -205,94 +296,41 @@ class DataStore_Dog(DataStore_Base):
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
|
||||
@classmethod
|
||||
def save_commands(cls, comment, commands):
|
||||
_m = f'{cls}.save_commands'
|
||||
av.val_str(comment, 'comment', _m)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid_str()
|
||||
now = datetime.now()
|
||||
def get_many_location(cls, filters_location):
|
||||
_m = f'{cls.__qualname__}.get_many_location'
|
||||
user = cls.get_user_session()
|
||||
|
||||
Helper_App.console_log(f'saving commands: {commands}')
|
||||
|
||||
rows = []
|
||||
for command in commands:
|
||||
row = Command_Temp.from_command(command)
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
cls.upload_bulk(Command_Temp.__tablename__, rows, 1000)
|
||||
|
||||
Helper_App.console_log('Commands uploaded')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
'a_guid': guid,
|
||||
'a_id_user': user.id_user,
|
||||
'a_debug': 0
|
||||
argument_dict = {
|
||||
'a_id_user': user.id_user
|
||||
, **filters_location.to_json()
|
||||
, 'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_dog_save_command', argument_dict_list)
|
||||
|
||||
Helper_App.console_log('Commands saved')
|
||||
|
||||
# Errors
|
||||
Helper_App.console_log(f'argument_dict: {argument_dict}')
|
||||
result = cls.db_procedure_execute('p_dog_get_many_location', argument_dict)
|
||||
cursor = result.cursor
|
||||
|
||||
# Locations
|
||||
result_set_1 = cursor.fetchall()
|
||||
Helper_App.console_log(f'raw locations: {result_set_1}')
|
||||
locations = []
|
||||
location_indexes = {}
|
||||
for row in result_set_1:
|
||||
new_location = Location.from_db_location(row)
|
||||
location_indexes[new_location.id_location] = len(locations)
|
||||
locations.append(new_location)
|
||||
|
||||
# Errors
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
Helper_App.console_log(f'raw errors: {result_set_e}')
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_db_record(row) for row in result_set_e]
|
||||
for error in errors:
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
@classmethod
|
||||
def save_command_categories(cls, comment, command_categories):
|
||||
_m = f'{cls}.save_command_categories'
|
||||
av.val_str(comment, 'comment', _m)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid_str()
|
||||
now = datetime.now()
|
||||
user = cls.get_user_session()
|
||||
|
||||
Helper_App.console_log(f'saving command categories: {command_categories}')
|
||||
|
||||
rows = []
|
||||
for command_category in command_categories:
|
||||
row = Command_Category_Temp.from_command_category(command_category)
|
||||
row.guid = guid
|
||||
rows.append(row)
|
||||
|
||||
cls.upload_bulk(Command_Category_Temp.__tablename__, rows, 1000)
|
||||
|
||||
Helper_App.console_log('Commands uploaded')
|
||||
|
||||
argument_dict_list = {
|
||||
'a_comment': comment,
|
||||
'a_guid': guid,
|
||||
'a_id_user': user.id_user,
|
||||
'a_debug': 0
|
||||
}
|
||||
result = cls.db_procedure_execute('p_dog_save_command_category', argument_dict_list)
|
||||
|
||||
Helper_App.console_log('Commands saved')
|
||||
|
||||
# Errors
|
||||
cursor = result.cursor
|
||||
cursor.nextset()
|
||||
result_set_e = cursor.fetchall()
|
||||
errors = []
|
||||
if len(result_set_e) > 0:
|
||||
errors = [SQL_Error.from_db_record(row) for row in result_set_e]
|
||||
for error in errors:
|
||||
Helper_App.console_log(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
cls.db_cursor_clear(cursor)
|
||||
return errors
|
||||
|
||||
|
||||
|
||||
return locations, errors
|
||||
|
||||
54
forms/dog/location.py
Normal file
54
forms/dog/location.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: Backend
|
||||
Feature: Location Form
|
||||
|
||||
Description:
|
||||
Defines Flask-WTF form for handling user input on Locations page.
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
# internal
|
||||
from business_objects.base import Base
|
||||
# from business_objects.dog.location import Location # Circular
|
||||
from helpers.helper_app import Helper_App
|
||||
# from models.model_view_store import Model_View_Store # circular
|
||||
# from models.model_view_base import Model_View_Base
|
||||
from forms.base import Form_Base
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from flask import Flask, render_template, request, flash, redirect, url_for, current_app
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import SelectField, BooleanField, StringField, SubmitField
|
||||
from wtforms.validators import DataRequired, Email, ValidationError
|
||||
import markupsafe
|
||||
from flask_wtf.recaptcha import RecaptchaField
|
||||
from abc import ABCMeta, abstractmethod
|
||||
import json
|
||||
|
||||
class Filters_Location(Form_Base):
|
||||
search = StringField(
|
||||
'Search'
|
||||
)
|
||||
active_only = BooleanField(
|
||||
'Active'
|
||||
, default = True
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
_m = f'{cls.__qualname__}.from_json'
|
||||
Helper_App.console_log(f'{_m}\njson: {json}')
|
||||
filters = cls()
|
||||
filters.search.data = json[Base.FLAG_SEARCH]
|
||||
filters.active_only.data = av.input_bool(json[Base.FLAG_ACTIVE_ONLY], Base.FLAG_ACTIVE_ONLY, f'{cls.__name__}.from_json')
|
||||
return filters
|
||||
|
||||
def to_json(self):
|
||||
return {
|
||||
Base.FLAG_SEARCH: self.search.data
|
||||
, Base.FLAG_ACTIVE_ONLY: self.active_only.data
|
||||
}
|
||||
@@ -23,6 +23,7 @@ from business_objects.dog.command import Command
|
||||
from business_objects.dog.command_category import Command_Category
|
||||
from business_objects.dog.dog import Dog
|
||||
from business_objects.dog.dog_command_link import Dog_Command_Link
|
||||
from business_objects.dog.location import Location
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from datastores.datastore_dog import DataStore_Dog
|
||||
from datastores.datastore_user import DataStore_User
|
||||
@@ -41,6 +42,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
ATTR_ID_COMMAND_CATEGORY: ClassVar[str] = Command_Category.ATTR_ID_COMMAND_CATEGORY
|
||||
ATTR_ID_DOG: ClassVar[str] = Dog.ATTR_ID_DOG
|
||||
ATTR_ID_DOG_COMMAND_LINK: ClassVar[str] = Dog_Command_Link.ATTR_ID_DOG_COMMAND_LINK
|
||||
ATTR_ID_LOCATION: ClassVar[str] = Location.ATTR_ID_LOCATION
|
||||
ATTR_TEXT_COLLAPSED: ClassVar[str] = 'textCollapsed'
|
||||
ATTR_TEXT_EXPANDED: ClassVar[str] = 'textExpanded'
|
||||
ATTR_VALUE_CURRENT: ClassVar[str] = 'current-value'
|
||||
@@ -121,6 +123,8 @@ class Model_View_Base(BaseModel, ABC):
|
||||
FLAG_IS_CHECKED: ClassVar[str] = 'is_checked'
|
||||
FLAG_IS_COLLAPSED: ClassVar[str] = 'is_collapsed'
|
||||
FLAG_LEFT_HAND_STUB: ClassVar[str] = 'lhs'
|
||||
FLAG_LOCATION: ClassVar[str] = Location.FLAG_LOCATION
|
||||
FLAG_LOCATION_PARENT: ClassVar[str] = Location.FLAG_LOCATION_PARENT
|
||||
FLAG_LOGO: ClassVar[str] = 'logo'
|
||||
FLAG_MESSAGE: ClassVar[str] = Command.FLAG_MESSAGE
|
||||
FLAG_MODAL: ClassVar[str] = 'modal'
|
||||
@@ -171,6 +175,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
HASH_PAGE_DOG_DOG_COMMAND_LINKS: ClassVar[str] = '/dog/dog-command-links'
|
||||
HASH_PAGE_DOG_DOGS: ClassVar[str] = '/dog/dogs'
|
||||
HASH_PAGE_DOG_HOME: ClassVar[str] = '/dog/home'
|
||||
HASH_PAGE_DOG_LOCATIONS: ClassVar[str] = '/dog/locations'
|
||||
HASH_PAGE_ERROR_NO_PERMISSION: ClassVar[str] = '/error'
|
||||
HASH_PAGE_HOME: ClassVar[str] = '/'
|
||||
HASH_PAGE_LICENSE: ClassVar[str] = '/license'
|
||||
@@ -181,6 +186,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
HASH_SAVE_DOG_COMMAND: ClassVar[str] = '/dog/save-command'
|
||||
HASH_SAVE_DOG_COMMAND_CATEGORY: ClassVar[str] = '/dog/save-command-category'
|
||||
HASH_SAVE_DOG_DOG_COMMAND_LINK: ClassVar[str] = '/dog/save-dog-command-link'
|
||||
HASH_SAVE_DOG_LOCATION: ClassVar[str] = '/dog/save-location'
|
||||
ID_BUTTON_ADD: ClassVar[str] = 'buttonAdd'
|
||||
ID_BUTTON_APPLY_FILTERS: ClassVar[str] = 'buttonApplyFilters'
|
||||
ID_BUTTON_CANCEL: ClassVar[str] = 'buttonCancel'
|
||||
|
||||
@@ -4,10 +4,10 @@ Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Parent View Model
|
||||
Feature: Dog Parent View Model
|
||||
|
||||
Description:
|
||||
Parent data model for store views
|
||||
Parent data model for dog views
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Permutations View Model
|
||||
Feature: Dog Command View Model
|
||||
|
||||
Description:
|
||||
Data model for store permutations view
|
||||
Data model for dog commands view
|
||||
"""
|
||||
|
||||
# internal
|
||||
|
||||
@@ -4,10 +4,10 @@ Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Permutations View Model
|
||||
Feature: Dog Command Category View Model
|
||||
|
||||
Description:
|
||||
Data model for store permutations view
|
||||
Data model for dog command categories view
|
||||
"""
|
||||
|
||||
# internal
|
||||
|
||||
@@ -4,10 +4,10 @@ Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Permutations View Model
|
||||
Feature: Dog Dog Command Link View Model
|
||||
|
||||
Description:
|
||||
Data model for store permutations view
|
||||
Data model for dog dog command links view
|
||||
"""
|
||||
|
||||
# internal
|
||||
|
||||
60
models/model_view_dog_location.py
Normal file
60
models/model_view_dog_location.py
Normal file
@@ -0,0 +1,60 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Dog Locations View Model
|
||||
|
||||
Description:
|
||||
Data model for dog locations view
|
||||
"""
|
||||
|
||||
# internal
|
||||
from business_objects.dog.location import Location, Parameters_Location
|
||||
from datastores.datastore_dog import DataStore_Dog
|
||||
from models.model_view_dog_base import Model_View_Dog_Base
|
||||
from forms.dog.location import Filters_Location
|
||||
# from routes import bp_home
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
# external
|
||||
from pydantic import BaseModel
|
||||
from typing import ClassVar
|
||||
|
||||
class Model_View_Dog_Location(Model_View_Dog_Base):
|
||||
FLAG_CAN_HAVE_BUTTON: ClassVar[str] = Location.FLAG_CAN_HAVE_BUTTON
|
||||
FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION: ClassVar[str] = Location.FLAG_HAND_SIGNAL_DEFAULT_DESCRIPTION
|
||||
filter_location_categories: list = None
|
||||
locations: list = None
|
||||
form_filters: Filters_Location = None
|
||||
form_filters_old: Filters_Location
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return 'Location'
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Dog_Base.HASH_PAGE_DOG_LOCATIONS):
|
||||
_m = 'Model_View_Dog_Location.__init__'
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters_old=form_filters_old)
|
||||
self.form_filters = form_filters_old
|
||||
datastore = DataStore_Dog()
|
||||
|
||||
parameters_filter_location = Parameters_Location.get_default()
|
||||
self.filter_location_categories, filter_locations, errors = datastore.get_many_location(parameters_filter_location)
|
||||
self.form_filters.id_location_category.choices += [(str(location_category.id_location_category), location_category.name) for location_category in self.filter_location_categories]
|
||||
|
||||
Helper_App.console_log(f'Form filters: {self.form_filters}')
|
||||
parameters_filter_location = Parameters_Location.from_form_filters_location(self.form_filters)
|
||||
Helper_App.console_log(f'Query args: {parameters_filter_location}')
|
||||
location_categories, self.locations, errors = datastore.get_many_location(parameters_filter_location)
|
||||
|
||||
|
||||
"""
|
||||
@classmethod
|
||||
def save_categories(cls, comment, list_categories):
|
||||
_m = f'{cls.__name__}.save_categories'
|
||||
return DataStore_Store_Product_Category().save_categories(comment, list_categories)
|
||||
"""
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,5 +14,10 @@ CREATE TABLE IF NOT EXISTS parts.DOG_Location_Temp (
|
||||
, code VARCHAR(100)
|
||||
, name VARCHAR(250)
|
||||
, active BIT
|
||||
|
||||
, does_meet_id_filters BIT
|
||||
, does_meet_non_id_filters BIT
|
||||
, csv_id_locations_parent TEXT
|
||||
|
||||
, guid BINARY(36)
|
||||
);
|
||||
|
||||
@@ -14,5 +14,9 @@ CREATE TABLE IF NOT EXISTS parts.DOG_Location_Link_Temp (
|
||||
, id_location_parent INT
|
||||
, id_location_child INT
|
||||
, active BIT
|
||||
|
||||
, does_meet_id_filters BIT
|
||||
, does_meet_non_id_filters BIT
|
||||
|
||||
, guid BINARY(36)
|
||||
);
|
||||
|
||||
@@ -17,15 +17,15 @@ BEGIN
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
DELETE COMMAND_CATEGORY_T
|
||||
FROM parts.DOG_Command_Category_Temp COMMAND_CATEGORY_T
|
||||
WHERE COMMAND_CATEGORY_T.GUID = a_guid
|
||||
;
|
||||
|
||||
DELETE COMMAND_T
|
||||
FROM parts.DOG_Command_Temp COMMAND_T
|
||||
WHERE COMMAND_T.GUID = a_guid
|
||||
;
|
||||
|
||||
DELETE COMMAND_CATEGORY_T
|
||||
FROM parts.DOG_Command_Category_Temp COMMAND_CATEGORY_T
|
||||
WHERE COMMAND_CATEGORY_T.GUID = a_guid
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
||||
723
static/MySQL/71200_p_dog_calc_location.sql
Normal file
723
static/MySQL/71200_p_dog_calc_location.sql
Normal file
@@ -0,0 +1,723 @@
|
||||
|
||||
USE parts;
|
||||
|
||||
DROP PROCEDURE IF EXISTS parts.p_dog_calc_location;
|
||||
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE parts.p_dog_calc_location (
|
||||
IN a_guid BINARY(36)
|
||||
, IN a_id_user INT
|
||||
, IN a_get_all_location BIT
|
||||
, IN a_get_inactive_location BIT
|
||||
, IN a_ids_location TEXT
|
||||
, IN a_names_location TEXT
|
||||
, IN a_require_all_id_search_filters_met BIT
|
||||
, IN a_require_any_id_search_filters_met BIT
|
||||
, IN a_require_all_non_id_search_filters_met BIT
|
||||
, IN a_require_any_non_id_search_filters_met BIT
|
||||
, IN a_show_errors BIT
|
||||
, IN a_debug BIT
|
||||
)
|
||||
BEGIN
|
||||
DECLARE v_can_view BIT;
|
||||
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
||||
DECLARE v_code_type_error_no_permission VARCHAR(100);
|
||||
DECLARE v_has_filter_location_id BIT;
|
||||
DECLARE v_has_filter_location_name BIT;
|
||||
DECLARE v_id_access_level_view INT;
|
||||
DECLARE v_id_minimum INT;
|
||||
DECLARE v_id_permission_dog_view INT;
|
||||
DECLARE v_id_type_error_bad_data INT;
|
||||
DECLARE v_id_type_error_no_permission INT;
|
||||
DECLARE v_time_start TIMESTAMP(6);
|
||||
|
||||
DECLARE exit handler for SQLEXCEPTION
|
||||
BEGIN
|
||||
GET DIAGNOSTICS CONDITION 1
|
||||
@sqlstate = RETURNED_SQLSTATE
|
||||
, @errno = MYSQL_ERRNO
|
||||
, @text = MESSAGE_TEXT
|
||||
;
|
||||
|
||||
ROLLBACK;
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error_Calc_Location (
|
||||
id_error INT NOT NULL PRIMARY KEY AUTO_INCREMENT
|
||||
, id_type INT NULL
|
||||
, code VARCHAR(100) NOT NULL
|
||||
, msg TEXT NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO tmp_Msg_Error_Calc_Location (
|
||||
id_type
|
||||
, code
|
||||
, msg
|
||||
)
|
||||
SELECT
|
||||
MET.id_type
|
||||
, @errno
|
||||
, @text
|
||||
FROM parts.CORE_Msg_Error_Type MET
|
||||
WHERE MET.code = 'MYSQL_ERROR'
|
||||
;
|
||||
|
||||
SELECT
|
||||
t_ERROR.id_error
|
||||
, t_ERROR.id_type
|
||||
, t_ERROR.code
|
||||
, ERROR_TYPE.name
|
||||
, ERROR_TYPE.description
|
||||
, ERROR_TYPE.is_breaking_error
|
||||
, ERROR_TYPE.background_colour
|
||||
, ERROR_TYPE.text_colour
|
||||
, t_ERROR.msg
|
||||
FROM tmp_Msg_Error_Calc_Location t_ERROR
|
||||
INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type
|
||||
;
|
||||
|
||||
DROP TABLE IF EXISTS tmp_Msg_Error_Calc_Location;
|
||||
END;
|
||||
|
||||
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||
SET v_code_type_error_bad_data := 'BAD_DATA';
|
||||
SET v_code_type_error_no_permission := 'NO_PERMISSION';
|
||||
SET v_id_type_error_bad_data := (SELECT ERROR_TYPE.id_type FROM parts.CORE_Msg_Error_Type ERROR_TYPE WHERE ERROR_TYPE.code = v_code_type_error_bad_data LIMIT 1);
|
||||
SET v_id_type_error_no_permission := (SELECT ERROR_TYPE.id_type FROM parts.CORE_Msg_Error_Type ERROR_TYPE WHERE ERROR_TYPE.code = v_code_type_error_no_permission LIMIT 1);
|
||||
SET v_id_permission_dog_view := (SELECT PERMISSION.id_permission FROM parts.DOG_Permission PERMISSION WHERE PERMISSION.code = 'DOG_VIEW' LIMIT 1);
|
||||
SET v_id_access_level_view := (SELECT ACCESS_LEVEL.id_access_level FROM parts.DOG_Access_Level ACCESS_LEVEL WHERE ACCESS_LEVEL.code = 'VIEW' LIMIT 1);
|
||||
|
||||
|
||||
CALL parts.p_core_validate_guid ( a_guid );
|
||||
|
||||
SET a_id_user := IFNULL(a_id_user, 0);
|
||||
SET a_get_all_location := IFNULL(a_get_all_location, 0);
|
||||
SET a_get_inactive_location := IFNULL(a_get_inactive_location, 0);
|
||||
SET a_ids_location := TRIM(IFNULL(a_ids_location, ''));
|
||||
SET a_names_location := TRIM(IFNULL(a_names_location, ''));
|
||||
SET a_require_all_id_search_filters_met := IFNULL(a_require_all_id_search_filters_met, 1);
|
||||
SET a_require_any_id_search_filters_met := IFNULL(a_require_any_id_search_filters_met, 1);
|
||||
SET a_require_all_non_id_search_filters_met := IFNULL(a_require_all_non_id_search_filters_met, 0);
|
||||
SET a_require_any_non_id_search_filters_met := IFNULL(a_require_any_non_id_search_filters_met, 1);
|
||||
SET a_show_errors := IFNULL(a_show_errors, 0);
|
||||
SET a_debug := IFNULL(a_debug, 0);
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT
|
||||
a_guid
|
||||
, a_id_user
|
||||
, a_get_all_location
|
||||
, a_get_inactive_location
|
||||
, a_ids_location
|
||||
, a_names_location
|
||||
, a_require_all_id_search_filters_met
|
||||
, a_require_any_id_search_filters_met
|
||||
, a_require_all_non_id_search_filters_met
|
||||
, a_require_any_non_id_search_filters_met
|
||||
, a_show_errors
|
||||
, a_debug
|
||||
;
|
||||
|
||||
SELECT
|
||||
v_id_type_error_bad_data
|
||||
, v_id_type_error_no_permission
|
||||
, v_id_permission_dog_view
|
||||
, v_time_start
|
||||
;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Split_Name_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Split_Id_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location_Link_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location_Calc_Location;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp_Location_Calc_Location (
|
||||
id_location INT NOT NULL
|
||||
, does_meet_id_filters BIT NOT NULL
|
||||
, does_meet_non_id_filters BIT NOT NULL
|
||||
, csv_id_locations_parent TEXT
|
||||
);
|
||||
|
||||
CREATE TEMPORARY TABLE tmp_Location_Link_Calc_Location (
|
||||
id_link INT NOT NULL
|
||||
, id_location_parent INT
|
||||
, id_location_child INT
|
||||
, does_meet_id_filters BIT
|
||||
, does_meet_non_id_filters BIT
|
||||
);
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error_Calc_Location (
|
||||
id_error INT NOT NULL PRIMARY KEY AUTO_INCREMENT
|
||||
, id_type INT NULL
|
||||
, code VARCHAR(100) NOT NULL
|
||||
, msg TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Split_Id_Calc_Location (
|
||||
substring VARCHAR(4000) NOT NULL
|
||||
, as_int INT NULL
|
||||
);
|
||||
DELETE FROM tmp_Split_Id_Calc_Location;
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Split_Name_Calc_Location (
|
||||
substring VARCHAR(4000) NOT NULL
|
||||
, as_int INT NULL
|
||||
);
|
||||
DELETE FROM tmp_Split_Name_Calc_Location;
|
||||
|
||||
SET v_has_filter_location_id = CASE WHEN a_ids_location <> '' THEN 1 ELSE 0 END;
|
||||
SET v_has_filter_location_name = CASE WHEN a_names_location <> '' THEN 1 ELSE 0 END;
|
||||
|
||||
-- Locations
|
||||
IF v_has_filter_location_id = 1 THEN
|
||||
CALL parts.p_core_split(a_guid, a_ids_location, ',', a_debug);
|
||||
|
||||
SET sql_mode = '';
|
||||
|
||||
INSERT INTO tmp_Split_Id_Calc_Location (
|
||||
substring
|
||||
, as_int
|
||||
)
|
||||
SELECT
|
||||
SPLIT_T.substring
|
||||
, CAST(SPLIT_T.substring AS DECIMAL(10,0)) AS as_int
|
||||
FROM parts.CORE_Split_Temp SPLIT_T
|
||||
WHERE
|
||||
SPLIT_T.GUID = a_guid
|
||||
AND IFNULL(SPLIT_T.substring, '') <> ''
|
||||
;
|
||||
|
||||
CALL parts.p_core_clear_split( a_guid );
|
||||
END IF;
|
||||
|
||||
IF v_has_filter_location_name = 1 THEN
|
||||
CALL parts.p_core_split(a_guid, a_names_location, ',', a_debug);
|
||||
|
||||
SET sql_mode = '';
|
||||
|
||||
INSERT INTO tmp_Split_Name_Calc_Location (
|
||||
substring
|
||||
, as_int
|
||||
)
|
||||
SELECT
|
||||
SPLIT_T.substring
|
||||
, CAST(SPLIT_T.substring AS DECIMAL(10,0)) AS as_int
|
||||
FROM parts.CORE_Split_Temp SPLIT_T
|
||||
WHERE
|
||||
SPLIT_T.GUID = a_guid
|
||||
AND IFNULL(SPLIT_T.substring, '') <> ''
|
||||
;
|
||||
|
||||
CALL parts.p_core_clear_split( a_guid );
|
||||
END IF;
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error_Calc_Location t_ERROR INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type WHERE ERROR_TYPE.is_breaking_error = 1 LIMIT 1) THEN
|
||||
IF EXISTS (
|
||||
SELECT *
|
||||
FROM tmp_Split_Id_Calc_Location t_SPLIT_ID
|
||||
LEFT JOIN parts.DOG_Location LOCATIONS ON t_SPLIT_ID.as_int = LOCATIONS.id_location
|
||||
WHERE
|
||||
ISNULL(t_SPLIT_ID.as_int)
|
||||
OR ISNULL(LOCATIONS.id_location)
|
||||
OR (
|
||||
LOCATIONS.active = 0
|
||||
AND a_get_inactive_location = 0
|
||||
)
|
||||
) THEN
|
||||
INSERT INTO tmp_Msg_Error_Calc_Location (
|
||||
id_type
|
||||
, code
|
||||
, msg
|
||||
)
|
||||
SELECT
|
||||
v_id_type_error_bad_data
|
||||
, v_code_type_error_bad_data
|
||||
, CONCAT('Invalid or inactive Location IDs: ', IFNULL(GROUP_CONCAT(t_SPLIT_ID.substring SEPARATOR ', '), 'NULL'))
|
||||
FROM tmp_Split_Id_Calc_Location t_SPLIT_ID
|
||||
LEFT JOIN parts.DOG_Location LOCATIONS ON t_SPLIT_ID.as_int = LOCATIONS.id_location
|
||||
WHERE
|
||||
ISNULL(t_SPLIT_ID.as_int)
|
||||
OR ISNULL(LOCATIONS.id_location)
|
||||
OR (
|
||||
LOCATIONS.active = 0
|
||||
AND a_get_inactive_location = 0
|
||||
)
|
||||
;
|
||||
/* Don't error on names, hand signals, or notes not found
|
||||
ELSEIF EXISTS ()
|
||||
*/
|
||||
ELSE
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'Location Filters';
|
||||
WITH
|
||||
Location_Id_Filter AS (
|
||||
SELECT LOCATIONS.id_location
|
||||
FROM tmp_Split_Id_Calc_Location t_SPLIT_ID
|
||||
INNER JOIN parts.DOG_Location LOCATIONS ON t_SPLIT_ID.as_int = LOCATIONS.id_location
|
||||
)
|
||||
, Location_Name_Filter AS (
|
||||
SELECT LOCATIONS.id_location
|
||||
FROM tmp_Split_Name_Calc_Location t_SPLIT_NAME
|
||||
INNER JOIN parts.DOG_Location LOCATIONS ON LOCATIONS.name LIKE CONCAT('%', t_SPLIT_NAME.substring, '%')
|
||||
WHERE NULLIF(t_SPLIT_NAME.substring, '') IS NOT NULL
|
||||
)
|
||||
, Location_Filters AS (
|
||||
SELECT
|
||||
LOCATIONS_COMBINED.id_location
|
||||
, MAX(LOCATIONS_COMBINED.does_meet_id_filter) AS does_meet_id_filter
|
||||
, MAX(LOCATIONS_COMBINED.does_meet_name_filter) AS does_meet_name_filter
|
||||
FROM (
|
||||
SELECT
|
||||
LOCATIONS_ID_FILTER.id_location
|
||||
, 1 AS does_meet_id_filter
|
||||
, 0 AS does_meet_name_filter
|
||||
FROM Location_Id_Filter LOCATIONS_ID_FILTER
|
||||
UNION
|
||||
SELECT
|
||||
LOCATIONS_NAME_FILTER.id_location
|
||||
, 0 AS does_meet_id_filter
|
||||
, 1 AS does_meet_name_filter
|
||||
FROM Location_Name_Filter LOCATIONS_NAME_FILTER
|
||||
) LOCATIONS_COMBINED
|
||||
GROUP BY LOCATIONS_COMBINED.id_location
|
||||
)
|
||||
SELECT
|
||||
LOCATIONS.id_location
|
||||
, CASE WHEN
|
||||
v_has_filter_location_id = 0
|
||||
OR LOCATIONS_FILTERS.does_meet_id_filter = 1
|
||||
THEN 1 ELSE 0 END AS does_meet_non_id_filters
|
||||
, CASE WHEN
|
||||
(
|
||||
v_has_filter_location_name = 0
|
||||
)
|
||||
OR LOCATIONS_FILTERS.does_meet_name_filter = 1
|
||||
THEN 1 ELSE 0 END AS does_meet_id_filters
|
||||
FROM parts.DOG_Location LOCATIONS
|
||||
LEFT JOIN Location_Filters LOCATIONS_FILTERS ON LOCATIONS.id_location = LOCATIONS_FILTERS.id_location
|
||||
WHERE
|
||||
(
|
||||
a_get_all_location = 1
|
||||
OR (
|
||||
v_has_filter_location_id = 1
|
||||
AND LOCATIONS_FILTERS.does_meet_id_filter = 1
|
||||
)
|
||||
OR (
|
||||
v_has_filter_location_name = 1
|
||||
AND LOCATIONS_FILTERS.does_meet_name_filter = 1
|
||||
)
|
||||
)
|
||||
AND (
|
||||
a_get_inactive_location = 1
|
||||
OR LOCATIONS.active = 1
|
||||
)
|
||||
;
|
||||
END IF;
|
||||
INSERT INTO tmp_Location_Calc_Location (
|
||||
id_location
|
||||
, does_meet_id_filters
|
||||
, does_meet_non_id_filters
|
||||
)
|
||||
WITH
|
||||
Location_Id_Filter AS (
|
||||
SELECT LOCATIONS.id_location
|
||||
FROM tmp_Split_Id_Calc_Location t_SPLIT_ID
|
||||
INNER JOIN parts.DOG_Location LOCATIONS ON t_SPLIT_ID.as_int = LOCATIONS.id_location
|
||||
)
|
||||
, Location_Name_Filter AS (
|
||||
SELECT LOCATIONS.id_location
|
||||
FROM tmp_Split_Name_Calc_Location t_SPLIT_NAME
|
||||
INNER JOIN parts.DOG_Location LOCATIONS ON LOCATIONS.name LIKE CONCAT('%', t_SPLIT_NAME.substring, '%')
|
||||
WHERE
|
||||
t_SPLIT_NAME.substring IS NOT NULL
|
||||
AND t_SPLIT_NAME.substring <> ''
|
||||
)
|
||||
, Location_Filters AS (
|
||||
SELECT
|
||||
LOCATIONS_COMBINED.id_location
|
||||
, MAX(LOCATIONS_COMBINED.does_meet_id_filter) AS does_meet_id_filter
|
||||
, MAX(LOCATIONS_COMBINED.does_meet_name_filter) AS does_meet_name_filter
|
||||
FROM (
|
||||
SELECT
|
||||
LOCATIONS_ID_FILTER.id_location
|
||||
, 1 AS does_meet_id_filter
|
||||
, 0 AS does_meet_name_filter
|
||||
FROM Location_Id_Filter LOCATIONS_ID_FILTER
|
||||
UNION
|
||||
SELECT
|
||||
LOCATIONS_NAME_FILTER.id_location
|
||||
, 0 AS does_meet_id_filter
|
||||
, 1 AS does_meet_name_filter
|
||||
FROM Location_Name_Filter LOCATIONS_NAME_FILTER
|
||||
) LOCATIONS_COMBINED
|
||||
GROUP BY LOCATIONS_COMBINED.id_location
|
||||
)
|
||||
SELECT
|
||||
LOCATIONS.id_location
|
||||
, CASE WHEN
|
||||
v_has_filter_location_id = 0
|
||||
OR IFNULL(LOCATIONS_FILTERS.does_meet_id_filter, 0) = 1
|
||||
THEN 1 ELSE 0 END AS does_meet_id_filters
|
||||
, CASE WHEN
|
||||
(
|
||||
v_has_filter_location_name = 0
|
||||
)
|
||||
OR IFNULL(LOCATIONS_FILTERS.does_meet_name_filter, 0) = 1
|
||||
THEN 1 ELSE 0 END AS does_meet_non_id_filters
|
||||
FROM parts.DOG_Location LOCATIONS
|
||||
LEFT JOIN Location_Filters LOCATIONS_FILTERS ON LOCATIONS.id_location = LOCATIONS_FILTERS.id_location
|
||||
WHERE
|
||||
(
|
||||
a_get_all_location = 1
|
||||
OR (
|
||||
v_has_filter_location_id = 1
|
||||
AND LOCATIONS_FILTERS.does_meet_id_filter = 1
|
||||
)
|
||||
OR (
|
||||
v_has_filter_location_name = 1
|
||||
AND LOCATIONS_FILTERS.does_meet_name_filter = 1
|
||||
)
|
||||
)
|
||||
AND (
|
||||
a_get_inactive_location = 1
|
||||
OR LOCATIONS.active = 1
|
||||
)
|
||||
;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
DELETE FROM tmp_Split_Id_Calc_Location;
|
||||
DELETE FROM tmp_Split_Name_Calc_Location;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'After get Locations ';
|
||||
SELECT * FROM tmp_Location_Calc_Location;
|
||||
END IF;
|
||||
|
||||
-- Filter records
|
||||
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error_Calc_Location t_ERROR INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type WHERE ERROR_TYPE.is_breaking_error = 1 LIMIT 1) THEN
|
||||
DELETE t_LOCATIONS
|
||||
FROM tmp_Location_Calc_Location t_LOCATIONS
|
||||
WHERE
|
||||
(
|
||||
a_require_all_id_search_filters_met = 1
|
||||
AND (
|
||||
t_LOCATIONS.does_meet_id_filters = 0
|
||||
)
|
||||
)
|
||||
OR (
|
||||
a_require_all_non_id_search_filters_met = 1
|
||||
AND (
|
||||
t_LOCATIONS.does_meet_non_id_filters = 0
|
||||
)
|
||||
)
|
||||
OR (
|
||||
a_require_any_id_search_filters_met = 1
|
||||
AND t_LOCATIONS.does_meet_id_filters = 0
|
||||
)
|
||||
OR (
|
||||
a_require_any_non_id_search_filters_met = 1
|
||||
AND t_LOCATIONS.does_meet_non_id_filters = 0
|
||||
)
|
||||
;
|
||||
END IF;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'After filter Locations';
|
||||
SELECT * FROM tmp_Location_Calc_Location;
|
||||
END IF;
|
||||
|
||||
-- Calculated fields
|
||||
-- Parent Location Ids
|
||||
WITH Location_Parent AS (
|
||||
SELECT
|
||||
LOCATIONS.id_location
|
||||
, GROUP_CONCAT(LOCATION_LINK.id_location_parent, ',') AS csv_id_locations_parent
|
||||
FROM parts.DOG_Location LOCATIONS
|
||||
INNER JOIN DOG_Location_Link LOCATION_LINK ON LOCATIONS.id_location = LOCATION_LINK.id_location_child
|
||||
WHERE
|
||||
a_get_inactive_location = 1
|
||||
OR LOCATION_LINK.active = 1
|
||||
GROUP BY LOCATIONS.id_location
|
||||
)
|
||||
UPDATE tmp_Location_Calc_Location t_LOCATIONS
|
||||
INNER JOIN Location_Parent LOCATIONS_PARENT ON t_LOCATIONS.id_location = LOCATIONS_PARENT.id_location
|
||||
SET
|
||||
t_LOCATIONS.csv_id_locations_parent = LOCATIONS_PARENT.csv_id_locations_parent
|
||||
;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'After generate calculated fields Locations';
|
||||
SELECT * FROM tmp_Location_Calc_Location;
|
||||
END IF;
|
||||
|
||||
|
||||
-- Location Links
|
||||
INSERT INTO tmp_Location_Link_Calc_Location (
|
||||
id_link
|
||||
, id_location_parent
|
||||
, id_location_child
|
||||
|
||||
, does_meet_id_filters
|
||||
, does_meet_non_id_filters
|
||||
)
|
||||
SELECT
|
||||
LOCATION_LINK.id_link
|
||||
, LOCATION_LINK.id_location_parent
|
||||
, LOCATION_LINK.id_location_child
|
||||
|
||||
, NULL AS does_meet_id_filters
|
||||
, NULL AS does_meet_non_id_filters
|
||||
FROM parts.DOG_Location_Link LOCATION_LINK
|
||||
INNER JOIN tmp_Location_Calc_Location t_LOCATIONS
|
||||
ON LOCATION_LINK.id_location_parent = t_LOCATIONS.id_location
|
||||
OR LOCATION_LINK.id_location_child = t_LOCATIONS.id_location
|
||||
WHERE
|
||||
a_get_inactive_location = 1
|
||||
OR LOCATION_LINK.active = 1
|
||||
;
|
||||
|
||||
-- Permissions
|
||||
IF a_debug = 1 THEN
|
||||
SELECT
|
||||
a_guid -- a_guid
|
||||
, 0 -- get_all_user
|
||||
, 0 -- get_inactive_user
|
||||
, a_id_user -- ids_user
|
||||
, '' -- a_auth0_ids_user
|
||||
, '' -- a_names_user
|
||||
, '' -- a_emails_user
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 0 -- a_require_any_non_id_search_filters_met
|
||||
, v_id_permission_dog_view -- ids_permission
|
||||
, v_id_access_level_view -- ids_access_level
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
;
|
||||
END IF;
|
||||
|
||||
CALL parts.p_dog_calc_user(
|
||||
a_guid -- a_guid
|
||||
, 0 -- get_all_user
|
||||
, 0 -- get_inactive_user
|
||||
, a_id_user -- ids_user
|
||||
, '' -- a_auth0_ids_user
|
||||
, '' -- a_names_user
|
||||
, '' -- a_emails_user
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 0 -- a_require_any_non_id_search_filters_met
|
||||
, v_id_permission_dog_view -- ids_permission
|
||||
, v_id_access_level_view -- ids_access_level
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
SELECT
|
||||
IFNULL(CALC_USER_T.has_access, 0)
|
||||
INTO
|
||||
v_can_view
|
||||
FROM parts.DOG_Calc_User_Temp CALC_USER_T
|
||||
WHERE CALC_USER_T.GUID = a_guid
|
||||
LIMIT 1
|
||||
;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT v_can_view;
|
||||
END IF;
|
||||
|
||||
IF (v_can_view = 0) THEN
|
||||
DELETE t_ME
|
||||
FROM tmp_Msg_Error_Calc_Location t_ME
|
||||
WHERE t_ME.id_type <> v_id_type_error_no_permission
|
||||
;
|
||||
INSERT INTO tmp_Msg_Error_Calc_Location (
|
||||
id_type
|
||||
, code
|
||||
, msg
|
||||
)
|
||||
VALUES (
|
||||
v_id_type_error_no_permission
|
||||
, v_code_type_error_no_permission
|
||||
, 'You do not have permission to view Dogs and Locations.'
|
||||
)
|
||||
;
|
||||
END IF;
|
||||
|
||||
CALL parts.p_dog_clear_calc_user(
|
||||
a_guid
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'Before non-permitted data deletion';
|
||||
SELECT * FROM tmp_Location_Calc_Location;
|
||||
SELECT * FROM tmp_Msg_Error_Calc_Location;
|
||||
END IF;
|
||||
|
||||
IF EXISTS(SELECT * FROM tmp_Msg_Error_Calc_Location t_ERROR INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type WHERE ERROR_TYPE.is_breaking_error = 1 LIMIT 1) THEN
|
||||
IF a_debug = 1 THEN
|
||||
SELECT * FROM tmp_Location_Calc_Location;
|
||||
END IF;
|
||||
|
||||
DELETE FROM tmp_Location_Calc_Location;
|
||||
END IF;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT 'After non-permitted data deletion';
|
||||
END IF;
|
||||
|
||||
-- Outputs
|
||||
START TRANSACTION;
|
||||
-- Locations
|
||||
INSERT INTO parts.DOG_Location_Temp (
|
||||
guid
|
||||
, id_location
|
||||
, code
|
||||
, name
|
||||
, active
|
||||
|
||||
, csv_id_locations_parent
|
||||
|
||||
, does_meet_id_filters
|
||||
, does_meet_non_id_filters
|
||||
)
|
||||
SELECT
|
||||
a_guid
|
||||
, t_LOCATIONS.id_location
|
||||
, LOCATIONS.code
|
||||
, LOCATIONS.name
|
||||
, LOCATIONS.active
|
||||
|
||||
, t_LOCATIONS.csv_id_locations_parent
|
||||
|
||||
, t_LOCATIONS.does_meet_id_filters
|
||||
, t_LOCATIONS.does_meet_non_id_filters
|
||||
FROM parts.DOG_Location LOCATIONS
|
||||
INNER JOIN tmp_Location_Calc_Location t_LOCATIONS ON LOCATIONS.id_location = t_LOCATIONS.id_location
|
||||
ORDER BY LOCATIONS.name
|
||||
;
|
||||
|
||||
INSERT INTO parts.DOG_Location_Link_Temp (
|
||||
guid
|
||||
, id_link
|
||||
, id_location_parent
|
||||
, id_location_child
|
||||
, active
|
||||
|
||||
, does_meet_id_filters
|
||||
, does_meet_non_id_filters
|
||||
)
|
||||
SELECT
|
||||
a_guid
|
||||
, t_LOCATION_LINK.id_link
|
||||
, LOCATION_LINK.id_location_parent
|
||||
, LOCATION_LINK.id_location_child
|
||||
, LOCATION_LINK.active
|
||||
|
||||
, NULL AS does_meet_id_filters
|
||||
, NULL AS does_meet_non_id_filters
|
||||
FROM parts.DOG_Location_Link LOCATION_LINK
|
||||
INNER JOIN tmp_Location_Link_Calc_Location t_LOCATION_LINK ON LOCATION_LINK.id_link = t_LOCATION_LINK.id_link
|
||||
INNER JOIN parts.DOG_Location LOCATIONS ON LOCATION_LINK.id_location_child = LOCATIONS.id_location
|
||||
ORDER BY LOCATIONS.name
|
||||
;
|
||||
COMMIT;
|
||||
|
||||
-- Errors
|
||||
IF a_show_errors = 1 THEN
|
||||
SELECT
|
||||
t_ERROR.id_error
|
||||
, t_ERROR.id_type
|
||||
, t_ERROR.code
|
||||
, ERROR_TYPE.name
|
||||
, ERROR_TYPE.description
|
||||
, ERROR_TYPE.is_breaking_error
|
||||
, ERROR_TYPE.background_colour
|
||||
, ERROR_TYPE.text_colour
|
||||
, t_ERROR.msg
|
||||
FROM tmp_Msg_Error_Calc_Location t_ERROR
|
||||
INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type
|
||||
;
|
||||
END IF;
|
||||
|
||||
IF a_debug = 1 AND v_can_view = 1 THEN
|
||||
SELECT * FROM tmp_Location_Calc_Location;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Split_Name_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Split_Id_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location_Link_Calc_Location;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location_Calc_Location;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
CALL parts.p_core_debug_timing_reporting ( v_time_start );
|
||||
END IF;
|
||||
END //
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
CALL parts.p_dog_calc_location (
|
||||
'slops ' -- a_guid
|
||||
, 1 -- 'auth0|6582b95c895d09a70ba10fef', -- a_id_user
|
||||
, 1 -- a_get_all_location
|
||||
, 0 -- a_get_inactive_location
|
||||
, '' -- a_ids_location
|
||||
, '' -- a_names_location
|
||||
, 0 -- a_require_all_id_search_filters_met
|
||||
, 0 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 0 -- a_require_any_non_id_search_filters_met
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
CALL parts.p_dog_calc_location (
|
||||
'slops ' -- a_guid
|
||||
, 1 -- 'auth0|6582b95c895d09a70ba10fef', -- a_id_user
|
||||
, 1 -- a_get_all_location
|
||||
, 0 -- a_get_inactive_location
|
||||
, '' -- a_ids_location
|
||||
, 'pat,point' -- a_names_location
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 1 -- a_require_any_non_id_search_filters_met
|
||||
, 1 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
);
|
||||
SELECT *
|
||||
FROM parts.DOG_Location_Temp
|
||||
;
|
||||
SELECT *
|
||||
FROM parts.DOG_Location_Link_Temp
|
||||
;
|
||||
/*
|
||||
SELECT *
|
||||
FROM parts.DOG_Location_Temp C
|
||||
WHERE
|
||||
C.does_meet_id_filters
|
||||
AND C.does_meet_non_id_filters
|
||||
;
|
||||
*/
|
||||
CALL parts.p_dog_clear_calc_location (
|
||||
'slips ' -- a_guid
|
||||
, 1 -- debug
|
||||
);
|
||||
|
||||
|
||||
DELETE
|
||||
FROM parts.DOG_Location_Temp
|
||||
;
|
||||
DELETE
|
||||
FROM parts.DOG_Location_Link_Temp
|
||||
;
|
||||
|
||||
*/
|
||||
50
static/MySQL/71200_p_dog_clear_calc_location.sql
Normal file
50
static/MySQL/71200_p_dog_clear_calc_location.sql
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
USE parts;
|
||||
|
||||
DROP PROCEDURE IF EXISTS parts.p_dog_clear_calc_location;
|
||||
DROP PROCEDURE IF EXISTS parts.p_location_clear_calc_location;
|
||||
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE parts.p_dog_clear_calc_location (
|
||||
IN a_guid BINARY(36)
|
||||
, IN a_debug BIT
|
||||
)
|
||||
BEGIN
|
||||
DECLARE v_time_start TIMESTAMP(6);
|
||||
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||
|
||||
CALL parts.p_core_validate_guid ( a_guid );
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
DELETE LOCATIONS_T
|
||||
FROM parts.DOG_Location_Temp LOCATIONS_T
|
||||
WHERE LOCATIONS_T.GUID = a_guid
|
||||
;
|
||||
|
||||
DELETE LOCATION_LINK_T
|
||||
FROM parts.DOG_Location_Link_Temp LOCATION_LINK_T
|
||||
WHERE LOCATION_LINK_T.GUID = a_guid
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
CALL parts.p_debug_timing_reporting( v_time_start );
|
||||
END IF;
|
||||
END //
|
||||
DELIMITER ;
|
||||
|
||||
/*
|
||||
|
||||
CALL parts.p_dog_clear_calc_location (
|
||||
'crips ' -- a_guid
|
||||
, 1 -- debug
|
||||
);
|
||||
|
||||
SELECT *
|
||||
FROM parts.DOG_Calc_User_Temp
|
||||
WHERE GUID = 'chips '
|
||||
;
|
||||
|
||||
*/
|
||||
443
static/MySQL/71200_p_dog_get_many_location.sql
Normal file
443
static/MySQL/71200_p_dog_get_many_location.sql
Normal file
@@ -0,0 +1,443 @@
|
||||
|
||||
USE parts;
|
||||
|
||||
DROP PROCEDURE IF EXISTS parts.p_dog_get_many_location;
|
||||
|
||||
DELIMITER //
|
||||
CREATE PROCEDURE parts.p_dog_get_many_location (
|
||||
IN a_id_user INT
|
||||
, IN a_get_all_location BIT
|
||||
, IN a_get_inactive_location BIT
|
||||
, IN a_ids_location TEXT
|
||||
, IN a_names_location TEXT
|
||||
, IN a_require_all_id_search_filters_met BIT
|
||||
, IN a_require_any_id_search_filters_met BIT
|
||||
, IN a_require_all_non_id_search_filters_met BIT
|
||||
, IN a_require_any_non_id_search_filters_met BIT
|
||||
, IN a_output_LOCATIONS BIT
|
||||
, IN a_output_LOCATION_links BIT
|
||||
, IN a_debug BIT
|
||||
)
|
||||
BEGIN
|
||||
DECLARE v_can_view BIT;
|
||||
DECLARE v_code_type_error_bad_data VARCHAR(100);
|
||||
DECLARE v_code_type_error_no_permission VARCHAR(100);
|
||||
DECLARE v_guid BINARY(36);
|
||||
DECLARE v_id_access_level_view INT;
|
||||
DECLARE v_id_minimum INT;
|
||||
DECLARE v_id_permission_dog_view INT;
|
||||
DECLARE v_id_type_error_bad_data INT;
|
||||
DECLARE v_id_type_error_no_permission INT;
|
||||
DECLARE v_time_start TIMESTAMP(6);
|
||||
|
||||
DECLARE exit handler for SQLEXCEPTION
|
||||
BEGIN
|
||||
GET DIAGNOSTICS CONDITION 1
|
||||
@sqlstate = RETURNED_SQLSTATE
|
||||
, @errno = MYSQL_ERRNO
|
||||
, @text = MESSAGE_TEXT
|
||||
;
|
||||
|
||||
ROLLBACK;
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
|
||||
id_error INT NOT NULL PRIMARY KEY AUTO_INCREMENT
|
||||
, id_type INT NULL
|
||||
, code VARCHAR(100) NOT NULL
|
||||
, msg TEXT NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO tmp_Msg_Error (
|
||||
id_type
|
||||
, code
|
||||
, msg
|
||||
)
|
||||
SELECT
|
||||
MET.id_type
|
||||
, @errno
|
||||
, @text
|
||||
FROM parts.CORE_Msg_Error_Type MET
|
||||
WHERE MET.code = 'MYSQL_ERROR'
|
||||
;
|
||||
|
||||
SELECT
|
||||
t_ERROR.id_error
|
||||
, t_ERROR.id_type
|
||||
, t_ERROR.code
|
||||
, ERROR_TYPE.name
|
||||
, ERROR_TYPE.description
|
||||
, ERROR_TYPE.is_breaking_error
|
||||
, ERROR_TYPE.background_colour
|
||||
, ERROR_TYPE.text_colour
|
||||
, t_ERROR.msg
|
||||
FROM tmp_Msg_Error t_ERROR
|
||||
INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type
|
||||
;
|
||||
|
||||
DROP TABLE IF EXISTS tmp_Msg_Error;
|
||||
END;
|
||||
|
||||
SET v_time_start := CURRENT_TIMESTAMP(6);
|
||||
SET v_guid := UUID();
|
||||
SET v_code_type_error_bad_data := 'BAD_DATA';
|
||||
SET v_code_type_error_no_permission := 'NO_PERMISSION';
|
||||
SET v_id_type_error_bad_data := (SELECT ERROR_TYPE.id_type FROM parts.CORE_Msg_Error_Type ERROR_TYPE WHERE ERROR_TYPE.code = v_code_type_error_bad_data LIMIT 1);
|
||||
SET v_id_type_error_no_permission := (SELECT ERROR_TYPE.id_type FROM parts.CORE_Msg_Error_Type ERROR_TYPE WHERE ERROR_TYPE.code = v_code_type_error_no_permission LIMIT 1);
|
||||
SET v_id_permission_dog_view := (SELECT PERMISSION.id_permission FROM parts.DOG_Permission PERMISSION WHERE PERMISSION.code = 'DOG_VIEW' LIMIT 1);
|
||||
SET v_id_access_level_view := (SELECT ACCESS_LEVEL.id_access_level FROM parts.DOG_Access_Level ACCESS_LEVEL WHERE ACCESS_LEVEL.code = 'VIEW' LIMIT 1);
|
||||
|
||||
SET a_id_user := IFNULL(a_id_user, 0);
|
||||
/*
|
||||
SET a_get_all_location := IFNULL(a_get_all_location, 0);
|
||||
SET a_get_inactive_location := IFNULL(a_get_inactive_location, 0);
|
||||
SET a_ids_location := TRIM(IFNULL(a_ids_location, ''));
|
||||
SET a_names_location := TRIM(IFNULL(a_names_location, ''));
|
||||
SET a_hand_signal_default_descriptions_location := TRIM(IFNULL(a_hand_signal_default_descriptions_location, ''));
|
||||
SET a_notes_location := TRIM(IFNULL(a_notes_location, ''));
|
||||
SET a_require_all_id_search_filters_met := IFNULL(a_require_all_id_search_filters_met, 1);
|
||||
SET a_require_any_id_search_filters_met := IFNULL(a_require_any_id_search_filters_met, 1);
|
||||
SET a_require_all_non_id_search_filters_met := IFNULL(a_require_all_non_id_search_filters_met, 0);
|
||||
SET a_require_any_non_id_search_filters_met := IFNULL(a_require_any_non_id_search_filters_met, 1);
|
||||
*/
|
||||
SET a_output_LOCATIONS := IFNULL(a_output_LOCATIONS, 0);
|
||||
SET a_output_LOCATION_links := IFNULL(a_output_LOCATION_links, 0);
|
||||
SET a_debug := IFNULL(a_debug, 0);
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT
|
||||
a_id_user
|
||||
, a_get_all_location
|
||||
, a_get_inactive_location
|
||||
, a_ids_location
|
||||
, a_names_location
|
||||
, a_require_all_id_search_filters_met
|
||||
, a_require_any_id_search_filters_met
|
||||
, a_require_all_non_id_search_filters_met
|
||||
, a_require_any_non_id_search_filters_met
|
||||
, a_output_LOCATIONS
|
||||
, a_output_LOCATION_links
|
||||
, a_debug
|
||||
;
|
||||
|
||||
SELECT
|
||||
v_id_type_error_bad_data
|
||||
, v_id_type_error_no_permission
|
||||
, v_guid
|
||||
, v_id_permission_dog_view
|
||||
, v_time_start
|
||||
;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location_Link;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp_Location (
|
||||
id_location INT NOT NULL
|
||||
, code VARCHAR(100)
|
||||
, name VARCHAR(250)
|
||||
, active BIT
|
||||
|
||||
, does_meet_id_filters BIT
|
||||
, does_meet_non_id_filters BIT
|
||||
);
|
||||
|
||||
CREATE TEMPORARY TABLE tmp_Location_Link (
|
||||
id_link INT NOT NULL
|
||||
, id_location_parent INT
|
||||
, id_location_child INT
|
||||
, active BIT
|
||||
|
||||
, does_meet_id_filters BIT
|
||||
, does_meet_non_id_filters BIT
|
||||
);
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
|
||||
id_error INT NOT NULL PRIMARY KEY AUTO_INCREMENT
|
||||
, id_type INT NULL
|
||||
, code VARCHAR(100) NOT NULL
|
||||
, msg TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- Permissions
|
||||
IF a_debug = 1 THEN
|
||||
SELECT
|
||||
v_guid
|
||||
, 0 -- get_all_user
|
||||
, 0 -- get_inactive_user
|
||||
, a_id_user -- ids_user
|
||||
, '' -- a_auth0_ids_user
|
||||
, '' -- a_names_user
|
||||
, '' -- a_emails_user
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 0 -- a_require_any_non_id_search_filters_met
|
||||
, v_id_permission_dog_view -- ids_permission
|
||||
, v_id_access_level_view -- ids_access_level
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
;
|
||||
END IF;
|
||||
|
||||
CALL parts.p_dog_calc_user(
|
||||
v_guid
|
||||
, 0 -- get_all_user
|
||||
, 0 -- get_inactive_user
|
||||
, a_id_user -- ids_user
|
||||
, '' -- a_auth0_ids_user
|
||||
, '' -- a_names_user
|
||||
, '' -- a_emails_user
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 0 -- a_require_any_non_id_search_filters_met
|
||||
, v_id_permission_dog_view -- ids_permission
|
||||
, v_id_access_level_view -- ids_access_level
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
SELECT
|
||||
IFNULL(CALC_USER_T.has_access, 0)
|
||||
INTO
|
||||
v_can_view
|
||||
FROM parts.DOG_Calc_User_Temp CALC_USER_T
|
||||
WHERE CALC_USER_T.GUID = v_guid
|
||||
LIMIT 1
|
||||
;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT v_can_view;
|
||||
SELECT COUNT(*) AS Count_Errors FROM tmp_Msg_Error t_ERROR;
|
||||
SELECT * FROM tmp_Msg_Error t_ERROR;
|
||||
END IF;
|
||||
|
||||
IF (v_can_view = 0) THEN
|
||||
DELETE t_ME
|
||||
FROM tmp_Msg_Error t_ME
|
||||
WHERE t_ME.id_type <> v_id_type_error_no_permission
|
||||
;
|
||||
INSERT INTO tmp_Msg_Error (
|
||||
id_type
|
||||
, code
|
||||
, msg
|
||||
)
|
||||
VALUES (
|
||||
v_id_type_error_no_permission
|
||||
, v_code_type_error_no_permission
|
||||
, 'You do not have permission to view Locations.'
|
||||
)
|
||||
;
|
||||
END IF;
|
||||
|
||||
CALL parts.p_dog_clear_calc_user(
|
||||
v_guid
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
|
||||
-- Call Location Calc
|
||||
IF NOT EXISTS(SELECT * FROM tmp_Msg_Error t_ERROR INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type WHERE ERROR_TYPE.is_breaking_error = 1 LIMIT 1) THEN
|
||||
IF a_debug = 1 THEN
|
||||
SELECT
|
||||
v_guid -- a_guid
|
||||
, a_id_user -- a_id_user
|
||||
, a_get_all_location -- a_get_all_location
|
||||
, a_get_inactive_location -- a_get_inactive_location
|
||||
, a_ids_location -- a_ids_location
|
||||
, a_names_location -- a_names_location
|
||||
, a_require_all_id_search_filters_met -- a_require_all_id_search_filters_met
|
||||
, a_require_any_id_search_filters_met -- a_require_any_id_search_filters_met
|
||||
, a_require_all_non_id_search_filters_met -- a_require_all_non_id_search_filters_met
|
||||
, a_require_any_non_id_search_filters_met -- a_require_any_non_id_search_filters_met
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
;
|
||||
END IF;
|
||||
|
||||
CALL parts.p_dog_calc_location (
|
||||
v_guid -- a_guid
|
||||
, a_id_user -- a_id_user
|
||||
, a_get_all_location -- a_get_all_location
|
||||
, a_get_inactive_location -- a_get_inactive_location
|
||||
, a_ids_location -- a_ids_location
|
||||
, a_names_location -- a_names_location
|
||||
, a_require_all_id_search_filters_met -- a_require_all_id_search_filters_met
|
||||
, a_require_any_id_search_filters_met -- a_require_any_id_search_filters_met
|
||||
, a_require_all_non_id_search_filters_met -- a_require_all_non_id_search_filters_met
|
||||
, a_require_any_non_id_search_filters_met -- a_require_any_non_id_search_filters_met
|
||||
, 0 -- a_show_errors
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT COUNT(*) FROM parts.DOG_Location_Temp;
|
||||
SELECT * FROM parts.DOG_Location_Temp;
|
||||
SELECT COUNT(*) FROM parts.DOG_Location_Link_Temp;
|
||||
SELECT * FROM parts.DOG_Location_Link_Temp;
|
||||
END IF;
|
||||
|
||||
INSERT INTO tmp_Location (
|
||||
id_location
|
||||
, code
|
||||
, name
|
||||
, active
|
||||
|
||||
, does_meet_id_filters
|
||||
, does_meet_non_id_filters
|
||||
)
|
||||
SELECT
|
||||
LOCATION_T.id_location
|
||||
, LOCATION_T.code
|
||||
, LOCATION_T.name
|
||||
, LOCATION_T.active
|
||||
|
||||
, LOCATION_T.does_meet_id_filters
|
||||
, LOCATION_T.does_meet_non_id_filters
|
||||
FROM parts.DOG_Location_Temp LOCATION_T
|
||||
WHERE LOCATION_T.GUID = v_guid
|
||||
;
|
||||
|
||||
INSERT INTO tmp_Location_Link (
|
||||
id_link
|
||||
, id_location_parent
|
||||
, id_location_child
|
||||
, active
|
||||
|
||||
, does_meet_id_filters
|
||||
, does_meet_non_id_filters
|
||||
)
|
||||
SELECT
|
||||
LOCATION_LINK_T.id_link
|
||||
, LOCATION_LINK_T.id_location_parent
|
||||
, LOCATION_LINK_T.id_location_child
|
||||
, LOCATION_LINK_T.active
|
||||
|
||||
, NULL AS does_meet_id_filters
|
||||
, NULL AS does_meet_non_id_filters
|
||||
FROM parts.DOG_Location_Link_Temp LOCATION_LINK_T
|
||||
WHERE LOCATION_LINK_T.GUID = v_guid
|
||||
;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
SELECT COUNT(*) FROM tmp_Location;
|
||||
SELECT * FROM tmp_Location;
|
||||
SELECT COUNT(*) FROM tmp_Location_Link;
|
||||
SELECT * FROM tmp_Location_Link;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
-- Filter outputs
|
||||
IF EXISTS(SELECT * FROM tmp_Msg_Error t_ERROR INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type WHERE ERROR_TYPE.is_breaking_error = 1 LIMIT 1) THEN
|
||||
IF a_debug = 1 THEN
|
||||
SELECT * FROM tmp_Location;
|
||||
SELECT * FROM tmp_Location_Link;
|
||||
END IF;
|
||||
|
||||
DELETE FROM tmp_Location_Link;
|
||||
DELETE FROM tmp_Location;
|
||||
END IF;
|
||||
|
||||
|
||||
-- Outputs
|
||||
-- Locations
|
||||
IF a_output_LOCATIONS = 1 THEN
|
||||
SELECT
|
||||
t_LOCATIONS.id_location
|
||||
, t_LOCATIONS.code
|
||||
, t_LOCATIONS.name
|
||||
, t_LOCATIONS.active
|
||||
|
||||
, t_LOCATIONS.does_meet_id_filters
|
||||
, t_LOCATIONS.does_meet_non_id_filters
|
||||
FROM tmp_Location t_LOCATIONS
|
||||
ORDER BY t_LOCATIONS.name
|
||||
;
|
||||
END IF;
|
||||
|
||||
-- Location Links
|
||||
IF a_output_LOCATION_links = 1 THEN
|
||||
SELECT
|
||||
t_LOCATION_LINK.id_link
|
||||
, t_LOCATION_LINK.id_location_parent
|
||||
, t_LOCATION_LINK.id_location_child
|
||||
, t_LOCATION_LINK.active
|
||||
|
||||
, t_LOCATION_LINK.does_meet_id_filters
|
||||
, t_LOCATION_LINK.does_meet_non_id_filters
|
||||
FROM tmp_Location_Link t_LOCATION_LINK
|
||||
INNER JOIN tmp_Location t_LOCATIONS ON t_LOCATION_LINK.id_location_child = t_LOCATIONS.id_location
|
||||
ORDER BY t_LOCATIONS.name
|
||||
;
|
||||
END IF;
|
||||
|
||||
-- Errors
|
||||
SELECT
|
||||
t_ERROR.id_error
|
||||
, t_ERROR.id_type
|
||||
, t_ERROR.code
|
||||
, ERROR_TYPE.name
|
||||
, ERROR_TYPE.description
|
||||
, ERROR_TYPE.is_breaking_error
|
||||
, ERROR_TYPE.background_colour
|
||||
, ERROR_TYPE.text_colour
|
||||
, t_ERROR.msg
|
||||
FROM tmp_Msg_Error t_ERROR
|
||||
INNER JOIN parts.CORE_Msg_Error_Type ERROR_TYPE ON t_ERROR.id_type = ERROR_TYPE.id_type
|
||||
;
|
||||
|
||||
IF a_debug = 1 AND v_can_view = 1 THEN
|
||||
SELECT * FROM tmp_Location;
|
||||
END IF;
|
||||
|
||||
CALL parts.p_dog_clear_calc_location(
|
||||
v_guid -- a_guid
|
||||
, 0 -- a_debug
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location_Link;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_Location;
|
||||
|
||||
IF a_debug = 1 THEN
|
||||
CALL parts.p_core_debug_timing_reporting ( v_time_start );
|
||||
END IF;
|
||||
END //
|
||||
DELIMITER ;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
CALL parts.p_dog_get_many_location (
|
||||
1 -- 'auth0|6582b95c895d09a70ba10fef', -- a_id_user
|
||||
, 1 -- a_get_all_location
|
||||
, 0 -- a_get_inactive_location
|
||||
, '' -- a_ids_location
|
||||
, '' -- a_names_location
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 1 -- a_require_any_non_id_search_filters_met
|
||||
, 1 -- a_output_LOCATIONS
|
||||
, 1 -- a_output_LOCATION_links
|
||||
, 1 -- a_debug
|
||||
);
|
||||
|
||||
|
||||
CALL demo.p_dog_get_many_location (
|
||||
1 -- 'auth0|6582b95c895d09a70ba10fef', -- a_id_user
|
||||
, 1 -- a_get_all_location
|
||||
, 0 -- a_get_inactive_location
|
||||
, '' -- a_ids_location
|
||||
, 'pat,point' -- a_names_location
|
||||
, 1 -- a_require_all_id_search_filters_met
|
||||
, 1 -- a_require_any_id_search_filters_met
|
||||
, 0 -- a_require_all_non_id_search_filters_met
|
||||
, 1 -- a_require_any_non_id_search_filters_met
|
||||
, 1 -- a_output_LOCATIONS
|
||||
, 1 -- a_output_LOCATION_links
|
||||
, 1 -- a_debug
|
||||
);
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
select {
|
||||
border: 1px solid var(--colour-accent);
|
||||
}
|
||||
@@ -128,6 +128,7 @@ header {
|
||||
#formFilters .container-input input {
|
||||
width: 10vh;
|
||||
max-width: 10vh;
|
||||
height: 20px;
|
||||
}
|
||||
/*
|
||||
#formFilters .container-input input {
|
||||
@@ -145,15 +146,16 @@ header {
|
||||
display: none;
|
||||
}
|
||||
#formFilters .container-input.filter.active_only svg.active_only {
|
||||
height: 2vh;
|
||||
height: 25px;
|
||||
fill: var(--colour-text-background);
|
||||
background-color: var(--colour-primary);
|
||||
border: 1px solid var(--colour-primary);
|
||||
width: 2vh;
|
||||
border-radius: 0.5vh;
|
||||
background-color: var(--colour-accent);
|
||||
/* border: 1px solid var(--colour-accent);
|
||||
border-radius: 0.5vh; */
|
||||
width: 25px;
|
||||
}
|
||||
#formFilters .container-input.filter.active_only svg.active_only.is_checked {
|
||||
fill: var(--colour-accent);
|
||||
background-color: var(--colour-text-background);
|
||||
}
|
||||
#formFilters .container-input.filter.is_not_empty {
|
||||
width: 12vh;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
align-self: center;
|
||||
position: relative;
|
||||
display: block;
|
||||
width: min(calc(90vh), calc(70vw));
|
||||
width: 100%; /* min(calc(90vh), calc(70vw)); */
|
||||
}
|
||||
|
||||
#tableMain select,
|
||||
|
||||
@@ -196,8 +196,9 @@ img.header-logo {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.container-input > input, .container-input > textarea {
|
||||
border: 2px solid var(--colour-primary);
|
||||
.container-input > input,
|
||||
.container-input > textarea {
|
||||
border: 2px solid var(--colour-accent);
|
||||
padding: 1vh;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
.home-hero a {
|
||||
font-size: 1.25rem;
|
||||
margin-bottom: 2rem;
|
||||
color: var(--colour-text-background);
|
||||
color: var(--colour-primary);
|
||||
cursor: pointer;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
@@ -4,26 +4,15 @@
|
||||
min-width: 20vh;
|
||||
}
|
||||
|
||||
#tableMain tbody > div {
|
||||
width: 58vh;
|
||||
}
|
||||
#tableMain thead tr th,
|
||||
#tableMain tbody tr td {
|
||||
height: 3vh;
|
||||
}
|
||||
#tableMain tbody tr td.name .name {
|
||||
border: 1px solid var(--colour-accent);
|
||||
/*
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
align-self: center;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
justify-items: center;
|
||||
justify-self: center;
|
||||
padding-top: auto;
|
||||
padding-bottom: auto;
|
||||
display: flex;
|
||||
resize: none;
|
||||
box-sizing: border-box;
|
||||
*/
|
||||
}
|
||||
/*
|
||||
#tableMain thead tr th.code,
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
max-width: fit-content;
|
||||
}
|
||||
*/
|
||||
|
||||
#tableMain tbody > div {
|
||||
width: 99vh;
|
||||
}
|
||||
#tableMain thead tr th.can-have-button,
|
||||
#tableMain tbody tr td.can-have-button {
|
||||
width: 6vh;
|
||||
|
||||
@@ -4,32 +4,13 @@
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#tableMain tbody > div {
|
||||
width: 113vh;
|
||||
}
|
||||
#tableMain {
|
||||
max-width: 90vw;
|
||||
}
|
||||
/*
|
||||
#tableMain thead tr th.category, #tableMain tbody tr td.category {
|
||||
width: 8vh;
|
||||
min-width: 8vh;
|
||||
}
|
||||
#tableMain thead tr th.product, #tableMain tbody tr td.product {
|
||||
width: 10vh;
|
||||
min-width: 10vh;
|
||||
}
|
||||
#tableMain thead tr th.product_variations.is_collapsed, #tableMain tbody tr td.product_variations.is_collapsed {
|
||||
width: 10vh;
|
||||
min-width: 10vh;
|
||||
display: table-cell !important;
|
||||
}
|
||||
#tableMain thead tr th.product_variations, #tableMain tbody tr td.product_variations {
|
||||
width: 24vh;
|
||||
min-width: 24vh;
|
||||
}
|
||||
#tableMain thead tr th.active, #tableMain tbody tr td.active {
|
||||
width: 6vh;
|
||||
min-width: 6vh;
|
||||
}
|
||||
*/
|
||||
|
||||
td > input,
|
||||
td > select,
|
||||
|
||||
5
static/css/pages/dog/locations.css
Normal file
5
static/css/pages/dog/locations.css
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
#tableMain tbody > div {
|
||||
width: 99vh;
|
||||
}
|
||||
2
static/dist/css/core_home.bundle.css
vendored
2
static/dist/css/core_home.bundle.css
vendored
@@ -23,7 +23,7 @@
|
||||
.home-hero a {
|
||||
font-size: 1.25rem;
|
||||
margin-bottom: 2rem;
|
||||
color: var(--colour-text-background);
|
||||
color: var(--colour-primary);
|
||||
cursor: pointer;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
2
static/dist/css/core_home.bundle.css.map
vendored
2
static/dist/css/core_home.bundle.css.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"css/core_home.bundle.css","mappings":";AACA,iBAAiB;AACjB;IACI,oBAAoB;IACpB,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,gBAAgB;AACpB;;AAEA;IACI,eAAe;IACf,gBAAgB;IAChB,qBAAqB;IACrB,yBAAyB;IACzB,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;IAClB,mBAAmB;IACnB,oCAAoC;IACpC,eAAe;IACf,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA,qBAAqB;AACrB;IACI,eAAe;IACf,iBAAiB;AACrB;;AAEA;IACI,aAAa;IACb,2DAA2D;IAC3D,SAAS;IACT,gBAAgB;AACpB;;AAEA;IACI,aAAa;IACb,wBAAwB;IACxB,kBAAkB;IAClB,+BAA+B;AACnC;;AAEA;IACI,2BAA2B;AAC/B;;AAEA,wBAAwB;AACxB;IACI,eAAe;IACf,wBAAwB;AAC5B;;AAEA;IACI,iBAAiB;IACjB,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,qCAAqC;AACzC;;AAEA,oBAAoB;AACpB;IACI,eAAe;IACf,iBAAiB;AACrB;;AAEA;IACI,wBAAwB;IACxB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;AACvB;;AAEA;IACI,iBAAiB;IACjB,qBAAqB;IACrB,iBAAiB;IACjB,cAAc;AAClB;;AAEA,gBAAgB;AAChB;IACI,eAAe;IACf,0BAA0B;IAC1B,YAAY;IACZ,kBAAkB;AACtB;;;AAGA,eAAe;AACf,4DAA4D;AAC5D;IACI,UAAU,EAAE,0BAA0B;AAC1C;;AAEA,iEAAiE;AACjE;IACI;QACI,UAAU;IACd;;IAEA;QACI,yCAAyC;IAC7C;AACJ;;AAEA;IACI;QACI,UAAU;QACV,2BAA2B;IAC/B;IACA;QACI,UAAU;QACV,wBAAwB;IAC5B;AACJ;;AAEA,WAAW,qBAAqB,EAAE;AAClC,WAAW,qBAAqB,EAAE;AAClC,WAAW,qBAAqB,EAAE;AAClC,WAAW,qBAAqB,EAAE,C","sources":["webpack://app/./static/css/pages/core/home.css"],"sourcesContent":["\n/* Hero Section */\n.home-hero {\n padding: 8rem 0 4rem;\n align-self: center;\n margin-left: auto;\n margin-right: auto;\n}\n\n.hero-content {\n max-width: 600px;\n}\n\n.home-hero h2 {\n font-size: 24px;\n line-height: 1.2;\n margin-bottom: 1.5rem;\n color: var(--colour-text); \n margin-left: auto;\n margin-right: auto;\n}\n\n.home-hero a {\n font-size: 1.25rem;\n margin-bottom: 2rem;\n color: var(--colour-text-background);\n cursor: pointer;\n margin-left: auto;\n margin-right: auto;\n}\n\n/* Services Section */\n.services {\n padding: 6rem 0;\n background: white;\n}\n\n.services-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));\n gap: 2rem;\n margin-top: 3rem;\n}\n\n.service-card {\n padding: 2rem;\n background: var(--light);\n border-radius: 8px;\n transition: transform 0.3s ease;\n}\n\n.service-card:hover {\n transform: translateY(-5px);\n}\n\n/* Testimonial Section */\n.testimonial {\n padding: 6rem 0;\n background: var(--light);\n}\n\n.testimonial-card {\n background: white;\n padding: 2rem;\n border-radius: 8px;\n max-width: 800px;\n margin: 3rem auto 0;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n}\n\n/* Pricing Section */\n.pricing {\n padding: 6rem 0;\n background: white;\n}\n\n.pricing-card {\n background: var(--light);\n padding: 2rem;\n border-radius: 8px;\n text-align: center;\n max-width: 400px;\n margin: 3rem auto 0;\n}\n\n.price {\n font-size: 2.5rem;\n color: var(--primary);\n font-weight: bold;\n margin: 1rem 0;\n}\n\n/* CTA Section */\n.cta {\n padding: 6rem 0;\n background: var(--primary);\n color: white;\n text-align: center;\n}\n\n\n/* Animations */\n/* Fallback styles to ensure content is visible without JS */\n.reveal {\n opacity: 1; /* Default visible state */\n}\n\n/* Only hide elements if browser supports Intersection Observer */\n@supports (animation-name: fade) {\n .reveal {\n opacity: 0;\n }\n\n .reveal.active {\n animation: fade-up 0.8s ease-out forwards;\n }\n}\n\n@keyframes fade-up {\n 0% {\n opacity: 0;\n transform: translateY(30px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.delay-1 { animation-delay: 0.1s; }\n.delay-2 { animation-delay: 0.2s; }\n.delay-3 { animation-delay: 0.3s; }\n.delay-4 { animation-delay: 0.4s; }"],"names":[],"sourceRoot":""}
|
||||
{"version":3,"file":"css/core_home.bundle.css","mappings":";AACA,iBAAiB;AACjB;IACI,oBAAoB;IACpB,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,gBAAgB;AACpB;;AAEA;IACI,eAAe;IACf,gBAAgB;IAChB,qBAAqB;IACrB,yBAAyB;IACzB,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;IAClB,mBAAmB;IACnB,4BAA4B;IAC5B,eAAe;IACf,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA,qBAAqB;AACrB;IACI,eAAe;IACf,iBAAiB;AACrB;;AAEA;IACI,aAAa;IACb,2DAA2D;IAC3D,SAAS;IACT,gBAAgB;AACpB;;AAEA;IACI,aAAa;IACb,wBAAwB;IACxB,kBAAkB;IAClB,+BAA+B;AACnC;;AAEA;IACI,2BAA2B;AAC/B;;AAEA,wBAAwB;AACxB;IACI,eAAe;IACf,wBAAwB;AAC5B;;AAEA;IACI,iBAAiB;IACjB,aAAa;IACb,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;IACnB,qCAAqC;AACzC;;AAEA,oBAAoB;AACpB;IACI,eAAe;IACf,iBAAiB;AACrB;;AAEA;IACI,wBAAwB;IACxB,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;IAChB,mBAAmB;AACvB;;AAEA;IACI,iBAAiB;IACjB,qBAAqB;IACrB,iBAAiB;IACjB,cAAc;AAClB;;AAEA,gBAAgB;AAChB;IACI,eAAe;IACf,0BAA0B;IAC1B,YAAY;IACZ,kBAAkB;AACtB;;;AAGA,eAAe;AACf,4DAA4D;AAC5D;IACI,UAAU,EAAE,0BAA0B;AAC1C;;AAEA,iEAAiE;AACjE;IACI;QACI,UAAU;IACd;;IAEA;QACI,yCAAyC;IAC7C;AACJ;;AAEA;IACI;QACI,UAAU;QACV,2BAA2B;IAC/B;IACA;QACI,UAAU;QACV,wBAAwB;IAC5B;AACJ;;AAEA,WAAW,qBAAqB,EAAE;AAClC,WAAW,qBAAqB,EAAE;AAClC,WAAW,qBAAqB,EAAE;AAClC,WAAW,qBAAqB,EAAE,C","sources":["webpack://app/./static/css/pages/core/home.css"],"sourcesContent":["\n/* Hero Section */\n.home-hero {\n padding: 8rem 0 4rem;\n align-self: center;\n margin-left: auto;\n margin-right: auto;\n}\n\n.hero-content {\n max-width: 600px;\n}\n\n.home-hero h2 {\n font-size: 24px;\n line-height: 1.2;\n margin-bottom: 1.5rem;\n color: var(--colour-text); \n margin-left: auto;\n margin-right: auto;\n}\n\n.home-hero a {\n font-size: 1.25rem;\n margin-bottom: 2rem;\n color: var(--colour-primary);\n cursor: pointer;\n margin-left: auto;\n margin-right: auto;\n}\n\n/* Services Section */\n.services {\n padding: 6rem 0;\n background: white;\n}\n\n.services-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));\n gap: 2rem;\n margin-top: 3rem;\n}\n\n.service-card {\n padding: 2rem;\n background: var(--light);\n border-radius: 8px;\n transition: transform 0.3s ease;\n}\n\n.service-card:hover {\n transform: translateY(-5px);\n}\n\n/* Testimonial Section */\n.testimonial {\n padding: 6rem 0;\n background: var(--light);\n}\n\n.testimonial-card {\n background: white;\n padding: 2rem;\n border-radius: 8px;\n max-width: 800px;\n margin: 3rem auto 0;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n}\n\n/* Pricing Section */\n.pricing {\n padding: 6rem 0;\n background: white;\n}\n\n.pricing-card {\n background: var(--light);\n padding: 2rem;\n border-radius: 8px;\n text-align: center;\n max-width: 400px;\n margin: 3rem auto 0;\n}\n\n.price {\n font-size: 2.5rem;\n color: var(--primary);\n font-weight: bold;\n margin: 1rem 0;\n}\n\n/* CTA Section */\n.cta {\n padding: 6rem 0;\n background: var(--primary);\n color: white;\n text-align: center;\n}\n\n\n/* Animations */\n/* Fallback styles to ensure content is visible without JS */\n.reveal {\n opacity: 1; /* Default visible state */\n}\n\n/* Only hide elements if browser supports Intersection Observer */\n@supports (animation-name: fade) {\n .reveal {\n opacity: 0;\n }\n\n .reveal.active {\n animation: fade-up 0.8s ease-out forwards;\n }\n}\n\n@keyframes fade-up {\n 0% {\n opacity: 0;\n transform: translateY(30px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.delay-1 { animation-delay: 0.1s; }\n.delay-2 { animation-delay: 0.2s; }\n.delay-3 { animation-delay: 0.3s; }\n.delay-4 { animation-delay: 0.4s; }"],"names":[],"sourceRoot":""}
|
||||
23
static/dist/css/main.bundle.css
vendored
23
static/dist/css/main.bundle.css
vendored
@@ -196,8 +196,9 @@ img.header-logo {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.container-input > input, .container-input > textarea {
|
||||
border: 2px solid var(--colour-primary);
|
||||
.container-input > input,
|
||||
.container-input > textarea {
|
||||
border: 2px solid var(--colour-accent);
|
||||
padding: 1vh;
|
||||
}
|
||||
|
||||
@@ -289,6 +290,10 @@ input.dirty, textarea.dirty, select.dirty {
|
||||
|
||||
|
||||
|
||||
select {
|
||||
border: 1px solid var(--colour-accent);
|
||||
}
|
||||
|
||||
img, video {
|
||||
border-radius: 3vh;
|
||||
}
|
||||
@@ -645,6 +650,7 @@ header {
|
||||
#formFilters .container-input input {
|
||||
width: 10vh;
|
||||
max-width: 10vh;
|
||||
height: 20px;
|
||||
}
|
||||
/*
|
||||
#formFilters .container-input input {
|
||||
@@ -662,15 +668,16 @@ header {
|
||||
display: none;
|
||||
}
|
||||
#formFilters .container-input.filter.active_only svg.active_only {
|
||||
height: 2vh;
|
||||
height: 25px;
|
||||
fill: var(--colour-text-background);
|
||||
background-color: var(--colour-primary);
|
||||
border: 1px solid var(--colour-primary);
|
||||
width: 2vh;
|
||||
border-radius: 0.5vh;
|
||||
background-color: var(--colour-accent);
|
||||
/* border: 1px solid var(--colour-accent);
|
||||
border-radius: 0.5vh; */
|
||||
width: 25px;
|
||||
}
|
||||
#formFilters .container-input.filter.active_only svg.active_only.is_checked {
|
||||
fill: var(--colour-accent);
|
||||
background-color: var(--colour-text-background);
|
||||
}
|
||||
#formFilters .container-input.filter.is_not_empty {
|
||||
width: 12vh;
|
||||
@@ -792,7 +799,7 @@ form.filter button.save, form.filter button.button-cancel {
|
||||
align-self: center;
|
||||
position: relative;
|
||||
display: block;
|
||||
width: min(calc(90vh), calc(70vw));
|
||||
width: 100%; /* min(calc(90vh), calc(70vw)); */
|
||||
}
|
||||
|
||||
#tableMain select,
|
||||
|
||||
2
static/dist/css/main.bundle.css.map
vendored
2
static/dist/css/main.bundle.css.map
vendored
File diff suppressed because one or more lines are too long
196
static/dist/js/main.bundle.js
vendored
196
static/dist/js/main.bundle.js
vendored
@@ -1339,7 +1339,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
} else {
|
||||
var dataPage = this.getLocalStoragePage();
|
||||
var filters = dataPage[flagFormFilters];
|
||||
var formFilters = this.getFormFilters();
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var filtersDefault = DOM.convertForm2JSON(formFilters);
|
||||
if (!Validation.areEqualDicts(filters, filtersDefault)) {
|
||||
this.callFilterTableContent();
|
||||
@@ -1362,6 +1362,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupFilterActive",
|
||||
value: function hookupFilterActive() {
|
||||
var _this3 = this;
|
||||
var filterSelector = idFormFilters + ' #' + flagActiveOnly;
|
||||
var filterActiveOld = document.querySelector(filterSelector);
|
||||
filterActiveOld.removeAttribute('id');
|
||||
@@ -1382,7 +1383,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
} else {
|
||||
svgElement.classList.add(flagIsChecked);
|
||||
}
|
||||
return TableBasePage.isDirtyFilter(svgElement);
|
||||
return _this3.handleChangeFilter(event, filterActive);
|
||||
});
|
||||
var filter = document.querySelector(filterSelector);
|
||||
var filterValuePrevious = DOM.getElementValueCurrent(filter);
|
||||
@@ -1392,8 +1393,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupFilter",
|
||||
value: function hookupFilter(filterFlag) {
|
||||
var _this4 = this;
|
||||
var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, filter) {
|
||||
return TableBasePage.isDirtyFilter(filter);
|
||||
return _this4.handleChangeFilter(event, filter);
|
||||
};
|
||||
var filterSelector = idFormFilters + ' #' + filterFlag;
|
||||
this.hookupEventHandler("change", filterSelector, handler);
|
||||
@@ -1402,6 +1404,44 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
filter.setAttribute(attrValueCurrent, filterValuePrevious);
|
||||
filter.setAttribute(attrValuePrevious, filterValuePrevious);
|
||||
}
|
||||
}, {
|
||||
key: "handleChangeFilter",
|
||||
value: function handleChangeFilter(event, filter) {
|
||||
var isDirtyFilter = DOM.updateAndCheckIsElementDirty(filter);
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var areDirtyFilters = isDirtyFilter || DOM.hasDirtyChildrenContainer(formFilters);
|
||||
var tbody = document.querySelector(idTableMain + ' tbody');
|
||||
var rows = tbody.querySelectorAll(':scope > tr');
|
||||
rows.forEach(function (row) {
|
||||
if (areDirtyFilters && !row.classList.contains(flagIsCollapsed)) row.classList.add(flagIsCollapsed);
|
||||
if (!areDirtyFilters && row.classList.contains(flagIsCollapsed)) {
|
||||
row.classList.remove(flagIsCollapsed);
|
||||
var dirtyInputs = row.querySelectorAll('input.' + flagDirty);
|
||||
dirtyInputs.forEach(function (dirtyInput) {
|
||||
dirtyInput.value = DOM.getElementAttributeValueCurrent(dirtyInput);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (areDirtyFilters) {
|
||||
/*
|
||||
tbody.querySelectorAll('tr').forEach((tr) => {
|
||||
if (!DOM.hasDirtyChildrenContainer(tr)) tr.remove();
|
||||
});
|
||||
*/
|
||||
tbody.innerHTML = '<div>Press "Apply Filters" to refresh the table.</div>' + tbody.innerHTML;
|
||||
if (!tbody.classList.contains(flagIsCollapsed)) tbody.classList.add(flagIsCollapsed);
|
||||
} else {
|
||||
var isDirtyLabel = tbody.querySelector(":scope > div");
|
||||
if (isDirtyLabel != null) isDirtyLabel.remove();
|
||||
if (tbody.classList.contains(flagIsCollapsed)) tbody.classList.remove(flagIsCollapsed);
|
||||
var initialisedElements = tbody.querySelectorAll('.' + flagInitialised);
|
||||
initialisedElements.forEach(function (initialisedElement) {
|
||||
initialisedElement.classList.remove(flagInitialised);
|
||||
});
|
||||
this.hookupTableMain();
|
||||
}
|
||||
this.updateAndToggleShowButtonsSaveCancel();
|
||||
}
|
||||
}, {
|
||||
key: "hookupFilterIsNotEmpty",
|
||||
value: function hookupFilterIsNotEmpty() {
|
||||
@@ -1410,10 +1450,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupButtonApplyFilters",
|
||||
value: function hookupButtonApplyFilters() {
|
||||
var _this3 = this;
|
||||
var _this5 = this;
|
||||
this.hookupEventHandler("click", idButtonApplyFilters, function (event, button) {
|
||||
event.stopPropagation();
|
||||
_this3.callFilterTableContent();
|
||||
_this5.callFilterTableContent();
|
||||
});
|
||||
}
|
||||
}, {
|
||||
@@ -1429,8 +1469,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupFilterCommandCategory",
|
||||
value: function hookupFilterCommandCategory() {
|
||||
var _this6 = this;
|
||||
this.hookupFilter(attrIdCommandCategory, function (event, filterCommandCategory) {
|
||||
TableBasePage.isDirtyFilter(filterCommandCategory);
|
||||
_this6.handleChangeFilter();
|
||||
var isDirtyFilter = filterCommandCategory.classList.contains(flagDirty);
|
||||
var idCommandCategory = DOM.getElementValueCurrent(filterCommandCategory);
|
||||
console.log("filter commands unsorted");
|
||||
@@ -1467,15 +1508,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
*/
|
||||
}, {
|
||||
key: "getFormFilters",
|
||||
value: function getFormFilters() {
|
||||
return document.querySelector(idFormFilters);
|
||||
}
|
||||
}, {
|
||||
key: "callFilterTableContent",
|
||||
value: function callFilterTableContent() {
|
||||
var formFilters = this.getFormFilters();
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var filtersJson = DOM.convertForm2JSON(formFilters);
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment("callFilterTableContent");
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment("formFilters");
|
||||
@@ -1512,10 +1548,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "getAndLoadFilteredTableContentSinglePageApp",
|
||||
value: function getAndLoadFilteredTableContentSinglePageApp() {
|
||||
var _this4 = this;
|
||||
var _this7 = this;
|
||||
this.callFilterTableContent().then(function (data) {
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment('Table data received:', data);
|
||||
_this4.callbackLoadTableContent(data);
|
||||
_this7.callbackLoadTableContent(data);
|
||||
})["catch"](function (error) {
|
||||
return console.error('Error:', error);
|
||||
});
|
||||
@@ -1530,13 +1566,13 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "saveRecordsTableDirty",
|
||||
value: function saveRecordsTableDirty() {
|
||||
var _this5 = this;
|
||||
var _this8 = this;
|
||||
var records = this.getTableRecords(true);
|
||||
if (records.length == 0) {
|
||||
OverlayError.show('No records to save');
|
||||
return;
|
||||
}
|
||||
var formElement = this.getFormFilters();
|
||||
var formElement = TableBasePage.getFormFilters();
|
||||
var comment = DOM.getElementValueCurrent(document.querySelector(idTextareaConfirm));
|
||||
/*
|
||||
Utils.consoleLogIfNotProductionEnvironment({ formElement, comment, records });
|
||||
@@ -1550,7 +1586,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment('Records saved!');
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment('Data received:', data);
|
||||
}
|
||||
_this5.callFilterTableContent();
|
||||
_this8.callFilterTableContent();
|
||||
} else {
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment("error: ", data[flagMessage]);
|
||||
OverlayError.show(data[flagMessage]);
|
||||
@@ -1562,13 +1598,13 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "getTableRecords",
|
||||
value: function getTableRecords() {
|
||||
var _this6 = this;
|
||||
var _this9 = this;
|
||||
var dirtyOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||||
var records = [];
|
||||
var record;
|
||||
document.querySelectorAll(idTableMain + ' > tbody > tr').forEach(function (row) {
|
||||
if (dirtyOnly && !DOM.hasDirtyChildrenContainer(row)) return;
|
||||
record = _this6.getJsonRow(row);
|
||||
record = _this9.getJsonRow(row);
|
||||
records.push(record);
|
||||
});
|
||||
return records;
|
||||
@@ -1581,13 +1617,13 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "saveRecordsTableDirtySinglePageApp",
|
||||
value: function saveRecordsTableDirtySinglePageApp() {
|
||||
var _this7 = this;
|
||||
var _this10 = this;
|
||||
var records = this.getTableRecords(true);
|
||||
if (records.length == 0) {
|
||||
OverlayError.show('No records to save');
|
||||
return;
|
||||
}
|
||||
var formElement = this.getFormFilters();
|
||||
var formElement = TableBasePage.getFormFilters();
|
||||
var comment = DOM.getElementValueCurrent(document.querySelector(idTextareaConfirm));
|
||||
this.callSaveTableContent(records, formElement, comment).then(function (data) {
|
||||
if (data[flagStatus] == flagSuccess) {
|
||||
@@ -1595,7 +1631,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment('Records saved!');
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment('Data received:', data);
|
||||
}
|
||||
_this7.callbackLoadTableContent(data);
|
||||
_this10.callbackLoadTableContent(data);
|
||||
} else {
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment("error: ", data[flagMessage]);
|
||||
OverlayError.show(data[flagMessage]);
|
||||
@@ -1607,13 +1643,13 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupButtonCancel",
|
||||
value: function hookupButtonCancel() {
|
||||
var _this8 = this;
|
||||
var _this11 = this;
|
||||
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function (button) {
|
||||
button.addEventListener("click", function (event) {
|
||||
event.stopPropagation();
|
||||
button = event.target;
|
||||
if (button.classList.contains(flagIsCollapsed)) return;
|
||||
_this8.callFilterTableContent();
|
||||
_this11.callFilterTableContent();
|
||||
});
|
||||
button.classList.add(flagIsCollapsed);
|
||||
});
|
||||
@@ -1649,14 +1685,14 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupTableMain",
|
||||
value: function hookupTableMain() {
|
||||
var _this9 = this;
|
||||
var _this12 = this;
|
||||
if (this.constructor === TableBasePage) {
|
||||
throw new Error("Must implement hookupTableMain() method.");
|
||||
}
|
||||
if (true) {
|
||||
// _rowBlank == null) {
|
||||
Events.initialiseEventHandler(idTableMain, flagInitialised, function (table) {
|
||||
_this9.cacheRowBlank();
|
||||
_this12.cacheRowBlank();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1702,9 +1738,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupChangeHandlerTableCells",
|
||||
value: function hookupChangeHandlerTableCells(inputSelector) {
|
||||
var _this10 = this;
|
||||
var _this13 = this;
|
||||
var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
|
||||
_this10.handleChangeNestedElementCellTable(event, element);
|
||||
_this13.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
Events.initialiseEventHandler(inputSelector, flagInitialised, function (input) {
|
||||
input.addEventListener("change", function (event) {
|
||||
@@ -1836,9 +1872,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupChangeHandlerTableCellsWhenNotCollapsed",
|
||||
value: function hookupChangeHandlerTableCellsWhenNotCollapsed(inputSelector) {
|
||||
var _this11 = this;
|
||||
var _this14 = this;
|
||||
var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
|
||||
if (!element.classList.contains(flagIsCollapsed)) _this11.handleChangeNestedElementCellTable(event, element);
|
||||
if (!element.classList.contains(flagIsCollapsed)) _this14.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
this.hookupEventHandler("change", inputSelector, handler);
|
||||
}
|
||||
@@ -1865,10 +1901,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupFieldsActive",
|
||||
value: function hookupFieldsActive() {
|
||||
var _this12 = this;
|
||||
var _this15 = this;
|
||||
var flagTable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
var handleClickRowNew = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
|
||||
_this12.handleClickAddRowTable(event, element);
|
||||
_this15.handleClickAddRowTable(event, element);
|
||||
};
|
||||
var selectorButton = 'table' + (Validation.isEmpty(flagTable) ? '' : '.' + flagTable) + ' > tbody > tr > td.' + flagActive + ' .' + flagButton + '.' + flagActive;
|
||||
var selectorButtonDelete = selectorButton + '.' + flagDelete;
|
||||
@@ -1883,12 +1919,12 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupButtonsRowDelete",
|
||||
value: function hookupButtonsRowDelete(selectorButtonDelete, selectorButtonUndelete) {
|
||||
var _this13 = this;
|
||||
var _this16 = this;
|
||||
var changeHandler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (event, element) {
|
||||
_this13.handleChangeNestedElementCellTable(event, element);
|
||||
_this16.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
this.hookupEventHandler("click", selectorButtonDelete, function (event, element) {
|
||||
_this13.handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete, function (changeEvent, changeElement) {
|
||||
_this16.handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete, function (changeEvent, changeElement) {
|
||||
changeHandler(changeEvent, changeElement);
|
||||
});
|
||||
});
|
||||
@@ -1896,9 +1932,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "handleClickButtonRowDelete",
|
||||
value: function handleClickButtonRowDelete(event, element, selectorButtonDelete, selectorButtonUndelete) {
|
||||
var _this14 = this;
|
||||
var _this17 = this;
|
||||
var changeHandler = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (event, element) {
|
||||
_this14.handleChangeNestedElementCellTable(event, element);
|
||||
_this17.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
if (element.tagName.toUpperCase() != 'SVG') element = element.parentElement;
|
||||
var valuePrevious = DOM.getElementAttributeValuePrevious(element);
|
||||
@@ -1923,12 +1959,12 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupButtonsRowUndelete",
|
||||
value: function hookupButtonsRowUndelete(selectorButtonDelete, selectorButtonUndelete) {
|
||||
var _this15 = this;
|
||||
var _this18 = this;
|
||||
var changeHandler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (event, element) {
|
||||
_this15.handleChangeNestedElementCellTable(event, element);
|
||||
_this18.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
this.hookupEventHandler("click", selectorButtonUndelete, function (event, element) {
|
||||
_this15.handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete, function (changeEvent, changeElement) {
|
||||
_this18.handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete, function (changeEvent, changeElement) {
|
||||
changeHandler(changeEvent, changeElement);
|
||||
});
|
||||
});
|
||||
@@ -1936,9 +1972,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "handleClickButtonRowUndelete",
|
||||
value: function handleClickButtonRowUndelete(event, element, selectorButtonDelete, selectorButtonUndelete) {
|
||||
var _this16 = this;
|
||||
var _this19 = this;
|
||||
var changeHandler = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (event, element) {
|
||||
_this16.handleChangeNestedElementCellTable(event, element);
|
||||
_this19.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
if (element.tagName.toUpperCase() != 'SVG') element = element.parentElement;
|
||||
var valuePrevious = DOM.getElementAttributeValuePrevious(element);
|
||||
@@ -1963,17 +1999,17 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupTableCellDdlPreviews",
|
||||
value: function hookupTableCellDdlPreviews(fieldFlag, optionList) {
|
||||
var _this17 = this;
|
||||
var _this20 = this;
|
||||
var cellSelector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
||||
var ddlHookup = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (ddlSelector) {
|
||||
_this17.hookupTableCellDdls(ddlSelector);
|
||||
_this20.hookupTableCellDdls(ddlSelector);
|
||||
};
|
||||
var changeHandler = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (event, element) {
|
||||
_this17.handleChangeNestedElementCellTable(event, element);
|
||||
_this20.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
if (cellSelector == null) cellSelector = idTableMain + ' > tbody > tr > td.' + fieldFlag;
|
||||
this.hookupEventHandler("click", cellSelector + ' div.' + fieldFlag, function (event, div) {
|
||||
_this17.handleClickTableCellDdlPreview(event, div, fieldFlag, optionList, cellSelector, function (ddlSelector) {
|
||||
_this20.handleClickTableCellDdlPreview(event, div, fieldFlag, optionList, cellSelector, function (ddlSelector) {
|
||||
ddlHookup(ddlSelector, function (event, element) {
|
||||
changeHandler(event, element);
|
||||
});
|
||||
@@ -1984,9 +2020,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupTableCellDdls",
|
||||
value: function hookupTableCellDdls(ddlSelector) {
|
||||
var _this18 = this;
|
||||
var _this21 = this;
|
||||
var changeHandler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (event, element) {
|
||||
_this18.handleChangeNestedElementCellTable(event, element);
|
||||
_this21.handleChangeNestedElementCellTable(event, element);
|
||||
};
|
||||
this.hookupEventHandler("change", ddlSelector, function (event, element) {
|
||||
changeHandler(event, element);
|
||||
@@ -1995,10 +2031,10 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "handleClickTableCellDdlPreview",
|
||||
value: function handleClickTableCellDdlPreview(event, div, fieldFlag, optionObjectList) {
|
||||
var _this19 = this;
|
||||
var _this22 = this;
|
||||
var cellSelector = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
||||
var ddlHookup = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : function (cellSelector) {
|
||||
_this19.hookupTableCellDdls(cellSelector);
|
||||
_this22.hookupTableCellDdls(cellSelector);
|
||||
};
|
||||
if (Validation.isEmpty(cellSelector)) cellSelector = idTableMain + ' > tbody > tr > td.' + fieldFlag;
|
||||
var idSelected = DOM.getElementAttributeValueCurrent(div);
|
||||
@@ -2046,19 +2082,19 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupFieldsCommandCategory",
|
||||
value: function hookupFieldsCommandCategory() {
|
||||
var _this20 = this;
|
||||
var _this23 = this;
|
||||
this.hookupTableCellDdlPreviews(flagCommandCategory, utils_Utils.getListFromDict(filterCommandCategories).sort(function (a, b) {
|
||||
return a[flagName].localeCompare(b[flagName]);
|
||||
}), null, function (cellSelector) {
|
||||
_this20.hookupCommandCategoryDdls(cellSelector);
|
||||
_this23.hookupCommandCategoryDdls(cellSelector);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "hookupCommandCategoryDdls",
|
||||
value: function hookupCommandCategoryDdls(ddlSelector) {
|
||||
var _this21 = this;
|
||||
var _this24 = this;
|
||||
this.hookupChangeHandlerTableCells(ddlSelector, function (event, element) {
|
||||
_this21.handleChangeCommandCategoryDdl(event, element);
|
||||
_this24.handleChangeCommandCategoryDdl(event, element);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
@@ -2092,7 +2128,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "hookupFieldsCommand",
|
||||
value: function hookupFieldsCommand() {
|
||||
var _this22 = this;
|
||||
var _this25 = this;
|
||||
this.hookupEventHandler("click", idTableMain + ' td.' + flagCommand + ' .' + flagCommand, function (event, div) {
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment(div);
|
||||
var parentTr = DOM.getRowFromElement(div);
|
||||
@@ -2101,8 +2137,8 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
parentTr: parentTr
|
||||
});
|
||||
var tdCommandCategory = parentTr.querySelector('td.' + flagCommandCategory);
|
||||
var idCommandCategoryRow = _this22.getIdCommandCategoryRow(parentTr); // DOM.getElementAttributeValueCurrent(tdCommandCategory);
|
||||
var idCommandCategoryFilter = _this22.getIdCommandCategoryFilter();
|
||||
var idCommandCategoryRow = _this25.getIdCommandCategoryRow(parentTr); // DOM.getElementAttributeValueCurrent(tdCommandCategory);
|
||||
var idCommandCategoryFilter = _this25.getIdCommandCategoryFilter();
|
||||
var filterCommandList = utils_Utils.getListFromDict(filterCommands);
|
||||
var commandsInCategory = filterCommandList.filter(function (command) {
|
||||
return (command[attrIdCommandCategory] == idCommandCategoryRow || idCommandCategoryRow == 0) && (command[attrIdCommandCategory] == idCommandCategoryFilter || idCommandCategoryFilter == 0);
|
||||
@@ -2118,9 +2154,9 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
commandsInCategory: commandsInCategory
|
||||
});
|
||||
utils_Utils.consoleLogIfNotProductionEnvironment(filterCommandList);
|
||||
_this22.handleClickTableCellDdlPreview(event, div, flagCommand, sortedCommands, null, function (cellSelector) {
|
||||
_this22.hookupTableCellDdls(cellSelector, function (event, element) {
|
||||
_this22.handleChangeNestedElementCellTable(event, element);
|
||||
_this25.handleClickTableCellDdlPreview(event, div, flagCommand, sortedCommands, null, function (cellSelector) {
|
||||
_this25.hookupTableCellDdls(cellSelector, function (event, element) {
|
||||
_this25.handleChangeNestedElementCellTable(event, element);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -2135,7 +2171,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "getIdCommandCategoryFilter",
|
||||
value: function getIdCommandCategoryFilter() {
|
||||
var formFilters = this.getFormFilters();
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var commandCategoryFilter = formFilters.querySelector('#' + attrIdCommandCategory);
|
||||
var commandFilter = formFilters.querySelector('#' + attrIdCommand);
|
||||
var idCommandCategory = 0;
|
||||
@@ -2172,7 +2208,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
}, {
|
||||
key: "getIdCommandFilter",
|
||||
value: function getIdCommandFilter() {
|
||||
var formFilters = this.getFormFilters();
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var commandFilter = formFilters.querySelector('#' + attrIdCommand);
|
||||
var valueCurrentCommandFilter = DOM.getElementAttributeValueCurrent(commandFilter);
|
||||
var idCommand = Number(valueCurrentCommandFilter);
|
||||
@@ -2215,7 +2251,7 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
throw new Error("Must implement leave() method.");
|
||||
}
|
||||
base_table_superPropGet(TableBasePage, "leave", this, 3)([]);
|
||||
var formFilters = this.getFormFilters();
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var dataPage = {};
|
||||
dataPage[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
this.setLocalStoragePage(dataPage);
|
||||
@@ -2240,35 +2276,15 @@ var TableBasePage = /*#__PURE__*/function (_BasePage) {
|
||||
key: "updateAndToggleShowButtonsSaveCancel",
|
||||
value: function updateAndToggleShowButtonsSaveCancel() {
|
||||
var records = this.getTableRecords(true);
|
||||
var existsDirtyRecord = records.length > 0;
|
||||
this.toggleShowButtonsSaveCancel(existsDirtyRecord);
|
||||
var isDirtyMainTable = records.length > 0;
|
||||
var formFilters = TableBasePage.getFormFilters();
|
||||
var areDirtyFilters = DOM.hasDirtyChildrenContainer(formFilters);
|
||||
this.toggleShowButtonsSaveCancel(isDirtyMainTable && !areDirtyFilters);
|
||||
}
|
||||
}], [{
|
||||
key: "isDirtyFilter",
|
||||
value: function isDirtyFilter(filter) {
|
||||
var isDirty = DOM.updateAndCheckIsElementDirty(filter);
|
||||
var tbody = document.querySelector(idTableMain + ' tbody');
|
||||
var rows = tbody.querySelectorAll(':scope > tr');
|
||||
var cancelButton = document.querySelector(idFormFilters + ' ' + idButtonCancel);
|
||||
var saveButton = document.querySelector(idFormFilters + ' ' + idButtonSave);
|
||||
rows.forEach(function (row) {
|
||||
if (isDirty && !row.classList.contains(flagIsCollapsed)) row.classList.add(flagIsCollapsed);
|
||||
if (!isDirty && row.classList.contains(flagIsCollapsed)) row.classList.remove(flagIsCollapsed);
|
||||
});
|
||||
if (isDirty) {
|
||||
// tbody.querySelectorAll('tr').forEach((tr) => { tr.remove(); });
|
||||
tbody.innerHTML = '<div>Press "Apply Filters" to refresh the table.</div>' + tbody.innerHTML;
|
||||
if (!tbody.classList.contains(flagIsCollapsed)) tbody.classList.add(flagIsCollapsed);
|
||||
if (!cancelButton.classList.contains(flagIsCollapsed)) cancelButton.classList.add(flagIsCollapsed);
|
||||
if (!saveButton.classList.contains(flagIsCollapsed)) saveButton.classList.add(flagIsCollapsed);
|
||||
} else {
|
||||
if (tbody.classList.contains(flagIsCollapsed)) tbody.classList.remove(flagIsCollapsed);
|
||||
if (cancelButton.classList.contains(flagIsCollapsed)) cancelButton.classList.remove(flagIsCollapsed);
|
||||
if (saveButton.classList.contains(flagIsCollapsed)) saveButton.classList.remove(flagIsCollapsed);
|
||||
var isDirtyLabel = tbody.querySelector(":scope > div");
|
||||
if (isDirtyLabel != null) isDirtyLabel.remove();
|
||||
}
|
||||
return isDirty;
|
||||
key: "getFormFilters",
|
||||
value: function getFormFilters() {
|
||||
return document.querySelector(idFormFilters);
|
||||
}
|
||||
}, {
|
||||
key: "getTableMain",
|
||||
|
||||
2
static/dist/js/main.bundle.js.map
vendored
2
static/dist/js/main.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -98,4 +98,13 @@ export default class API {
|
||||
return await API.request(hashSaveDogDogCommandLink, 'POST', dataRequest);
|
||||
}
|
||||
|
||||
// Locations
|
||||
static async saveLocations(locations, formFilters, comment) {
|
||||
let dataRequest = {};
|
||||
dataRequest[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
dataRequest[flagLocation] = locations;
|
||||
dataRequest[flagComment] = comment;
|
||||
return await API.request(hashSaveDogLocation, 'POST', dataRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default class TableBasePage extends BasePage {
|
||||
} else {
|
||||
let dataPage = this.getLocalStoragePage();
|
||||
let filters = dataPage[flagFormFilters];
|
||||
let formFilters = this.getFormFilters();
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let filtersDefault = DOM.convertForm2JSON(formFilters);
|
||||
if (!Validation.areEqualDicts(filters, filtersDefault)) {
|
||||
this.callFilterTableContent();
|
||||
@@ -84,14 +84,14 @@ export default class TableBasePage extends BasePage {
|
||||
else {
|
||||
svgElement.classList.add(flagIsChecked);
|
||||
}
|
||||
return TableBasePage.isDirtyFilter(svgElement);
|
||||
return this.handleChangeFilter(event, filterActive);
|
||||
});
|
||||
let filter = document.querySelector(filterSelector);
|
||||
let filterValuePrevious = DOM.getElementValueCurrent(filter);
|
||||
filter.setAttribute(attrValueCurrent, filterValuePrevious);
|
||||
filter.setAttribute(attrValuePrevious, filterValuePrevious);
|
||||
}
|
||||
hookupFilter(filterFlag, handler = (event, filter) => { return TableBasePage.isDirtyFilter(filter); }) {
|
||||
hookupFilter(filterFlag, handler = (event, filter) => { return this.handleChangeFilter(event, filter); }) {
|
||||
let filterSelector = idFormFilters + ' #' + filterFlag;
|
||||
this.hookupEventHandler("change", filterSelector, handler);
|
||||
let filter = document.querySelector(filterSelector);
|
||||
@@ -99,31 +99,42 @@ export default class TableBasePage extends BasePage {
|
||||
filter.setAttribute(attrValueCurrent, filterValuePrevious);
|
||||
filter.setAttribute(attrValuePrevious, filterValuePrevious);
|
||||
}
|
||||
static isDirtyFilter(filter) {
|
||||
let isDirty = DOM.updateAndCheckIsElementDirty(filter);
|
||||
handleChangeFilter(event, filter) {
|
||||
let isDirtyFilter = DOM.updateAndCheckIsElementDirty(filter);
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let areDirtyFilters = isDirtyFilter || DOM.hasDirtyChildrenContainer(formFilters);
|
||||
let tbody = document.querySelector(idTableMain + ' tbody');
|
||||
let rows = tbody.querySelectorAll(':scope > tr');
|
||||
let cancelButton = document.querySelector(idFormFilters + ' ' + idButtonCancel);
|
||||
let saveButton = document.querySelector(idFormFilters + ' ' + idButtonSave);
|
||||
rows.forEach((row) => {
|
||||
if (isDirty && !row.classList.contains(flagIsCollapsed)) row.classList.add(flagIsCollapsed);
|
||||
if (!isDirty && row.classList.contains(flagIsCollapsed)) row.classList.remove(flagIsCollapsed);
|
||||
if (areDirtyFilters && !row.classList.contains(flagIsCollapsed)) row.classList.add(flagIsCollapsed);
|
||||
if (!areDirtyFilters && row.classList.contains(flagIsCollapsed)) {
|
||||
row.classList.remove(flagIsCollapsed);
|
||||
let dirtyInputs = row.querySelectorAll('input.' + flagDirty);
|
||||
dirtyInputs.forEach((dirtyInput) => {
|
||||
dirtyInput.value = DOM.getElementAttributeValueCurrent(dirtyInput);
|
||||
});
|
||||
}
|
||||
});
|
||||
if (isDirty) {
|
||||
// tbody.querySelectorAll('tr').forEach((tr) => { tr.remove(); });
|
||||
if (areDirtyFilters) {
|
||||
/*
|
||||
tbody.querySelectorAll('tr').forEach((tr) => {
|
||||
if (!DOM.hasDirtyChildrenContainer(tr)) tr.remove();
|
||||
});
|
||||
*/
|
||||
tbody.innerHTML = '<div>Press "Apply Filters" to refresh the table.</div>' + tbody.innerHTML;
|
||||
if (!tbody.classList.contains(flagIsCollapsed)) tbody.classList.add(flagIsCollapsed);
|
||||
if (!cancelButton.classList.contains(flagIsCollapsed)) cancelButton.classList.add(flagIsCollapsed);
|
||||
if (!saveButton.classList.contains(flagIsCollapsed)) saveButton.classList.add(flagIsCollapsed);
|
||||
}
|
||||
else {
|
||||
if (tbody.classList.contains(flagIsCollapsed)) tbody.classList.remove(flagIsCollapsed);
|
||||
if (cancelButton.classList.contains(flagIsCollapsed)) cancelButton.classList.remove(flagIsCollapsed);
|
||||
if (saveButton.classList.contains(flagIsCollapsed)) saveButton.classList.remove(flagIsCollapsed);
|
||||
let isDirtyLabel = tbody.querySelector(":scope > div");
|
||||
if (isDirtyLabel != null) isDirtyLabel.remove();
|
||||
if (tbody.classList.contains(flagIsCollapsed)) tbody.classList.remove(flagIsCollapsed);
|
||||
let initialisedElements = tbody.querySelectorAll('.' + flagInitialised);
|
||||
initialisedElements.forEach((initialisedElement) => {
|
||||
initialisedElement.classList.remove(flagInitialised);
|
||||
});
|
||||
this.hookupTableMain();
|
||||
}
|
||||
return isDirty;
|
||||
this.updateAndToggleShowButtonsSaveCancel();
|
||||
}
|
||||
hookupFilterIsNotEmpty() {
|
||||
this.hookupFilter(flagIsNotEmpty);
|
||||
@@ -142,7 +153,7 @@ export default class TableBasePage extends BasePage {
|
||||
}
|
||||
hookupFilterCommandCategory() {
|
||||
this.hookupFilter(attrIdCommandCategory, (event, filterCommandCategory) => {
|
||||
TableBasePage.isDirtyFilter(filterCommandCategory);
|
||||
this.handleChangeFilter();
|
||||
let isDirtyFilter = filterCommandCategory.classList.contains(flagDirty);
|
||||
let idCommandCategory = DOM.getElementValueCurrent(filterCommandCategory);
|
||||
console.log("filter commands unsorted");
|
||||
@@ -173,11 +184,11 @@ export default class TableBasePage extends BasePage {
|
||||
.catch(error => console.error('Error:', error));
|
||||
}
|
||||
*/
|
||||
getFormFilters() {
|
||||
static getFormFilters() {
|
||||
return document.querySelector(idFormFilters);
|
||||
}
|
||||
callFilterTableContent() {
|
||||
let formFilters = this.getFormFilters();
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let filtersJson = DOM.convertForm2JSON(formFilters);
|
||||
Utils.consoleLogIfNotProductionEnvironment("callFilterTableContent");
|
||||
Utils.consoleLogIfNotProductionEnvironment("formFilters");
|
||||
@@ -223,7 +234,7 @@ export default class TableBasePage extends BasePage {
|
||||
OverlayError.show('No records to save');
|
||||
return;
|
||||
}
|
||||
let formElement = this.getFormFilters();
|
||||
let formElement = TableBasePage.getFormFilters();
|
||||
let comment = DOM.getElementValueCurrent(document.querySelector(idTextareaConfirm));
|
||||
/*
|
||||
Utils.consoleLogIfNotProductionEnvironment({ formElement, comment, records });
|
||||
@@ -266,7 +277,7 @@ export default class TableBasePage extends BasePage {
|
||||
OverlayError.show('No records to save');
|
||||
return;
|
||||
}
|
||||
let formElement = this.getFormFilters();
|
||||
let formElement = TableBasePage.getFormFilters();
|
||||
let comment = DOM.getElementValueCurrent(document.querySelector(idTextareaConfirm));
|
||||
this.callSaveTableContent(records, formElement, comment)
|
||||
.then(data => {
|
||||
@@ -703,7 +714,7 @@ export default class TableBasePage extends BasePage {
|
||||
return DOM.getElementAttributeValueCurrent(elementCommandCategory);
|
||||
}
|
||||
getIdCommandCategoryFilter() {
|
||||
let formFilters = this.getFormFilters();
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let commandCategoryFilter = formFilters.querySelector('#' + attrIdCommandCategory);
|
||||
let commandFilter = formFilters.querySelector('#' + attrIdCommand);
|
||||
let idCommandCategory = 0;
|
||||
@@ -730,7 +741,7 @@ export default class TableBasePage extends BasePage {
|
||||
return DOM.getElementAttributeValueCurrent(elementCommand);
|
||||
}
|
||||
getIdCommandFilter() {
|
||||
let formFilters = this.getFormFilters();
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let commandFilter = formFilters.querySelector('#' + attrIdCommand);
|
||||
let valueCurrentCommandFilter = DOM.getElementAttributeValueCurrent(commandFilter);
|
||||
let idCommand = Number(valueCurrentCommandFilter);
|
||||
@@ -765,7 +776,7 @@ export default class TableBasePage extends BasePage {
|
||||
throw new Error("Must implement leave() method.");
|
||||
}
|
||||
super.leave();
|
||||
let formFilters = this.getFormFilters();
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let dataPage = {};
|
||||
dataPage[flagFormFilters] = DOM.convertForm2JSON(formFilters);
|
||||
this.setLocalStoragePage(dataPage);
|
||||
@@ -786,7 +797,11 @@ export default class TableBasePage extends BasePage {
|
||||
|
||||
updateAndToggleShowButtonsSaveCancel() {
|
||||
let records = this.getTableRecords(true);
|
||||
let existsDirtyRecord = records.length > 0;
|
||||
this.toggleShowButtonsSaveCancel(existsDirtyRecord);
|
||||
let isDirtyMainTable = records.length > 0;
|
||||
|
||||
let formFilters = TableBasePage.getFormFilters();
|
||||
let areDirtyFilters = DOM.hasDirtyChildrenContainer(formFilters);
|
||||
|
||||
this.toggleShowButtonsSaveCancel(isDirtyMainTable && !areDirtyFilters);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,8 @@ export default class PageDogCommandCategories extends TableBasePage {
|
||||
let inputName = row.querySelector('td.' + flagName + ' .' + flagName);
|
||||
let buttonActive = row.querySelector('td.' + flagActive + ' .' + flagActive);
|
||||
|
||||
/*
|
||||
console.log("inputName");
|
||||
console.log(inputName);
|
||||
*/
|
||||
console.log("inputCode");
|
||||
console.log(inputCode);
|
||||
|
||||
let jsonRow = {};
|
||||
jsonRow[attrIdCommandCategory] = row.getAttribute(attrIdCommandCategory);
|
||||
|
||||
83
static/js/pages/dog/locations.js
Normal file
83
static/js/pages/dog/locations.js
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
import API from "../../api.js";
|
||||
import BusinessObjects from "../../lib/business_objects/business_objects.js";
|
||||
import DOM from "../../dom.js";
|
||||
import Events from "../../lib/events.js";
|
||||
import TableBasePage from "../base_table.js";
|
||||
import Utils from "../../lib/utils.js";
|
||||
import Validation from "../../lib/validation.js";
|
||||
import DogTableMixinPage from "./mixin_table.js";
|
||||
|
||||
export default class PageDogLocations extends TableBasePage {
|
||||
static hash = hashPageDogLocations;
|
||||
static attrIdRowObject = attrIdLocation;
|
||||
callSaveTableContent = API.saveLocations;
|
||||
|
||||
constructor(router) {
|
||||
super(router);
|
||||
this.dogMixin = new DogTableMixinPage(this);
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.sharedInitialize();
|
||||
}
|
||||
|
||||
hookupFilters() {
|
||||
this.sharedHookupFilters();
|
||||
this.hookupFilterActive();
|
||||
}
|
||||
|
||||
loadRowTable(rowJson) {
|
||||
if (rowJson == null) return;
|
||||
if (_verbose) { Utils.consoleLogIfNotProductionEnvironment("applying data row: ", rowJson); }
|
||||
}
|
||||
getJsonRow(row) {
|
||||
if (row == null) return;
|
||||
let inputName = row.querySelector('td.' + flagName + ' .' + flagName);
|
||||
let buttonActive = row.querySelector('td.' + flagActive + ' .' + flagActive);
|
||||
|
||||
let jsonRow = {};
|
||||
jsonRow[attrIdLocation] = row.getAttribute(attrIdLocation);
|
||||
jsonRow[flagLocationParent] = this.getIdLocationParentRow(row);
|
||||
jsonRow[flagName] = DOM.getElementAttributeValueCurrent(inputName);
|
||||
jsonRow[flagActive] = buttonActive.classList.contains(flagDelete);
|
||||
return jsonRow;
|
||||
}
|
||||
getIdLocationParentRow(row) {
|
||||
let elementLocationParent = row.querySelector('td.' + flagLocationParent + ' .' + flagLocationParent);
|
||||
return DOM.getElementAttributeValueCurrent(elementLocationParent);
|
||||
}
|
||||
initialiseRowNew(tbody, row) {
|
||||
|
||||
}
|
||||
postInitialiseRowNewCallback(tbody) {
|
||||
let newRows = tbody.querySelectorAll('tr.' + flagRowNew);
|
||||
let newestRow = newRows[0];
|
||||
let clickableElementsSelector = [
|
||||
'td.' + flagDog + ' div.' + flagDog
|
||||
, ',td.' + flagLocationCategory + ' div.' + flagLocationCategory
|
||||
, ',td.' + flagLocation + ' div.' + flagLocation
|
||||
].join('');
|
||||
newestRow.querySelectorAll(clickableElementsSelector).forEach((clickableElement) => {
|
||||
clickableElement.click();
|
||||
});
|
||||
}
|
||||
|
||||
hookupTableMain() {
|
||||
super.hookupTableMain();
|
||||
this.hookupFieldsLocationCategory();
|
||||
this.hookupFieldsNameTable();
|
||||
this.hookupFieldsActive();
|
||||
}
|
||||
hookupFieldsLocationParent() {
|
||||
this.hookupTableCellDdlPreviews(
|
||||
flagLocationParent
|
||||
, Utils.getListFromDict(locations)
|
||||
);
|
||||
}
|
||||
|
||||
leave() {
|
||||
super.leave();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import PageDogCommandCategories from './pages/dog/command_categories.js';
|
||||
import PageDogCommands from './pages/dog/commands.js';
|
||||
import PageDogDogCommandLinks from './pages/dog/dog_command_links.js';
|
||||
// import PageDogDogs from './pages/dog/dogs.js';
|
||||
import PageDogLocations from './pages/dog/locations.js';
|
||||
// Legal
|
||||
import PageAccessibilityReport from './pages/legal/accessibility_report.js';
|
||||
import PageAccessibilityStatement from './pages/legal/accessibility_statement.js';
|
||||
@@ -36,6 +37,7 @@ export default class Router {
|
||||
this.pages[hashPageDogCommands] = { name: 'PageDogCommands', module: PageDogCommands };
|
||||
this.pages[hashPageDogDogCommandLinks] = { name: 'PageDogDogCommandLinks', module: PageDogDogCommandLinks };
|
||||
// this.pages[hashPageDogDogs] = { name: 'PageDogDogs', module: PageDogDogs };
|
||||
this.pages[hashPageDogLocations] = { name: 'PageDogLocations', module: PageDogLocations };
|
||||
// Legal
|
||||
this.pages[hashPageAccessibilityStatement] = { name: 'PageAccessibilityStatement', module: PageAccessibilityStatement };
|
||||
this.pages[hashPageDataRetentionSchedule] = { name: 'PageDataRetentionSchedule', module: PageRetentionSchedule };
|
||||
@@ -55,6 +57,7 @@ export default class Router {
|
||||
this.routes[hashPageDogCommands] = (isPopState = false) => this.navigateToHash(hashPageDogCommands, isPopState);
|
||||
this.routes[hashPageDogDogCommandLinks] = (isPopState = false) => this.navigateToHash(hashPageDogDogCommandLinks, isPopState);
|
||||
// this.routes[hashPageDogDogs] = (isPopState = false) => this.navigateToHash(hashPageDogDogs, isPopState);
|
||||
this.routes[hashPageDogLocations] = (isPopState = false) => this.navigateToHash(hashPageDogLocations, isPopState);
|
||||
// Legal
|
||||
this.routes[hashPageAccessibilityStatement] = (isPopState = false) => this.navigateToHash(hashPageAccessibilityStatement, isPopState);
|
||||
this.routes[hashPageDataRetentionSchedule] = (isPopState = false) => this.navigateToHash(hashPageDataRetentionSchedule, isPopState);
|
||||
|
||||
7
templates/components/dog/_preview_DDL_location.html
Normal file
7
templates/components/dog/_preview_DDL_location.html
Normal 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 %}
|
||||
33
templates/components/dog/_row_location.html
Normal file
33
templates/components/dog/_row_location.html
Normal 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 %}
|
||||
@@ -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 }}";
|
||||
|
||||
74
templates/pages/dog/_locations.html
Normal file
74
templates/pages/dog/_locations.html
Normal 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 %}
|
||||
23
todo.txt
23
todo.txt
@@ -1,8 +1,23 @@
|
||||
|
||||
Command list random generator for assessment - and any other variables e.g. location, handler
|
||||
Features:
|
||||
- Command list random generator for assessment - and any other variables e.g. location, handler
|
||||
- Last tested
|
||||
- Print page option on Dog Command Links Page, Assessment-single Page for test sessions, giving the dog to another handler temporarily - give view only access
|
||||
- UI warning for attempt to create duplicate
|
||||
- Add Button management to Command page
|
||||
- Add Command management to Command Category page
|
||||
- Reporting
|
||||
- Buttons by category, command
|
||||
- Assessment results by category, command
|
||||
- Reminders / calendar sync
|
||||
- Dietary and medical appointments and notes tracking
|
||||
- Sample trigger sounds
|
||||
- Training videos for commands
|
||||
- Timer / stopwatch functionality
|
||||
- Hamburger menu links for local website subsection
|
||||
- Info icon and popup for page purpose on page and against links to page
|
||||
|
||||
Last tested
|
||||
|
||||
Print page option on Dog Command Links Page, Assessment-single Page for test sessions, giving the dog to another handler temporarily - give view only access
|
||||
Fix:
|
||||
- formFilters - centre columns on flex
|
||||
|
||||
UI warning for attempt to create duplicate
|
||||
|
||||
@@ -81,6 +81,10 @@ module.exports = {
|
||||
path.resolve(__dirname, 'static/css/sections/dog.css'),
|
||||
path.resolve(__dirname, 'static/css/pages/dog/dog_command_links.css')
|
||||
],
|
||||
dog_locations: [
|
||||
path.resolve(__dirname, 'static/css/sections/location.css'),
|
||||
path.resolve(__dirname, 'static/css/pages/dog/locations.css')
|
||||
],
|
||||
},
|
||||
output: {
|
||||
filename: 'js/[name].bundle.js',
|
||||
|
||||
Reference in New Issue
Block a user