{% extends "base.html" %}
{% block title %}{{ _('Time Entries Export') }}{% endblock %}
{% block content %}
<div class="p-6 max-w-5xl mx-auto">
  <h1 class="text-2xl font-semibold mb-2">{{ _('Time Entries Export') }}</h1>
  <p class="text-sm text-text-muted-light dark:text-text-muted-dark mb-6">
    {{ _('Generated at') }}: {{ generated_at }}
  </p>

  <div class="bg-card-light dark:bg-card-dark rounded-lg shadow overflow-hidden">
    <table class="min-w-full divide-y divide-border-light dark:divide-border-dark">
      <thead class="bg-background-light dark:bg-background-dark">
        <tr>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('Start') }}</th>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('End') }}</th>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('Project/Client') }}</th>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('Task') }}</th>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('Duration') }}</th>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('Notes') }}</th>
          <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">{{ _('Tags') }}</th>
        </tr>
      </thead>
      <tbody class="bg-card-light dark:bg-card-dark divide-y divide-border-light dark:divide-border-dark">
        {% for entry in entries %}
        <tr>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">{{ entry.start_time|user_datetime if entry.start_time else '-' }}</td>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">{{ entry.end_time|user_datetime if entry.end_time else '-' }}</td>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">
            {% if entry.project %}{{ entry.project.name }}{% elif entry.client %}{{ entry.client.name }}{% else %}-{% endif %}
          </td>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">{{ entry.task.name if entry.task else '-' }}</td>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">{{ entry.duration_formatted }}</td>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">{{ (entry.notes or '')|striptags }}</td>
          <td class="px-4 py-3 text-sm text-gray-900 dark:text-gray-100">{{ entry.tags or '-' }}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}

