Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Add @rada_member_required decorator for access control - Add BoardDocument model for storing protocols and documents - Create document upload service (PDF, DOCX, DOC up to 50MB) - Add /rada/ blueprint with list, upload, download endpoints - Add "Rada" link in navigation (visible only for board members) - Add "Rada" badge and toggle button in admin user management - Create SQL migration to set up board_documents table and assign is_rada_member=True to 16 board members by email Storage: /data/board-docs/ (outside webroot for security) Access: is_rada_member=True OR role >= OFFICE_MANAGER Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
383 lines
11 KiB
HTML
383 lines
11 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Dodaj dokument - Strefa RADA{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.upload-container {
|
|
max-width: 600px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.upload-header {
|
|
margin-bottom: var(--spacing-xl);
|
|
}
|
|
|
|
.upload-header h1 {
|
|
font-size: var(--font-size-2xl);
|
|
color: var(--text-primary);
|
|
margin-bottom: var(--spacing-sm);
|
|
}
|
|
|
|
.upload-header p {
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.back-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
font-size: var(--font-size-sm);
|
|
margin-bottom: var(--spacing-lg);
|
|
}
|
|
|
|
.back-link:hover {
|
|
color: var(--primary);
|
|
}
|
|
|
|
.back-link svg {
|
|
width: 16px;
|
|
height: 16px;
|
|
}
|
|
|
|
.upload-form {
|
|
background: white;
|
|
border-radius: var(--radius-lg);
|
|
border: 1px solid var(--border-color);
|
|
padding: var(--spacing-xl);
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: var(--spacing-lg);
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
font-weight: 500;
|
|
color: var(--text-primary);
|
|
margin-bottom: var(--spacing-sm);
|
|
}
|
|
|
|
.form-group label .required {
|
|
color: var(--danger);
|
|
}
|
|
|
|
.form-group input[type="text"],
|
|
.form-group input[type="date"],
|
|
.form-group input[type="number"],
|
|
.form-group select,
|
|
.form-group textarea {
|
|
width: 100%;
|
|
padding: 10px 14px;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: var(--radius-md);
|
|
font-size: var(--font-size-base);
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
.form-group input:focus,
|
|
.form-group select:focus,
|
|
.form-group textarea:focus {
|
|
outline: none;
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
|
|
}
|
|
|
|
.form-group textarea {
|
|
min-height: 100px;
|
|
resize: vertical;
|
|
}
|
|
|
|
.form-hint {
|
|
font-size: var(--font-size-sm);
|
|
color: var(--text-muted);
|
|
margin-top: var(--spacing-xs);
|
|
}
|
|
|
|
.file-upload-area {
|
|
border: 2px dashed var(--border-color);
|
|
border-radius: var(--radius-lg);
|
|
padding: var(--spacing-xl);
|
|
text-align: center;
|
|
background: var(--bg-secondary);
|
|
transition: all 0.2s;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.file-upload-area:hover,
|
|
.file-upload-area.dragover {
|
|
border-color: var(--primary);
|
|
background: rgba(37, 99, 235, 0.05);
|
|
}
|
|
|
|
.file-upload-area svg {
|
|
width: 48px;
|
|
height: 48px;
|
|
color: var(--text-muted);
|
|
margin-bottom: var(--spacing-md);
|
|
}
|
|
|
|
.file-upload-area p {
|
|
color: var(--text-secondary);
|
|
margin-bottom: var(--spacing-sm);
|
|
}
|
|
|
|
.file-upload-area .file-types {
|
|
font-size: var(--font-size-sm);
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
.file-upload-area input[type="file"] {
|
|
display: none;
|
|
}
|
|
|
|
.selected-file {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--spacing-sm);
|
|
padding: var(--spacing-md);
|
|
background: var(--bg-secondary);
|
|
border-radius: var(--radius-md);
|
|
margin-top: var(--spacing-md);
|
|
}
|
|
|
|
.selected-file svg {
|
|
width: 24px;
|
|
height: 24px;
|
|
color: var(--success);
|
|
}
|
|
|
|
.selected-file .file-name {
|
|
flex: 1;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.selected-file .file-size {
|
|
color: var(--text-muted);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
|
|
.btn-remove-file {
|
|
background: none;
|
|
border: none;
|
|
color: var(--danger);
|
|
cursor: pointer;
|
|
padding: 4px;
|
|
}
|
|
|
|
.form-row {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: var(--spacing-md);
|
|
}
|
|
|
|
.form-actions {
|
|
display: flex;
|
|
gap: var(--spacing-md);
|
|
margin-top: var(--spacing-xl);
|
|
padding-top: var(--spacing-lg);
|
|
border-top: 1px solid var(--border-color);
|
|
}
|
|
|
|
.btn-submit {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px 24px;
|
|
background: var(--primary);
|
|
color: white;
|
|
border: none;
|
|
border-radius: var(--radius-md);
|
|
font-weight: 500;
|
|
font-size: var(--font-size-base);
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-submit:hover {
|
|
background: var(--primary-dark);
|
|
}
|
|
|
|
.btn-submit svg {
|
|
width: 18px;
|
|
height: 18px;
|
|
}
|
|
|
|
.btn-cancel {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
padding: 12px 24px;
|
|
background: transparent;
|
|
color: var(--text-secondary);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: var(--radius-md);
|
|
font-weight: 500;
|
|
text-decoration: none;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-cancel:hover {
|
|
background: var(--bg-secondary);
|
|
}
|
|
|
|
@media (max-width: 600px) {
|
|
.form-row {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.form-actions {
|
|
flex-direction: column;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="upload-container">
|
|
<a href="{{ url_for('board.index') }}" class="back-link">
|
|
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
|
<path d="M15 19l-7-7 7-7"/>
|
|
</svg>
|
|
Powrot do listy dokumentow
|
|
</a>
|
|
|
|
<div class="upload-header">
|
|
<h1>Dodaj nowy dokument</h1>
|
|
<p>Dodaj protokol lub inny dokument z posiedzenia Rady Izby</p>
|
|
</div>
|
|
|
|
<form class="upload-form" method="POST" enctype="multipart/form-data">
|
|
<div class="form-group">
|
|
<label for="title">Tytul dokumentu <span class="required">*</span></label>
|
|
<input type="text" id="title" name="title" required
|
|
value="{{ form_data.get('title', '') }}"
|
|
placeholder="np. Protokol z posiedzenia Rady Izby - Luty 2026">
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group">
|
|
<label for="document_type">Typ dokumentu</label>
|
|
<select id="document_type" name="document_type">
|
|
{% for doc_type in document_types %}
|
|
<option value="{{ doc_type }}"
|
|
{% if form_data.get('document_type') == doc_type %}selected{% endif %}>
|
|
{{ type_labels[doc_type] }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="meeting_date">Data posiedzenia <span class="required">*</span></label>
|
|
<input type="date" id="meeting_date" name="meeting_date" required
|
|
value="{{ form_data.get('meeting_date', '') }}">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="meeting_number">Numer posiedzenia (opcjonalnie)</label>
|
|
<input type="number" id="meeting_number" name="meeting_number" min="1"
|
|
value="{{ form_data.get('meeting_number', '') }}"
|
|
placeholder="np. 12">
|
|
<div class="form-hint">Numer kolejny posiedzenia w danym roku</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="description">Opis (opcjonalnie)</label>
|
|
<textarea id="description" name="description"
|
|
placeholder="Krotki opis zawartosci dokumentu...">{{ form_data.get('description', '') }}</textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Plik dokumentu <span class="required">*</span></label>
|
|
<div class="file-upload-area" id="fileUploadArea" onclick="document.getElementById('document').click()">
|
|
<svg fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
<path d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"/>
|
|
</svg>
|
|
<p>Kliknij lub przeciagnij plik tutaj</p>
|
|
<span class="file-types">PDF, DOCX lub DOC (max 50MB)</span>
|
|
<input type="file" id="document" name="document" accept=".pdf,.docx,.doc" required>
|
|
</div>
|
|
<div id="selectedFile" class="selected-file" style="display: none;">
|
|
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
|
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>
|
|
<span class="file-name" id="fileName"></span>
|
|
<span class="file-size" id="fileSize"></span>
|
|
<button type="button" class="btn-remove-file" onclick="removeFile()">
|
|
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
|
<path d="M6 18L18 6M6 6l12 12"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<button type="submit" class="btn-submit">
|
|
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
|
|
<path d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/>
|
|
</svg>
|
|
Dodaj dokument
|
|
</button>
|
|
<a href="{{ url_for('board.index') }}" class="btn-cancel">Anuluj</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_js %}
|
|
const fileInput = document.getElementById('document');
|
|
const fileUploadArea = document.getElementById('fileUploadArea');
|
|
const selectedFile = document.getElementById('selectedFile');
|
|
const fileName = document.getElementById('fileName');
|
|
const fileSize = document.getElementById('fileSize');
|
|
|
|
fileInput.addEventListener('change', function(e) {
|
|
if (this.files.length > 0) {
|
|
showSelectedFile(this.files[0]);
|
|
}
|
|
});
|
|
|
|
fileUploadArea.addEventListener('dragover', function(e) {
|
|
e.preventDefault();
|
|
this.classList.add('dragover');
|
|
});
|
|
|
|
fileUploadArea.addEventListener('dragleave', function(e) {
|
|
e.preventDefault();
|
|
this.classList.remove('dragover');
|
|
});
|
|
|
|
fileUploadArea.addEventListener('drop', function(e) {
|
|
e.preventDefault();
|
|
this.classList.remove('dragover');
|
|
const files = e.dataTransfer.files;
|
|
if (files.length > 0) {
|
|
fileInput.files = files;
|
|
showSelectedFile(files[0]);
|
|
}
|
|
});
|
|
|
|
function showSelectedFile(file) {
|
|
fileName.textContent = file.name;
|
|
fileSize.textContent = formatFileSize(file.size);
|
|
selectedFile.style.display = 'flex';
|
|
fileUploadArea.style.display = 'none';
|
|
}
|
|
|
|
function removeFile() {
|
|
fileInput.value = '';
|
|
selectedFile.style.display = 'none';
|
|
fileUploadArea.style.display = 'block';
|
|
}
|
|
|
|
function formatFileSize(bytes) {
|
|
if (bytes < 1024) return bytes + ' B';
|
|
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
|
|
return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
|
|
}
|
|
{% endblock %}
|