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

{% block title %}{{ lang.change_password }} {% 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"><a href="{{route('user.index')}}" class="text-dark">{{ lang.users }}</a></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.change_password }}</li>
                            <li class="breadcrumb-item active" aria-current="page">{{ user.name }}</li>
                        </ol>
                    </nav>
                </div>
                <div class="ms-auto">
                    <div class="btn-group btn-group-sm">
                        <a class="btn btn-primary btn-sm" href="{{route('user.index')}}"><i class="bi bi-reply font16"></i> {{ lang.go_back }}</a>
                    </div>
                </div>
            </div>
            <!--end breadcrumb-->

            <div class="row">
                <div class="col-xl-7 mx-auto">
                    {% include'partials/flash.twig' %}
                    <div class="card border shadow-none">
                        <div class="card-body p-5">
                            <form class="row g-3" method="post" action="{{ route('user.password.store') }}">
                                <input name="id" type="hidden" value="{{ user.id }}">
                                {{ csrf.field | raw }}
                                <div class="col-md-12">
                                    <div class="input-group mb-3">
                                        <label for="password" class="form-label d-none">{{ lang.user_password }}</label>
                                        <input type="password" name="password" placeholder="{{ lang.user_password }}" id="password" class="form-control {{ errors.password ? ' is-invalid' : '' }}" />
                                        <span class="input-group-text"><a href="javascript:;" class="text-dark" onclick="showPassword()">Show</a></span>
                                        {% if errors.password %}
                                            <div class="invalid-feedback">{{ errors.password | first }}</div>
                                        {% endif %}
                                    </div>
                                </div>
                                <div class="col-12">
                                    <button type="submit" class="btn btn-primary px-5">{{ lang.change_password }}</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

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