ed
This commit is contained in:
parent
05be118a84
commit
2f2d0b1103
3 changed files with 60 additions and 142 deletions
|
@ -425,10 +425,17 @@ openRevokeLicenseMenu = function(targetId, targetName, licenses)
|
|||
lib.showContext('revoke_license')
|
||||
end
|
||||
|
||||
-- Manual License Entry Menu
|
||||
-- Manual License Entry Menu (Vollständig manuell)
|
||||
openManualLicenseEntry = function(targetId, targetName)
|
||||
debugPrint("Öffne manuelle Lizenz-Eingabe für: " .. targetName)
|
||||
|
||||
-- Aktuelles Datum für Standardwerte
|
||||
local currentDate = os.date("%d.%m.%Y")
|
||||
|
||||
-- Berechne Standardablaufdatum (1 Jahr später)
|
||||
local day, month, year = currentDate:match("(%d+)%.(%d+)%.(%d+)")
|
||||
local defaultExpireDate = day .. "." .. month .. "." .. (tonumber(year) + 1)
|
||||
|
||||
local input = lib.inputDialog('Lizenz manuell ausstellen', {
|
||||
{type = 'select', label = 'Lizenztyp', options = getLicenseTypeOptions()},
|
||||
{type = 'input', label = 'Name', default = targetName},
|
||||
|
@ -438,30 +445,44 @@ openManualLicenseEntry = function(targetId, targetName)
|
|||
{value = 'female', label = 'Weiblich'},
|
||||
{value = 'other', label = 'Divers'}
|
||||
}},
|
||||
{type = 'date', label = 'Ausstellungsdatum', default = os.date("%Y-%m-%d")},
|
||||
{type = 'date', label = 'Ablaufdatum', default = os.date("%Y-%m-%d", os.time() + 365*24*60*60)},
|
||||
{type = 'input', label = 'Ausstellungsdatum', description = 'Format: DD.MM.YYYY', default = currentDate},
|
||||
{type = 'input', label = 'Ablaufdatum', description = 'Format: DD.MM.YYYY', default = defaultExpireDate},
|
||||
{type = 'input', label = 'Klassen (kommagetrennt)', description = 'z.B. A,B,C', default = ''},
|
||||
{type = 'input', label = 'Bemerkungen', default = ''},
|
||||
{type = 'checkbox', label = 'Foto aufnehmen?'}
|
||||
})
|
||||
|
||||
if not input then return end
|
||||
|
||||
local licenseType = input[1]
|
||||
|
||||
-- Klassen verarbeiten
|
||||
local classes = {}
|
||||
if input[7] and input[7] ~= "" then
|
||||
for class in string.gmatch(input[7], '([^,]+)') do
|
||||
table.insert(classes, class:match("^%s*(.-)%s*$")) -- Leerzeichen entfernen
|
||||
end
|
||||
end
|
||||
|
||||
local licenseData = {
|
||||
name = input[2],
|
||||
birthday = input[3],
|
||||
gender = input[4],
|
||||
issue_date = os.date("%d.%m.%Y", os.time(os.date("!*t", input[5] / 1000))),
|
||||
expire_date = os.date("%d.%m.%Y", os.time(os.date("!*t", input[6] / 1000))),
|
||||
issue_date = input[5],
|
||||
expire_date = input[6],
|
||||
classes = classes,
|
||||
notes = input[8],
|
||||
license_type = licenseType
|
||||
}
|
||||
|
||||
if input[7] then -- Take photo
|
||||
if input[9] then -- Foto aufnehmen
|
||||
TriggerEvent('license-system:client:openCamera', targetId, licenseData)
|
||||
else
|
||||
TriggerServerEvent('license-system:server:issueManualLicense', targetId, licenseData)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- License Reactivation Menu
|
||||
openReactivateLicenseMenu = function(targetId, targetName)
|
||||
debugPrint("Öffne Lizenz-Reaktivierungs-Menü für: " .. targetName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue