[ADD] website_sale_aplicoop: re-implement clear search button

Added × button to clear the search input field. When clicked:
- Clears the search text
- Updates lastSearchValue to prevent polling false-positive
- Calls infiniteScroll.resetWithFilters() to reload all products from server
- Maintains current category filter
- Returns focus to search input

The button appears when text is entered and hides when search is empty.
This commit is contained in:
snt 2026-02-18 17:11:47 +01:00
parent 267059fa1b
commit c70de71cff
2 changed files with 27 additions and 10 deletions

View file

@ -473,15 +473,12 @@
<div class="col-md-7">
<!-- CRITICAL: This input is NOT inside a form to prevent Odoo from transforming it -->
<!-- It must remain a pure HTML input element for realtime_search.js to detect value changes -->
<!-- TODO: Re-add clear button wrapper after fixing initialization issues
<div style="position: relative;">
<input type="text" id="realtime-search-input" class="form-control realtime-search-box search-input-styled" placeholder="Search products..." autocomplete="off" style="padding-right: 40px;" />
<button type="button" id="clear-search-btn" class="btn btn-link" style="position: absolute; right: 5px; top: 50%; transform: translateY(-50%); padding: 0; width: 30px; height: 30px; display: none; color: #6c757d; text-decoration: none; font-size: 1.5rem; line-height: 1;" aria-label="Clear search" title="Clear search">
×
</button>
</div>
-->
<input type="text" id="realtime-search-input" class="form-control realtime-search-box search-input-styled" placeholder="Search products..." autocomplete="off" />
</div>
<div class="col-md-5">
<select name="category" id="realtime-category-select" class="form-select">