142 lines
8.1 KiB
PHP
142 lines
8.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?php echo APP_NAME; ?> - Settings</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
|
<?php $themeSection = 'head'; include __DIR__ . '/partials/theme.php'; ?>
|
|
</head>
|
|
<body class="theme-page min-h-screen">
|
|
<!-- Header -->
|
|
<header class="theme-surface shadow-sm">
|
|
<div class="max-w-7xl mx-auto px-4 py-4 flex justify-between items-center">
|
|
<a href="<?php echo url('/home'); ?>" class="text-2xl font-bold theme-text hover:opacity-90 transition"><?php echo APP_NAME; ?></a>
|
|
<div class="flex items-center space-x-4">
|
|
<a href="<?php echo url('/settings'); ?>" class="theme-text-muted hover:opacity-90">
|
|
<i class="bi bi-gear-fill text-2xl"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="max-w-7xl mx-auto px-4 py-8">
|
|
<!-- Breadcrumb -->
|
|
<div class="mb-6">
|
|
<a href="<?php echo url('/home'); ?>" class="font-medium transition hover:opacity-90" style="color: color-mix(in srgb, #3b82f6 72%, var(--theme-text));">← Back to Vehicles</a>
|
|
</div>
|
|
|
|
<?php if (isset($_SESSION['error'])): ?>
|
|
<div class="border px-4 py-3 rounded mb-4" style="background-color: color-mix(in srgb, #ef4444 14%, var(--theme-surface)); border-color: color-mix(in srgb, #ef4444 40%, var(--theme-border)); color: var(--theme-text);">
|
|
<?php echo htmlspecialchars($_SESSION['error']); unset($_SESSION['error']); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (isset($_SESSION['success'])): ?>
|
|
<div class="border px-4 py-3 rounded mb-4" style="background-color: color-mix(in srgb, #22c55e 14%, var(--theme-surface)); border-color: color-mix(in srgb, #22c55e 40%, var(--theme-border)); color: var(--theme-text);">
|
|
<?php echo htmlspecialchars($_SESSION['success']); unset($_SESSION['success']); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h2 class="text-2xl font-bold theme-text">Settings</h2>
|
|
<a href="<?php echo url('/logout'); ?>"
|
|
class="inline-flex items-center bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-md transition">
|
|
<i class="bi bi-box-arrow-right mr-2"></i> Logout
|
|
</a>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
<!-- Quick Tasks Section -->
|
|
<div class="theme-surface rounded-lg shadow-sm p-6">
|
|
<h3 class="text-lg font-semibold theme-text mb-4 flex items-center">
|
|
<i class="bi bi-lightning-charge-fill text-yellow-500 mr-2"></i>
|
|
Quick Tasks
|
|
</h3>
|
|
<p class="text-sm theme-text-muted mb-4">Predefined maintenance items for quick selection when adding records.</p>
|
|
|
|
<!-- Add Quick Task Form -->
|
|
<form method="POST" action="<?php echo url('/settings/quick-tasks/add'); ?>" class="mb-4">
|
|
<div class="flex space-x-2">
|
|
<input type="text" name="name" required placeholder="New task name"
|
|
class="flex-1 px-3 py-2 border theme-input theme-border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
<button type="submit"
|
|
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md transition">
|
|
<i class="bi bi-plus-lg"></i> Add
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Quick Tasks List -->
|
|
<div class="space-y-2 max-h-96 overflow-y-auto">
|
|
<?php foreach ($quickTasks as $task): ?>
|
|
<div class="flex items-center justify-between p-2 theme-surface-alt hover:opacity-95 rounded border theme-border">
|
|
<span class="theme-text"><?php echo htmlspecialchars($task['name']); ?></span>
|
|
<form method="POST" action="<?php echo url('/settings/quick-tasks/' . $task['id'] . '/delete'); ?>"
|
|
onsubmit="return confirm('Are you sure you want to delete this quick task?')" class="inline">
|
|
<button type="submit" class="transition hover:opacity-85" style="color: color-mix(in srgb, #ef4444 78%, var(--theme-text));">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Change Password Section -->
|
|
<div class="theme-surface rounded-lg shadow-sm p-6">
|
|
<h3 class="text-lg font-semibold theme-text mb-4 flex items-center">
|
|
<i class="bi bi-key-fill text-blue-500 mr-2"></i>
|
|
Change Password
|
|
</h3>
|
|
<p class="text-sm theme-text-muted mb-4">Update your login password.</p>
|
|
|
|
<form method="POST" action="<?php echo url('/settings/password'); ?>" class="space-y-4">
|
|
<div>
|
|
<label class="block text-sm font-medium theme-text mb-1">Current Password</label>
|
|
<input type="password" name="current_password" required
|
|
class="w-full px-3 py-2 border theme-input theme-border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium theme-text mb-1">New Password</label>
|
|
<input type="password" name="new_password" required
|
|
class="w-full px-3 py-2 border theme-input theme-border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
placeholder="At least 6 characters">
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium theme-text mb-1">Confirm New Password</label>
|
|
<input type="password" name="confirm_password" required
|
|
class="w-full px-3 py-2 border theme-input theme-border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
|
|
<button type="submit"
|
|
class="w-full bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md transition">
|
|
Update Password
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Powered by Mainty Section -->
|
|
<div class="mt-6 theme-surface rounded-lg shadow-sm p-6 text-center">
|
|
<h3 class="text-lg font-semibold theme-text mb-2 flex items-center justify-center">
|
|
<i class="bi bi-github theme-text-muted mr-2"></i>
|
|
Powered by Mainty, a project by Michael Staake and the community.
|
|
</h3>
|
|
<p class="text-sm theme-text-muted mb-3">
|
|
Get the latest version, learn more, or report issues on the official project GitHub.
|
|
</p>
|
|
<a href="https://github.com/michaelstaake/mainty" target="_blank" rel="noopener noreferrer"
|
|
class="inline-flex items-center font-medium transition hover:opacity-90" style="color: color-mix(in srgb, #3b82f6 72%, var(--theme-text));">
|
|
<i class="bi bi-box-arrow-up-right theme-text-muted mr-1"></i>
|
|
github.com/michaelstaake/mainty
|
|
</a>
|
|
</div>
|
|
</main>
|
|
<?php $themeSection = 'body'; include __DIR__ . '/partials/theme.php'; ?>
|
|
</body>
|
|
</html>
|