mirror of
https://gitea.gofwd.group/Forward_Group/ballistic-builder-spring.git
synced 2026-01-20 16:51:03 -05:00
added tailwinds
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,185 +4,118 @@
|
|||||||
<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">
|
|
||||||
<h2 id="formTitle">Add New Platform</h2>
|
<div class="bg-white rounded-lg shadow-md p-6 mb-8">
|
||||||
<form id="platformForm">
|
<h2 id="formTitle" class="text-2xl font-semibold text-gray-700 mb-6">Add New Platform</h2>
|
||||||
<input type="hidden" id="platformId" name="id">
|
<form id="platformForm">
|
||||||
|
<input type="hidden" id="platformId" name="id">
|
||||||
<div class="form-group">
|
|
||||||
<label for="key">Key:</label>
|
<div class="mb-4">
|
||||||
<input type="text" id="key" name="key" required>
|
<label for="key" class="block text-sm font-medium text-gray-700 mb-2">Key:</label>
|
||||||
|
<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>
|
||||||
const API_BASE = '/api/platforms';
|
const API_BASE = '/api/platforms';
|
||||||
|
|
||||||
// Load platforms on page load
|
// Load platforms on page load
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
loadPlatforms();
|
loadPlatforms();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Form submission
|
// Form submission
|
||||||
document.getElementById('platformForm').addEventListener('submit', function(e) {
|
document.getElementById('platformForm').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const id = document.getElementById('platformId').value;
|
const id = document.getElementById('platformId').value;
|
||||||
const platform = {
|
const platform = {
|
||||||
key: document.getElementById('key').value,
|
key: document.getElementById('key').value,
|
||||||
label: document.getElementById('label').value
|
label: document.getElementById('label').value
|
||||||
};
|
};
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
updatePlatform(id, platform);
|
updatePlatform(id, platform);
|
||||||
} else {
|
} else {
|
||||||
addPlatform(platform);
|
addPlatform(platform);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadPlatforms() {
|
function loadPlatforms() {
|
||||||
fetch(API_BASE)
|
fetch(API_BASE)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(platforms => {
|
.then(platforms => {
|
||||||
const tbody = document.getElementById('platformList');
|
const tbody = document.getElementById('platformList');
|
||||||
tbody.innerHTML = '';
|
tbody.innerHTML = '';
|
||||||
|
|
||||||
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);
|
||||||
@@ -190,7 +123,7 @@
|
|||||||
})
|
})
|
||||||
.catch(error => showMessage('Error loading platforms: ' + error, 'error'));
|
.catch(error => showMessage('Error loading platforms: ' + error, 'error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPlatform(platform) {
|
function addPlatform(platform) {
|
||||||
fetch(API_BASE + '/add', {
|
fetch(API_BASE + '/add', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -210,20 +143,20 @@
|
|||||||
})
|
})
|
||||||
.catch(error => showMessage('Error: ' + error, 'error'));
|
.catch(error => showMessage('Error: ' + error, 'error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function editPlatform(id, key, label) {
|
function editPlatform(id, key, label) {
|
||||||
document.getElementById('platformId').value = id;
|
document.getElementById('platformId').value = id;
|
||||||
document.getElementById('key').value = key;
|
document.getElementById('key').value = key;
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePlatform(id, platform) {
|
function updatePlatform(id, platform) {
|
||||||
platform.id = parseInt(id);
|
platform.id = parseInt(id);
|
||||||
|
|
||||||
fetch(API_BASE + '/add', {
|
fetch(API_BASE + '/add', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -242,7 +175,7 @@
|
|||||||
})
|
})
|
||||||
.catch(error => showMessage('Error: ' + error, 'error'));
|
.catch(error => showMessage('Error: ' + error, 'error'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletePlatform(id) {
|
function deletePlatform(id) {
|
||||||
if (confirm('Are you sure you want to delete this platform?')) {
|
if (confirm('Are you sure you want to delete this platform?')) {
|
||||||
fetch(API_BASE + '/delete/' + id, {
|
fetch(API_BASE + '/delete/' + id, {
|
||||||
@@ -259,31 +192,33 @@
|
|||||||
.catch(error => showMessage('Error: ' + error, 'error'));
|
.catch(error => showMessage('Error: ' + error, 'error'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
document.getElementById('platformForm').reset();
|
document.getElementById('platformForm').reset();
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(dateString) {
|
function formatDate(dateString) {
|
||||||
if (!dateString) return '';
|
if (!dateString) return '';
|
||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
return date.toLocaleString();
|
return date.toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(text) {
|
function escapeHtml(text) {
|
||||||
return text.replace(/'/g, "\\'");
|
return text.replace(/'/g, "\\'");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user