2025-08-10 17:49:40 +02:00
|
|
|
|
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
|
local nearInfoPoint = false
|
|
|
|
|
local currentInfoPoint = nil
|
|
|
|
|
|
|
|
|
|
-- Blips erstellen
|
|
|
|
|
CreateThread(function()
|
|
|
|
|
for _, point in pairs(Config.InfoPoints) do
|
|
|
|
|
if point.blip.display then
|
|
|
|
|
local blip = AddBlipForCoord(point.coords.x, point.coords.y, point.coords.z)
|
|
|
|
|
SetBlipSprite(blip, point.blip.sprite)
|
|
|
|
|
SetBlipColour(blip, point.blip.color)
|
|
|
|
|
SetBlipScale(blip, point.blip.scale)
|
|
|
|
|
SetBlipAsShortRange(blip, true)
|
|
|
|
|
BeginTextCommandSetBlipName("STRING")
|
|
|
|
|
AddTextComponentString(point.name .. " - Infopoint")
|
|
|
|
|
EndTextCommandSetBlipName(blip)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- Hauptschleife für Nähe-Erkennung
|
|
|
|
|
CreateThread(function()
|
|
|
|
|
while true do
|
|
|
|
|
local sleep = 1000
|
|
|
|
|
local playerPed = PlayerPedId()
|
|
|
|
|
local playerCoords = GetEntityCoords(playerPed)
|
|
|
|
|
|
|
|
|
|
nearInfoPoint = false
|
|
|
|
|
currentInfoPoint = nil
|
|
|
|
|
|
|
|
|
|
for _, point in pairs(Config.InfoPoints) do
|
|
|
|
|
local distance = #(playerCoords - point.coords)
|
|
|
|
|
|
|
|
|
|
if distance < 2.0 then
|
|
|
|
|
nearInfoPoint = true
|
|
|
|
|
currentInfoPoint = point
|
|
|
|
|
sleep = 0
|
|
|
|
|
|
|
|
|
|
-- Draw Text anzeigen
|
|
|
|
|
lib.showTextUI('[E] - Infopoint öffnen\n' .. point.name, {
|
|
|
|
|
position = "top-center",
|
|
|
|
|
icon = 'info-circle'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- E-Taste abfragen
|
|
|
|
|
if IsControlJustPressed(0, 38) then -- E
|
|
|
|
|
openInfoPointMenu()
|
|
|
|
|
end
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if not nearInfoPoint then
|
|
|
|
|
lib.hideTextUI()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Wait(sleep)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- Infopoint Menü öffnen
|
|
|
|
|
function openInfoPointMenu()
|
|
|
|
|
local PlayerData = QBCore.Functions.GetPlayerData()
|
|
|
|
|
local job = PlayerData.job.name
|
|
|
|
|
local jobPermissions = Config.JobPermissions.jobSpecificInfo[job] or {}
|
|
|
|
|
|
|
|
|
|
local menuOptions = {
|
|
|
|
|
{
|
|
|
|
|
title = 'Events anzeigen',
|
|
|
|
|
description = 'Aktuelle Events und Veranstaltungen',
|
|
|
|
|
icon = 'calendar',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showEvents()
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Event erstellen (nur für berechtigte Jobs)
|
|
|
|
|
local canCreateEvents = false
|
|
|
|
|
for _, allowedJob in pairs(Config.JobPermissions.canCreateEvents) do
|
|
|
|
|
if job == allowedJob then
|
|
|
|
|
canCreateEvents = true
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if canCreateEvents then
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = 'Event erstellen',
|
|
|
|
|
description = 'Neues Event oder Veranstaltung erstellen',
|
|
|
|
|
icon = 'plus',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
createEventDialog()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = 'Job-Angebot erstellen',
|
|
|
|
|
description = 'Neues Job-Angebot veröffentlichen',
|
|
|
|
|
icon = 'briefcase',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
createJobOfferDialog()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Vorfall melden (für alle oder spezifische Jobs)
|
|
|
|
|
if Config.JobPermissions.canReportIncidents == 'all' or
|
|
|
|
|
(type(Config.JobPermissions.canReportIncidents) == 'table' and
|
|
|
|
|
table.contains(Config.JobPermissions.canReportIncidents, job)) then
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = 'Vorfall melden',
|
|
|
|
|
description = 'Einen Vorfall an die Behörden melden',
|
|
|
|
|
icon = 'exclamation-triangle',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
reportIncidentDialog()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Job-spezifische Optionen
|
|
|
|
|
if jobPermissions.showIncidents then
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = 'Vorfälle anzeigen',
|
|
|
|
|
description = 'Gemeldete Vorfälle einsehen',
|
|
|
|
|
icon = 'list',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showIncidents()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if jobPermissions.showJobOffers then
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = 'Job-Angebote',
|
|
|
|
|
description = 'Verfügbare Job-Angebote anzeigen',
|
|
|
|
|
icon = 'briefcase',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showJobOffers()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if jobPermissions.showLicenseInfo then
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = 'Lizenz Informationen',
|
2025-08-10 18:08:36 +02:00
|
|
|
|
description = jobPermissions.canManageLicenses and 'Lizenz-Informationen anzeigen und verwalten' or 'Informationen zu verfügbaren Lizenzen',
|
2025-08-10 17:49:40 +02:00
|
|
|
|
icon = 'id-card',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showLicenseInfo()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
|
id = 'infopoint_main',
|
|
|
|
|
title = currentInfoPoint.name .. ' - Infopoint',
|
|
|
|
|
options = menuOptions
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.showContext('infopoint_main')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Events anzeigen
|
|
|
|
|
function showEvents()
|
|
|
|
|
QBCore.Functions.TriggerCallback('infopoint:getEvents', function(events)
|
|
|
|
|
local eventOptions = {}
|
|
|
|
|
|
|
|
|
|
if #events == 0 then
|
|
|
|
|
table.insert(eventOptions, {
|
|
|
|
|
title = 'Keine Events verfügbar',
|
|
|
|
|
description = 'Derzeit sind keine Events geplant',
|
|
|
|
|
icon = 'info'
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
for _, event in pairs(events) do
|
|
|
|
|
local eventDate = event.event_date and os.date('%d.%m.%Y %H:%M', os.time({
|
|
|
|
|
year = tonumber(string.sub(event.event_date, 1, 4)),
|
|
|
|
|
month = tonumber(string.sub(event.event_date, 6, 7)),
|
|
|
|
|
day = tonumber(string.sub(event.event_date, 9, 10)),
|
|
|
|
|
hour = tonumber(string.sub(event.event_date, 12, 13)),
|
|
|
|
|
min = tonumber(string.sub(event.event_date, 15, 16))
|
|
|
|
|
})) or 'Kein Datum'
|
|
|
|
|
|
|
|
|
|
table.insert(eventOptions, {
|
|
|
|
|
title = event.title,
|
|
|
|
|
description = 'Datum: ' .. eventDate .. '\nOrt: ' .. (event.location or 'Nicht angegeben') .. '\nErstellt von: ' .. event.created_by_name,
|
|
|
|
|
icon = 'calendar',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showEventDetails(event)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.insert(eventOptions, {
|
|
|
|
|
title = '← Zurück',
|
|
|
|
|
icon = 'arrow-left',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
openInfoPointMenu()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
|
id = 'infopoint_events',
|
|
|
|
|
title = 'Events & Veranstaltungen',
|
|
|
|
|
options = eventOptions
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.showContext('infopoint_events')
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Event Details anzeigen
|
|
|
|
|
function showEventDetails(event)
|
|
|
|
|
local eventDate = event.event_date and os.date('%d.%m.%Y %H:%M', os.time({
|
|
|
|
|
year = tonumber(string.sub(event.event_date, 1, 4)),
|
|
|
|
|
month = tonumber(string.sub(event.event_date, 6, 7)),
|
|
|
|
|
day = tonumber(string.sub(event.event_date, 9, 10)),
|
|
|
|
|
hour = tonumber(string.sub(event.event_date, 12, 13)),
|
|
|
|
|
min = tonumber(string.sub(event.event_date, 15, 16))
|
|
|
|
|
})) or 'Kein Datum'
|
|
|
|
|
|
|
|
|
|
lib.alertDialog({
|
|
|
|
|
header = event.title,
|
|
|
|
|
content = 'Kategorie: ' .. (event.category or 'Keine') .. '\n\n' ..
|
|
|
|
|
'Datum: ' .. eventDate .. '\n\n' ..
|
|
|
|
|
'Ort: ' .. (event.location or 'Nicht angegeben') .. '\n\n' ..
|
|
|
|
|
'Beschreibung:\n' .. (event.description or 'Keine Beschreibung verfügbar') .. '\n\n' ..
|
|
|
|
|
'Erstellt von: ' .. event.created_by_name,
|
|
|
|
|
centered = true,
|
|
|
|
|
cancel = true
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Event erstellen Dialog
|
|
|
|
|
function createEventDialog()
|
2025-08-10 18:08:36 +02:00
|
|
|
|
local categoryOptions = {}
|
|
|
|
|
for _, category in pairs(Config.EventCategories) do
|
|
|
|
|
table.insert(categoryOptions, {value = category, label = category})
|
|
|
|
|
end
|
|
|
|
|
|
2025-08-10 17:49:40 +02:00
|
|
|
|
local input = lib.inputDialog('Event erstellen', {
|
|
|
|
|
{type = 'input', label = 'Titel', required = true, max = 100},
|
|
|
|
|
{type = 'textarea', label = 'Beschreibung', max = 500},
|
2025-08-10 18:08:36 +02:00
|
|
|
|
{type = 'select', label = 'Kategorie', options = categoryOptions, required = true},
|
2025-08-10 17:49:40 +02:00
|
|
|
|
{type = 'input', label = 'Ort', max = 100},
|
|
|
|
|
{type = 'date', label = 'Datum', required = true},
|
|
|
|
|
{type = 'time', label = 'Uhrzeit', required = true}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if input then
|
|
|
|
|
local eventData = {
|
|
|
|
|
title = input[1],
|
|
|
|
|
description = input[2],
|
|
|
|
|
category = input[3],
|
|
|
|
|
location = input[4],
|
|
|
|
|
date = input[5] .. ' ' .. input[6] .. ':00'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TriggerServerEvent('infopoint:createEvent', eventData)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Vorfälle anzeigen
|
|
|
|
|
function showIncidents()
|
|
|
|
|
QBCore.Functions.TriggerCallback('infopoint:getIncidents', function(incidents)
|
|
|
|
|
local incidentOptions = {}
|
|
|
|
|
|
|
|
|
|
if #incidents == 0 then
|
|
|
|
|
table.insert(incidentOptions, {
|
|
|
|
|
title = 'Keine Vorfälle',
|
|
|
|
|
description = 'Derzeit sind keine Vorfälle gemeldet',
|
|
|
|
|
icon = 'info'
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
for _, incident in pairs(incidents) do
|
|
|
|
|
local statusColor = incident.status == 'open' and '🔴' or '🟢'
|
|
|
|
|
local createdDate = os.date('%d.%m.%Y %H:%M', os.time({
|
|
|
|
|
year = tonumber(string.sub(incident.created_at, 1, 4)),
|
|
|
|
|
month = tonumber(string.sub(incident.created_at, 6, 7)),
|
|
|
|
|
day = tonumber(string.sub(incident.created_at, 9, 10)),
|
|
|
|
|
hour = tonumber(string.sub(incident.created_at, 12, 13)),
|
|
|
|
|
min = tonumber(string.sub(incident.created_at, 15, 16))
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
table.insert(incidentOptions, {
|
|
|
|
|
title = statusColor .. ' ' .. incident.title,
|
|
|
|
|
description = 'Gemeldet: ' .. createdDate .. '\nOrt: ' .. (incident.location or 'Nicht angegeben') .. '\nStatus: ' .. incident.status,
|
|
|
|
|
icon = 'exclamation-triangle',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showIncidentDetails(incident)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.insert(incidentOptions, {
|
|
|
|
|
title = '← Zurück',
|
|
|
|
|
icon = 'arrow-left',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
openInfoPointMenu()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
|
id = 'infopoint_incidents',
|
|
|
|
|
title = 'Gemeldete Vorfälle',
|
|
|
|
|
options = incidentOptions
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.showContext('infopoint_incidents')
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Vorfall Details anzeigen
|
|
|
|
|
function showIncidentDetails(incident)
|
|
|
|
|
local createdDate = os.date('%d.%m.%Y %H:%M', os.time({
|
|
|
|
|
year = tonumber(string.sub(incident.created_at, 1, 4)),
|
|
|
|
|
month = tonumber(string.sub(incident.created_at, 6, 7)),
|
|
|
|
|
day = tonumber(string.sub(incident.created_at, 9, 10)),
|
|
|
|
|
hour = tonumber(string.sub(incident.created_at, 12, 13)),
|
|
|
|
|
min = tonumber(string.sub(incident.created_at, 15, 16))
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
lib.alertDialog({
|
|
|
|
|
header = incident.title,
|
|
|
|
|
content = 'Kategorie: ' .. (incident.category or 'Keine') .. '\n\n' ..
|
|
|
|
|
'Gemeldet am: ' .. createdDate .. '\n\n' ..
|
|
|
|
|
'Ort: ' .. (incident.location or 'Nicht angegeben') .. '\n\n' ..
|
|
|
|
|
'Status: ' .. incident.status .. '\n\n' ..
|
|
|
|
|
'Beschreibung:\n' .. (incident.description or 'Keine Beschreibung verfügbar') .. '\n\n' ..
|
|
|
|
|
'Gemeldet von: ' .. incident.reported_by_name,
|
|
|
|
|
centered = true,
|
|
|
|
|
cancel = true
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Vorfall melden Dialog
|
|
|
|
|
function reportIncidentDialog()
|
2025-08-10 18:08:36 +02:00
|
|
|
|
local categoryOptions = {}
|
|
|
|
|
for _, category in pairs(Config.IncidentCategories) do
|
|
|
|
|
table.insert(categoryOptions, {value = category, label = category})
|
|
|
|
|
end
|
|
|
|
|
|
2025-08-10 17:49:40 +02:00
|
|
|
|
local input = lib.inputDialog('Vorfall melden', {
|
|
|
|
|
{type = 'input', label = 'Titel', required = true, max = 100},
|
|
|
|
|
{type = 'textarea', label = 'Beschreibung', required = true, max = 500},
|
2025-08-10 18:08:36 +02:00
|
|
|
|
{type = 'select', label = 'Kategorie', options = categoryOptions, required = true},
|
2025-08-10 17:49:40 +02:00
|
|
|
|
{type = 'input', label = 'Ort', max = 100}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if input then
|
|
|
|
|
local incidentData = {
|
|
|
|
|
title = input[1],
|
|
|
|
|
description = input[2],
|
|
|
|
|
category = input[3],
|
|
|
|
|
location = input[4]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TriggerServerEvent('infopoint:reportIncident', incidentData)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Job-Angebote anzeigen
|
|
|
|
|
function showJobOffers()
|
|
|
|
|
local PlayerData = QBCore.Functions.GetPlayerData()
|
|
|
|
|
local job = PlayerData.job.name
|
|
|
|
|
|
|
|
|
|
QBCore.Functions.TriggerCallback('infopoint:getJobOffers', function(offers)
|
|
|
|
|
local offerOptions = {}
|
|
|
|
|
|
|
|
|
|
if #offers == 0 then
|
|
|
|
|
table.insert(offerOptions, {
|
|
|
|
|
title = 'Keine Job-Angebote',
|
|
|
|
|
description = 'Derzeit sind keine Job-Angebote verfügbar',
|
|
|
|
|
icon = 'info'
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
for _, offer in pairs(offers) do
|
|
|
|
|
table.insert(offerOptions, {
|
|
|
|
|
title = offer.title,
|
|
|
|
|
description = 'Job: ' .. offer.job_name .. '\nGehalt: ' .. (offer.salary or 'Verhandelbar') .. '\nKontakt: ' .. (offer.contact or 'Nicht angegeben'),
|
|
|
|
|
icon = 'briefcase',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showJobOfferDetails(offer)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.insert(offerOptions, {
|
|
|
|
|
title = '← Zurück',
|
|
|
|
|
icon = 'arrow-left',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
openInfoPointMenu()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
|
id = 'infopoint_job_offers',
|
|
|
|
|
title = 'Job-Angebote',
|
|
|
|
|
options = offerOptions
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.showContext('infopoint_job_offers')
|
2025-08-10 18:08:36 +02:00
|
|
|
|
end, job)
|
2025-08-10 17:49:40 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Job-Angebot Details anzeigen
|
|
|
|
|
function showJobOfferDetails(offer)
|
2025-08-10 18:08:36 +02:00
|
|
|
|
local createdDate = os.date('%d.%m.%Y %H:%M', os.time({
|
|
|
|
|
year = tonumber(string.sub(offer.created_at, 1, 4)),
|
|
|
|
|
month = tonumber(string.sub(offer.created_at, 6, 7)),
|
|
|
|
|
day = tonumber(string.sub(offer.created_at, 9, 10)),
|
|
|
|
|
hour = tonumber(string.sub(offer.created_at, 12, 13)),
|
|
|
|
|
min = tonumber(string.sub(offer.created_at, 15, 16))
|
|
|
|
|
}))
|
|
|
|
|
|
2025-08-10 17:49:40 +02:00
|
|
|
|
lib.alertDialog({
|
|
|
|
|
header = offer.title,
|
|
|
|
|
content = 'Job: ' .. offer.job_name .. '\n\n' ..
|
|
|
|
|
'Gehalt: ' .. (offer.salary or 'Verhandelbar') .. '\n\n' ..
|
|
|
|
|
'Kontakt: ' .. (offer.contact or 'Nicht angegeben') .. '\n\n' ..
|
2025-08-10 18:08:36 +02:00
|
|
|
|
'Erstellt am: ' .. createdDate .. '\n\n' ..
|
2025-08-10 17:49:40 +02:00
|
|
|
|
'Anforderungen:\n' .. (offer.requirements or 'Keine besonderen Anforderungen') .. '\n\n' ..
|
|
|
|
|
'Beschreibung:\n' .. (offer.description or 'Keine Beschreibung verfügbar'),
|
|
|
|
|
centered = true,
|
|
|
|
|
cancel = true
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Job-Angebot erstellen Dialog
|
|
|
|
|
function createJobOfferDialog()
|
|
|
|
|
local input = lib.inputDialog('Job-Angebot erstellen', {
|
|
|
|
|
{type = 'input', label = 'Titel', required = true, max = 100},
|
|
|
|
|
{type = 'textarea', label = 'Beschreibung', max = 500},
|
|
|
|
|
{type = 'textarea', label = 'Anforderungen', max = 300},
|
2025-08-10 18:08:36 +02:00
|
|
|
|
{type = 'input', label = 'Gehalt', placeholder = 'z.B. $2500/Woche', max = 50},
|
|
|
|
|
{type = 'input', label = 'Kontakt', placeholder = 'Telefonnummer oder Name', max = 100}
|
2025-08-10 17:49:40 +02:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if input then
|
|
|
|
|
local jobData = {
|
|
|
|
|
title = input[1],
|
|
|
|
|
description = input[2],
|
|
|
|
|
requirements = input[3],
|
|
|
|
|
salary = input[4],
|
|
|
|
|
contact = input[5]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TriggerServerEvent('infopoint:createJobOffer', jobData)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Lizenz Informationen anzeigen
|
|
|
|
|
function showLicenseInfo()
|
|
|
|
|
QBCore.Functions.TriggerCallback('infopoint:getLicenseInfo', function(licenses)
|
2025-08-10 18:08:36 +02:00
|
|
|
|
QBCore.Functions.TriggerCallback('infopoint:canManageLicenses', function(canManage)
|
|
|
|
|
local licenseOptions = {}
|
|
|
|
|
|
|
|
|
|
if #licenses == 0 then
|
|
|
|
|
table.insert(licenseOptions, {
|
|
|
|
|
title = 'Keine Lizenz-Informationen verfügbar',
|
|
|
|
|
description = 'Derzeit sind keine Lizenz-Informationen hinterlegt',
|
|
|
|
|
icon = 'info'
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
for _, license in pairs(licenses) do
|
|
|
|
|
table.insert(licenseOptions, {
|
|
|
|
|
title = license.license_type,
|
|
|
|
|
description = 'Preis: ' .. (license.price or 'Nicht angegeben') .. '\nBearbeitungszeit: ' .. (license.processing_time or 'Nicht angegeben'),
|
|
|
|
|
icon = 'id-card',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showLicenseDetails(license, canManage)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Management-Optionen für berechtigte Jobs
|
|
|
|
|
if canManage then
|
|
|
|
|
table.insert(licenseOptions, {
|
|
|
|
|
title = '➕ Neue Lizenz-Information hinzufügen',
|
|
|
|
|
description = 'Neue Lizenz-Information erstellen',
|
|
|
|
|
icon = 'plus',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
createLicenseInfoDialog()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
2025-08-10 17:49:40 +02:00
|
|
|
|
table.insert(licenseOptions, {
|
2025-08-10 18:08:36 +02:00
|
|
|
|
title = '← Zurück',
|
|
|
|
|
icon = 'arrow-left',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
openInfoPointMenu()
|
|
|
|
|
end
|
2025-08-10 17:49:40 +02:00
|
|
|
|
})
|
2025-08-10 18:08:36 +02:00
|
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
|
id = 'infopoint_licenses',
|
|
|
|
|
title = 'Lizenz Informationen',
|
|
|
|
|
options = licenseOptions
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.showContext('infopoint_licenses')
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Lizenz Details anzeigen
|
|
|
|
|
function showLicenseDetails(license, canManage)
|
|
|
|
|
local menuOptions = {
|
|
|
|
|
{
|
|
|
|
|
title = 'Details anzeigen',
|
|
|
|
|
description = 'Vollständige Informationen anzeigen',
|
|
|
|
|
icon = 'info',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
lib.alertDialog({
|
|
|
|
|
header = license.license_type,
|
|
|
|
|
content = 'Preis: ' .. (license.price or 'Nicht angegeben') .. '\n\n' ..
|
|
|
|
|
'Bearbeitungszeit: ' .. (license.processing_time or 'Nicht angegeben') .. '\n\n' ..
|
|
|
|
|
'Gültigkeitsdauer: ' .. (license.valid_duration or 'Nicht angegeben') .. '\n\n' ..
|
|
|
|
|
'Anforderungen:\n' .. (license.requirements or 'Keine Anforderungen angegeben') .. '\n\n' ..
|
|
|
|
|
'Beschreibung:\n' .. (license.description or 'Keine Beschreibung verfügbar'),
|
|
|
|
|
centered = true,
|
|
|
|
|
cancel = true
|
2025-08-10 17:49:40 +02:00
|
|
|
|
})
|
|
|
|
|
end
|
2025-08-10 18:08:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if canManage then
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = '✏️ Bearbeiten',
|
|
|
|
|
description = 'Lizenz-Information bearbeiten',
|
|
|
|
|
icon = 'edit',
|
2025-08-10 17:49:40 +02:00
|
|
|
|
onSelect = function()
|
2025-08-10 18:08:36 +02:00
|
|
|
|
editLicenseInfoDialog(license)
|
2025-08-10 17:49:40 +02:00
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
2025-08-10 18:08:36 +02:00
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = '🗑️ Löschen',
|
|
|
|
|
description = 'Lizenz-Information löschen',
|
|
|
|
|
icon = 'trash',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
lib.alertDialog({
|
|
|
|
|
header = 'Lizenz-Information löschen',
|
|
|
|
|
content = 'Bist du sicher, dass du die Lizenz-Information für "' .. license.license_type .. '" löschen möchtest?',
|
|
|
|
|
centered = true,
|
|
|
|
|
cancel = true,
|
|
|
|
|
labels = {
|
|
|
|
|
cancel = 'Abbrechen',
|
|
|
|
|
confirm = 'Löschen'
|
|
|
|
|
}
|
|
|
|
|
}, function(confirmed)
|
|
|
|
|
if confirmed then
|
|
|
|
|
TriggerServerEvent('infopoint:deleteLicenseInfo', license.id)
|
|
|
|
|
Wait(500)
|
|
|
|
|
showLicenseInfo() -- Zurück zur Übersicht
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
2025-08-10 17:49:40 +02:00
|
|
|
|
})
|
2025-08-10 18:08:36 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.insert(menuOptions, {
|
|
|
|
|
title = '← Zurück',
|
|
|
|
|
icon = 'arrow-left',
|
|
|
|
|
onSelect = function()
|
|
|
|
|
showLicenseInfo()
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
|
id = 'license_details',
|
|
|
|
|
title = license.license_type,
|
|
|
|
|
options = menuOptions
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
lib.showContext('license_details')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Lizenz-Information erstellen Dialog
|
|
|
|
|
function createLicenseInfoDialog()
|
|
|
|
|
local licenseTypeOptions = {}
|
|
|
|
|
for _, licenseType in pairs(Config.DefaultLicenseTypes) do
|
|
|
|
|
table.insert(licenseTypeOptions, {value = licenseType, label = licenseType})
|
|
|
|
|
end
|
|
|
|
|
table.insert(licenseTypeOptions, {value = 'custom', label = 'Benutzerdefiniert'})
|
|
|
|
|
|
|
|
|
|
local input = lib.inputDialog('Lizenz-Information erstellen', {
|
|
|
|
|
{type = 'select', label = 'Lizenz-Typ', options = licenseTypeOptions, required = true},
|
|
|
|
|
{type = 'input', label = 'Benutzerdefinierter Typ (falls ausgewählt)', max = 100},
|
|
|
|
|
{type = 'input', label = 'Preis', placeholder = 'z.B. $500', max = 50},
|
|
|
|
|
{type = 'textarea', label = 'Anforderungen', max = 500},
|
|
|
|
|
{type = 'textarea', label = 'Beschreibung', max = 500},
|
|
|
|
|
{type = 'input', label = 'Bearbeitungszeit', placeholder = 'z.B. 1-2 Werktage', max = 100},
|
|
|
|
|
{type = 'input', label = 'Gültigkeitsdauer', placeholder = 'z.B. 5 Jahre', max = 100}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if input then
|
|
|
|
|
local licenseType = input[1] == 'custom' and input[2] or input[1]
|
2025-08-10 17:49:40 +02:00
|
|
|
|
|
2025-08-10 18:08:36 +02:00
|
|
|
|
if not licenseType or licenseType == '' then
|
|
|
|
|
QBCore.Functions.Notify('Bitte gib einen Lizenz-Typ an!', 'error')
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local licenseData = {
|
|
|
|
|
license_type = licenseType,
|
|
|
|
|
price = input[3],
|
|
|
|
|
requirements = input[4],
|
|
|
|
|
description = input[5],
|
|
|
|
|
processing_time = input[6],
|
|
|
|
|
valid_duration = input[7]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TriggerServerEvent('infopoint:createLicenseInfo', licenseData)
|
|
|
|
|
Wait(500)
|
|
|
|
|
showLicenseInfo() -- Zurück zur Übersicht
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Lizenz-Information bearbeiten Dialog
|
|
|
|
|
function editLicenseInfoDialog(license)
|
|
|
|
|
local licenseTypeOptions = {}
|
|
|
|
|
for _, licenseType in pairs(Config.DefaultLicenseTypes) do
|
|
|
|
|
table.insert(licenseTypeOptions, {value = licenseType, label = licenseType})
|
|
|
|
|
end
|
|
|
|
|
table.insert(licenseTypeOptions, {value = 'custom', label = 'Benutzerdefiniert'})
|
|
|
|
|
|
|
|
|
|
local input = lib.inputDialog('Lizenz-Information bearbeiten', {
|
|
|
|
|
{type = 'select', label = 'Lizenz-Typ', options = licenseTypeOptions, required = true, default = license.license_type},
|
|
|
|
|
{type = 'input', label = 'Benutzerdefinierter Typ (falls ausgewählt)', max = 100},
|
|
|
|
|
{type = 'input', label = 'Preis', placeholder = 'z.B. $500', max = 50, default = license.price},
|
|
|
|
|
{type = 'textarea', label = 'Anforderungen', max = 500, default = license.requirements},
|
|
|
|
|
{type = 'textarea', label = 'Beschreibung', max = 500, default = license.description},
|
|
|
|
|
{type = 'input', label = 'Bearbeitungszeit', placeholder = 'z.B. 1-2 Werktage', max = 100, default = license.processing_time},
|
|
|
|
|
{type = 'input', label = 'Gültigkeitsdauer', placeholder = 'z.B. 5 Jahre', max = 100, default = license.valid_duration}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if input then
|
|
|
|
|
local licenseType = input[1] == 'custom' and input[2] or input[1]
|
|
|
|
|
|
|
|
|
|
if not licenseType or licenseType == '' then
|
|
|
|
|
QBCore.Functions.Notify('Bitte gib einen Lizenz-Typ an!', 'error')
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local licenseData = {
|
|
|
|
|
license_type = licenseType,
|
|
|
|
|
price = input[3],
|
|
|
|
|
requirements = input[4],
|
|
|
|
|
description = input[5],
|
|
|
|
|
processing_time = input[6],
|
|
|
|
|
valid_duration = input[7]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TriggerServerEvent('infopoint:updateLicenseInfo', license.id, licenseData)
|
|
|
|
|
Wait(500)
|
|
|
|
|
showLicenseInfo() -- Zurück zur Übersicht
|
|
|
|
|
end
|
2025-08-10 17:49:40 +02:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Hilfsfunktion für table.contains
|
|
|
|
|
function table.contains(table, element)
|
|
|
|
|
for _, value in pairs(table) do
|
|
|
|
|
if value == element then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
2025-08-10 18:08:36 +02:00
|
|
|
|
-- Event für Daten-Refresh
|
2025-08-10 17:49:40 +02:00
|
|
|
|
RegisterNetEvent('infopoint:refreshData', function()
|
2025-08-10 18:08:36 +02:00
|
|
|
|
-- Hier könnten wir bei Bedarf Daten neu laden
|
2025-08-10 17:49:40 +02:00
|
|
|
|
end)
|
2025-08-10 18:08:36 +02:00
|
|
|
|
|