{% import 'core_ui/_media_macros.html' as media %}
{% extends 'core_ui/base.html' %}
{% block content %}
<h2>Logs for Plant #{{ plant.id }}</h2>
<a href="{{ url_for('growlog.add_log', plant_id=plant.id) }}">Add New Log</a>
<ul>
  {% for log in logs %}
  <li>
    <strong>{{ log.timestamp.strftime('%Y-%m-%d') }}:</strong> {{ log.event_type }} - {{ log.note }}
    {% if log.media %}
      <br><em>Images:</em>
      <ul>
        {% for image in log.media %}
        <li>
          <img src="{{ url_for('media.media_file', filename=image.file_url) }}" width="150"><br>
          {{ image.caption or "No caption" }}
        </li>
        {% endfor %}
      </ul>
    {% endif %}
  </li>
  {% endfor %}
</ul>
{{ media.render_media_list(log.media) }}
{% endblock %}