<div>

    % my $btn = l('hos_ADD_HOSTNAME');

    <form action="/smanager/hostentriesd" method="POST">
        <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' => $hos_datas->{trt} %>
    </form>

    % my %dom_hos = %{$dom_hosts};
    % foreach my $domain ( sort ( keys %dom_hos ) ) {

        <br>
            <%= $c->l('hos_CURRENT_HOSTNAMES_FOR_LOCAL_DOMAIN', $domain); %>
        <br>

        <table class="table table-bordered">
            <thead>
                <tr class="">
                    <th class="col-sm"><%= l 'hos_HOSTNAME' %></th>
                    <th class="col-auto"><%= l 'hos_HOSTTYPE' %></th>
                    <th class="col-auto"><%= l 'IP_ADDRESS_OR_FQDN' %></th>
                    <th class="col-auto"><%= l 'hos_ETHERNET_ADDRESS' %></th>
                    <th class="col-auto"><%= l 'COMMENT' %></th>
                    <th class="user-valign-center" colspan="2"><%= l 'ACTION' %></th>
                </tr>
            </thead>

            <tbody>
            % foreach (@{$dom_hos{$domain}{'HOSTS'}}) {
                <tr>
                    <td><%= $_->{'HostName'}; %></td>
                    <td><%= $_->{'HostType'}; %></td>
                    <td><%= $_->{'IP'}; %></td>
                    <td><%= $_->{'MACAddress'}; %></td>
                    <td><%= $_->{'Comment'}; %></td>

                        % my ($actionModify, $actionRemove) = '&nbsp;';
                        % my $static = $_->{'static'} || "no";
                        % if ($static ne 'yes') {
                            %my $modify_text = l('MODIFY');  # Localized text
                            %my $csrf_token = "TOKEN";  # CSRF token for security
                            %my $hostentries_name = $_->{'HostName'};  # hostentries name extracted from the data structure
                            %$actionModify = qq{
                                % <a href="hostentriesd?CsrfDef=$csrf_token&trt=UPD&Hostname=$hostentries_name">
                                %   <button type='button' class="btn btn-primary" title='$modify_text' >
                                %     $modify_text
                                %   </button>
                                % </a>
                            %};
                            %my $remove_text = l('REMOVE');  # Localized text
                            %$csrf_token = "TOKEN";  # CSRF token for security
                            %#my $hostentries_name = $_->{'HostName'};  # hostentries name extracted from the data structure
                            %$actionRemove = qq{
                                % <a href="hostentriesd?CsrfDef=$csrf_token&trt=DEL&Hostname=$hostentries_name">
                                %   <button type='button' class="btn btn-primary" title='$remove_text' >
                                %     $remove_text
                                %   </button>
                                % </a>
                            %};
                        % }
                        <td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
                        <td class="user-valign-center"><%= $c->render_to_string(inline => $actionRemove) %></td>

                </tr>
               % }
            </tbody>
        </table>
     %  }
</div>
