{% extends "base.html" %}
{% load static %}
{% load i18n %}

{% block title %}{{ _("Dealer Details") }}{% endblock title %}

{% block content %}
<div class="container my-5">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <!-- Dealer Details Card -->
            <div class="card shadow-sm">
                <div class="card-header bg-primary text-white">
                    <h4 class="mb-0">{{ _("Dealer Details") }}</h4>
                </div>
                <div class="card-body">
                    <div class="mb-3 text-center">
                        {% if dealer.logo %}
                            <img src="{{ dealer.logo.url }}" alt="{{ dealer.name }}" class="img-thumbnail" style="max-width: 150px;">
                        {% else %}
                            <img src="{% static 'images/logo.png' %}" alt="{{ dealer.name }}" class="img-thumbnail" style="max-width: 150px;">
                        {% endif %}
                    </div>
                    <table class="table table-bordered">
                        <tr>
                            <th>{{ _("Name") }}</th>
                            <td>{{ dealer.get_local_name }}</td>
                        </tr>
                        <tr>
                            <th>{{ _("Commercial Registration Number") }}</th>
                            <td>{{ dealer.crn }}</td>
                        </tr>
                        <tr>
                            <th>{{ _("VAT Registration Number") }}</th>
                            <td>{{ dealer.vrn }}</td>
                        </tr>
                        <tr>
                            <th>{{ _("Phone Number") }}</th>
                            <td>{{ dealer.phone_number }}</td>
                        </tr>
                        <tr>
                            <th>{{ _("Address") }}</th>
                            <td>{{ dealer.address|default:_("N/A") }}</td>
                        </tr>
                    </table>
                <div class="">
                    <a href="{% url 'dealer_update' dealer.pk %}" class="btn btn-warning">{% trans 'Update' %}</a>
                </div>
                </div>
            </div>

            <!-- Authentication Links -->
            <div class="mt-4">
                <h5>{{ _("Account Management") }}</h5>
                <ul class="list-group">
                    <li class="list-group-item">
                        <a href="{% url 'change_password' %}" class="text-decoration-none">
                            <i class="bi bi-shield-lock"></i> {{ _("Change Password") }}
                        </a>
                    </li>
                    <li class="list-group-item">
                        <a href="{% url 'logout' %}" class="text-decoration-none">
                            <i class="bi bi-box-arrow-right"></i> {{ _("Sign Out") }}
                        </a>
                    </li>
                    {% if user.is_superuser %}
                    <li class="list-group-item">
                        <a href="{% url 'admin:index' %}" class="text-decoration-none">
                            <i class="bi bi-gear"></i> {{ _("Admin Panel") }}
                        </a>
                    </li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
</div>
{% endblock %}