{% extends "orgapy/layout/skeleton.html" %}
{% load static %}

{% block title %}Progress log {{ log.id }}{% endblock title %}

{% block column_main %}
<form action="" method="post">
    {% csrf_token %}
    {% if log %}<input type="hidden" name="id" value="{{ log.id }}">{% endif %}
    <div class="card">
        <h1 class="card-header">Progress log</h1>
        <div class="card-body colll">
            <div>
                <label for="input-description">Description</label>
                <input  id="input-description" type="text" name="description" value="{% if log.description %}{{ log.description }}{% endif %}" required placeholder="Project X - Task Z" />
            </div>
            <div>
                <label for="input-dt">Timestamp</label>
                <input  id="input-dt" type="datetime-local" name="dt" value="{% if log %}{{ log.dt_html }}{% endif %}" required />
            </div>
            <div>
                <label for="select-type">Type</label>
                <select id="select-type" name="type" required>
                    <option value="OT" {% if log and log.type == 'OT' %}selected{% endif %}>Other</option>
                    <option value="PR" {% if log and log.type == 'PR' %}selected{% endif %}>Project checklist item checked</option>
                    <option value="TA" {% if log and log.type == 'TA' %}selected{% endif %}>Task completed</option>
                    <option value="OB" {% if log and log.type == 'OB' %}selected{% endif %}>Objective completed</option>
                </select>
            </div>
        </div>
        <div class="card-actions">
            <button type="submit" name="action" value="save">Save</button>
            <button type="submit" name="action" value="delete" class="button-danger submit-confirm" message="Do you want to delete this log entry?">Delete</button>
        </div>
    </div>
</form>
{% endblock column_main %}
