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

{% block title %}Profile - AI ML Operations{% endblock %}

{% block content %}
<div class="section">
    <div class="container">
        <h1 class="section-title" style="text-align: left;">Profile</h1>

        {% if messages %}
        {% for message in messages %}
        <p style="margin-bottom: 1rem; color: {% if message.tags == 'error' %}#ff6666{% else %}var(--primary-color){% endif %};">
            {{ message }}
        </p>
        {% endfor %}
        {% endif %}

        <div class="card" style="max-width: 600px; margin-bottom: 2rem;">
            <h2 style="font-size: 1.1rem; margin-bottom: 1rem;">Account Type</h2>
            <p style="color: var(--text-muted); margin-bottom: 1rem;">
                Your account is currently: <strong>{{ profile.get_user_type_display }}</strong>
            </p>
            <form method="post">
                {% csrf_token %}
                {{ form.as_p }}
                {% if can_edit_type %}
                <button type="submit" class="btn" style="margin-top: 1rem;">Save Profile</button>
                {% endif %}
            </form>
        </div>

        {% if employee_form %}
        <div class="card" style="max-width: 600px;">
            <h2 style="font-size: 1.1rem; margin-bottom: 1rem;">Employee Details</h2>
            {{ employee_form.as_p }}
            <p style="color: var(--text-muted); font-size: 0.9rem;">Contact an admin to update employee details.</p>
        </div>
        {% endif %}
    </div>
</div>
{% endblock %}
