first commit
This commit is contained in:
commit
dd6a740645
37 files changed
+5424
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<tr id="entry-{{ e.id }}" class="editing">
|
||||
<td colspan="2">
|
||||
<div class="stack">
|
||||
<input type="datetime-local" name="started_at" value="{{ e.start_input() }}" required aria-label="Début">
|
||||
{% if e.running() %}
|
||||
<span class="muted">en cours</span>
|
||||
{% else %}
|
||||
<input type="datetime-local" name="ended_at" value="{{ e.end_input() }}" required aria-label="Fin">
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td><select name="project_id" aria-label="Projet">{% include "_project_select.html" %}</select></td>
|
||||
<td><input name="note" value="{{ e.note }}" aria-label="Note"></td>
|
||||
<td></td>
|
||||
<td class="actions">
|
||||
<button class="btn small primary" hx-put="/ui/entries/{{ e.id }}" hx-include="closest tr" hx-target="closest tr" hx-swap="outerHTML">Enregistrer</button>
|
||||
<button class="btn small" hx-get="/ui/entries/{{ e.id }}" hx-target="closest tr" hx-swap="outerHTML">Annuler</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,14 @@
|
||||
<tr id="entry-{{ e.id }}"{% if e.running() %} class="running"{% endif %}>
|
||||
<td class="nowrap">{{ e.day() }}</td>
|
||||
<td class="time">
|
||||
{{ e.start_time() }} – {{ e.end_time() }}
|
||||
{% if e.overlaps %}<span class="warn" title="Chevauche une autre entrée">⚠</span>{% endif %}
|
||||
</td>
|
||||
<td><span class="dot" style="--color: {{ e.color }}"></span><span class="client">{{ e.client_name }}</span> / {{ e.project_name }}</td>
|
||||
<td class="note">{{ e.note }}</td>
|
||||
<td class="num">{{ e.duration() }}</td>
|
||||
<td class="actions">
|
||||
<button class="btn small" hx-get="/ui/entries/{{ e.id }}/edit" hx-target="closest tr" hx-swap="outerHTML">Modifier</button>
|
||||
<button class="btn small danger" hx-delete="/ui/entries/{{ e.id }}" hx-target="closest tr" hx-swap="outerHTML" hx-confirm="Supprimer cette entrée ?">Suppr.</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="presets">
|
||||
{% for p in presets %}
|
||||
<a href="?from={{ p.from }}&to={{ p.to }}{{ extra_query }}"{% if p.active %} aria-current="true"{% endif %}>{{ p.label }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
{% for g in groups %}
|
||||
<optgroup label="{{ g.name }}">
|
||||
{% for p in g.projects %}<option value="{{ p.id }}"{% if p.selected %} selected{% endif %}>{{ p.name }}</option>{% endfor %}
|
||||
</optgroup>
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,22 @@
|
||||
<section id="timer" class="card timer{% if running.is_some() %} is-running{% endif %}"{% if let Some(e) = running %} style="--color: {{ e.color }}"{% endif %}>
|
||||
{% if let Some(e) = running %}
|
||||
<div class="current">
|
||||
<div class="current-label">
|
||||
<div class="muted"><span class="dot" style="--color: {{ e.client_color }}"></span>{{ e.client_name }}</div>
|
||||
<div class="current-project">{{ e.project_name }}</div>
|
||||
{% if !e.note.is_empty() %}<div class="note">{{ e.note }}</div>{% endif %}
|
||||
</div>
|
||||
<div class="clock" data-started="{{ e.started_rfc3339() }}">{{ e.duration() }}</div>
|
||||
<button class="btn danger" hx-post="/ui/timer/stop" hx-target="#timer" hx-swap="outerHTML">Arrêter</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if groups.is_empty() %}
|
||||
<p class="empty">Aucun projet actif. <a href="/clients">Crée un client et un projet</a> pour commencer.</p>
|
||||
{% else %}
|
||||
<form class="start" hx-post="/ui/timer/start" hx-target="#timer" hx-swap="outerHTML">
|
||||
<select name="project_id" required aria-label="Projet">{% include "_project_select.html" %}</select>
|
||||
<input name="note" placeholder="Sur quoi travailles-tu ?" aria-label="Note">
|
||||
<button class="btn primary">{% if running.is_some() %}Basculer{% else %}Démarrer{% endif %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
@@ -0,0 +1,24 @@
|
||||
<section id="today" class="card" hx-get="/ui/today" hx-trigger="entries-changed from:body" hx-swap="outerHTML">
|
||||
<div class="card-head">
|
||||
<h2>Aujourd'hui</h2>
|
||||
<span class="total">{{ today_total }}</span>
|
||||
</div>
|
||||
{% if today_entries.is_empty() %}
|
||||
<p class="empty">Rien de saisi pour l'instant.</p>
|
||||
{% else %}
|
||||
<table class="entries">
|
||||
<tbody>
|
||||
{% for e in today_entries %}
|
||||
<tr{% if e.running() %} class="running"{% endif %}>
|
||||
<td class="time">{{ e.start_time() }} – {{ e.end_time() }}</td>
|
||||
<td>
|
||||
<span class="dot" style="--color: {{ e.color }}"></span><span class="client">{{ e.client_name }}</span> / {{ e.project_name }}
|
||||
{% if !e.note.is_empty() %}<div class="note">{{ e.note }}</div>{% endif %}
|
||||
</td>
|
||||
<td class="num">{{ e.duration() }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
</section>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Tempus{% endblock %} · Tempus</title>
|
||||
<link rel="stylesheet" href="/static/app.css">
|
||||
<script src="/static/htmx.min.js" defer></script>
|
||||
<script src="/static/app.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<a class="brand" href="/">Tempus</a>
|
||||
<nav>
|
||||
<a href="/" {% if nav == "dashboard" %}aria-current="page"{% endif %}>Aujourd'hui</a>
|
||||
<a href="/entries" {% if nav == "entries" %}aria-current="page"{% endif %}>Entrées</a>
|
||||
<a href="/reports" {% if nav == "reports" %}aria-current="page"{% endif %}>Rapports</a>
|
||||
<a href="/clients" {% if nav == "clients" %}aria-current="page"{% endif %}>Clients</a>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
<div id="toast" role="alert" hidden></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,70 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Clients{% endblock %}
|
||||
{% block content %}
|
||||
<section class="card">
|
||||
<h2>Nouveau client</h2>
|
||||
<form method="post" action="/ui/clients" class="row">
|
||||
<input type="color" name="color" value="{{ next_color }}" aria-label="Couleur du client">
|
||||
<input name="name" required placeholder="Nom du client" aria-label="Nom du client" class="grow">
|
||||
<button class="btn primary">Ajouter</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
{% if clients.is_empty() %}
|
||||
<p class="empty">Aucun client pour l'instant.</p>
|
||||
{% endif %}
|
||||
|
||||
{% for c in clients %}
|
||||
<section class="card client-card{% if c.client.archived %} archived{% endif %}" style="--color: {{ c.client.color }}">
|
||||
<div class="card-head">
|
||||
<form method="post" action="/ui/clients/{{ c.client.id }}" class="row grow">
|
||||
<input type="color" name="color" value="{{ c.client.color }}" aria-label="Couleur du client">
|
||||
<input name="name" value="{{ c.client.name }}" required aria-label="Nom du client" class="title-input">
|
||||
<button class="btn">Enregistrer</button>
|
||||
</form>
|
||||
<div class="row">
|
||||
{% if c.client.archived %}<span class="badge">archivé</span>{% endif %}
|
||||
<form method="post" action="/ui/clients/{{ c.client.id }}/archive">
|
||||
<input type="hidden" name="archived" value="{{ !c.client.archived }}">
|
||||
<button class="btn">{% if c.client.archived %}Réactiver{% else %}Archiver{% endif %}</button>
|
||||
</form>
|
||||
<form method="post" action="/ui/clients/{{ c.client.id }}/delete" data-confirm="Supprimer ce client, ses projets et tout le temps saisi ?">
|
||||
<button class="btn danger">Supprimer</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="projects">
|
||||
{% for p in c.projects %}
|
||||
<li{% if p.archived %} class="archived"{% endif %}>
|
||||
<form method="post" action="/ui/projects/{{ p.id }}" class="row grow">
|
||||
<input type="color" name="color" value="{{ p.effective_color }}" aria-label="Couleur du projet"
|
||||
title="{% if p.color.is_some() %}Couleur propre au projet{% else %}Couleur du client{% endif %}">
|
||||
<input name="name" value="{{ p.name }}" required aria-label="Nom du projet">
|
||||
<button class="btn small">Enregistrer</button>
|
||||
{% if p.color.is_some() %}
|
||||
<button class="btn small" name="inherit" value="true" title="Reprendre la couleur du client">↺</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="row">
|
||||
{% if p.archived %}<span class="badge">archivé</span>{% endif %}
|
||||
<form method="post" action="/ui/projects/{{ p.id }}/archive">
|
||||
<input type="hidden" name="archived" value="{{ !p.archived }}">
|
||||
<button class="btn small">{% if p.archived %}Réactiver{% else %}Archiver{% endif %}</button>
|
||||
</form>
|
||||
<form method="post" action="/ui/projects/{{ p.id }}/delete" data-confirm="Supprimer ce projet et tout le temps saisi dessus ?">
|
||||
<button class="btn small danger">Supprimer</button>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<form method="post" action="/ui/clients/{{ c.client.id }}/projects" class="row">
|
||||
<input type="color" name="color" value="{{ c.client.color }}" aria-label="Couleur du projet" title="Garder la couleur du client ou en choisir une autre">
|
||||
<input name="name" required placeholder="Nouveau projet" aria-label="Nouveau projet" class="grow">
|
||||
<button class="btn">Ajouter le projet</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Aujourd'hui{% endblock %}
|
||||
{% block content %}
|
||||
{% include "_timer.html" %}
|
||||
{% include "_today.html" %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,56 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Entrées{% endblock %}
|
||||
{% block content %}
|
||||
<section class="card">
|
||||
<h2>Ajouter du temps</h2>
|
||||
{% if groups.is_empty() %}
|
||||
<p class="empty">Aucun projet actif. <a href="/clients">Crée un client et un projet</a> d'abord.</p>
|
||||
{% else %}
|
||||
<form method="post" action="/ui/entries" class="row wrap">
|
||||
<select name="project_id" required aria-label="Projet">{% include "_project_select.html" %}</select>
|
||||
<input type="datetime-local" name="started_at" value="{{ default_start }}" required aria-label="Début">
|
||||
<input type="datetime-local" name="ended_at" value="{{ default_end }}" required aria-label="Fin">
|
||||
<input name="note" placeholder="Note" aria-label="Note" class="grow">
|
||||
<button class="btn primary">Ajouter</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-head">
|
||||
<h2>Entrées</h2>
|
||||
<span class="total">{{ total }}</span>
|
||||
</div>
|
||||
{% include "_presets.html" %}
|
||||
<form method="get" class="row wrap filters">
|
||||
<label>Du <input type="date" name="from" value="{{ from }}"></label>
|
||||
<label>au <input type="date" name="to" value="{{ to }}"></label>
|
||||
<select name="client_id" aria-label="Client">
|
||||
<option value="">Tous les clients</option>
|
||||
{% for c in clients %}<option value="{{ c.id }}"{% if c.selected %} selected{% endif %}>{{ c.name }}</option>{% endfor %}
|
||||
</select>
|
||||
<select name="project_id" aria-label="Projet">
|
||||
<option value="">Tous les projets</option>
|
||||
{% for g in filter_groups %}
|
||||
<optgroup label="{{ g.name }}">
|
||||
{% for p in g.projects %}<option value="{{ p.id }}"{% if p.selected %} selected{% endif %}>{{ p.name }}</option>{% endfor %}
|
||||
</optgroup>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button class="btn">Filtrer</button>
|
||||
</form>
|
||||
|
||||
{% if entries.is_empty() %}
|
||||
<p class="empty">Aucune entrée sur cette période.</p>
|
||||
{% else %}
|
||||
<div class="table-wrap">
|
||||
<table class="entries">
|
||||
<thead><tr><th>Jour</th><th>Horaire</th><th>Projet</th><th>Note</th><th class="num">Durée</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
{% for e in entries %}{% include "_entry_row.html" %}{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Erreur{% endblock %}
|
||||
{% block content %}
|
||||
<section class="card">
|
||||
<h1>Oups</h1>
|
||||
<p id="error-message">{{ message }}</p>
|
||||
<p><a href="javascript:history.back()">← Retour</a></p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,44 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Rapports{% endblock %}
|
||||
{% block content %}
|
||||
<section class="card">
|
||||
<div class="card-head">
|
||||
<h2>Rapport</h2>
|
||||
<span class="total">{{ report.total() }}</span>
|
||||
</div>
|
||||
{% include "_presets.html" %}
|
||||
<form method="get" class="row wrap filters">
|
||||
<label>Du <input type="date" name="from" value="{{ report.from }}"></label>
|
||||
<label>au <input type="date" name="to" value="{{ report.to }}"></label>
|
||||
<select name="group_by" aria-label="Regrouper par">
|
||||
<option value="project"{% if group_by == "project" %} selected{% endif %}>Par projet</option>
|
||||
<option value="client"{% if group_by == "client" %} selected{% endif %}>Par client</option>
|
||||
<option value="day"{% if group_by == "day" %} selected{% endif %}>Par jour</option>
|
||||
</select>
|
||||
<select name="client_id" aria-label="Client">
|
||||
<option value="">Tous les clients</option>
|
||||
{% for c in clients %}<option value="{{ c.id }}"{% if c.selected %} selected{% endif %}>{{ c.name }}</option>{% endfor %}
|
||||
</select>
|
||||
<button class="btn">Afficher</button>
|
||||
</form>
|
||||
|
||||
{% if report.rows.is_empty() %}
|
||||
<p class="empty">Aucun temps sur cette période.</p>
|
||||
{% else %}
|
||||
<table class="report">
|
||||
<tbody>
|
||||
{% for r in report.rows %}
|
||||
<tr>
|
||||
<td class="label">{% if let Some(c) = r.color %}<span class="dot" style="--color: {{ c }}"></span>{% endif %}{{ r.label }}</td>
|
||||
<td class="bar-cell"><div class="bar" style="width: {{ r.percent }}%{% if let Some(c) = r.color %}; --color: {{ c }}{% endif %}"></div></td>
|
||||
<td class="num">{{ r.duration() }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td>Total</td><td></td><td class="num">{{ report.total() }}</td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user