Added ability to clear the BOLO plate

This commit is contained in:
Dan
2020-11-05 15:33:21 +00:00
parent dc8875893f
commit 4f7d56471b
4 changed files with 26 additions and 3 deletions

View File

@@ -114,13 +114,21 @@ end
-- Returns the bolo plate -- Returns the bolo plate
function READER:GetBoloPlate() function READER:GetBoloPlate()
if ( self.vars.boloPlate ~= nil ) then
return self.vars.boloPlate return self.vars.boloPlate
end
end end
-- Sets the bolo plate to the given plate -- Sets the bolo plate to the given plate
function READER:SetBoloPlate( plate ) function READER:SetBoloPlate( plate )
self.vars.boloPlate = plate self.vars.boloPlate = plate
UTIL:Notify( "BOLO plate set to: " .. plate ) UTIL:Notify( "BOLO plate set to: ~b~" .. plate )
end
-- Clears the BOLO plate
function READER:ClearBoloPlate()
self.vars.boloPlate = nil
UTIL:Notify( "~b~BOLO plate cleared!" )
end end
-- Returns if the given reader is locked -- Returns if the given reader is locked
@@ -187,6 +195,13 @@ RegisterNUICallback( "setBoloPlate", function( plate, cb )
cb('ok') cb('ok')
end ) end )
-- Runs when the "Clear BOLO Plate" button is pressed on the plate reader box
RegisterNUICallback( "clearBoloPlate", function( plate, cb )
-- Clear the BOLO plate
READER:ClearBoloPlate()
cb( "ok" )
end )
-- This is the main function that runs and scans all vehicles in front and behind the patrol vehicle -- This is the main function that runs and scans all vehicles in front and behind the patrol vehicle
function READER:Main() function READER:Main()
-- Check that the system can actually run -- Check that the system can actually run

View File

@@ -770,7 +770,7 @@ button:focus { outline: none; }
#plateReaderBox { #plateReaderBox {
width: 225px; width: 225px;
height: 300px; height: 330px;
position: absolute; position: absolute;
margin: auto; margin: auto;

View File

@@ -245,6 +245,8 @@
<input id="boloText" type="text" maxlength="8" placeholder="12ABC345" onkeypress="checkPlateInput(event)" class="plate_input"/> <input id="boloText" type="text" maxlength="8" placeholder="12ABC345" onkeypress="checkPlateInput(event)" class="plate_input"/>
<button id="setBoloPlate" class="btn">Set BOLO Plate</button> <button id="setBoloPlate" class="btn">Set BOLO Plate</button>
<button id="clearBoloPlate" class="btn">Clear BOLO Plate</button>
</div> </div>
<button id="closePlateReaderSettings" class="close">CLOSE</button> <button id="closePlateReaderSettings" class="close">CLOSE</button>

View File

@@ -89,6 +89,7 @@ const elements =
plateReaderBox: $( "#plateReaderBox" ), plateReaderBox: $( "#plateReaderBox" ),
boloText: $( "#boloText" ), boloText: $( "#boloText" ),
setBoloBtn: $( "#setBoloPlate" ), setBoloBtn: $( "#setBoloPlate" ),
clearBoloBtn: $( "#clearBoloPlate" ),
closePrBtn: $( "#closePlateReaderSettings" ), closePrBtn: $( "#closePlateReaderSettings" ),
openHelp: $( "#helpBtn" ), openHelp: $( "#helpBtn" ),
@@ -766,6 +767,11 @@ elements.setBoloBtn.click( function() {
} }
} ) } )
// Sets the on click function for the clear BOLO button
elements.clearBoloBtn.click( function() {
sendData( "clearBoloPlate", null );
} )
// Checks what the user is typing into the plate box // Checks what the user is typing into the plate box
function checkPlateInput( event ) function checkPlateInput( event )
{ {