{% extends "base.html" %}
{% block title %}Upload Dokumen{% endblock %}
{% block breadcrumb %}<a href="{{ url_for('documents.index') }}" style="color:var(--text-muted)">Dokumen</a> / Upload{% endblock %}
{% block page_title %}Upload Dokumen{% endblock %}
{% block content %}
<div class="card">
<form method="POST" enctype="multipart/form-data">
    <div class="form-grid">
        <div class="form-group"><label>Nama Dokumen *</label><input type="text" name="doc_name" required></div>
        <div class="form-group"><label>No. Dokumen</label><input type="text" name="doc_number" placeholder="cth. 027/BAST/2025"></div>
        <div class="form-group">
            <label>Tipe Dokumen *</label>
            <select name="doc_type" required>
                {% for dt in doc_types %}<option>{{ dt }}</option>{% endfor %}
            </select>
        </div>
        <div class="form-group">
            <label>Proyek Terkait</label>
            <select name="project_id">
                <option value="">— Tanpa Proyek —</option>
                {% for p in projects %}<option value="{{ p.id }}">{{ p.project_code }} — {{ p.project_name[:40] }}</option>{% endfor %}
            </select>
        </div>
        <div class="form-group full"><label>Deskripsi</label><textarea name="description" rows="2"></textarea></div>
        <div class="form-group full"><label>Tags (pisahkan dengan koma)</label><input type="text" name="tags" placeholder="cth. 2025, q1, kontrak"></div>
        <div class="form-group full">
            <label>File *</label>
            <input type="file" name="file" required accept=".pdf,.png,.jpg,.jpeg,.doc,.docx,.xls,.xlsx">
            <div class="fs-13 text-muted" style="margin-top:4px">Format: PDF, Word, Excel, JPG, PNG — Maks. 16MB</div>
        </div>
    </div>
    <div style="display:flex;gap:12px;justify-content:flex-end;margin-top:20px">
        <a href="{{ url_for('documents.index') }}" class="btn btn-secondary">Batal</a>
        <button type="submit" class="btn btn-primary">Upload Dokumen →</button>
    </div>
</form>
</div>
{% endblock %}
