mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Pressing enter inside input now posts, further improvements
This commit is contained in:
@@ -132,4 +132,13 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- close the menu when script is restarting to avoid being stuck in NUI focus
|
||||
AddEventHandler('onResourceStop', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
if menuIsShowed then
|
||||
TriggerEvent('esx_atm:closeATM')
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -34,10 +34,29 @@ $(window).ready(function () {
|
||||
$('#deposit_amount').val(0);
|
||||
})
|
||||
|
||||
$('#deposit_amount').on("keyup", function(e) {
|
||||
if (e.keyCode == 13) {
|
||||
$.post('http://esx_atm/deposit', JSON.stringify({
|
||||
amount: $('#deposit_amount').val()
|
||||
}));
|
||||
$('#deposit_amount').val(0);
|
||||
}
|
||||
});
|
||||
|
||||
$('#withdraw_btn').on('click', function () {
|
||||
$.post('http://esx_atm/withdraw', JSON.stringify({
|
||||
amount: $('#withdraw_amount').val()
|
||||
}));
|
||||
$('#withdraw_amount').val(0);
|
||||
});
|
||||
|
||||
$('#withdraw_amount').on("keyup", function(e) {
|
||||
if (e.keyCode == 13) {
|
||||
$.post('http://esx_atm/withdraw', JSON.stringify({
|
||||
amount: $('#withdraw_amount').val()
|
||||
}));
|
||||
$('#withdraw_amount').val(0);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
+2
-2
@@ -14,12 +14,12 @@
|
||||
</div>
|
||||
<div id="menu">
|
||||
<div>
|
||||
<input type="number" id="deposit_amount"/>
|
||||
<input type="number" id="deposit_amount" tabindex="1" onClick="this.select();"/>
|
||||
<button id="deposit_btn">Déposer</button>
|
||||
</div>
|
||||
<br><br>
|
||||
<div>
|
||||
<input type="number" id="withdraw_amount"/>
|
||||
<input type="number" id="withdraw_amount" tabindex="2" onClick="this.select();"/>
|
||||
<button id="withdraw_btn">Retirer</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -14,12 +14,12 @@
|
||||
</div>
|
||||
<div id="menu">
|
||||
<div>
|
||||
<input type="number" id="deposit_amount"/>
|
||||
<input type="number" id="deposit_amount" tabindex="1" onClick="this.select();"/>
|
||||
<button id="deposit_btn">Einzahlen</button>
|
||||
</div>
|
||||
<br><br>
|
||||
<div>
|
||||
<input type="number" id="withdraw_amount"/>
|
||||
<input type="number" id="withdraw_amount" tabindex="2" onClick="this.select();"/>
|
||||
<button id="withdraw_btn">Abheben</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -14,12 +14,12 @@
|
||||
</div>
|
||||
<div id="menu">
|
||||
<div>
|
||||
<input type="number" id="deposit_amount"/>
|
||||
<input type="number" id="deposit_amount" tabindex="1" onClick="this.select();"/>
|
||||
<button id="deposit_btn">Deposit</button>
|
||||
</div>
|
||||
<br><br>
|
||||
<div>
|
||||
<input type="number" id="withdraw_amount"/>
|
||||
<input type="number" id="withdraw_amount" tabindex="2" onClick="this.select();"/>
|
||||
<button id="withdraw_btn">Withdraw</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,8 @@ AddEventHandler('esx_atm:deposit', function(amount)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
amount = tonumber(amount)
|
||||
|
||||
if not tonumber(amount) then return end
|
||||
amount = round(amount)
|
||||
if amount == nil or amount <= 0 or amount > xPlayer.getMoney() then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
|
||||
@@ -21,6 +23,8 @@ AddEventHandler('esx_atm:withdraw', function(amount)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
amount = tonumber(amount)
|
||||
|
||||
if not tonumber(amount) then return end
|
||||
amount = round(amount)
|
||||
local accountMoney = 0
|
||||
accountMoney = xPlayer.getAccount('bank').money
|
||||
|
||||
Reference in New Issue
Block a user