% content_for 'module' => begin

<div class="container-sm">
    <br>
    <h2><%= l 'usr_P2_TITLE' %></h2>
    <br>
    <%= $c->render_to_string(inline => l ('usr_CREATE_MODIFY_DESC')) %>
    <br><br>
    
    % my $btn = l('ADD');  

    <form action="/smanager/useraccountsd" method="POST">
        %#= form_for '/useraccountsd' => (method => 'POST') => begin
    
        % if ( $usr_datas->{trt} eq 'ADD' ) {
        
        % param 'user' => $usr_datas->{user} unless param 'user';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputLastNAme" class="col-form-label"><%= l 'usr_ACCOUNT_NAME' %></label>
            </div>
            <div class="col-auto">
              <input type="text" id="inputUser" class="form-control" aria-describedby="LastName" value="<%= $usr_datas->{user} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                User
              </span>
            </div>
        </div>
    
        %#= text_field 'user'
    
        % } else {
            <!-- If not user set Button Save not Add -->
            % $btn = l('SAVE');

            <div class="row g-3 align-items-center">
                <div class="col-md-2">
                  <label for="inputLastNAme" class="col-form-label"><%= l 'usr_ACCOUNT_NAME' %></label>
                </div>
                <div class="col-auto">
                  <input disabled type="text" id="disabledTextInput" class="form-control" placeholder="<%= $usr_datas->{user} %>">
                </div>
        
            </div>
        % }
       
        <br>
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputFirstName" class="col-form-label"><%= l 'usr_FIRSTNAME' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="FirstName" id="inputFirstName" class="form-control" aria-describedby="FirstName" value="<%= $usr_datas->{firstname} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                First Name
              </span>
            </div>
        </div>
        <br>
    
       % param 'LastName' => $usr_datas->{lastname} unless param 'LastName';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputLastNAme" class="col-form-label"><%= l 'usr_LASTNAME' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="LastName" id="inputLastName" class="form-control" aria-describedby="LastName" value="<%= $usr_datas->{lastname} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                Last Name
              </span>
            </div>
        </div>
        <br>
    
    
        % param 'Dept' => $usr_datas->{dept} unless param 'Dept';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputDepartment" class="col-form-label"><%= l 'usr_DEPARTMENT' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="Dept" id="inputEmail" class="form-control" aria-describedby="Dept" value="<%= $usr_datas->{dept} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                Department
              </span>
            </div>
        </div>
        <br>
    
    
        % param 'Company' => $usr_datas->{company} unless param 'Company';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputCompany" class="col-form-label"><%= l 'usr_COMPANY' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="Company" id="inputCompany" class="form-control" aria-describedby="Company" value="<%= $usr_datas->{company} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                Company
              </span>
            </div>
        </div>
        <br>
    
    
        % param 'Street' => $usr_datas->{street} unless param 'Street';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputStreet" class="col-form-label"><%= l 'usr_STREET_ADDRESS' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="Street" id="inputCompany" class="form-control" aria-describedby="Street" value="<%= $usr_datas->{street} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                Street
              </span>
            </div>
        </div>
        <br>
        
        % param 'City' => $usr_datas->{city} unless param 'City';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputCity" class="col-form-label"><%= l 'usr_CITY' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="City" id="inputCity" class="form-control" aria-describedby="City" value="<%= $usr_datas->{city} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                City
              </span>
            </div>
        </div>
        <br>
       
        
       
        % param 'Phone' => $usr_datas->{phone} unless param 'Phone';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputPhone" class="col-form-label"><%= l 'usr_PHONE_NUMBER' %></label>
            </div>
            <div class="col-auto">
              <input type="text" name="Phone" id="inputPhone" class="form-control" aria-describedby="City" value="<%= $usr_datas->{phone} %>" >
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                Phone
              </span>
            </div>
        </div>
        <br>
    
    
        % param 'EmailForward' => $usr_datas->{emailforward} unless param 'EmailForward';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <label for="inputEmailDelivery" class="col-form-label"><%= l 'usr_EMAIL_DELIVERY' %></label>
            </div>
            <div class="col-auto">
                %= select_field 'EmailForward' => $c->emailForward_list(), class => "form-select"
            </div>
        </div>
        <br>
    
        % param 'ForwardAddress' => $usr_datas->{forwardaddress} unless param 'ForwardAddress';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
              <label for="inputEmail" class="col-form-label"><%= l 'usr_FORWARDING_ADDRESS' %></label>
            </div>
            <div class="col-auto">
              <input type="email" name="ForwardAddresss" id="inputEmail" class="form-control" aria-describedby="Email" value=<%= $usr_datas->{forwardaddress} %>>
            </div>
            <div class="col-auto">
              <span id="passwordHelpInline" class="form-text">
                Email forwarding address
              </span>
            </div>
        </div>
        <br>
    
    
        % param 'VPNClientAccess' => $usr_datas->{vpnclientaccess} unless param 'VPNClientAccess';
    
        <div class="row g-3 align-items-center">
            <div class="col-md-2">
                <label for="inputVPNClientAccess" class="col-form-label"><%= l 'usr_VPN_CLIENT_ACCESS' %></label>
            </div>
            <div class="col-auto">
                %= select_field 'VPNClientAccess' => [[ (l 'NO') => 'no'], [ (l 'YES') => 'yes']], class => "form-select"
            </div>
        </div>
        <br>
    
        <!-- fix from here -->
    
        
        <!-- Begin if ipsec needs fixing -->
        % if (  $usr_datas->{trt} eq 'UPD' and $c->ipsec_for_acct eq 'OK' ) {
            % my $btn2 = $c->l('DOWNLOAD');
            %= form_for '/useraccountso' => (method => 'POST') => begin
            %= l 'usr_LABEL_IPSECRW_DOWNLOAD'
            %= submit_button $btn2, class => ""
            %= hidden_field 'trt' => 'CRT'
            %= hidden_field 'user' => $usr_datas->{user}
            % end
        % }
        <!-- End if ipsec  -->
    
    
        <!-- Groups begin -->
        <div>
            % my @groups = @{$c->get_groups()};
            
            %#= dumper @groups
        
            % if ( @groups ) {

                <br><br>
                
                %=l 'usr_GROUP_MEMBERSHIPS'
                
                <br><br>
                
                <table class="table table-bordered user-table-max-wdith">
                <thead>
                  <tr>
                    <th class="col-sm-1"><%= l 'usr_MEMBER' %></th>
                    <th class="col-sm-1"><%=l 'GROUP' %></th>
                    <th class="col-sm-1"><%=l 'DESCRIPTION' %></th>
                    
                  </tr>
                </thead>
                    <tbody>
                        
                        % foreach my $g ( @groups) {
                            % my $user = $usr_datas->{user};
                            % my $groupname  = $g->key();
                            % my $description    = $g->prop('Description');
                            % my $checked = '';
                                % if ( $user and $c->is_user_in_group($user, $groupname) ) {
                                %     $checked = 'checked';
                                % }
            
                            <tr>
                                <td>
                                % if ( $checked eq 'checked' ) {
                                <input type='checkbox' name='groupMemberships' checked value='<%= $groupname %>'>
                                %} else {
                                %= check_box 'groupMemberships' => $groupname
                                %}
                                </td>
                                <td><%= $groupname %></td>
                                <td><%= $description %></td>
                            </tr>
                            % }
        
                        </tbody>
                    </table>
            
            % }
        <!-- Groups End -->
        </div>
    
        <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 'trt' => $usr_datas->{trt}
    
        % if ( $usr_datas->{trt} eq 'UPD' ) {
                %= hidden_field 'user' => $usr_datas->{user}
        % }
        
        % end
    </form>
</div>

<!-- End of containers-sm -->