This commit is contained in:
Nordi98 2025-08-04 06:14:47 +02:00
parent a44c08fe7e
commit 4f3cd097a2
7 changed files with 1208 additions and 0 deletions

View file

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>License System</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>
<div id="license-container" class="hidden">
<div class="license-card" id="license-card">
<div class="license-header">
<div class="license-title"></div>
<div class="license-logo">
<i class="license-icon"></i>
</div>
</div>
<div class="license-content">
<div class="license-photo">
<i class="fas fa-user"></i>
</div>
<div class="license-info">
<div class="info-row">
<span class="label">Name:</span>
<span class="value" id="license-name"></span>
</div>
<div class="info-row">
<span class="label">Geburtsdatum:</span>
<span class="value" id="license-birthday"></span>
</div>
<div class="info-row">
<span class="label">Geschlecht:</span>
<span class="value" id="license-gender"></span>
</div>
<div class="info-row">
<span class="label">Ausgestellt:</span>
<span class="value" id="license-issue"></span>
</div>
<div class="info-row">
<span class="label">Gültig bis:</span>
<span class="value" id="license-expire"></span>
</div>
<div class="info-row" id="license-classes-row">
<span class="label">Klassen:</span>
<span class="value" id="license-classes"></span>
</div>
</div>
</div>
<div class="license-footer">
<div class="license-status" id="license-status"></div>
<button class="close-btn" onclick="closeLicense()">
<i class="fas fa-times"></i> Schließen
</button>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>

View file

@ -0,0 +1,103 @@
let currentLicense = null;
// Event Listener für Nachrichten von FiveM
window.addEventListener('message', function(event) {
const data = event.data;
switch(data.action) {
case 'showLicense':
showLicense(data.data);
break;
}
});
// Lizenz anzeigen
function showLicense(data) {
currentLicense = data;
const container = document.getElementById('license-container');
const card = document.getElementById('license-card');
// Lizenztyp-spezifische Klasse hinzufügen
card.className = 'license-card ' + data.license.license_type;
// Header befüllen
document.querySelector('.license-title').textContent = data.config.label;
document.querySelector('.license-icon').className = 'license-icon ' + data.config.icon;
// Lizenzinformationen befüllen
document.getElementById('license-name').textContent = data.license.name || 'N/A';
document.getElementById('license-birthday').textContent = data.license.birthday || 'N/A';
document.getElementById('license-gender').textContent = formatGender(data.license.gender) || 'N/A';
document.getElementById('license-issue').textContent = data.license.issue_date || 'N/A';
document.getElementById('license-expire').textContent = data.license.expire_date || 'N/A';
// Klassen anzeigen (nur bei Führerschein)
const classesRow = document.getElementById('license-classes-row');
if (data.license.classes && data.license.classes !== '[]') {
try {
const classes = JSON.parse(data.license.classes);
if (classes && classes.length > 0) {
document.getElementById('license-classes').textContent = classes.join(', ');
classesRow.style.display = 'flex';
} else {
classesRow.style.display = 'none';
}
} catch (e) {
classesRow.style.display = 'none';
}
} else {
classesRow.style.display = 'none';
}
// Status anzeigen
const statusElement = document.getElementById('license-status');
if (data.license.is_active) {
statusElement.textContent = '✅ Gültig';
statusElement.className = 'license-status active';
} else {
statusElement.textContent = '❌ Ungültig';
statusElement.className = 'license-status inactive';
}
// Container anzeigen
container.classList.remove('hidden');
}
// Geschlecht formatieren
function formatGender(gender) {
const genderMap = {
'male': 'Männlich',
'female': 'Weiblich',
'other': 'Divers'
};
return genderMap[gender] || gender;
}
// Lizenz schließen
function closeLicense() {
const container = document.getElementById('license-container');
container.classList.add('hidden');
// Callback an FiveM senden
fetch(`https://${GetParentResourceName()}/closeLicense`, {
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=UTF-8',
},
body: JSON.stringify({})
});
}
// ESC-Taste zum Schließen
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
closeLicense();
}
});
// Klick außerhalb der Karte zum Schließen
document.getElementById('license-container').addEventListener('click', function(event) {
if (event.target === this) {
closeLicense();
}
});

View file

@ -0,0 +1,220 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
background: transparent;
overflow: hidden;
}
.hidden {
display: none !important;
}
#license-container {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.8);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.license-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 15px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
width: 450px;
min-height: 300px;
color: white;
position: relative;
overflow: hidden;
}
.license-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
opacity: 0.3;
pointer-events: none;
}
.license-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}
.license-title {
font-size: 24px;
font-weight: bold;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.license-logo {
font-size: 32px;
opacity: 0.8;
}
.license-content {
display: flex;
padding: 20px;
gap: 20px;
}
.license-photo {
width: 100px;
height: 120px;
background: rgba(255, 255, 255, 0.2);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 48px;
color: rgba(255, 255, 255, 0.7);
flex-shrink: 0;
}
.license-info {
flex: 1;
}
.info-row {
display: flex;
justify-content: space-between;
margin-bottom: 12px;
padding: 8px 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.info-row:last-child {
border-bottom: none;
margin-bottom: 0;
}
.label {
font-weight: bold;
opacity: 0.9;
min-width: 100px;
}
.value {
text-align: right;
opacity: 0.8;
}
.license-footer {
padding: 20px;
border-top: 2px solid rgba(255, 255, 255, 0.2);
display: flex;
justify-content: space-between;
align-items: center;
}
.license-status {
font-weight: bold;
padding: 5px 15px;
border-radius: 20px;
font-size: 14px;
}
.license-status.active {
background: rgba(76, 175, 80, 0.3);
color: #4CAF50;
border: 1px solid #4CAF50;
}
.license-status.inactive {
background: rgba(244, 67, 54, 0.3);
color: #F44336;
border: 1px solid #F44336;
}
.close-btn {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
color: white;
padding: 10px 20px;
border-radius: 25px;
cursor: pointer;
transition: all 0.3s ease;
font-size: 14px;
display: flex;
align-items: center;
gap: 8px;
}
.close-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
/* Spezielle Styles für verschiedene Lizenztypen */
.license-card.id_card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.license-card.drivers_license {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.license-card.weapon_license {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}
.license-card.passport {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}
.license-card.business_license {
background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}
/* Responsive Design */
@media (max-width: 500px) {
.license-card {
width: 90vw;
margin: 20px;
}
.license-content {
flex-direction: column;
align-items: center;
}
.license-photo {
width: 80px;
height: 100px;
font-size: 36px;
}
}
/* Animation für das Erscheinen */
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-50px) scale(0.9);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.license-card {
animation: slideIn 0.3s ease-out;
}