{% extends "layouts/app.twig" %}

{% block title %}{{ lang.user_profile }}{% endblock %}

{% block content %}
    <div class="page-wrapper">
        <div class="page-content">
            <!--breadcrumb-->
            <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
                <div class="breadcrumb-title pe-3">{{ lang.profile }}</div>
                <div class="ps-3">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb mb-0 p-0">
                            <li class="breadcrumb-item active" aria-current="page">{{ lang.user_profile }}</li>
                        </ol>
                    </nav>
                </div>
            </div>
            <!--end breadcrumb-->
            <div class="container">
                <div class="main-body">
                    <div class="row">
                        <div class="col-lg-4">
                            <div class="card border shadow-none">
                                <div class="card-body">
                                    <div class="d-flex flex-column align-items-center text-center">
                                        <img src="{{ assets('assets/images/avatar.jpg') }}" alt="Admin"
                                             class="rounded-circle p-1 bg-primary" width="110">
                                        <div class="mt-3">
                                            {% if user.name %}
                                            <h4>{{ user.name }}</h4>
                                            {% endif %}
                                            <p class="text-secondary mb-1">{{ user.email }}</p>
                                            <p class="text-muted font-size-sm">{{ user.username }}</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-8">
                            {% include'partials/flash.twig' %}
                            <form class="row g-3" method="post" action="{{ route('profile') }}" enctype="multipart/form-data">
                                {{ csrf.field | raw }}
                                <div class="card border shadow-none">
                                    <div class="card-body">
                                        <div class="row mb-3">
                                            <div class="col-sm-3">
                                                <h6 class="mb-0">{{ lang.user_name }}</h6>
                                            </div>
                                            <div class="col-sm-9 text-secondary">
                                                <input type="text" name="name" class="form-control {{ errors.name ? ' is-invalid' : '' }}" value="{{ user.name }}"/>
                                                {% if errors.name %}
                                                    <div class="invalid-feedback">{{ errors.name | first }}</div>
                                                {% endif %}
                                            </div>
                                        </div>
                                        <div class="row mb-3">
                                            <div class="col-sm-3">
                                                <h6 class="mb-0">{{ lang.user_username }}</h6>
                                            </div>
                                            <div class="col-sm-9 text-secondary">
                                                <input type="text" name="username" class="form-control {{ errors.username ? ' is-invalid' : '' }}" value="{{ user.username }}"/>
                                                {% if errors.username %}
                                                    <div class="invalid-feedback">{{ errors.username | first }}</div>
                                                {% endif %}
                                            </div>
                                        </div>
                                        <div class="row mb-3">
                                            <div class="col-sm-3">
                                                <h6 class="mb-0">{{ lang.user_email }}</h6>
                                            </div>
                                            <div class="col-sm-9 text-secondary">
                                                <input type="text" name="email" class="form-control" value="{{ user.email }}" readonly/>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-sm-3"></div>
                                            <div class="col-sm-9 text-secondary">
                                                <button type="submit" class="btn btn-primary px-4">{{ lang.save_changes }}</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}
