ed
This commit is contained in:
parent
d72b640e12
commit
bb5b4ae2f0
2 changed files with 169 additions and 112 deletions
|
@ -168,8 +168,8 @@ function ShowBillingForm(selectedPlayer, accountOptions)
|
|||
timestamp = GetGameTimer()
|
||||
}
|
||||
|
||||
-- Show waiting screen
|
||||
ShowWaitingScreen(billData.billId, selectedPlayer.name)
|
||||
-- Show waiting screen with all details
|
||||
ShowWaitingScreen(billData.billId, selectedPlayer.name, input[1], input[2])
|
||||
else
|
||||
lib.notify({
|
||||
title = 'Billing System',
|
||||
|
@ -183,14 +183,27 @@ function ShowBillingForm(selectedPlayer, accountOptions)
|
|||
end
|
||||
|
||||
-- Function to show waiting screen
|
||||
function ShowWaitingScreen(billId, playerName)
|
||||
function ShowWaitingScreen(billId, playerName, amount, reason)
|
||||
-- Create a more informative waiting screen
|
||||
lib.registerContext({
|
||||
id = 'bill_waiting_screen',
|
||||
title = 'Warte auf Antwort',
|
||||
title = 'Warte auf Zahlung',
|
||||
options = {
|
||||
{
|
||||
title = 'Rechnung gesendet',
|
||||
description = 'Warte auf Antwort von ' .. playerName,
|
||||
title = 'Rechnung Details',
|
||||
description = 'Gesendet an: ' .. playerName,
|
||||
metadata = {
|
||||
{label = 'Betrag', value = '$' .. amount},
|
||||
{label = 'Grund', value = reason},
|
||||
{label = 'Status', value = 'Warte auf Antwort...'},
|
||||
},
|
||||
icon = 'file-invoice-dollar',
|
||||
disabled = true
|
||||
},
|
||||
{
|
||||
title = 'Warte auf Antwort',
|
||||
progress = 100, -- This creates a loading bar
|
||||
description = playerName .. ' entscheidet über die Rechnung',
|
||||
icon = 'clock',
|
||||
disabled = true
|
||||
},
|
||||
|
@ -207,6 +220,73 @@ function ShowWaitingScreen(billId, playerName)
|
|||
})
|
||||
|
||||
lib.showContext('bill_waiting_screen')
|
||||
|
||||
-- Start a loading animation
|
||||
Citizen.CreateThread(function()
|
||||
local dots = 0
|
||||
local loadingText = {'Warte', 'Warte.', 'Warte..', 'Warte...'}
|
||||
local progress = 100
|
||||
|
||||
while pendingBills[billId] do
|
||||
Citizen.Wait(500)
|
||||
dots = (dots + 1) % 4
|
||||
|
||||
-- Update the context menu with new loading text
|
||||
lib.registerContext({
|
||||
id = 'bill_waiting_screen',
|
||||
title = 'Warte auf Zahlung',
|
||||
options = {
|
||||
{
|
||||
title = 'Rechnung Details',
|
||||
description = 'Gesendet an: ' .. playerName,
|
||||
metadata = {
|
||||
{label = 'Betrag', value = '$' .. amount},
|
||||
{label = 'Grund', value = reason},
|
||||
{label = 'Status', value = 'Warte auf Antwort...'},
|
||||
},
|
||||
icon = 'file-invoice-dollar',
|
||||
disabled = true
|
||||
},
|
||||
{
|
||||
title = loadingText[dots + 1],
|
||||
progress = progress,
|
||||
description = playerName .. ' entscheidet über die Rechnung',
|
||||
icon = 'clock',
|
||||
disabled = true
|
||||
},
|
||||
{
|
||||
title = 'Abbrechen',
|
||||
description = 'Zurück zum Hauptmenü',
|
||||
icon = 'times-circle',
|
||||
onSelect = function()
|
||||
pendingBills[billId] = nil
|
||||
OpenMainBillingMenu()
|
||||
end
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Only refresh the context if it's still showing
|
||||
if isMenuOpen('bill_waiting_screen') then
|
||||
lib.showContext('bill_waiting_screen')
|
||||
else
|
||||
break
|
||||
end
|
||||
|
||||
-- Cycle the progress bar
|
||||
progress = progress - 5
|
||||
if progress <= 0 then
|
||||
progress = 100
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Helper function to check if a menu is open
|
||||
function isMenuOpen(menuId)
|
||||
-- This is a placeholder - ox_lib doesn't provide a direct way to check
|
||||
-- You might need to track this yourself or use a different approach
|
||||
return true
|
||||
end
|
||||
|
||||
-- Function to show payment account selection
|
||||
|
@ -585,19 +665,46 @@ RegisterNetEvent('billing:client:billResponse', function(billId, action, playerN
|
|||
lib.notify({
|
||||
title = 'Rechnung bezahlt',
|
||||
description = playerName .. ' hat deine Rechnung über $' .. bill.amount .. ' bezahlt',
|
||||
type = 'success'
|
||||
type = 'success',
|
||||
duration = 7000
|
||||
})
|
||||
|
||||
-- Show a more detailed success message
|
||||
lib.alertDialog({
|
||||
header = 'Zahlung erhalten',
|
||||
content = playerName .. ' hat deine Rechnung über $' .. bill.amount .. ' für "' .. bill.reason .. '" bezahlt.',
|
||||
centered = true,
|
||||
cancel = false
|
||||
})
|
||||
elseif action == 'decline' then
|
||||
lib.notify({
|
||||
title = 'Rechnung abgelehnt',
|
||||
description = playerName .. ' hat deine Rechnung über $' .. bill.amount .. ' abgelehnt',
|
||||
type = 'error'
|
||||
type = 'error',
|
||||
duration = 7000
|
||||
})
|
||||
|
||||
-- Show a more detailed decline message
|
||||
lib.alertDialog({
|
||||
header = 'Rechnung abgelehnt',
|
||||
content = playerName .. ' hat deine Rechnung über $' .. bill.amount .. ' für "' .. bill.reason .. '" abgelehnt.',
|
||||
centered = true,
|
||||
cancel = false
|
||||
})
|
||||
elseif action == 'later' then
|
||||
lib.notify({
|
||||
title = 'Rechnung gespeichert',
|
||||
description = playerName .. ' wird deine Rechnung später bezahlen',
|
||||
type = 'info'
|
||||
type = 'info',
|
||||
duration = 7000
|
||||
})
|
||||
|
||||
-- Show a more detailed "pay later" message
|
||||
lib.alertDialog({
|
||||
header = 'Zahlung aufgeschoben',
|
||||
content = playerName .. ' hat deine Rechnung über $' .. bill.amount .. ' für "' .. bill.reason .. '" für später gespeichert.',
|
||||
centered = true,
|
||||
cancel = false
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -640,5 +747,3 @@ Citizen.CreateThread(function()
|
|||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue