mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 19:01:37 +00:00
Implemented only show menu if bills available, closes #25
This commit is contained in:
+25
-21
@@ -10,29 +10,33 @@ end)
|
||||
|
||||
function ShowBillsMenu()
|
||||
ESX.TriggerServerCallback('esx_billing:getBills', function(bills)
|
||||
ESX.UI.Menu.CloseAll()
|
||||
local elements = {}
|
||||
if #bills > 0 then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
local elements = {}
|
||||
|
||||
for k,v in ipairs(bills) do
|
||||
table.insert(elements, {
|
||||
label = ('%s - <span style="color:red;">%s</span>'):format(v.label, _U('invoices_item', ESX.Math.GroupDigits(v.amount))),
|
||||
billId = v.id
|
||||
})
|
||||
for k,v in ipairs(bills) do
|
||||
table.insert(elements, {
|
||||
label = ('%s - <span style="color:red;">%s</span>'):format(v.label, _U('invoices_item', ESX.Math.GroupDigits(v.amount))),
|
||||
billId = v.id
|
||||
})
|
||||
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)
|
||||
else
|
||||
ESX.ShowNotification(_U('no_invoices'))
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user