{% 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.password }}</div>
                <div class="ps-3">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb mb-0 p-0">
                            {#<li class="breadcrumb-item"><a href="{{route('home')}}"><i class="bi bi-house"></i></a>
                            </li>#}
                            <li class="breadcrumb-item active" aria-current="page">{{ lang.change_password }}</li>
                        </ol>
                    </nav>
                </div>
            </div>
            <!--end breadcrumb-->
            <div class="container">
                <div class="main-body">
                    <div class="row">
                        <div class="col-lg-8 align-content-center">
                            {% include'partials/flash.twig' %}
                            <form class="row g-3" method="post" action="{{ route('change.password') }}">
                                {{ 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.old_password }}</h6>
                                            </div>
                                            <div class="col-sm-9 text-secondary">
                                                <input type="password" name="old_password" class="form-control {{ errors.old_password ? ' is-invalid' : '' }}" />
                                                {% if errors.old_password %}
                                                    <div class="invalid-feedback">{{ errors.old_password | first }}</div>
                                                {% endif %}
                                            </div>
                                        </div>
                                        <div class="row mb-3">
                                            <div class="col-sm-3">
                                                <h6 class="mb-0">{{ lang.new_password }}</h6>
                                            </div>
                                            <div class="col-sm-9 text-secondary">
                                                <div class="input-group mb-3">
                                                <input type="password" name="new_password" id="new_password" class="form-control {{ errors.new_password ? ' is-invalid' : '' }}" />
                                                    <span class="input-group-text"><a href="javascript:;" class="text-dark" onclick="showPassword()">Show</a></span>
                                                {% if errors.new_password %}
                                                    <div class="invalid-feedback">{{ errors.new_password | first }}</div>
                                                {% endif %}
                                                </div>
                                            </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.change_password }}</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block innerjs %}
<script>
    function showPassword() {
        var x = document.getElementById("new_password");
        if (x.type === "password") {
            x.type = "text";
        } else {
            x.type = "password";
        }
    }
</script>
{% endblock %}
