{% extends 'base.html' %}
{% load static %}

{% block content %}
<div class="container mt-5">
  <div class="card shadow-sm">
    <div class="card-header bg-dark text-white">
      <h4 class="mb-0">Official Details</h4>
    </div>
    <div class="card-body">
      <div class="row g-3">
        <div class="col-md-6">
          <strong>Name:</strong> {{ official.name }}
        </div>
        <div class="col-md-6">
          <strong>Designation:</strong> {{ official.designation }}
        </div>
        <div class="col-md-6">
          <strong>Sex:</strong> {{ official.sex }}
        </div>
        <div class="col-md-6">
          <strong>Status:</strong> {{ official.status }}
        </div>
        <div class="col-md-6">
          <strong>Club:</strong> {{ official.club.name }}
        </div>
        <div class="col-md-6">
          <strong>Is Coach:</strong> {{ official.is_coach|yesno:"Yes,No" }}
        </div>

        {% if official.is_coach %}
        <div class="col-md-6">
          <strong>Coaching Certificate:</strong> {{ official.coaching_certificate }}
        </div>
        <div class="col-md-6">
          <strong>Certificate Year:</strong> {{ official.certificate_year }}
        </div>
        <div class="col-md-6">
          <strong>Certificate File:</strong>
          {% if official.certificate_upload %}
            <a href="{{ official.certificate_upload.url }}" target="_blank">Download</a>
          {% else %}
            <span class="text-muted">Not uploaded</span>
          {% endif %}
        </div>
        {% endif %}

        <div class="col-md-6">
          <strong>Date Created:</strong> {{ official.date_created }}
        </div>
        <div class="col-md-6">
          <strong>Last Updated:</strong> {{ official.updated_at }}
        </div>
      </div>
    </div>
   
      
    
      <div class="card-footer text-end">
        <form method="post" action="{% url 'update_official_status' official.id %}" class="d-inline">
            {% csrf_token %}
            <input type="hidden" name="action" value="Approved">
            <button type="submit" class="btn btn-success me-2">Approve</button>
        </form>

        <form method="post" action="{% url 'update_official_status' official.id %}" class="d-inline">
            {% csrf_token %}
            <input type="hidden" name="action" value="Rejected">
            <button type="submit" class="btn btn-danger">Reject</button>
        </form>

        <a href="{% url 'admin_club_officials'  official.club.id %}" class="btn btn-secondary ms-2">Back to List</a>
        </div>
    
  </div>
</div>
{% endblock %}
