diff --git a/business_objects/dog/command.py b/business_objects/dog/command.py index 2334544..1e6052a 100644 --- a/business_objects/dog/command.py +++ b/business_objects/dog/command.py @@ -228,11 +228,11 @@ class Parameters_Command(Get_Many_Parameters_Base): filters.get_all_command_category = not has_filter_command_category filters.get_inactive_command_category = not active_only filters.ids_command_category = form.id_command_category.data if has_filter_command_category else '' - filters.names_command_category = form.search_text.data if has_filter_search_text else '' + filters.names_command_category = form.search.data if has_filter_search_text else '' filters.get_all_command = True filters.get_inactive_command = not active_only filters.ids_command = '' - filters.names_command = form.search_text.data if has_filter_search_text else '' + filters.names_command = form.search.data if has_filter_search_text else '' return filters @classmethod @@ -244,11 +244,13 @@ class Parameters_Command(Get_Many_Parameters_Base): filters.get_all_command_category = True filters.get_inactive_command_category = not active_only filters.ids_command_category = '' - filters.names_command_category = form.search_text.data if has_filter_search_text else '' - filters.get_all_command = True - filters.get_inactive_command = not active_only + filters.names_command_category = form.search.data if has_filter_search_text else '' + filters.get_all_command = False + filters.get_inactive_command = False filters.ids_command = '' - filters.names_command = form.search_text.data if has_filter_search_text else '' + filters.names_command = '' + filters.require_all_id_search_filters_met = False + filters.output_commands = False return filters def to_json(self): diff --git a/business_objects/dog/command_category.py b/business_objects/dog/command_category.py index 7bfa8ab..3ab9470 100644 --- a/business_objects/dog/command_category.py +++ b/business_objects/dog/command_category.py @@ -99,7 +99,7 @@ class Command_Category_Temp(db.Model, Base): __table_args__ = { 'extend_existing': True } id_temp = db.Column(db.Integer, primary_key=True) id_command_category = db.Column(db.Integer) - code = db.Column(db.String(100)) + # code = db.Column(db.String(100)) name = db.Column(db.String(250)) active = db.Column(db.Boolean) guid: str = db.Column(db.String(36)) @@ -112,7 +112,7 @@ class Command_Category_Temp(db.Model, Base): _m = 'Command_Category_Temp.from_Command_Category' temp = cls() temp.id_command_category = command_category.id_command_category - temp.code = command_category.code + # temp.code = command_category.code temp.name = command_category.name temp.active = command_category.active return temp \ No newline at end of file diff --git a/models/model_view_base.py b/models/model_view_base.py index 1778fdb..266175c 100644 --- a/models/model_view_base.py +++ b/models/model_view_base.py @@ -98,6 +98,7 @@ class Model_View_Base(BaseModel, ABC): FLAG_DATA: ClassVar[str] = 'data' FLAG_DATE_FROM: ClassVar[str] = Base.FLAG_DATE_FROM FLAG_DATE_TO: ClassVar[str] = Base.FLAG_DATE_TO + FLAG_DDL_PREVIEW: ClassVar[str] = "ddl-preview" FLAG_DELETE: ClassVar[str] = 'delete' FLAG_DESCRIPTION: ClassVar[str] = Base.FLAG_DESCRIPTION FLAG_DETAIL: ClassVar[str] = 'detail' diff --git a/models/model_view_dog_dog_command_link.py b/models/model_view_dog_dog_command_link.py index 43f6324..c2dba3f 100644 --- a/models/model_view_dog_dog_command_link.py +++ b/models/model_view_dog_dog_command_link.py @@ -25,6 +25,7 @@ import dog_training.lib.argument_validation as av # external from pydantic import BaseModel from typing import ClassVar +from operator import attrgetter class Model_View_Dog_Dog_Command_Link(Model_View_Dog_Base): FLAG_HAND_SIGNAL_DESCRIPTION: ClassVar[str] = Dog_Command_Link.FLAG_HAND_SIGNAL_DESCRIPTION @@ -47,12 +48,19 @@ class Model_View_Dog_Dog_Command_Link(Model_View_Dog_Base): datastore = DataStore_Dog() parameters_filter_dog = Parameters_Dog.get_default() self.filter_dogs, errors = datastore.get_many_dog(parameters_filter_dog) - self.form_filters.id_dog.choices += [(str(dog.id_dog), dog.name) for dog in self.filter_dogs] + if len(self.filter_dogs) > 0: + self.form_filters.id_dog.choices += [(str(dog.id_dog), dog.name) for dog in self.filter_dogs] parameters_filter_command = Parameters_Command.get_default() self.filter_command_categories, self.filter_commands, errors = datastore.get_many_command(parameters_filter_command) - self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories] - self.form_filters.id_command.choices += [(str(command.id_command), command.name) for command in self.filter_commands] + if len(self.filter_command_categories) > 0: + self.form_filters.id_command_category.choices += [(str(command_category.id_command_category), command_category.name) for command_category in self.filter_command_categories] + if len(self.filter_commands) > 0: + Helper_App.console_log(f'filter commands: {self.filter_commands}') + sorted_filter_commands = self.filter_commands + sorted_filter_commands.sort(key = attrgetter('name')) + Helper_App.console_log(f'sorted filter commands: {sorted_filter_commands}') + self.form_filters.id_command.choices += [(str(command.id_command), command.name) for command in sorted_filter_commands] # .sort(key = lambda command: command[1]) Helper_App.console_log(f'Form filters: {self.form_filters}') parameters_filter_dog_command_link = Parameters_Dog_Command_Link.from_form_filters_dog_command_link(self.form_filters) diff --git a/static/css/layouts/table-main.css b/static/css/layouts/table-main.css index 9461bd0..b173415 100644 --- a/static/css/layouts/table-main.css +++ b/static/css/layouts/table-main.css @@ -55,13 +55,21 @@ } #tableMain tbody tr td { height: 5vh; - padding-top: 0.5vh; + /* padding-top: 0.5vh; */ } #tableMain tbody tr td:has(.dirty) { background-color: var(--colour-primary); } #tableMain tbody tr:not(:last-of-type) td { - padding-bottom: 0.5vh; + padding-bottom: 0.25vh; +} +#tableMain tbody tr td.ddl-preview div, +#tableMain tbody tr td.ddl-preview select { + padding-left: 2vh; + padding-right: 2vh; +} +#tableMain tbody tr td.ddl-preview select { + font-size: 12px; } #tableMain thead tr th.active, #tableMain tbody tr td.active { diff --git a/static/css/pages/dog/command_categories.css b/static/css/pages/dog/command_categories.css index e4cc8e7..74f40b3 100644 --- a/static/css/pages/dog/command_categories.css +++ b/static/css/pages/dog/command_categories.css @@ -1,10 +1,13 @@ -/* -#formFilters .container { - max-width: fit-content; +#formFilters #search { + width: 20vh; + min-width: 20vh; } -*/ +#tableMain thead tr th, +#tableMain tbody tr td { + height: 3vh; +} #tableMain tbody tr td.name .name { border: 1px solid var(--colour-accent); /* @@ -22,11 +25,12 @@ box-sizing: border-box; */ } - +/* #tableMain thead tr th.code, #tableMain tbody tr td.code, +*/ #tableMain thead tr th.name , #tableMain tbody tr td.name { - width: 35vh; - min-width: 35vh; + width: 50vh; + min-width: 50vh; } \ No newline at end of file diff --git a/static/css/pages/dog/commands.css b/static/css/pages/dog/commands.css index bc58af7..75c524b 100644 --- a/static/css/pages/dog/commands.css +++ b/static/css/pages/dog/commands.css @@ -3,4 +3,9 @@ #formFilters .container { max-width: fit-content; } -*/ \ No newline at end of file +*/ +#tableMain thead tr th.can-have-button, +#tableMain tbody tr td.can-have-button { + width: 6vh; + min-width: 6vh; +} \ No newline at end of file diff --git a/static/js/pages/base_table.js b/static/js/pages/base_table.js index cd9a44f..c37e91d 100644 --- a/static/js/pages/base_table.js +++ b/static/js/pages/base_table.js @@ -208,7 +208,12 @@ export default class TableBasePage extends BasePage { } let formElement = this.getFormFilters(); let comment = DOM.getElementValueCurrent(document.querySelector(idTextareaConfirm)); + /* Utils.consoleLogIfNotProductionEnvironment({ formElement, comment, records }); + Utils.consoleLogIfNotProductionEnvironment('records'); + Utils.consoleLogIfNotProductionEnvironment(records); + debugger; + */ this.callSaveTableContent(records, formElement, comment) .then(data => { if (data[flagStatus] == flagSuccess) { diff --git a/static/js/pages/dog/command_categories.js b/static/js/pages/dog/command_categories.js index 4933203..5407877 100644 --- a/static/js/pages/dog/command_categories.js +++ b/static/js/pages/dog/command_categories.js @@ -32,6 +32,7 @@ export default class PageDogCommandCategories extends TableBasePage { if (_verbose) { Utils.consoleLogIfNotProductionEnvironment("applying data row: ", rowJson); } } getJsonRow(row) { + Utils.consoleLogIfNotProductionEnvironment({ row }); if (row == null) return; let inputCode = row.querySelector('td.' + flagCode + ' .' + flagCode); let inputName = row.querySelector('td.' + flagName + ' .' + flagName); @@ -41,7 +42,7 @@ export default class PageDogCommandCategories extends TableBasePage { console.log("inputName"); console.log(inputName); */ - + let jsonRow = {}; jsonRow[attrIdCommandCategory] = row.getAttribute(attrIdCommandCategory); jsonRow[flagCode] = DOM.getElementAttributeValueCurrent(inputCode); diff --git a/static/js/pages/dog/commands.js b/static/js/pages/dog/commands.js index 2352a7c..74839c0 100644 --- a/static/js/pages/dog/commands.js +++ b/static/js/pages/dog/commands.js @@ -37,12 +37,17 @@ export default class PageDogCommands extends TableBasePage { } getJsonRow(row) { if (row == null) return; - let inputName = row.querySelector('td.' + flagName + ' textarea'); - let inputHandSignalDefaultDescription = row.querySelector('td.' + flagHandSignalDefaultDescription + ' textarea'); - let inputCanHaveButton = row.querySelector('td.' + flagCanHaveButton + ' input'); - let inputNotes = row.querySelector('td.' + flagNotes + ' textarea'); + let inputName = row.querySelector('td.' + flagName + ' .' + flagName); + let inputHandSignalDefaultDescription = row.querySelector('td.' + flagHandSignalDefaultDescription + ' .' + flagHandSignalDefaultDescription); + let inputCanHaveButton = row.querySelector('td.' + flagCanHaveButton + ' .' + flagCanHaveButton); + let inputNotes = row.querySelector('td.' + flagNotes + ' .' + flagNotes); let buttonActive = row.querySelector('td.' + flagActive + ' .' + flagActive); + /* + Utils.consoleLogIfNotProductionEnvironment({ inputName, inputHandSignalDefaultDescription, inputCanHaveButton, inputNotes, buttonActive }); + debugger; + */ + let jsonRow = {}; jsonRow[attrIdCommand] = row.getAttribute(attrIdCommand); jsonRow[attrIdCommandCategory] = this.getIdCommandCategoryRow(row); diff --git a/templates/components/dog/_row_command.html b/templates/components/dog/_row_command.html index 1cc0b84..9c2dcb1 100644 --- a/templates/components/dog/_row_command.html +++ b/templates/components/dog/_row_command.html @@ -1,7 +1,7 @@ {% if is_blank_row %} - + {% include 'components/dog/_preview_DDL_command_category.html' %} @@ -28,7 +28,7 @@ {% else %} {% set command_category = command.command_category %} - + {% include 'components/dog/_preview_DDL_command_category.html' %} diff --git a/templates/components/dog/_row_command_category.html b/templates/components/dog/_row_command_category.html index a8145da..1e1f477 100644 --- a/templates/components/dog/_row_command_category.html +++ b/templates/components/dog/_row_command_category.html @@ -1,10 +1,12 @@ {% if is_blank_row %} + {# + #} @@ -14,12 +16,14 @@ {% else %} + {# + #} - + {% include 'components/dog/_preview_DDL_dog.html' %} - + {% include 'components/dog/_preview_DDL_command_category.html' %} - + {% include 'components/dog/_preview_DDL_command.html' %} @@ -26,15 +26,15 @@ {% else %} {% set dog = link.dog %} - + {% include 'components/dog/_preview_DDL_dog.html' %} {% set command_category = link.command.command_category %} - + {% include 'components/dog/_preview_DDL_command_category.html' %} {% set command = link.command %} - + {% include 'components/dog/_preview_DDL_command.html' %} diff --git a/templates/layouts/layout.html b/templates/layouts/layout.html index 6b04010..978f7d2 100644 --- a/templates/layouts/layout.html +++ b/templates/layouts/layout.html @@ -4,8 +4,8 @@ {{ model.title }} - DOG - - + +