AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.192
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/www/lrsys_apps/leo/application/plugins/module_fish/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/leo/application/plugins/module_fish/assets/js/food-programs.js
/* global ind_mil, ind_decimal, parseFloat */

$(document).ready(function()
{
    
    $("#emsg").hide();
    $("#submit").on('click', function (e) {
        e.preventDefault();
        $("#ibox-form").block({message: block_msg});
       if(verifyItens()){
            $.post($("#_url").val() +$("#_client_view").val() +"module_fish/foodprograms/post", $("#form-food-program").serialize())
                    .done(function (retorno) {
                        var data = JSON.parse(retorno);
                        if (data.status == 'OK') {
                            location.reload();
                        } else {
                            $("#ibox-form").unblock();
                            var body = $("html, body");
                            body.animate({scrollTop: 0}, '1000', 'swing');
                            $("#emsgbody").html(data.msg);
                            $("#emsg").show("slow");
                        }
                    });
        } else {
            bootbox.alert(_L['Module_Fish Insert the information periods']);
        }

    });

function verifyItens(){
       var qtds = document.getElementsByName('period_total[]');
        if (qtds.length > 0) {
            return true;
        }else{
            return false;
        }
}
    
    
    
    $('.number').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
    var rowNum = parseInt($("#rowNum").val());
 
         $('#item-add').on('click', function () {
        //guarda a ultima linha antes de adicionar essa
        var lastRow=0; 
        $('input[name=period\\[\\]]').each(function (f) {
             lastRow= $(this).attr('data-row');
        });


             $("#food_itens").find('tbody')
                    .append(
                            '<tr class="">\n\
                        <td class="middle">\n\
                            <input type="text" data-row="' + rowNum + '" class="form-control verifyValues"  value="" name="period[]" id="period_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                        <input id="period_total_' + rowNum + '" name="period_total[]" type="hidden"><span id="label_period_total_' + rowNum + '"></span></td> \n\\n\
                        <td class="middle">\n\
                                <select data-row="' + rowNum + '"  id="sys_item_id_' + rowNum + '" name="sys_item_id[]"  class="form-control" style="width:100%"><select>\n\
                        </td>  \n\
                        <td class="middle">\n\
                            <input type="text" data-row="' + rowNum + '"  class="form-control verifyValues"  value="1" name="number_deals[]" id="number_deals_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                             <input type="text" class="form-control verifyValues" data-row="' + rowNum + '"  value="" name="weight_of[]" id="weight_of_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                            <input type="text" class="form-control verifyValues" data-row="' + rowNum + '"  value="" name="weight_up[]" id="weight_up_' + rowNum + '">\n\
                        </td> \n\\n\
\n\                     <td class="middle">\n\
                            <input type="text" class="form-control verifyValues"  value="" name="mortality_rate[]" id="mortality_rate_' + rowNum + '">\n\
                        </td> \n\\n\
\n\                     <td class="middle">\n\
                            \n\<span id="label_biomass_' + rowNum + '"></span>\n\
                             <input type="hidden" class="form-control"  value="" name="biomass[]" id="biomass_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                            <input type="text" class="form-control verifyValues"  value="" name="pv[]" id="pv_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                            \n\<span id="label_gpd_' + rowNum + '"></span>\n\
                             <input type="hidden" class="form-control"  value="" name="gpd[]" id="gpd_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                            \n\<span id="label_consumption_day_' + rowNum + '"></span>\n\
                             <input type="hidden" class="form-control"  value="" name="consumption_day[]" id="consumption_day_' + rowNum + '">\n\
                        </td> \n\\n\
                        <td class="middle">\n\
                            \n\<span id="label_tca_' + rowNum + '"></span>\n\
                             <input type="hidden" class="form-control"  value="" name="tca[]" id="tca_' + rowNum + '">\n\
                        </td> \n\\n\
                       <td class="middle col-xs-1">  </span> <span class="btn btn-danger btn-xs delete_item" data-row="' + rowNum + '" ><i class="fa fa-trash"></i> </span></td></tr>'
                            );

        $('#period_' + rowNum).autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 0, aSign: ''});
        findDataSelect("#sys_item_id_" + rowNum, $("#_client_view").val()+'module_fish/ajax/ration/', '');
        $('#number_deals_' + rowNum).autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 0, aSign: ''});
        $('#weight_of_' + rowNum).autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 0, aSign: ''});
        $('#weight_up_' + rowNum).autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 0, aSign: ''});
        $('#mortality_rate_' + rowNum).autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 0, aSign: ''});     
        $('#pv_' + rowNum).autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 2, aSign: ''});
        $('[data-toggle="tooltip"]').tooltip();
                
        if(rowNum>0){
            $('#period_' + rowNum).val(  $('#period_' + lastRow).val());
        }else{
            $('#period_' + rowNum).val(1);
            
        }
        
        rowNum++;
     verifyValues();
    });


   function verifyValues(){
       var total_period=0;
       //verifica o periodo
        var lastRow=-1;
        $('input[name=period\\[\\]]').each(function (f) {
           
            total_period+=formatInt($(this).val());
            $("#period_total_"+$(this).attr('data-row')).val(total_period);
            $("#label_period_total_"+$(this).attr('data-row')).html(total_period);
            if(lastRow>=0){
                $('#weight_of_' + $(this).attr('data-row')).val($('#weight_up_' + lastRow).val());
                $('#weight_of_' + $(this).attr('data-row')).attr('readonly','readonly');
            }
            lastRow=$(this).attr('data-row');
        });
        lastRow=-1;
        
        $('input[name=weight_of\\[\\]]').each(function (f) {
            var biomass=(parseFloat((formatInt($(this).val())+formatInt($("#weight_up_"+$(this).attr('data-row')).val()))/2)*(formatInt($("#initial_amount_fish").val())-formatInt($("#initial_amount_fish").val())*(formatInt($("#mortality_rate_"+$(this).attr('data-row')).val())/100)))/1000;
            $("#biomass_"+$(this).attr('data-row')).val(formatDecimal3(parseFloat(biomass).toFixed(3)));
            $("#label_biomass_"+$(this).attr('data-row')).html(formatDecimal3(parseFloat(biomass).toFixed(3))+'');//Kg        
        

            var consum=0;
            if($("#pv_"+$(this).attr('data-row')).val()!="" && $(this).val()!=''){
               consum=biomass*(formatValueJs($("#pv_"+$(this).attr('data-row')).val()))/100;
            }
             $("#consumption_day_"+$(this).attr('data-row')).val(formatDecimal(parseFloat(consum).toFixed(2)));
            $("#label_consumption_day_"+$(this).attr('data-row')).html(formatDecimal(parseFloat(consum).toFixed(2))+'');//Kg        
         
            var gpd=0;
            if($("#weight_up_"+$(this).attr('data-row')).val()!='' && $(this).val()!=''){
                gpd=formatInt($("#weight_up_"+$(this).attr('data-row')).val())-formatInt($(this).val());
            }
            $("#gpd_"+$(this).attr('data-row')).val(gpd);        
            $("#label_gpd_"+$(this).attr('data-row')).html(gpd+'');//g        
  
            var tca=parseFloat((consum*formatInt($("#period_"+$(this).attr('data-row')).val()))/gpd).toFixed(2);
            $("#tca_"+$(this).attr('data-row')).val(formatDecimal(tca));        
            $("#label_tca_"+$(this).attr('data-row')).html(formatDecimal(tca));        
        });
        
        
   }

    $("#food_itens").on("click", ".delete_item", function (e) {
        $(this).closest('tr').remove();
        verifyValues();
    });
    $("#food_itens").on("blur", ".verifyValues", function (e) {
       verifyValues();
    });
    
    $("#initial_amount_fish").on("blur", function (e) {
       verifyValues();
    });
   // verifyValues();
    
    $('.period').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
    findDataSelect(".sys_item_id", $("#_client_view").val()+'module_fish/ajax/ration/', '');
    $('.number_deals').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
    $('.weight_of').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
    $('.weight_up').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
    $('.mortality_rate').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});     
    $('.pv').autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 2, aSign: ''});
     if( $('#id').val()==''){
       $('#item-add').click();
    }
});

Anon7 - 2022
AnonSec Team