feat: add export to PDF
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
{% if error %}<div class="flash error" role="alert">{{ error }}</div>{% endif %}
|
||||
<form class="stack" method="get" action="{{ app_path('/export/schedule.pdf') }}">
|
||||
<label>Escala
|
||||
<select name="schedule_id" required>
|
||||
{% for item in schedules %}
|
||||
<option value="{{ item.id }}" {% if item.id == selected_schedule_id %}selected{% endif %}>{{ item.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<div class="form-grid">
|
||||
<label>Data inicial
|
||||
<input type="date" name="start_date" value="{{ start }}" min="2000-01-01" max="2100-12-31" required>
|
||||
</label>
|
||||
<label>Data final
|
||||
<input type="date" name="end_date" value="{{ end }}" min="2000-01-01" max="2100-12-31" required>
|
||||
</label>
|
||||
</div>
|
||||
<p class="muted">As datas inicial e final estão incluídas. Máximo de 12 meses; o tamanho do texto adapta-se ao intervalo.</p>
|
||||
<div class="row end"><button class="primary" type="submit">Descarregar PDF</button></div>
|
||||
</form>
|
||||
@@ -8,6 +8,13 @@
|
||||
<a class="button primary" href="{{ app_path('/admin/assign') }}">Atribuir por dia</a>
|
||||
</div>
|
||||
<div class="stack gap">
|
||||
{% if schedules %}
|
||||
<section class="panel" id="export-pdf">
|
||||
<h2>Exportar PDF</h2>
|
||||
<p class="muted">Escolhe uma escala e as datas para descarregar a lista de dias e equipas numa única folha A4.</p>
|
||||
{% include "_schedule_export_form.html" %}
|
||||
</section>
|
||||
{% endif %}
|
||||
{% for card in cards %}
|
||||
{% set schedule = card.schedule %}
|
||||
<section class="panel">
|
||||
@@ -16,7 +23,10 @@
|
||||
<h2>{{ schedule.name }}</h2>
|
||||
<p class="muted">{{ card.kind_label }} · {{ schedule|horario }}{% if not schedule.is_active %} · inativa{% endif %}</p>
|
||||
</div>
|
||||
<a class="button primary" href="{{ app_path('/admin/schedules/' ~ schedule.id ) }}">Configurar</a>
|
||||
<div class="actions">
|
||||
{% if schedule.is_active %}<a class="button secondary" href="{{ app_path('/admin/schedules?schedule_id=' ~ schedule.id ~ '#export-pdf') }}">Exportar PDF</a>{% endif %}
|
||||
<a class="button primary" href="{{ app_path('/admin/schedules/' ~ schedule.id ) }}">Configurar</a>
|
||||
</div>
|
||||
</div>
|
||||
{% if card.kind == 'rotation' %}
|
||||
<p class="muted">Próximas datas</p>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<nav class="nav" aria-label="Navegação principal">
|
||||
{% if current_user %}
|
||||
<a href="{{ app_path('/swaps') }}">Trocas</a>
|
||||
{% if not current_user.is_admin %}<a href="{{ app_path('/export/schedule') }}">Exportar PDF</a>{% endif %}
|
||||
{% if current_user.is_admin %}
|
||||
<a href="{{ app_path('/admin/schedules') }}">Gerir escalas</a>
|
||||
<a href="{{ app_path('/admin/teams') }}">Equipas</a>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Exportar escala · {{ settings.app_name }}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="page-head">
|
||||
<div>
|
||||
<p class="eyebrow"><a href="{{ app_path('/') }}">Rota</a></p>
|
||||
<h1>Exportar escala</h1>
|
||||
<p class="muted">Escolhe uma escala e as datas. O PDF é descarregado numa única folha A4, com os dias e as equipas agrupados por mês.</p>
|
||||
</div>
|
||||
</div>
|
||||
<section class="panel">
|
||||
{% include "_schedule_export_form.html" %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user