full context implementation

This commit is contained in:
Taavi
2022-12-05 15:02:14 +08:00
committed by GitHub
parent 89194761e5
commit 88a32d6a6c
+8 -7
View File
@@ -238,15 +238,18 @@ function OpenMobileTaxiActionsMenu()
ESX.OpenContext("right", elements, function(menu,element)
if element.value == "billing" then
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', {
title = TranslateCap('invoice_amount')
}, function(data, menu)
local elements2 = {
{unselectable = true, icon = "fas fa-taxi", title = element.title},
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = "Amount to bill.."},
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
}
local amount = tonumber(data.value)
ESX.OpenContext("right", elements2, function(menu2,element2)
local amount = tonumber(menu2.eles[2].inputValue)
if amount == nil then
ESX.ShowNotification(TranslateCap('amount_invalid'))
else
menu.close()
ESX.CloseContext()
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification(TranslateCap('no_players_near'))
@@ -256,8 +259,6 @@ function OpenMobileTaxiActionsMenu()
ESX.ShowNotification(TranslateCap('billing_sent'))
end
end
end, function(data, menu)
menu.close()
end)
elseif element.value == "start_job" then
if OnJob then