Proper string formatting, no more hardcoded $ signs

This commit is contained in:
ElPumpo
2018-11-25 16:08:28 +01:00
parent e8fbc009a8
commit 786d6d24a0
9 changed files with 157 additions and 187 deletions
+17 -25
View File
@@ -23,38 +23,30 @@ end)
function ShowBillsMenu()
ESX.TriggerServerCallback('esx_billing:getBills', function(bills)
ESX.UI.Menu.CloseAll()
local elements = {}
for i=1, #bills, 1 do
table.insert(elements, {label = bills[i].label .. ' - <span style="color: red;">$' .. bills[i].amount .. '</span>', value = bills[i].id})
table.insert(elements, {
label = ('%s - <span style="color:red;">%s</span>'):format(bills[i].label, _U('invoices_item', ESX.Math.GroupDigits(bills[i].amount))),
billID = bills[i].id
})
end
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'billing',
{
title = _U('invoices'),
align = 'bottom-right',
elements = elements
},
function(data, menu)
menu.close()
local billId = data.current.value
ESX.TriggerServerCallback('esx_billing:payBill', function()
ShowBillsMenu()
end, billId)
end,
function(data, menu)
menu.close()
end
)
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'billing',
{
title = _U('invoices'),
align = 'bottom-right',
elements = elements
}, function(data, menu)
menu.close()
ESX.TriggerServerCallback('esx_billing:payBill', function()
ShowBillsMenu()
end, data.current.billID)
end, function(data, menu)
menu.close()
end)
end)
end