<div>
    % my $btn = l('pf_CREATE_RULE');
    %= form_for '/portforwardinga' => (method => 'POST') => begin

    % my $retref= $c->stash("ret");
    % my %ret;
    % unless (length($retref)) {%ret = (ret=>"");}
    % else {%ret = %$retref;}
 
    % my $numtcpforwards = @$tcpforwards;
    % my $numudpforwards = @$udpforwards;

    % my @vars = split(",",$ret{vars});
    % my $var1 = @vars[0];
    % my $var2 = @vars[1];
    % my $var3 = @vars[2];
    % my $var4 = @vars[3];
    % my $var5 = @vars[4];
    % my $var6 = @vars[5];

    %if ($ret{ret} eq "") {
        %= $c->render_to_string(inline => l('pf_FIRST_PAGE_DESCRIPTION'));
    %} elsif (index($ret{ret},"SUCCESS") != -1) {
        <br>
       <div class="">
           <!--<h2> Operation Status Report</h2>-->
            %= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
        </div>
       %} else { 
        <br>
       <div class="">
           <!--<h2> Operation Status Report - Error</h2>-->
            %= $c->l($ret{ret},$var1,$var2,$var3,$var4,$var5,$var6);
        </div>
    %}

    <p>
    <br>
    %= submit_button "$btn", class => ""
    </p>


    % end   
   
    %   if ($empty){
            <br>
        %=l 'pf_NO_FORWARDS'
    %   } else {
        <br>
        %=l 'pf_SHOW_FORWARDS'
    <br><br />
        <table class="table table-bordered">
        <thead>
        <tr>
            <th class="">
                %=l 'pf_LABEL_PROTOCOL'
            </th>
            <th class="">
                %=l 'pf_LABEL_SOURCE_PORT'
            </th>
            <th class="">
                %=l 'pf_LABEL_DESTINATION_HOST'
            </th>
            <th class="">
                %=l 'pf_LABEL_DESTINATION_PORT'
            </th>
            <th class="">
                %=l 'pf_ALLOW_HOSTS'
            </th>
            <th class="">
                %=l 'pf_RULE_COMMENT'
            </th>
            <th class="" '>
                %=l 'ACTION'
            </th>
        </tr>
        </thead>
        <tbody>
        % my %forwards = ();
        % $forwards{TCP} = $tcpforwards;
        % $forwards{UDP} = $udpforwards;

        % foreach my $proto (sort keys %forwards) {

        %    if (@{ $forwards{$proto} }) {
        %        foreach my $entry (@{ $forwards{$proto} }) {
            <tr>
        %           my $sport = $entry->key;
        %           my $dhost = $entry->prop('DestHost');
        %           my $dport = $entry->prop('DestPort') || '';
        %           my $cmmnt  = $entry->prop('Comment') || '';
        %           my $allow  = $entry->prop('AllowHosts') || '';
        %=          t td => (class => "") => $proto
        %=          t td => (class => "") => $sport
        %=          t td => (class => "") => $dhost
        %=          t td => (class => "") => $dport
        %=          t td => (class => "") => $allow
        %=          t td => (class => "") => $cmmnt
                    <td class="">
                        %my $remove_text = l('REMOVE');  # Localized text
                        %my $csrf_token = "TOKEN";  # CSRF token for security
                        %my $actionRemove = qq{
                                                %       <a href="portforwardingd?CsrfDef=$csrf_token&trt=DEL&sport=$sport&proto=$proto">
                        %   <button type='button' class="" title='$remove_text' >
                        %       $remove_text
                        %   </button>
                                                %       </a>
                        %};
                    <%= $c->render_to_string(inline => $actionRemove) %>
                    </td>
            </tr>
         %       }
         %   }
        %}
    %}
    </tbody>
    </table>
    %= hidden_field 'trt' => $pf_datas->{trt}
 
</div>
