% layout 'AdminLTE', title => "User password";

% content_for 'module' => begin

<div class="card-body">

    % if (config->{debug} == 1) {
    <p>
    %= dumper $c->current_route
    %= dumper $pwd_datas
    </p>
    % }

    <h2><%= l 'pwd_ACCOUNT_PASSWORD_CHANGE' %></h2>

    % if ( stash 'error' ) {
        <br>
        <div>
            %= $c->render_to_string(inline => stash 'error') 
        </div>
    %}


    %  my $btn = l('pwd_PASSWORD_CHANGE');
    %  my $url = '/userpassword';

    <div>
        %= $c->render_to_string( inline => l('pwd_DESCRIPTION'));
    </div>
    
    % if ( $pwd_datas->{trt} eq 'RESET' ) {
    %    my $btn = l('pwd_PASSWORD_RESET');
    %    my $url = '/userpasswordr';
    %= $c->render_to_string( inline => l('pwd_DESCRIPTION_RESET'));
    % }

   <br>

    <!-- Start of Form -->
    %= form_for $url => (method => 'POST') => begin

    <table class="table table-bordered user-table-max-wdith">
        <thead>
            <tr>
                <th class="col-sm">
                    %= l 'pwd_YOUR_ACCOUNT'
                </th>
                <th class="col-sm">
                    %=l 'USER_NAME'
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td><%= $pwd_datas->{Account} %></td>
                <td><%= $pwd_datas->{name} %>Not in pwd_datas-> name ? :-( </td>
           </tr>
       </tbody>
    </table>
    
    <br>

    % if ( $pwd_datas->{trt} ne 'RESET' ) {
        <div>
        <%= l 'pwd_PASSWORD_OLD' %>
        </div>
        
        <br>
        
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
            <input name="OldPass" id="OldPass" type="password" class="form-control sme-password" placeholder="Password">
            </div>
        </div>
    % }

    <br> 

    <div>
    <%= l 'pwd_PASSWORD_NEW' %>
    </div>
    
    <br>
    
    <div class="row g-3 align-items-center">
        <div class="col-md-2">
        <input name="Pass" id="Pass" type="password" class="form-control sme-password" placeholder="Password">
        </div>
    </div>

    <br>

    <div>
    %=l 'pwd_PASSWORD_VERIFY_NEW'
    </div>
    
    <br>
    
    <div class="row g-3 align-items-center">
        <div class="col-md-2">
        <input name="Passverify" id="PassVerify" type="password" class="form-control sme-password" placeholder="Password">
        </div>
    </div>   

    <br>

    <div class="row g-3 align-items-center">
        <div class="col-md-2">
            <button type="submit" class="btn btn-primary"><%= $btn %></button>
        </div>
    </div>

    %= hidden_field 'User' => $pwd_datas->{Account}
    %= hidden_field 'Trt' => $pwd_datas->{trt}
    %= hidden_field 'jwt' => $pwd_datas->{jwt}

    % end
    <!-- End of Form -->

</div>

% end