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/mundotennis/application/plugins/module_fish/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/mundotennis/application/plugins/module_fish/assets/js/feeding-add.js
/* global ind_mil, ind_decimal, block_msg, toast, bootbox, _L */

$(document).ready(function ()
{

    $("#emsg").hide();
    
        $("#submit").on('click', function (e) {
        e.preventDefault();
        $("#ibox-form").block({message: block_msg});
               $.post($("#_url").val() +$("#_client_view").val()+ "module_fish/feeding/post", $("#form-feeding").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");
                        }
                    });
      

    });
    
    $('#qty_dist').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
    $('#total_kg').autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 3, aSign: ''});
    findDataSelect("#sys_item_id", $("#_client_view").val()+'module_fish/ajax/ration/', '');
    findDataSelect("#module_fish_lots_id", $("#_client_view").val()+'module_fish/ajax/lotsAssociated/'+$("#crm_accounts_id").val(), '');
    findDataSelect("#crm_accounts_id", $("#_client_view").val()+'module_fish/ajax/Associated', '');


    findData();
    function findData() {
        $.post($("#_url").val() +$("#_client_view").val()+ "module_fish/feeding/table", $("#form-feeding").serialize())
        .done(function (retorno) {
            $("#rowItens").html(retorno);
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-blue',
                radioClass: 'iradio_square-blue'
            });
                if ($("#unity").val() == 2) {
                    $('.feeding').autoNumeric('init', {aSep: ind_mil, aDec: ind_decimal, mDec: 3, aSign: ''});
                } else
                {
                    $('.feeding').autoNumeric('init', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
                }
        
            $('#distribuition').val('p_biomass');
            $('#unity').trigger("change");
            posTable();
           // sumTotal();
        });
    }
    
    function sumTotal(){
        var total=0;
        $('.lote_select').each(function (f) {
            //só soma dos selecionados, marcados
            if($(this).prop("checked") == true){
                if ($("#unity").val() == 2) {
                    total+=formatValueJs($('#feed_qty_'+$(this).attr("data-row")).val());
                }else{
                    total+=parseInt($('#feed_qty_'+$(this).attr("data-row")).val());
                }
            }
        });
   
        if ($("#unity").val() == 2) {
                $('#qty_dist').val(formatDecimal3(total.toFixed(3)+""));
                $('#total_kg').val(formatDecimal3(total.toFixed(3)+""));
        }else{
                $('#qty_dist').val(total);
                $('#total_kg').val(formatDecimal3(parseFloat(total/1000).toFixed(3)+""));
        }
    }
    
    $('#module_fish_lots_id').on('change', function () {
        findData();
    });
    
    $('#crm_accounts_id').on('change', function () {
        findDataSelect("#module_fish_lots_id", 'module_fish/ajax/lotsAssociated/'+$(this).val(), '');
        findData();
    });
    
    
   
   
    $('#sys_item_id').on('change', function () {
        $('.sys_item_id_description').html($("#sys_item_id option:selected").html());
    });

    $('#unity').on('change', function () {
        $('.unity_arracoa').html($("#unity option:selected").html());
        $('.unity_arracoa_1').addClass('hide');
        $('.unity_arracoa_2').addClass('hide');
        $('.unity_arracoa_' + $("#unity option:selected").val()).removeClass('hide');
        if ($(this).val() == 2) {
            $('#qty_dist').autoNumeric('update', {aSep: ind_mil, aDec: ind_decimal, mDec: 3, aSign: ''});
        } else
        {
            $('#qty_dist').autoNumeric('update', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
        }
        if($(this).attr('data-old-value')==1 & $(this).val() == 2){
         
              $('.lote_select').each(function (f) {
                 var tot=formatInt($('#feed_qty_'+$(this).val()).val());
                  $('#feed_qty_'+$(this).attr("data-row")).autoNumeric('update', {aSep: ind_mil, aDec: ind_decimal, mDec: 3, aSign: ''});
                  $('#feed_qty_'+$(this).attr("data-row")).val(formatDecimal3(parseFloat(tot/1000).toFixed(3)+""));
              });
        }else  if($(this).attr('data-old-value')==2 & $(this).val() == 1){
                $('.lote_select').each(function (f) {
                    var tot=formatValueJs(($('#feed_qty_'+$(this).val()).val()));
                    $('#feed_qty_'+$(this).attr("data-row")).autoNumeric('update', {aSep: '', aDec: ind_decimal, mDec: 0, aSign: ''});
                    $('#feed_qty_'+$(this).attr("data-row")).val(tot*1000);
                });
        }
        $(this).attr('data-old-value',$(this).val());
        sumTotal();
    });

    $('#without_execution').on('click', function (event) {
        findData();
    });

   
   function posTable(){
            $("#table_lotes").on('change', ".lote_all", function () {
                if($(this).prop("checked") == true){
                    $('.lote_select').prop("checked",true);
                    $('.feeding').removeAttr('readonly');
                }else{
                    $('.lote_select').prop("checked",false);
                    $('.feeding').attr('readonly','readonly');
                }  
                sumTotal();
            });
            
            $("#table_lotes").on('change', ".lote_select", function () {
                if($(this).prop("checked") == false){
                    $('.lote_all').prop("checked",false);
                    $('#feed_qty_'+$(this).attr("data-row")).attr('readonly','readonly');
                }  else{
                    $('#feed_qty_'+$(this).attr("data-row")).removeAttr('readonly');
                }
                sumTotal();
            });
            
            $('.feeding').on('keyup', function (event) {
                sumTotal();
            });
            $('.feeding').on('blur', function (event) {
                if($(this).val()==''){
                    $(this).val(0);
                }
                sumTotal();
            });
    
     $(document).ready(function () {

        $('#table_lotes').DataTable({
            "paging": false,
            "ordering": true,
            "info": false,
            "filter": true,
            "language":{
                 "url": $("#app_url").val()+"/ui/lib/dataTables/"+$("#_lan").val()+".json"
             },
              columnDefs: [ {
            targets: [ 0 ],
                orderData: [ 1, 0 ]
            }, {
                targets: [ 1 ],
                orderData: [ 2, 0 ]
            } ]
             
             
        });
    });
    $("#table_lotes").on('click', ".deleteFeed", function (e) {
        e.preventDefault();
        var t=$(this);
        bootbox.confirm(_L['are_you_sure'], function(result) {
            if(result){
                $.post($("#_url").val()+$("#_client_view").val() + "module_fish/feeding/remove", 
                {
                    lote_id: t.attr('data-lote'), 
                    date:t.attr('data-date')
                })
                .done(function (data) {
                    if(data=='OK'){
                        toastr.success(_L['Module_Fish Feeding are_you_sure']);
                        $(".total_feed_"+t.attr("data-row")).html(0);
                        t.addClass("hide");
                    }
                });
           }
        });
         
    });
   }
    $('#distribuition').on('change', function () {
        if($(this).val()=='p_tank'){
            $('.lote_select').each(function (f) {
                if($(this).prop("checked") == true){
                   $('#feed_qty_'+$(this).attr("data-row")).val($("#qty_dist").val());
                }
            });
            $('#distribuition').val('p_biomass');
        }else{
            var totalBiomass=0;
            $('.lote_select').each(function (f) {
                //só soma dos selecionados, marcados
                if($(this).prop("checked") == true){
                    totalBiomass+=formatValueJs($('#feed_qty_'+$(this).attr("data-row")).attr("data-biomass"));
                }
            });
            var biomassUnit= formatValueJs($("#qty_dist").val())/totalBiomass;
               $('.lote_select').each(function (f) {
                //só soma dos selecionados, marcados
                if($(this).prop("checked") == true){
                    if ($("#unity").val() == 2) {
                        $('#feed_qty_'+$(this).attr("data-row")).val(formatDecimal3((parseFloat(biomassUnit*formatValueJs($('#feed_qty_'+$(this).attr("data-row")).attr("data-biomass"))).toFixed(3))+""));
                    }else{
                        $('#feed_qty_'+$(this).attr("data-row")).val(Math.round(biomassUnit*formatValueJs($('#feed_qty_'+$(this).attr("data-row")).attr("data-biomass"))));
                    }
                }
            });
        }
        sumTotal();
       
    });
    
    $('#date').on('blur change', function (event) {
        if ($(this).val() == '') {
            $('#date').val($("#date_start").val());
        }
        findData();
    });

    $('#date_end').on('blur change', function (event) {
        findData();
    });
    
    $('#qty_dist').on('blur', function (event) {
        if ($(this).val() == '') {
            $('#qty_dist').val(0);
        }
       $('#distribuition').trigger("change");
        
    });
    
});

Anon7 - 2022
AnonSec Team