{% extends "components/base.html" %}

{% block title %}Landing Page{% endblock %}

{% block main_area %}
  <div class="container mt-5">
    <div class="row">
      <!-- NoticeBoard Section -->
      <div class="col-md-6">
        <h2>Latest Notices</h2>
        <div class="row">
          {% for notice in board_notices %}
            <div class="col-12 mb-3">
              <div class="card">
                <div class="card-body">
                  <h5 class="card-title">{{ notice.title }}</h5>
                  <p class="card-text">{{ notice.contents|truncatechars:50 }}</p>
                  <a href="{{ notice.get_absolute_url }}" class="btn btn-primary">View Notice</a>
                </div>
              </div>
            </div>
            {% empty %}
            <p>No notices available.</p>
          {% endfor %}
        </div>
      </div>
      <!-- Blog Posts Section -->
      <div class="col-md-6">
        <h2>Latest Blog Posts</h2>
        <div class="row">
          {% for post in blog_posts %}
            <div class="col-12 mb-3">
              <div class="card">
                <div class="card-body">
                  <h5 class="card-title">{{ post.title }}</h5>
                  <p class="card-text">{{ post.contents|truncatechars:50 }}</p>
                  <a href="{% url 'blog:post_detail' post.id %}" class="btn btn-primary">Read More</a>
                </div>
              </div>
            </div>
            {% empty %}
            <p>No blog posts available.</p>
          {% endfor %}
        </div>
      </div>
    </div>
  </div>
{% endblock %}