Skip to content

Commit

Permalink
Adding a manufacturer search in the printer selection
Browse files Browse the repository at this point in the history
  • Loading branch information
fr3ak2402 committed Jul 26, 2023
1 parent b99a7b9 commit 3585745
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 6 deletions.
45 changes: 43 additions & 2 deletions resources/web/guide/21/21.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function HandleModelList( pVal )
if( sVV=="Other")
sVV="Orca colosseum";

let HtmlNewVendor='<div class="OneVendorBlock" Vendor="'+strVendor+'">'+
let HtmlNewVendor='<div class="OneVendorBlock" Vendor="'+strVendor+'" VendorName="'+sVV+'">'+
'<div class="BlockBanner">'+
' <div class="BannerBtns">'+
' <div class="SmallBtn_Green trans" tid="t11" onClick="SelectPrinterAll('+"\'"+strVendor+"\'"+')">all</div>'+
Expand Down Expand Up @@ -228,6 +228,47 @@ function ShowNotice( nShow )
}
}

function FilterVendor()
{
var inputValue = $('#Search').val();

if (inputValue.trim() !== '')
{
var searchedVendor = $('#Search').val().trim();



// Search for elements with the attribute "VendorName" and check them
$('[VendorName]').each(function()
{
var nameVendor = $(this).attr('VendorName');

if (nameVendor.includes(searchedVendor))
{
$(this).show(); // The element's vendor value contains the searched string, show it
}
else
{
$(this).hide(); // The element has a different vendor value or doesn't contain the string, hide it
}
});
}
else
{
$('[VendorName]').show();
}
}

$(document).ready(function()
{
$('#Search').on('input', function()
{
FilterVendor();
});


$('#Clear').click(function()
{
$('#Search').val(''); // Clear the input field
$('[VendorName]').show(); // Show all Vendor elements
});
});
2 changes: 1 addition & 1 deletion resources/web/guide/21/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>

<div id="SearchWrapper">
<input class="trans" tid="t100" type="text" id="Search" placeholder="Search">
<input class="trans" tid="t100" type="search" id="Search" placeholder="Search" spellcheck="false" onchange="FilterVendor()">
</div>
</div>

Expand Down
45 changes: 43 additions & 2 deletions resources/web/guide/24/24.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function HandleModelList( pVal )
if( sVV=="Other")
sVV="Orca colosseum";

let HtmlNewVendor='<div class="OneVendorBlock" Vendor="'+strVendor+'">'+
let HtmlNewVendor='<div class="OneVendorBlock" Vendor="'+strVendor+'" VendorName="'+sVV+'">'+
'<div class="BlockBanner">'+
' <div class="BannerBtns">'+
' <div class="SmallBtn_Green trans" tid="t11" onClick="SelectPrinterAll('+"\'"+strVendor+"\'"+')">all</div>'+
Expand Down Expand Up @@ -247,6 +247,47 @@ function ConfirmSelect()
}
}

function FilterVendor()
{
var inputValue = $('#Search').val();

if (inputValue.trim() !== '')
{
var searchedVendor = $('#Search').val().trim();



// Search for elements with the attribute "VendorName" and check them
$('[VendorName]').each(function()
{
var nameVendor = $(this).attr('VendorName');

if (nameVendor.includes(searchedVendor))
{
$(this).show(); // The element's vendor value contains the searched string, show it
}
else
{
$(this).hide(); // The element has a different vendor value or doesn't contain the string, hide it
}
});
}
else
{
$('[VendorName]').show();
}
}

$(document).ready(function()
{
$('#Search').on('input', function()
{
FilterVendor();
});


$('#Clear').click(function()
{
$('#Search').val(''); // Clear the input field
$('[VendorName]').show(); // Show all Vendor elements
});
});
2 changes: 1 addition & 1 deletion resources/web/guide/24/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>

<div id="SearchWrapper">
<input type="search" id="Search" placeholder="Search" class="trans" tid="t100">
<input class="trans" tid="t100" type="search" id="Search" placeholder="Search" spellcheck="false" onchange="FilterVendor()">
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions resources/web/guide/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ input[type=search] {
border:#9c6da4 1px solid;
background-color: #B9B9BC;
caret-color : #9c6da4;
color: black;
}

/*-----Button-----*/
Expand Down

0 comments on commit 3585745

Please sign in to comment.