Implemented only show menu if bills available, closes #25

This commit is contained in:
ElPumpo
2020-02-05 11:16:02 +01:00
parent 19a54ee750
commit 146328ddea
9 changed files with 37 additions and 25 deletions
+25 -21
View File
@@ -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
+1
View File
@@ -3,6 +3,7 @@ Locales['br'] = {
['invoices_item'] = '$%s',
['received_invoice'] = 'você ~r~recebeu~s~ uma fatura',
['paid_invoice'] = 'você ~g~pagou~s~ uma fatura de ~r~$%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = 'você ~g~recebeu~s~ um pagamento de ~r~$%s~s~',
['player_not_online'] = 'o jogador não está na cidade',
['no_money'] = 'você não tem dinheiro suficiente para pagar esta fatura',
+1
View File
@@ -3,6 +3,7 @@ Locales['de'] = {
['invoices_item'] = '$%s',
['received_invoice'] = 'you hast eine Rechnung ~r~erhlaten~s~',
['paid_invoice'] = 'du ~g~bezahlst~s~ eine Rechnung von ~r~$%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = 'du ~g~erhältst~s~ eine Zahlung von ~r~$%s~s~',
['player_not_online'] = 'der Spieler ist nicht online',
['no_money'] = 'you do not have enough money to pay this bill',
+1
View File
@@ -3,6 +3,7 @@ Locales['en'] = {
['invoices_item'] = '$%s',
['received_invoice'] = 'you have just ~r~received~s~ an invoice',
['paid_invoice'] = 'you ~g~paid~s~ an invoice of ~r~$%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = 'you ~g~received~s~ a payment of ~r~$%s~s~',
['player_not_online'] = 'the player is not logged in',
['no_money'] = 'you do not have enough money to pay this bill',
+1
View File
@@ -3,6 +3,7 @@ Locales['es'] = {
['invoices_item'] = '€%s',
['received_invoice'] = 'has ~r~recibido~s~ una multa',
['paid_invoice'] = 'has ~g~pagado~s~ una multa de ~r~€%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = 'has ~g~recibido~s~ un pago de ~g~€%s~s~',
['player_not_online'] = 'el jugador no está conectado',
['no_money'] = 'you do not have enough money to pay this bill',
+1
View File
@@ -3,6 +3,7 @@ Locales['fi'] = {
['invoices_item'] = '$%s',
['received_invoice'] = 'sinä ~r~sait~s~ laskun',
['paid_invoice'] = 'sinä ~g~maksoit~s~ laskun suuruudelta ~r~$%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = 'sinä ~g~sait~s~ maksun suuruudelta ~r~$%s~s~',
['player_not_online'] = 'pelaaja ei ole sisäänkirjautuneena',
['no_money'] = 'sinulla ei ole tarpeeksi rahaa maksaaksesi tätä laskua.',
+1
View File
@@ -3,6 +3,7 @@ Locales['fr'] = {
['invoices_item'] = '$%s',
['received_invoice'] = 'vous avez ~r~reçu~s~ une facture',
['paid_invoice'] = 'vous avez ~g~payé~s~ une facture de ~r~$%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = 'vous avez ~g~reçu~s~ un paiement de ~g~$%s~s~',
['player_not_online'] = 'le joueur n\'est pas connecté',
['no_money'] = 'you do not have enough money to pay this bill',
+1
View File
@@ -3,6 +3,7 @@ Locales['pl'] = {
['invoices_item'] = '$%s',
['received_invoice'] = 'właśnie ~r~dostałeś/aś~s~ fakture',
['paid_invoice'] = '~g~Zapłaciłeś/aś~s~ fakture: ~r~$%s~s~',
['no_invoices'] = 'you do not have any bills to pay at this moment',
['received_payment'] = '~g~Otrzymałeś/aś~s~ zapłate: ~r~$%s~s~',
['player_not_online'] = 'gracz nie jest zalogowany',
['no_money'] = 'nie masz wystarczająco pieniędzy aby zapłacić tą fakture',
+5 -4
View File
@@ -3,9 +3,10 @@ Locales['sv'] = {
['invoices_item'] = '%s SEK',
['received_invoice'] = 'du har ~y~mottagit~s~ en räkning',
['paid_invoice'] = 'du ~y~betalade~s~ precis en räkning på ~g~%s SEK~s~',
['no_invoices'] = 'du har inga inkommande räkningar',
['received_payment'] = 'du har ~y~mottagit~s~ en räkning på ~g~%s SEK~s~',
['player_not_online'] = 'personen är inte online',
['no_money'] = 'du har ~r~inte råd~s~ för att kunna betala räkningen',
['target_no_money'] = 'personen har ~r~inte råd~s~ för att betala räkningen',
['keymap_showbills'] = 'open bills menu',
['player_not_online'] = 'spelaren är inte online',
['no_money'] = 'du har ~r~inte råd~s~ för att betala räkningen',
['target_no_money'] = 'spelaren har ~r~inte råd~s~ för att betala räkningen',
['keymap_showbills'] = 'öppna menyn för räkningar',
}