forked from Simnation/Main
ed
This commit is contained in:
parent
e876d31e05
commit
625f80361b
2 changed files with 6 additions and 54 deletions
|
@ -430,7 +430,6 @@ function ViewBills()
|
||||||
lib.showContext('billing_menu')
|
lib.showContext('billing_menu')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Helper function to get nearby players
|
-- Helper function to get nearby players
|
||||||
function GetNearbyPlayers()
|
function GetNearbyPlayers()
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
|
@ -612,35 +611,8 @@ RegisterNetEvent('billing:client:showPaymentPrompt', function(data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
|
||||||
{
|
|
||||||
title = 'Später bezahlen',
|
|
||||||
description = 'Rechnung für später speichern',
|
|
||||||
icon = 'clock',
|
|
||||||
onSelect = function()
|
|
||||||
local success = lib.callback.await('billing:server:handleBillResponse', false, {
|
|
||||||
action = 'later',
|
|
||||||
billId = data.billId
|
|
||||||
})
|
|
||||||
|
|
||||||
if success then
|
|
||||||
lib.notify({
|
|
||||||
title = 'Rechnung gespeichert',
|
|
||||||
description = 'Die Rechnung wurde für später gespeichert',
|
|
||||||
type = 'info'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Notify the sender
|
|
||||||
TriggerServerEvent('billing:server:notifyBillSender', data.billId, 'later')
|
|
||||||
else
|
|
||||||
lib.notify({
|
|
||||||
title = 'Fehler',
|
|
||||||
description = 'Fehler beim Speichern der Rechnung',
|
|
||||||
type = 'error'
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
-- "Pay Later" option removed
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -692,22 +664,8 @@ RegisterNetEvent('billing:client:billResponse', function(billId, action, playerN
|
||||||
centered = true,
|
centered = true,
|
||||||
cancel = false
|
cancel = false
|
||||||
})
|
})
|
||||||
elseif action == 'later' then
|
}
|
||||||
lib.notify({
|
-- "later" case removed
|
||||||
title = 'Rechnung gespeichert',
|
|
||||||
description = playerName .. ' wird deine Rechnung später bezahlen',
|
|
||||||
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
|
|
||||||
|
|
||||||
-- Remove from pending bills
|
-- Remove from pending bills
|
||||||
pendingBills[billId] = nil
|
pendingBills[billId] = nil
|
||||||
|
|
|
@ -162,16 +162,9 @@ lib.callback.register('billing:server:handleBillResponse', function(source, data
|
||||||
-- Notify the player
|
-- Notify the player
|
||||||
TriggerClientEvent('QBCore:Notify', src, 'Du hast die Rechnung abgelehnt', 'info')
|
TriggerClientEvent('QBCore:Notify', src, 'Du hast die Rechnung abgelehnt', 'info')
|
||||||
|
|
||||||
return true
|
|
||||||
elseif data.action == 'later' then
|
|
||||||
-- Simply close the prompt without any action
|
|
||||||
-- The bill will remain in the system as unpaid
|
|
||||||
|
|
||||||
-- Notify the player
|
|
||||||
TriggerClientEvent('QBCore:Notify', src, 'Die Rechnung wurde für später gespeichert', 'info')
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
-- "later" action removed
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end)
|
end)
|
||||||
|
@ -189,7 +182,6 @@ function PayBillFromSharedAccount(source, billId, accountId)
|
||||||
|
|
||||||
local bill = billResult[1]
|
local bill = billResult[1]
|
||||||
local amount = tonumber(bill.amount)
|
local amount = tonumber(bill.amount)
|
||||||
|
|
||||||
-- Get account details
|
-- Get account details
|
||||||
local accountResult = MySQL.query.await('SELECT * FROM ps_banking_accounts WHERE id = ?', {accountId})
|
local accountResult = MySQL.query.await('SELECT * FROM ps_banking_accounts WHERE id = ?', {accountId})
|
||||||
if not accountResult or #accountResult == 0 then return false end
|
if not accountResult or #accountResult == 0 then return false end
|
||||||
|
@ -466,3 +458,5 @@ QBCore.Commands.Add('bills', 'Zeige deine unbezahlten Rechnungen an', {}, false,
|
||||||
-- This will trigger the client to open the bills menu
|
-- This will trigger the client to open the bills menu
|
||||||
TriggerClientEvent('billing:client:openBillsMenu', source)
|
TriggerClientEvent('billing:client:openBillsMenu', source)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue