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 }, { title = 'Allgemeine Informationen', description = 'Wichtige Bekanntmachungen und Hinweise', icon = 'bullhorn', onSelect = function() showGeneralInfo() 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 -- Option to post general information (only for authorized jobs) local canPostInfo = false for _, allowedJob in pairs(Config.JobPermissions.canPostGeneralInfo) do if job == allowedJob then canPostInfo = true break end end if canPostInfo then table.insert(menuOptions, { title = 'Information veröffentlichen', description = 'Neue allgemeine Information erstellen', icon = 'pen', onSelect = function() createGeneralInfoDialog() 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', description = jobPermissions.canManageLicenses and 'Lizenz-Informationen anzeigen und verwalten' or 'Informationen zu verfügbaren Lizenzen', 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() local categoryOptions = {} for _, category in pairs(Config.EventCategories) do table.insert(categoryOptions, {value = category, label = category}) end local input = lib.inputDialog('Event erstellen', { {type = 'input', label = 'Titel', required = true, max = 100}, {type = 'textarea', label = 'Beschreibung', max = 500}, {type = 'select', label = 'Kategorie', options = categoryOptions, required = true}, {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() local categoryOptions = {} for _, category in pairs(Config.IncidentCategories) do table.insert(categoryOptions, {value = category, label = category}) end local input = lib.inputDialog('Vorfall melden', { {type = 'input', label = 'Titel', required = true, max = 100}, {type = 'textarea', label = 'Beschreibung', required = true, max = 500}, {type = 'select', label = 'Kategorie', options = categoryOptions, required = true}, {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') end, job) end -- Job-Angebot Details anzeigen function showJobOfferDetails(offer) 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)) })) 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' .. 'Erstellt am: ' .. createdDate .. '\n\n' .. '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}, {type = 'input', label = 'Gehalt', placeholder = 'z.B. $2500/Woche', max = 50}, {type = 'input', label = 'Kontakt', placeholder = 'Telefonnummer oder Name', max = 100} }) 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) 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 table.insert(licenseOptions, { title = '← Zurück', icon = 'arrow-left', onSelect = function() openInfoPointMenu() end }) 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 }) end } } if canManage then table.insert(menuOptions, { title = '✏️ Bearbeiten', description = 'Lizenz-Information bearbeiten', icon = 'edit', onSelect = function() editLicenseInfoDialog(license) end }) 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 }) 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] 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 end -- Show general information function showGeneralInfo() QBCore.Functions.TriggerCallback('infopoint:getGeneralInfo', function(infoList) local infoOptions = {} if #infoList == 0 then table.insert(infoOptions, { title = 'Keine Informationen verfügbar', description = 'Derzeit sind keine allgemeinen Informationen vorhanden', icon = 'info' }) else for _, info in pairs(infoList) do local importanceIcon = '📄' if info.importance == 'high' then importanceIcon = '🔴' elseif info.importance == 'medium' then importanceIcon = '🟠' end local createdDate = os.date('%d.%m.%Y', os.time({ year = tonumber(string.sub(info.created_at, 1, 4)), month = tonumber(string.sub(info.created_at, 6, 7)), day = tonumber(string.sub(info.created_at, 9, 10)) })) table.insert(infoOptions, { title = importanceIcon .. ' ' .. info.title, description = 'Kategorie: ' .. info.category .. ' | Erstellt: ' .. createdDate, icon = 'bullhorn', onSelect = function() showGeneralInfoDetails(info) end }) end end table.insert(infoOptions, { title = '← Zurück', icon = 'arrow-left', onSelect = function() openInfoPointMenu() end }) lib.registerContext({ id = 'infopoint_general_info', title = 'Allgemeine Informationen', options = infoOptions }) lib.showContext('infopoint_general_info') end) end -- Show general information details function showGeneralInfoDetails(info) local PlayerData = QBCore.Functions.GetPlayerData() local canManage = false -- Check if player can manage this info (created by them or has management rights) if PlayerData.citizenid == info.created_by then canManage = true end -- Check if player has permission to post general info (they can also manage) local job = PlayerData.job.name for _, allowedJob in pairs(Config.JobPermissions.canPostGeneralInfo) do if job == allowedJob then canManage = true break end end -- If they can manage, show management options if canManage then local options = { { title = 'Information anzeigen', description = 'Details der Information anzeigen', icon = 'eye', onSelect = function() showInfoContent(info) end }, { title = '✏️ Bearbeiten', description = 'Information bearbeiten', icon = 'edit', onSelect = function() editGeneralInfoDialog(info) end }, { title = '🗑️ Löschen', description = 'Information löschen', icon = 'trash', onSelect = function() deleteGeneralInfo(info.id) end }, { title = '← Zurück', icon = 'arrow-left', onSelect = function() showGeneralInfo() end } } lib.registerContext({ id = 'general_info_management', title = info.title, options = options }) lib.showContext('general_info_management') return end -- If they can't manage, just show the content showInfoContent(info) end -- Function to show just the content function showInfoContent(info) local createdDate = os.date('%d.%m.%Y', os.time({ year = tonumber(string.sub(info.created_at, 1, 4)), month = tonumber(string.sub(info.created_at, 6, 7)), day = tonumber(string.sub(info.created_at, 9, 10)) })) local expiryInfo = '' if info.expires_at then local expiryDate = os.date('%d.%m.%Y', os.time({ year = tonumber(string.sub(info.expires_at, 1, 4)), month = tonumber(string.sub(info.expires_at, 6, 7)), day = tonumber(string.sub(info.expires_at, 9, 10)) })) expiryInfo = 'Gültig bis: ' .. expiryDate .. '\n\n' end local importanceText = 'Normal' if info.importance == 'high' then importanceText = 'Hoch' elseif info.importance == 'medium' then importanceText = 'Mittel' end lib.alertDialog({ header = info.title, content = 'Kategorie: ' .. info.category .. '\n\n' .. 'Wichtigkeit: ' .. importanceText .. '\n\n' .. 'Erstellt am: ' .. createdDate .. '\n\n' .. expiryInfo .. 'Inhalt:\n' .. info.content .. '\n\n' .. 'Veröffentlicht von: ' .. info.created_by_name .. ' (' .. info.created_by_job .. ')', centered = true, cancel = true }) end -- Create general information dialog function createGeneralInfoDialog() local categoryOptions = {} for _, category in pairs(Config.GeneralInfoCategories) do table.insert(categoryOptions, {value = category, label = category}) end local importanceOptions = { {value = 'normal', label = 'Normal'}, {value = 'medium', label = 'Mittel'}, {value = 'high', label = 'Hoch'} } local input = lib.inputDialog('Information veröffentlichen', { {type = 'input', label = 'Titel', required = true, max = 100}, {type = 'textarea', label = 'Inhalt', required = true, max = 1000}, {type = 'select', label = 'Kategorie', options = categoryOptions, required = true}, {type = 'select', label = 'Wichtigkeit', options = importanceOptions, default = 'normal'}, {type = 'date', label = 'Gültig bis (optional)'} }) if input then local infoData = { title = input[1], content = input[2], category = input[3], importance = input[4], expires_at = input[5] ~= '' and input[5] or nil } TriggerServerEvent('infopoint:createGeneralInfo', infoData) end end -- Function to edit general info function editGeneralInfoDialog(info) local categoryOptions = {} for _, category in pairs(Config.GeneralInfoCategories) do table.insert(categoryOptions, {value = category, label = category}) end local importanceOptions = { {value = 'normal', label = 'Normal'}, {value = 'medium', label = 'Mittel'}, {value = 'high', label = 'Hoch'} } local expiryDate = nil if info.expires_at then expiryDate = string.sub(info.expires_at, 1, 10) end local input = lib.inputDialog('Information bearbeiten', { {type = 'input', label = 'Titel', required = true, max = 100, default = info.title}, {type = 'textarea', label = 'Inhalt', required = true, max = 1000, default = info.content}, {type = 'select', label = 'Kategorie', options = categoryOptions, required = true, default = info.category}, {type = 'select', label = 'Wichtigkeit', options = importanceOptions, default = info.importance}, {type = 'date', label = 'Gültig bis (optional)', default = expiryDate} }) if input then local infoData = { title = input[1], content = input[2], category = input[3], importance = input[4], expires_at = input[5] ~= '' and input[5] or nil } TriggerServerEvent('infopoint:updateGeneralInfo', info.id, infoData) end end -- Function to delete general info function deleteGeneralInfo(infoId) lib.alertDialog({ header = 'Information löschen', content = 'Bist du sicher, dass du diese Information löschen möchtest?', centered = true, cancel = true, labels = { cancel = 'Abbrechen', confirm = 'Löschen' } }, function(confirmed) if confirmed then TriggerServerEvent('infopoint:deleteGeneralInfo', infoId) Wait(500) showGeneralInfo() -- Back to overview end end) 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 -- Event für Daten-Refresh RegisterNetEvent('infopoint:refreshData', function() -- Hier könnten wir bei Bedarf Daten neu laden end)