fix empty search

This commit is contained in:
melina 2022-04-20 17:46:16 +02:00
parent 25fbd3b385
commit 5cb114df61

View File

@ -557,6 +557,18 @@ function New() {
* return {void}
*/
function Search2(keyCodeForEnter) {
if ($('#search').val() == '') {
$("[id^=prowatermark]").html("");
$("[id^=prodesc]").text("");
$("[id^=probutton]").text("");
$("[id^=probutton]").hide();
$("[id^=proprice]").attr("class", "hidden");
$("[id^=proprice]").html("");
$("[id^=proimg]").attr("src", "genimg/empty.png");
$("[id^=prodiv]").data("rowid", "");
return;
}
console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter);
var search = false;
@ -579,6 +591,7 @@ function Search2(keyCodeForEnter) {
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term=' + $('#search').val(), function (data) {
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
if (typeof (data[i]) == "undefined") {
$("#prowatermark" + i).html("");
$("#prodesc" + i).text("");
$("#probutton" + i).text("");
$("#probutton" + i).hide();