%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-01-20 16:21:33
%#
<div>



    % if (config->{debug} == 1) {
        <pre>
            %= dumper $nut_data
        </pre>
    % }


    <form action="/smanager/nutupsu" method="POST">

        %# Inputs etc in here.

        <!-- reetp - autocomplete="off" ? -->

        <h2><%=l('nut_Manage_Nutups-config_settings:')%></h2>

        <br>

        <div class="row g-3 align-items-center">
            <div class="col-md-1">
                <%= l ('nut_Nut_status') %>
            </div>
            <div class="col-auto">
            %# my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled']];
            %# param 'status' => $nut_data->{status} unless param 'status';

                % my @status_options = selected_field([['Disabled' => 'disabled'], ['Enabled' => 'enabled']], $nut_data->{status});
                <%= select_field 'status' => @status_options, class => "form-select", id => 'status_select' %>
            </div>
        </div>

        <br>

        <div class="row g-3 align-items-center">
            <div class="col-md-1">
                <%= l ('nut_Nut_mode') %>
            </div>
            <div class="col-auto">
                % my @Nutmode_options = [['Standalone' => 'standalone'], ['Net Server' => 'netserver'], ['Net Client ' => 'netclient']];
                % param 'Nutmode' => $nut_data->{Nutmode} unless param 'Nutmode';
                <%= select_field 'Nutmode' => @Nutmode_options, class => "input form-select", id => "Nutmode_select" %>
            </div>
        </div>

        <br><br>

        <div class="masterups">
            <div class="secondaryups">

                <h2><%=l('nut_if_Net_Server')%></h2>

                <br>

                <div class="row g-3 align-items-center">
                    <div class="col-md-1">
                        <label for="inputMasterUPSName" class="col-form-label"><%= l ('nut_MasterUPS_UPSNAME@IP') %></label>
                    </div>
                    <div class="col-auto">
                        % param 'MasterUPS_Name' => $nut_data->{MasterUPS_Name} unless param 'MasterUPS_Name';
                        <%= 'ups@'. $nut_data->{'localip'} %>
                    </div>
                </div>

                <div class="row g-3 align-items-center">
                    <div class="col-md-1">
                        <%= l ('nut_SlaveUPS_User') %>
                    </div>
                    <div class="col-auto">
                        <%= 'upssecondary' %>
                    </div>
                </div>

                <div class="row g-3 align-items-center">
                    <div class="col-md-1">
                        %=l('nut_SlaveUPS_Password')
                    </div>
                    <div class="col-auto">
                        <%= $nut_data->{'SlaveUPS_Pass'}%>
                    </div>
                </div>

                <br>

            </div>

            <br>

            <div>

                <h2><%= l ('nut_UPS_Device') %></h2>

                <br>

                <div class="row g-3 align-items-center">
                    <div class="col-md-1">
                        <label for="UPS_Model_select" class="col-form-label"><%= l ('nut_UPS_Model') %></label>
                    </div>
                    <div class="col-auto">
                        % my @UPS_Model_options = $c->get_model_options();
                        % param 'UPS_Model' => $nut_data->{UPS_Model} unless param 'UPS_Model';
                        <%= select_field 'UPS_Model' => \@UPS_Model_options, class => "form-select", id => 'UPS_Model_select' %>
                    </div>
                </div>

                <br>

                <div class="row g-3 align-items-center">
                    <div class="col-md-1">
                        <label for="inputUPSDevice" class="col-form-label"><%= l ('nut_UPS_Device') %></label>
                    </div>
                    <div class="col-auto">
                        % param 'UPS_Device' => $nut_data->{UPS_Device} unless param 'UPS_Device';
                        <input type="text" name="UPS_Device" pattern=".*" size="50" id="inputUPSDevice" class="form-control" aria-describedby="UPS Device" placeholder="auto (for usb)" value="<%= $nut_data->{UPS_Device} %>" >
                    </div>
                </div>
            </div>

        </div>

        <div class="slaveups">

            <h2><%=l('nut_if_Net_Client')%></h2>

            <br>

            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="inputClientUPSDevice" class="col-form-label"><%= l ('nut_SlaveUPS_UPSNAME@IP') %></label>
                </div>
                <div class="col-auto">
                    % param 'ClientUPS_Name' => $nut_data->{ClientUPS_Name} unless param 'ClientUPS_Name';
                    <input type="text" name="ClientUPS_Name" pattern=".*" size="50" id="inputClientUPSDevice" class="form-control" aria-describedby="Client UPS Name" placeholder="upsname@IP[:port]" value="<%= $nut_data->{ClientUPS_Name} %>" >
                </div>
            </div>

            <br>

            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="ClientUPSUsername" class="col-form-label"><%= l ('nut_ClientUPS_Username') %></label>
                </div>
                <div class="col-auto">
                    % param 'ClientUPS_User' => $nut_data->{ClientUPS_User} unless param 'ClientUPS_User';
                    <input type="text" name="ClientUPS_User" id="ClientUPSUsername" class="form-control" aria-describedby="Client UPS Username" placeholder="Client username" value="<%= $nut_data->{ClientUPS_User} %>" >
                </div>
            </div>

            <br>

            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="password" class="col-form-label"><%= l ('nut_ClientUPS_Password') %></label>
                </div>
                <div class="col-auto">
                    % param 'ClientUPS_Pass' => $nut_data->{ClientUPS_Pass} unless param 'ClientUPS_Pass';
                    <input type="password" name="ClientUPS_Pass" id="password" class="form-control" aria-describedby="Client UPS Password" placeholder="Client password" value="<%= $nut_data->{ClientUPS_Pass} %>" >
                </div>
                <div class="col-auto">
                    <span id="togglePassword" class="bi bi-eye"></span>
                </div>

            </div>
        </div>

        <br><br>

        <div class="generics">

            <h2><%=l('nut_if_genericups')%></h2>

            <br><br>

            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="inputUPSGenericType" class="col-form-label"><%= l ('nut_UPS_Generic_Type') %></label>
                </div>
                <div class="col-auto">
                    % param 'UPS_gen_Type' => $nut_data->{UPS_gen_Type} unless param 'UPS_gen_Type';
                    <input type="text" name="UPS_gen_Type" pattern=".*" size="50" id="inputUPSGenericType" class="form-control" aria-describedby="UPS Generic Type" placeholder="UPS_Gen_Type" value="<%= $nut_data->{UPS_gen_Type} %>" >
                </div>
            </div>

            <br>

            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="inputUPSManufacturer" class="col-form-label"><%= l ('nut_UPS_Generic_Manufacturer') %></label>
                </div>
                <div class="col-auto">
                    % param 'UPS_gen_Mfr' => $nut_data->{UPS_gen_Mfr} unless param 'UPS_gen_Mfr';
                    <input type="text" name="UPS_gen_Mfr" pattern=".*" size="50" id="inputUPSManufacturer" class="form-control" aria-describedby="UPS Generic Manufacturer" placeholder="UPS_sen_Mfr" value="<%= $nut_data->{UPS_gen_Mfr} %>" >
                </div>
            </div>

            <br>

            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="inputUPSModel" class="col-form-label"><%= l ('nut_UPS_Generic_Model') %></label>
                </div>
                <div class="col-auto">
                    % param 'UPS_gen_Model' => $nut_data->{UPS_gen_Model} unless param 'UPS_gen_Model';
                    <input type="text" name="UPS_gen_Model" pattern=".*" size="50" id="inputUPSModel" class="form-control" aria-describedby="UPS Generic Model" placeholder="UPS_gen_Model" value="<%= $nut_data->{UPS_gen_Model} %>" >
                </div>
            </div>

        </div>

        <br>

        % param 'trt' => $nut_data->{trt} unless param 'trt';
        <%= hidden_field 'trt' => $nut_data->{trt} %>

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

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

    </form>

    <br>

</div>