<?php

//////////////////////////////////////////////////////////////
//===========================================================
// add_baremetal_theme.php
//===========================================================
// SOFTACULOUS VIRTUALIZOR
// Version : 1.0
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Alons
// Date:       8th Mar 2010
// Time:       23:00 hrs
// Site:       https://www.virtualizor.com/ (SOFTACULOUS VIRTUALIZOR)
// ----------------------------------------------------------
// Please Read the Terms of use at https://www.virtualizor.com
// ----------------------------------------------------------
//===========================================================
// (c)Softaculous Ltd.
//===========================================================
//////////////////////////////////////////////////////////////

if (!defined('VIRTUALIZOR')) {
    die('Hacking Attempt');
}

function add_baremetal_theme() {
    
    global $theme, $globals, $kernel, $l, $error, $done, $SESS, $baremetals, $list_datacenters, $countries, $users, $netmaskList;

    softheader($l['<title>']);

    $GLOBALS['breadcrumbs'] = array('dashboard', 'lms_add_datacenter');

    echo page_header(__('Add Baremetal'), 'fas fa-server', '', 1, 0, '');

    echo '
    <script>

    // get ajax call function
    function get_ajax_reps(url){
        var data_response = "";
        $.ajax({
            type:"GET",
            url: url,
            async: false,
            success:function(data){
                data_response = data;
            }
        });

        return data_response;
    }

    // post ajax call function
    function post_ajax_res(url, formname = "", data = ""){
        
        let response_data = "";
        if(formname){
            data += $("#"+formname).serialize();
        };

        console.log(data);

        $.ajax({
            type: "POST",
            url: url,
            data: data,
            async: false,
            success:function(data_res){
                response_data = data_res;
            },
        });

        return response_data;
    }

    // as per the selected_dcid we can fetch the data of available racks
    function rack_plan_check(selected_dcid){

        show_loader("screen-loader");
        let dcid = $(selected_dcid).val();
        let selected_dc =  $(selected_dcid).find(":selected");
        let dc_name = selected_dc.data("name");

        // converting to number to avoid the 0 value select datacenter
        if(Number(dcid)){

            var url = "'.$globals['index'].'&act=add_baremetal&dcid="+dcid+"&api=json";
            let resource_vals = get_ajax_reps(url);
            resource_vals = JSON.parse(resource_vals);
            let rack_details = resource_vals.data.rack_details;
            let message = resource_vals.message;

            if (rack_details === null) {
                $("#selected_rack").prop("disabled", true);
                
                let rack_options = `<option value="-1" selected="selected">' . __j('Select Datacenter First') . '</option>`;

                $.each(rack_details, function(key, value){
                    rack_options += `<option data-height="${value["rack_height"]}" value="${value["rackid"]}">${value["rack_name"]}</option>`;
                });

                $("#selected_rack").html(rack_options);

                let rack_height = `<option value="0" selected="selected">' . __j('Select Rack First') . '</option>`;

                $.each(rack_details, function(key, value){
                    rack_height += `<option data-height="${value["rack_height"]}" value="${value["rackid"]}">${value["rack_name"]}</option>`;
                });

                $("#rack_position").html(rack_height);
                
                show_loader("screen-loader");

                $("#rack_position").prop("disabled", true);
                
                let rack_message = `${message} </br> Please Add Racks in <a href="'.$globals['index'].'act=add_dcracks'.'">${dc_name}</a> Datacenter`;
                showalert(rack_message, 2);

                return false;
            }

            $("#selected_rack").prop("disabled", false);

            let rack_options = `<option value="-1" selected="selected">' . __j('Select Rack') . '</option>`;

            $.each(rack_details, function(key, value){
                rack_options += `<option data-height="${value["rack_height"]}" value="${value["rackid"]}">${value["rack_name"]}</option>`;
            });

            $("#selected_rack").html(rack_options);
            show_loader("screen-loader");

            return false;
            
        }else{
            show_loader("screen-loader");
            showalert("'.__('Please select Datacenter first').'", 1);
        }
    }

    // As per rack change we can assign the height of each rack
    function rack_plan_change(rackid){

        // showing loader incase the ajax takes time
        show_loader("screen-loader");
        // let dcid = Number($("#dcid").val());
        let rack_height = $("#selected_rack option:selected").data("height");
        console.log(rack_height);

        if(rack_height == 0){

            let rack_height = `<option value="0" selected="selected">' . __j('Select Rack First') . '</option>`;

            $.each(rack_details, function(key, value){
                rack_height += `<option data-height="${value["rack_height"]}" value="${value["rackid"]}">${value["rack_name"]}</option>`;
            });

            $("#rack_position").html(rack_height);
            
            // hiding loader incase the ajax takes time
            show_loader("screen-loader");

            showalert("No Rack Height Found, Please check once", 2);
            return false;
        }else{

            $("#rack_position").prop("disabled", false);

            let rack_height_options = "";

            for (let i = 1; i <= rack_height; i++) {
                rack_height_options += `<option value="${i}">U${i}</option>`;
            }

            $("#rack_position").html(rack_height_options);
            
            // hiding loader incase the ajax takes time
            show_loader("screen-loader");
        }
    }

    
    $(document).ready(function(){

        // submit the form of baremetal
        $("#add_baremetal").submit(function(){

            show_loader("screen-loader");
            
            $("#selected_rack").prop("disabled", false);
            $("#rack_position").prop("disabled", false);

            let baremetal_name = $("#baremetal_name").val();

            if(baremetal_name){

                let act_url = "add_baremetal";
                let url = "' . $globals['index'] . '&act="+act_url+"&api=json&jsnohf=1";
                let response = post_ajax_res(url, "add_baremetal", "&add_baremetal=1&");
                response = JSON.parse(response);

                console.log(response.status);

                if(response.status == "success"){
                    show_loader("screen-loader");
                    showalert(response.message);
                }else{
                    showalert(response.message, 1);
                }

                $("#alert-modal").on("hidden.bs.modal", function (e) {
                    // put your default event here
                    window.location.href="'.$globals['index'].'act=list_baremetals";
                });

            }else{pv
                show_loader("screen-loader");
                showalert("'.__('Please check baremetal name').'", 1);
            }

            return false;

        });

        // select2 format for the datacenter with flags
        function formatOption(state) {
            if (!state.id) {
                return state.text; // default option (placeholder)
            }

            let img = $(state.element).data("image");

            if (!img) {
                return state.text;
            }

            let $state = $(`
                <span style="display:flex; align-items:center;">
                    <img src="${img}" style="width:22px; height:15px; margin-right:8px; object-fit:cover;">
                    ${state.text}
                </span>
            `);

            return $state;
        }

        $("#selected_dc").select2({
            templateResult: formatOption,
            templateSelection: formatOption,
        });

        // select2 for the bm_tags
        $("#bm_tags").select2({
            tags: true,
            tokenSeparators: [",", " "]
        });

    });

    // chcek IPMI connection function
    function check_connection(){

        show_loader("screen-loader");
        let loader = `<div class="loader-sm"></div>`; // your loader HTML
        // Show loader inside the button
        $("#test_connection_btn").html(loader);

        // Disable the button to prevent double click
        $("#test_connection_btn").prop("disabled", true);

        let all_data = {
            test_connection: 1,
            ipmi_provider: $("#ipmi_provider").val(),
            ipmi_ip: $("#ipmi_ip").val(),
            ipmi_user: $("#ipmi_username").val(),
            ipmi_password: $("#ipmi_password").val(),
            redfish_support: $("#redfish_support").prop("checked") ? 1 : 0
        };

        let act_url = "add_baremetal";
        let url = "' . $globals['index'] . '&act="+act_url+"&api=json&jsnohf=1";
        let response = post_ajax_res(url, "", all_data);
        
        response = JSON.parse(response);

        if(response.status == "success"){
            let message = response.message;
            show_loader("screen-loader");
            showalert(message);
            let test_text = "'.__('Test Connection').'"; // your loader HTML

            // Show loader inside the button
            $("#test_connection_btn").html(test_text);
            $("#test_connection_btn").prop("disabled", false);

        }else{
            show_loader("screen-loader");
            showalert(message, 1);
        }
        return false;
    };

    </script>
    
    <div class="card p-4 mx-3">
        <form accept-charset="' . $globals['charset'] . '" name="add_baremetal" method="post" action="" class="form-horizontal" id="add_baremetal">
            <ul class="nav nav-tabs nav-justified d-none d-md-flex d-lg-flex" id="add_baremetal_tabs" role="tablist">
                <li class="nav-item" role="presentation">
                    <a class="nav-link w-100 gap-1 active" id="add_baremetal-tab" data-toggle="tab" href="#add_baremetal-justified" role="tab" aria-controls="add_baremetal" aria-selected="true">
                        <i class="fas fa-server text-admin"></i>
                        '.__('Baremetal Details').'
                    </a>
                </li>
                <li class="nav-item" role="presentation">
                    <a class="nav-link w-100 gap-1" id="bm-network-tab" data-toggle="tab" href="#bm-network-justified" role="tab" aria-controls="ipmi" aria-selected="false">
                    <i class="fas fa-network-wired text-admin"></i>
                    '.__('Network Details').'</a>
                </li>
                <li class="nav-item" role="presentation">
                    <a class="nav-link w-100 gap-1" id="ipmi-tab" data-toggle="tab" href="#ipmi-justified" role="tab" aria-controls="ipmi" aria-selected="false">
                    <i class="fas fa-microchip text-admin"></i>
                    '.__('IPMI Details (Optional)').'</a>
                </li>
            </ul>
            <select class="form-select custom-select d-md-none" id="add_baremetal_tabs_select">
                <option value="#general-justified">'.__('Add Baremetal').'</option>
                <option value="#user-justified">'.__('Add IPMI Details').'</option>
            </select>
            <div class="loading_overlay" id="screen-loader" style="display:none">
                <div class="loader-lg"></div>
            </div>
            <div class="tab-content pt-2" id="add_baremetal_tabs_content">
                <div class="tab-pane fade show active" id="add_baremetal-justified" role="tabpanel" aria-labelledby="add_baremetal-tab">
                    <div class="row mx-auto w-100 mb-3">
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Select User').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Select the user the invoice belongs to').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <select class="custom-select virt-select" name="uid" id="uid">
                                <option value="0" '.(POSTval('uid') == "" ? 'selected="selected"' : '').'>'.__('Select User').'</option>';	
                                foreach($users as $k => $v){ 
                                    echo '<option value="'.$k.'" '.(POSTval('uid') == $k ? 'selected="selected"' : '').'>'.$v['email'].'</option>';
                                }
                        
                                echo'
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Baremetal Server Name').' <a class="info" data-placement="right" tooltip="'.__('Name which will be shown to users').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="baremetal_name" id="baremetal_name" size="30" value="'.POSTval('baremetal_name', '').'" required/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Unit Height').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Bare Metal Unit Height').'"><i class="fas text-primary fa-info-circle"></i></a></label>
                            <select class="custom-select virt-select w-100" name="baremetal_height" id="baremetal_height">';
                                for($i=1; $i<=10;$i++){
                                    echo'<option value="'.$i.'" '.($i == 1 ? 'selected="selected"' : '').'>'.$i.'</option>';
                                }
                                echo'
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Unit Length').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Bare Metal Unit Length').'"><i class="fas text-primary fa-info-circle"></i></a></label>
                            <select class="custom-select virt-select w-100" name="baremetal_length" id="baremetal_length">
                                <option value="100" '.(POSTval('baremetal_length') == '100' ? 'selected="selected"' : '').'>'.__('100 %').'</option>
                                <option value="50" '.(POSTval('baremetal_length') == '50' ? 'selected="selected"' : '').'>'.__('50 %').'</option>
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Datacenter Name').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Choose Datacenter to assign the baremetal for it').'"><i class="fas text-primary fa-info-circle"></i></a></label>
                            <select class="custom-select form-select w-100" name="dcid" id="selected_dc" onchange="rack_plan_check(this);" required>
                                <option value="0" >'.__('Select Datacenter').'</option>';
                                foreach($list_datacenters as $dcid => $dcdetails){
                                    echo'<option data-name="'.$dcdetails['name'].'" data-image="'.location_flag($dcdetails['country']).'" value='.$dcid.'. '.(POSTval('selected_dc') == $dcid ? 'selected="selected"' : '').' >'.$dcdetails['name'].' ('.$countries[$dcdetails['country']].')</option>';
                                }
                                echo'
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Assign Rack').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Rack name available at selected datacenter').'"><i class="fas text-primary fa-info-circle"></i></a></label>
                            <select class="custom-select virt-select w-100" onchange="rack_plan_change(this);" name="rackid" id="selected_rack" disabled>
                                <option value="0" '.(POSTval('rackid') == 0 ? 'selected="selected"' : '').'>'.__('Select Datacenter First').'</option>
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Unit Loading').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('UNit loading is that Baremetal occupied full rack or front or back load with 50 % occupied').'"><i class="fas text-primary fa-info-circle"></i></a></label>
                            <select class="custom-select virt-select w-100" name="unit_position" id="unit_position">
                                <option value="full" '.(POSTval('unit_position') == 'full' ? 'selected="selected"' : '').'>Full</option>
                                <option value="front" '.(POSTval('unit_position') == 'front' ? 'selected="selected"' : '').'>Front</option>
                                <option value="back" '.(POSTval('unit_position') == 'back' ? 'selected="selected"' : '').'>Back</option>
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Position In Rack').'&nbsp;<a class="info" data-placement="right" tooltip="'.__('Please choose the Rack position').'"><i class="fas text-primary fa-info-circle"></i></a></label>
                            <select class="custom-select virt-select w-100" name="rack_position" id="rack_position" disabled>
                                <option value="0" '.(POSTval('rack_position') == 0 ? 'selected="selected"' : '').'>'.__('Select Rack First').'</option>
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Status').' <a class="info" data-placement="right" tooltip="'.__('Status of the Baremetal Server').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <select class="custom-select virt-select" name="machine_status" id="machine_status">
                                <option data-color="green" value="available" '.(POSTval('machine_status') == 'available' ? 'selected="selected"' : '').'>available</option>
                                <option data-color="red" value="ordered" '.(POSTval('machine_status') == 'ordered' ? 'selected="selected"' : '').'>ordered</option>
                                <option data-color="blue" value="received" '.(POSTval('machine_status') == 'received' ? 'selected="selected"' : '').'>received</option>
                                <option value="reserved" '.(POSTval('machine_status') == 'reserved' ? 'selected="selected"' : '').'>reserved</option>
                                <option value="provisioning" '.(POSTval('machine_status') == 'provisioning' ? 'selected="selected"' : '').'>provisioning</option>
                                <option value="active" '.(POSTval('machine_status') == 'active' ? 'selected="selected"' : '').'>Active</option>
                                <option value="maintenance" '.(POSTval('machine_status') == 'maintenance' ? 'selected="selected"' : '').'>maintenance</option>
                                <option value="decommissioned" '.(POSTval('machine_status') == 'decommissioned' ? 'selected="selected"' : '').'>decommissioned</option>
                                <option value="sold" '.(POSTval('machine_status') == 'sold' ? 'selected="selected"' : '').'>sold</option>
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Tags').' <a class="info" data-placement="right" tooltip="'.__('Tag for remebering this Baremetal Server').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <select class="form-control" name="bm_tags[]" id="bm_tags" multiple="">';
                                if(!empty($bm_tags)){
                                    foreach($bm_tags as $tk => $tv){		 
                                        echo '<option value="'.$tk.'" '.(POSTval('bm_tags') == $k ? 'selected="selected"' : '').'>'.$tv.'</option>';
                                    }
                                }
                            echo '
                            </select>
                        </div>
                    </div>
                </div>
                <div class="tab-pane fade" id="bm-network-justified" role="tabpanel" aria-labelledby="bm-network-tab">
                    <div class="row mx-auto w-100 mb-3">
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Baremetal IP Address').' <a class="info" data-placement="right" tooltip="'.__('IP address of the baremetal').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="bm_ip_address" id="bm_ip_address" size="30" value="'.POSTval('bm_ip_address', '').'"/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Baremetal Hostname').' <a class="info" data-placement="right" tooltip="'.__('Hostname of the bare metal').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="bm_ip_hostname" id="bm_ip_hostname" size="30" value="'.POSTval('bm_ip_hostname', '').'"/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Baremetal MAC Address').' <a class="info" data-placement="right" tooltip="'.__('MAC Address of the bare metal').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="bm_ip_macaddress" id="bm_ip_macaddress" size="30" value="'.POSTval('bm_ip_macaddress', '').'"/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label required">'.__('Baremetal IP Gateway').' <a class="info" data-placement="right" tooltip="'.__('IP Address Gateway').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="bm_ip_gateway" id="bm_ip_gateway" size="30" value="'.POSTval('bm_ip_gateway', '').'"/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Netmask').' <a class="info" data-placement="right" tooltip="'.__('Tag for remebering this Baremetal Server').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <select class="custom-select virt-select w-100" name="bm_ip_netmask" id="bm_ip_netmask" >
                                <option value="0" '.(POSTval('bm_ip_netmask') == 0 ? 'selected="selected"' : '').' disabled>'.__('Select Netmask').'</option>';
                                foreach($netmaskList as $maskid => $netmaskdetails){
                                    echo'<option value='.$maskid.'. '.(POSTval('bm_ip_netmask') == $maskid ? 'selected="selected"' : '').' >'.$netmaskdetails.'</option>';
                                }
                                echo'
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Firmware').' <a class="info" data-placement="right" tooltip="'.__('Tag for remebering this Baremetal Server').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <select class="custom-select virt-select w-100" name="firmware" id="firmware" required>
                                <option value="0" '.(POSTval('firmware') == 0 ? 'selected="selected"' : '').' disabled>'.__('Select Firmware').'</option>
                                <option value="1" '.(POSTval('firmware') == 1 ? 'selected="selected"' : '').'>'.__('BIOS').'</option>
                                <option value="2" '.(POSTval('firmware') == 2 ? 'selected="selected"' : '').'>'.__('UEFI').'</option>
                                <option value="3" '.(POSTval('firmware') == 3 ? 'selected="selected"' : '').'>'.__('UEFI Secure Boot').'</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="tab-pane fade" id="ipmi-justified" role="tabpanel" aria-labelledby="ipmi-tab">
                    <div class="row mx-auto w-100 mb-3">
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('Baremetal IPMI provider').' <a class="info" data-placement="right" tooltip="'.__('Baremetal IPMI provider').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <select class="custom-select virt-select" name="ipmi_provider" id="ipmi_provider">
                                <option value="">'.__('Select Provider').'</option>
                                <option value="hp" '.(POSTval('ipmi_provider') == 'hp' ? 'selected="selected"' : '').'>Hewlett Packard</option>
                                <option value="supermicro" '.(POSTval('ipmi_provider') == 'supermicro' ? 'selected="selected"' : '').'>SuperMicro</option>
                                <option value="dell" '.(POSTval('ipmi_provider') == 'dell' ? 'selected="selected"' : '').'>Dell</option>
                                <option value="asus" '.(POSTval('ipmi_provider') == 'asus' ? 'selected="selected"' : '').'>Asus</option>
                            </select>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('IPMI IP').' <a class="info" data-placement="right" tooltip="'.__('Enter the IPMI/BMC IP address (e.g., 192.168.1.20). This dedicated management IP provides remote access to the server\'s hardware controls. Ensure the IP is reachable and properly secured within your network.').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="ipmi_ip" id="ipmi_ip" size="30" value="'.POSTval('ipmi_ip', '').'"/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('IPMI Username').' <a class="info" data-placement="right" tooltip="'.__('Enter the username for accessing the server’s IPMI/BMC interface. This credential is required for remote hardware management.').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="ipmi_username" id="ipmi_username" size="30" value="'.POSTval('ipmi_username', '').'"/>
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('IPMI Password').' <a class="info" data-placement="right" tooltip="'.__('Enter the password for the server’s IPMI/BMC login. This credential allows access to the remote hardware controls.').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            <input type="text" class="form-control" name="ipmi_password" id="ipmi_password" size="30" value="'.POSTval('ipmi_password', '').'"  />
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <label class="control-label">'.__('RedFish Support').' <a class="info" data-placement="right" tooltip="'.__('Enable Redfish support to manage and monitor the server using the Redfish API interface.').'"><i class="fas text-primary fa-info-circle"></i></a></label><br>
                            '.get_switch('redfish_support', '', 'redfish_support', array('chk_it' => 1), 1, '').'
                        </div>
                        <div class="col-sm-12 col-md-6 my-2">
                            <button id="test_connection_btn" class="btn btn-information" onclick="check_connection();">
                                ' . __('Test Connection') . '
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="text-center mt-4">
                <button type="submit" onclick="" class="go_btn mt-5 mb-3" name="add_baremetal" value="1">
                    ' . __('Save Baremetal') . '
                </button>
            </div>
        </form>
    </div>
    
    ';
    
    softfooter();

}
