diff --git a/lib/GaletteAuto/Filters/ModelsList.php b/lib/GaletteAuto/Filters/ModelsList.php index 73da0970..8ddcce7c 100644 --- a/lib/GaletteAuto/Filters/ModelsList.php +++ b/lib/GaletteAuto/Filters/ModelsList.php @@ -25,11 +25,9 @@ class ModelsList extends Pagination /** * Returns the field we want to default set order to - * - * @return string field name */ - protected function getDefaultOrder(): string + protected function getDefaultOrder(): int { - return 'model'; + return self::ORDERBY_MODEL; } } diff --git a/templates/default/history.html.twig b/templates/default/history.html.twig index acf5270d..299b1d5d 100644 --- a/templates/default/history.html.twig +++ b/templates/default/history.html.twig @@ -41,7 +41,7 @@ {% elseif owner.isWoman() %} {{ _T('Is a woman') }} {% else %} - + {% endif %} {{ owner.sfullname }} diff --git a/templates/default/history_modal.js.twig b/templates/default/history_modal.js.twig new file mode 100644 index 00000000..929462c4 --- /dev/null +++ b/templates/default/history_modal.js.twig @@ -0,0 +1,34 @@ +{# + # This file is part of Galette Auto plugin (https://galette.eu). + # SPDX-FileCopyrightText: Copyright © 2009-2026 The Galette Team + # SPDX-License-Identifier: GPL-3.0-or-later + #} + +{# Open vehicle history in a modal from any `.vehicle-history` button #} + $(function() { + $('.vehicle-history').on('click', function() { + $.ajax({ + url: $(this).data('url'), + success: function(res) { + {% include "elements/js/modal.js.twig" with { + modal_title_twig: _T("Car's history", "auto")|e("js"), + modal_content: "res", + modal_class: "large", + modal_content_class: "scrolling", + modal_deny_only: true, + modal_cancel_text: _T("Close")|e("js") + } %} + }, + error: function() { + {% include "elements/js/modal.js.twig" with { + modal_title_twig: _T("An error occurred displaying history :(", "auto")|e("js"), + modal_without_content: true, + modal_class: "mini", + modal_deny_only: true, + modal_cancel_text: _T("Close")|e("js"), + modal_classname: "redalert", + } %} + } + }); + }); + }); diff --git a/templates/default/model.html.twig b/templates/default/model.html.twig index f94ea01e..193ffc33 100644 --- a/templates/default/model.html.twig +++ b/templates/default/model.html.twig @@ -10,7 +10,7 @@