added tailwinds

This commit is contained in:
2025-12-08 16:50:00 -05:00
parent 4522d914e8
commit 139fe01f61
2 changed files with 106 additions and 159 deletions

View File

@@ -33,6 +33,10 @@ public class Platform {
@Column(name = "deleted_at") @Column(name = "deleted_at")
private OffsetDateTime deletedAt; private OffsetDateTime deletedAt;
@ColumnDefault("true")
@Column(name = "is_active", nullable = false)
private Boolean isActive = true;
public Integer getId() { public Integer getId() {
return id; return id;
} }
@@ -81,4 +85,12 @@ public class Platform {
this.deletedAt = deletedAt; this.deletedAt = deletedAt;
} }
public Boolean getIsActive() {
return isActive;
}
public void setIsActive(Boolean active) {
this.isActive = active;
}
} }

View File

@@ -4,140 +4,66 @@
<html> <html>
<head> <head>
<title>Platform Manager</title> <title>Platform Manager</title>
<style> <script src="https://cdn.tailwindcss.com"></script>
body {
font-family: Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
h1 {
color: #333;
}
.form-section {
background: #f5f5f5;
padding: 20px;
border-radius: 8px;
margin-bottom: 30px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"] {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
}
button {
background: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background: #0056b3;
}
button.delete {
background: #dc3545;
}
button.delete:hover {
background: #c82333;
}
button.edit {
background: #28a745;
margin-right: 5px;
}
button.edit:hover {
background: #218838;
}
table {
width: 100%;
border-collapse: collapse;
background: white;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background: #007bff;
color: white;
}
tr:hover {
background: #f5f5f5;
}
.actions {
white-space: nowrap;
}
.message {
padding: 10px;
margin-bottom: 20px;
border-radius: 4px;
}
.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
</style>
</head> </head>
<body> <body class="bg-gray-100 min-h-screen">
<h1>Platform Manager</h1> <div class="container mx-auto px-4 py-8 max-w-7xl">
<h1 class="text-4xl font-bold text-gray-800 mb-8">Platform Manager</h1>
<div id="message"></div> <div id="message" class="hidden"></div>
<div class="form-section"> <div class="bg-white rounded-lg shadow-md p-6 mb-8">
<h2 id="formTitle">Add New Platform</h2> <h2 id="formTitle" class="text-2xl font-semibold text-gray-700 mb-6">Add New Platform</h2>
<form id="platformForm"> <form id="platformForm">
<input type="hidden" id="platformId" name="id"> <input type="hidden" id="platformId" name="id">
<div class="form-group"> <div class="mb-4">
<label for="key">Key:</label> <label for="key" class="block text-sm font-medium text-gray-700 mb-2">Key:</label>
<input type="text" id="key" name="key" required> <input type="text" id="key" name="key" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
</div>
<div class="mb-6">
<label for="label" class="block text-sm font-medium text-gray-700 mb-2">Label:</label>
<input type="text" id="label" name="label" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
</div>
<div class="flex gap-3">
<button type="submit" id="submitBtn"
class="bg-blue-600 hover:bg-blue-700 text-white font-medium px-6 py-2 rounded-lg transition duration-200">
Add Platform
</button>
<button type="button" id="cancelBtn" onclick="resetForm()"
class="hidden bg-gray-500 hover:bg-gray-600 text-white font-medium px-6 py-2 rounded-lg transition duration-200">
Cancel
</button>
</div>
</form>
</div>
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-2xl font-semibold text-gray-700">Existing Platforms</h2>
</div> </div>
<div class="overflow-x-auto">
<div class="form-group"> <table class="min-w-full divide-y divide-gray-200">
<label for="label">Label:</label> <thead class="bg-blue-600">
<input type="text" id="label" name="label" required> <tr>
<th class="px-6 py-3 text-left text-xs font-medium text-white uppercase tracking-wider">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-white uppercase tracking-wider">Key</th>
<th class="px-6 py-3 text-left text-xs font-medium text-white uppercase tracking-wider">Label</th>
<th class="px-6 py-3 text-left text-xs font-medium text-white uppercase tracking-wider">Created At</th>
<th class="px-6 py-3 text-left text-xs font-medium text-white uppercase tracking-wider">Updated At</th>
<th class="px-6 py-3 text-left text-xs font-medium text-white uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody id="platformList" class="bg-white divide-y divide-gray-200">
<!-- Platforms will be loaded here -->
</tbody>
</table>
</div> </div>
</div>
<button type="submit" id="submitBtn">Add Platform</button>
<button type="button" id="cancelBtn" onclick="resetForm()" style="display:none; background:#6c757d;">Cancel</button>
</form>
</div>
<div>
<h2>Existing Platforms</h2>
<table id="platformTable">
<thead>
<tr>
<th>ID</th>
<th>Key</th>
<th>Label</th>
<th>Created At</th>
<th>Updated At</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="platformList">
<!-- Platforms will be loaded here -->
</tbody>
</table>
</div> </div>
<script> <script>
@@ -174,15 +100,22 @@
platforms.forEach(platform => { platforms.forEach(platform => {
const row = document.createElement('tr'); const row = document.createElement('tr');
row.className = 'hover:bg-gray-50 transition duration-150';
row.innerHTML = ` row.innerHTML = `
<td>\${platform.id}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">\${platform.id}</td>
<td>\${platform.key}</td> <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">\${platform.key}</td>
<td>\${platform.label}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">\${platform.label}</td>
<td>\${formatDate(platform.createdAt)}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">\${formatDate(platform.createdAt)}</td>
<td>\${formatDate(platform.updatedAt)}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">\${formatDate(platform.updatedAt)}</td>
<td class="actions"> <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="edit" onclick="editPlatform(\${platform.id}, '\${escapeHtml(platform.key)}', '\${escapeHtml(platform.label)}')">Edit</button> <button onclick="editPlatform(\${platform.id}, '\${escapeHtml(platform.key)}', '\${escapeHtml(platform.label)}')"
<button class="delete" onclick="deletePlatform(\${platform.id})">Delete</button> class="text-white bg-green-600 hover:bg-green-700 px-3 py-1 rounded mr-2 transition duration-200">
Edit
</button>
<button onclick="deletePlatform(\${platform.id})"
class="text-white bg-red-600 hover:bg-red-700 px-3 py-1 rounded transition duration-200">
Delete
</button>
</td> </td>
`; `;
tbody.appendChild(row); tbody.appendChild(row);
@@ -217,7 +150,7 @@
document.getElementById('label').value = label; document.getElementById('label').value = label;
document.getElementById('formTitle').textContent = 'Edit Platform'; document.getElementById('formTitle').textContent = 'Edit Platform';
document.getElementById('submitBtn').textContent = 'Update Platform'; document.getElementById('submitBtn').textContent = 'Update Platform';
document.getElementById('cancelBtn').style.display = 'inline-block'; document.getElementById('cancelBtn').classList.remove('hidden');
window.scrollTo(0, 0); window.scrollTo(0, 0);
} }
@@ -265,16 +198,18 @@
document.getElementById('platformId').value = ''; document.getElementById('platformId').value = '';
document.getElementById('formTitle').textContent = 'Add New Platform'; document.getElementById('formTitle').textContent = 'Add New Platform';
document.getElementById('submitBtn').textContent = 'Add Platform'; document.getElementById('submitBtn').textContent = 'Add Platform';
document.getElementById('cancelBtn').style.display = 'none'; document.getElementById('cancelBtn').classList.add('hidden');
} }
function showMessage(message, type) { function showMessage(message, type) {
const messageDiv = document.getElementById('message'); const messageDiv = document.getElementById('message');
messageDiv.className = 'message ' + type; messageDiv.className = type === 'success'
? 'mb-6 p-4 rounded-lg bg-green-100 border border-green-400 text-green-700'
: 'mb-6 p-4 rounded-lg bg-red-100 border border-red-400 text-red-700';
messageDiv.textContent = message; messageDiv.textContent = message;
messageDiv.style.display = 'block'; messageDiv.classList.remove('hidden');
setTimeout(() => { setTimeout(() => {
messageDiv.style.display = 'none'; messageDiv.classList.add('hidden');
}, 5000); }, 5000);
} }