feat: Space Booking System - MVP complet

Sistem web pentru rezervarea de birouri și săli de ședință
cu flux de aprobare administrativă.

Stack: FastAPI + Vue.js 3 + SQLite + TypeScript

Features implementate:
- Autentificare JWT + Self-registration cu email verification
- CRUD Spații, Utilizatori, Settings (Admin)
- Calendar interactiv (FullCalendar) cu drag-and-drop
- Creare rezervări cu validare (durată, program, overlap, max/zi)
- Rezervări recurente (săptămânal)
- Admin: aprobare/respingere/anulare cereri
- Admin: creare directă rezervări (bypass approval)
- Admin: editare orice rezervare
- User: editare/anulare rezervări proprii
- Notificări in-app (bell icon + dropdown)
- Notificări email (async SMTP cu BackgroundTasks)
- Jurnal acțiuni administrative (audit log)
- Rapoarte avansate (utilizare, top users, approval rate)
- Șabloane rezervări (booking templates)
- Atașamente fișiere (upload/download)
- Conflict warnings (verificare disponibilitate real-time)
- Integrare Google Calendar (OAuth2)
- Suport timezone (UTC storage + user preference)
- 225+ teste backend

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-02-09 17:51:29 +00:00
commit df4031d99c
113 changed files with 24491 additions and 0 deletions

View File

@@ -0,0 +1,411 @@
<template>
<div class="admin">
<h2>Admin Dashboard - Space Management</h2>
<!-- Create/Edit Form -->
<div class="card">
<h3>{{ editingSpace ? 'Edit Space' : 'Create New Space' }}</h3>
<form @submit.prevent="handleSubmit" class="space-form">
<div class="form-group">
<label for="name">Name *</label>
<input
id="name"
v-model="formData.name"
type="text"
required
placeholder="Conference Room A"
/>
</div>
<div class="form-group">
<label for="type">Type *</label>
<select id="type" v-model="formData.type" required>
<option value="sala">Sala</option>
<option value="birou">Birou</option>
</select>
</div>
<div class="form-group">
<label for="capacity">Capacity *</label>
<input
id="capacity"
v-model.number="formData.capacity"
type="number"
required
min="1"
placeholder="10"
/>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea
id="description"
v-model="formData.description"
rows="3"
placeholder="Optional description..."
></textarea>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" :disabled="loading">
{{ editingSpace ? 'Update' : 'Create' }}
</button>
<button
v-if="editingSpace"
type="button"
class="btn btn-secondary"
@click="cancelEdit"
>
Cancel
</button>
</div>
</form>
<div v-if="error" class="error">{{ error }}</div>
<div v-if="success" class="success">{{ success }}</div>
</div>
<!-- Spaces List -->
<div class="card">
<h3>All Spaces</h3>
<div v-if="loadingSpaces" class="loading">Loading spaces...</div>
<div v-else-if="spaces.length === 0" class="empty">
No spaces created yet. Create one above!
</div>
<table v-else class="spaces-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Capacity</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="space in spaces" :key="space.id">
<td>{{ space.name }}</td>
<td>{{ space.type === 'sala' ? 'Sala' : 'Birou' }}</td>
<td>{{ space.capacity }}</td>
<td>
<span :class="['badge', space.is_active ? 'badge-active' : 'badge-inactive']">
{{ space.is_active ? 'Active' : 'Inactive' }}
</span>
</td>
<td class="actions">
<button
class="btn btn-sm btn-secondary"
@click="startEdit(space)"
:disabled="loading"
>
Edit
</button>
<button
:class="['btn', 'btn-sm', space.is_active ? 'btn-warning' : 'btn-success']"
@click="toggleStatus(space)"
:disabled="loading"
>
{{ space.is_active ? 'Deactivate' : 'Activate' }}
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { spacesApi, handleApiError } from '@/services/api'
import type { Space } from '@/types'
const spaces = ref<Space[]>([])
const loadingSpaces = ref(false)
const loading = ref(false)
const error = ref('')
const success = ref('')
const editingSpace = ref<Space | null>(null)
const formData = ref({
name: '',
type: 'sala',
capacity: 1,
description: ''
})
const loadSpaces = async () => {
loadingSpaces.value = true
error.value = ''
try {
spaces.value = await spacesApi.list()
} catch (err) {
error.value = handleApiError(err)
} finally {
loadingSpaces.value = false
}
}
const handleSubmit = async () => {
loading.value = true
error.value = ''
success.value = ''
try {
if (editingSpace.value) {
await spacesApi.update(editingSpace.value.id, formData.value)
success.value = 'Space updated successfully!'
} else {
await spacesApi.create(formData.value)
success.value = 'Space created successfully!'
}
resetForm()
await loadSpaces()
// Clear success message after 3 seconds
setTimeout(() => {
success.value = ''
}, 3000)
} catch (err) {
error.value = handleApiError(err)
} finally {
loading.value = false
}
}
const startEdit = (space: Space) => {
editingSpace.value = space
formData.value = {
name: space.name,
type: space.type,
capacity: space.capacity,
description: space.description || ''
}
window.scrollTo({ top: 0, behavior: 'smooth' })
}
const cancelEdit = () => {
resetForm()
}
const resetForm = () => {
editingSpace.value = null
formData.value = {
name: '',
type: 'sala',
capacity: 1,
description: ''
}
}
const toggleStatus = async (space: Space) => {
loading.value = true
error.value = ''
success.value = ''
try {
await spacesApi.updateStatus(space.id, !space.is_active)
success.value = `Space ${space.is_active ? 'deactivated' : 'activated'} successfully!`
await loadSpaces()
setTimeout(() => {
success.value = ''
}, 3000)
} catch (err) {
error.value = handleApiError(err)
} finally {
loading.value = false
}
}
onMounted(() => {
loadSpaces()
})
</script>
<style scoped>
.admin {
max-width: 1200px;
margin: 0 auto;
}
.card {
background: white;
border-radius: 8px;
padding: 24px;
margin-bottom: 24px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.space-form {
display: flex;
flex-direction: column;
gap: 16px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 4px;
}
.form-group label {
font-weight: 500;
color: #374151;
}
.form-group input,
.form-group select,
.form-group textarea {
padding: 8px 12px;
border: 1px solid #d1d5db;
border-radius: 4px;
font-size: 14px;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-actions {
display: flex;
gap: 12px;
margin-top: 8px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-primary {
background: #3b82f6;
color: white;
}
.btn-primary:hover:not(:disabled) {
background: #2563eb;
}
.btn-secondary {
background: #6b7280;
color: white;
}
.btn-secondary:hover:not(:disabled) {
background: #4b5563;
}
.btn-success {
background: #10b981;
color: white;
}
.btn-success:hover:not(:disabled) {
background: #059669;
}
.btn-warning {
background: #f59e0b;
color: white;
}
.btn-warning:hover:not(:disabled) {
background: #d97706;
}
.btn-sm {
padding: 6px 12px;
font-size: 12px;
}
.error {
padding: 12px;
background: #fee2e2;
color: #991b1b;
border-radius: 4px;
margin-top: 12px;
}
.success {
padding: 12px;
background: #d1fae5;
color: #065f46;
border-radius: 4px;
margin-top: 12px;
}
.loading {
text-align: center;
color: #6b7280;
padding: 24px;
}
.empty {
text-align: center;
color: #9ca3af;
padding: 24px;
}
.spaces-table {
width: 100%;
border-collapse: collapse;
}
.spaces-table th {
text-align: left;
padding: 12px;
background: #f9fafb;
font-weight: 600;
color: #374151;
border-bottom: 2px solid #e5e7eb;
}
.spaces-table td {
padding: 12px;
border-bottom: 1px solid #e5e7eb;
}
.spaces-table tr:hover {
background: #f9fafb;
}
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.badge-active {
background: #d1fae5;
color: #065f46;
}
.badge-inactive {
background: #fee2e2;
color: #991b1b;
}
.actions {
display: flex;
gap: 8px;
}
</style>