| 
				Server : Apache System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 User : matalashes ( 1004) PHP Version : 8.1.29 Disable Function : NONE Directory : /home/matalashes/public_html/kite.mata-lashes.com/app/Views/admin/layout/  | 
Upload File :  | 
<!DOCTYPE html>
<html lang="en">
<!--begin::Head-->
<head>
    <base href="<?= base_url() ?>">
    <title><?= $page_title . ' - ' . $core_profile->asp_name ?></title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta property="og:locale" content="en_US"/>
    <link rel="shortcut icon" href="assets/theme/admin/images/favicon.ico"/>
    <!--begin::Fonts-->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
    <!--end::Fonts-->
    <!--begin::Global Stylesheets Bundle(used by all pages)-->
    <link href="assets/theme/admin/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css"/>
    <link href="assets/theme/admin/dashboard/css/style.bundle.css" rel="stylesheet" type="text/css"/>
    <link href="assets/theme/admin/dashboard/css/generale.css" rel="stylesheet" type="text/css"/>
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <link href="assets/theme/public/css/generale.css" rel="stylesheet" type="text/css"/>
    <!--end::Global Stylesheets Bundle-->
</head>
<!--end::Head-->
<!--begin::Body-->
<body id="kt_body"
      class="header-fixed header-tablet-and-mobile-fixed toolbar-enabled toolbar-fixed aside-enabled aside-fixed"
      style="--kt-toolbar-height:55px;--kt-toolbar-height-tablet-and-mobile:55px" data-kt-aside-minimize="on">
<!--begin::Main-->
<!--begin::Root-->
<div class="d-flex flex-column flex-root">
    <!--begin::Page-->
    <div class="page d-flex flex-row flex-column-fluid">
        <?= $this->include('admin/pages/common/left_sidebar') ?>
        <!--begin::Wrapper-->
        <div class="wrapper d-flex flex-column flex-row-fluid" id="kt_wrapper">
            <?= $this->include('admin/pages/common/top_navigation') ?>
            <div class="content d-flex flex-column flex-column-fluid" id="kt_content">
                <div class="toolbar" id="kt_toolbar">
                    <!--begin::Container-->
                    <div id="kt_toolbar_container" class="container-fluid d-flex flex-stack">
                        <!--begin::Page title-->
                        <div data-kt-swapper="true" data-kt-swapper-mode="prepend"
                             data-kt-swapper-parent="{default: '#kt_content_container', 'lg': '#kt_toolbar_container'}"
                             class="page-title d-flex align-items-center flex-wrap me-3 mb-5 mb-lg-0">
                            <!--begin::Title-->
                            <h1 class="d-flex text-dark fw-bolder fs-3 align-items-center my-1"><?= $breadcrumb['l1']; ?>
                                <!--begin::Separator-->
                                <span class="h-20px border-1 border-gray-200 border-start ms-3 mx-2 me-1"></span>
                                <!--end::Separator-->
                                <!--begin::Description-->
                                <span class="text-muted fs-7 fw-bold"> <?= $breadcrumb['l2']; ?></span>
                                <!--end::Description--></h1>
                            <!--end::Title-->
                        </div>
                        <!--end::Page title-->
                    </div>
                    <!--end::Container-->
                </div>
                <div class="post d-flex flex-column-fluid" id="kt_post">
                    <div id="kt_content_container" class="container-fluid">
                        <?= $this->renderSection('content') ?>
                    </div>
                </div>
            </div>
            <?= $this->include('admin/pages/common/footer') ?>
        </div>
        <!--end::Wrapper-->
        <!--end::Page-->
        <!--begin::Scrolltop-->
        <div id="kt_scrolltop" class="scrolltop" data-kt-scrolltop="true">
            <!--begin::Svg Icon | path: icons/duotune/arrows/arr066.svg-->
            <span class="svg-icon">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
					<rect opacity="0.5" x="13" y="6" width="13" height="2" rx="1" transform="rotate(90 13 6)"
                          fill="currentColor"/>
					<path d="M12.5657 8.56569L16.75 12.75C17.1642 13.1642 17.8358 13.1642 18.25 12.75C18.6642 12.3358 18.6642 11.6642 18.25 11.25L12.7071 5.70711C12.3166 5.31658 11.6834 5.31658 11.2929 5.70711L5.75 11.25C5.33579 11.6642 5.33579 12.3358 5.75 12.75C6.16421 13.1642 6.83579 13.1642 7.25 12.75L11.4343 8.56569C11.7467 8.25327 12.2533 8.25327 12.5657 8.56569Z"
                          fill="currentColor"/>
				</svg>
			</span>
            <!--end::Svg Icon-->
        </div>
        <!--end::Scrolltop-->
        <!--begin::Global Javascript Bundle(used by all pages)-->
        <script src="assets/theme/admin/plugins/global/plugins.bundle.js"></script>
        <script src="assets/theme/admin/dashboard/js/scripts.bundle.js"></script>
        <!--end::Global Javascript Bundle-->
        <!--begin::Datatable Javascript & CSS-->
        <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
        <link rel="stylesheet" type="text/css" href="assets/theme/admin/datatable/css/my-style.css"/>
        <!--end::Datatable Javascript-->
    </div>
    <?= $this->include('admin/layout/swalscript') ?>
</body>
    <!-- cleave -->
    <script src="https://cdn.jsdelivr.net/npm/cleave.js@1.5.3/dist/cleave.min.js"></script>
    <!-- <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> -->
    <!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/cleave.js@1.5.3/dist/cleave.min.js"></script>
    <script type="text/javascript">
        document.querySelectorAll('.currency').forEach(inp => new Cleave(inp, {
        numeral: true,
        numeralDecimalMark: ',',
        delimiter: '.'
    }));
    </script>
       <script type="text/javascript">
    $(document).ready(function(){
        $("body").on("click",".add_new_frm_field_inv", function (){ 
            
            //console.log("clicked");
            var index = $(".form_field_outer").find(".form_field_outer_row").length + 1;
            $(".form_field_outer").append(`
                <div class="row form_field_outer_row">
                    <div class="form-group col-md-4">
                        <label class="form-label d-md-none">Barang</label>
                        <div class="input-group mb-2">  
                            <select onchange="getStok(this)" class="form-control form-control-sm select2" name="item[]" id="item_${index}" required>
                                <option value="">Pilih Barang</option>
                                <?php
                                    foreach ($_barang as $d) { ?>
                                    <option value="<?= $d->mb_id ?>">[<?= $d->mb_kode ?>] - <?= $d->mb_name ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <div class="form-group col-md-2 mb-2">
                        <label class="form-label d-md-none">Stok</label>
                        <input type="text" readonly class="form-control form-control-sm currency" name="stok[]" id="stok_${index}" value="0" placeholder="Stok" />
                    </div>
                    <div class="form-group col-md-2 mb-2">
                        <label class="form-label d-md-none">Jumlah Dimusnahkan</label>
                        <input type="text" class="form-control form-control-sm currency" name="qty[]" id="qty_${index}" value="0" placeholder="Qty" />
                    </div>
                    <div class="form-group col-md-3 mb-2">
                        <label class="form-label d-md-none">Alasan</label>
                        <input type="text" class="form-control form-control-sm" name="alasan[]" id="alasan_${index}" placeholder="Alasan" value="" />
                    </div>
                    <div class="form-group col-md-1 mb-2">
                        <button id="delete_${index}" class="btn btn-danger remove-button remove_node_btn_frm_field" disabled>
                        <i class="bi bi-x-circle px-0"></i>
                        </button>
                    </div>
                </div>
            `);
            $(".form_field_outer").find(".remove_node_btn_frm_field:not(:first)").prop("disabled", false);
     
            $(".form_field_outer").find(".remove_node_btn_frm_field").first().prop("disabled", true);
                document.querySelectorAll('.currency').forEach(inp => new Cleave(inp, {
                    numeral: true,
                    numeralDecimalMark: ',',
                    delimiter: '.'
                }));
            $(".select2").select2({
                placeholder: "Cari",
                tags: true
            });
        });
     });
    $(document).ready(function(){
        //===== delete the form fieed row
        $("body").on("click", ".remove_node_btn_frm_field", function () {
          $(this).closest(".form_field_outer_row").remove();
          console.log("success");
        });
      });
    $(".select2").select2({
        placeholder: "Cari ",
        tags: true
    });
    function confirmMusnah() {
        Swal.fire({
            title: 'Apakah Anda Yakin?',
            text: "Pastikan data yang diinputkan sudah benar",
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Ya, Musnahkan!'
        }).then((result) => {
            if (result.value) {
                var flag = true;
                var index = $(".form_field_outer").find(".form_field_outer_row").length;
                for (var i = 1; i <= index; i++) {
                    var qtyInput = document.getElementById('qty_'+i).value;
                    var qtyInputFormated = qtyInput.replace(".", "");
                    if(qtyInputFormated <= 0 ){
                        flag = false;
                    }
                }
                if(flag){
                    $('#musnah').trigger('click');
                }else{
                    Swal.fire({
                        title: 'Jumlah Tidak Valid!',
                        text: 'Jumlah 0, silakan periksa kembali.',
                        icon: 'error',
                        confirmButtonColor: '#d33',
                        confirmButtonText: 'OK'
                    });
                }
            } else {
                return false;
            }
        });
               
    } 
    function checkQty() {
        var index = $(".form_field_outer").find(".form_field_outer_row").length;
        var stok = document.getElementById("stok_"+index).value;
        var item = document.getElementById("qty_"+index).value;
        if(item>stok){
            // alert('Jumlah yang Anda inputkan melebihi Stok tersedia');
        }
    }
    function getStok(val) {
        var index = $(".form_field_outer").find(".form_field_outer_row").length;
        
        $.ajax({
            url: "<?php echo base_url("ic/kirimbarangic/cekstok");?>",
            type: "POST",
                data: {
                    id: val.value,
                },
            cache: false,
            success: function (dataResult) {
                var dataResult = JSON.parse(dataResult);
                if (dataResult.statusCode == 200) {
                    document.getElementById('stok_'+index).value = numberFormat(dataResult.stok, 0, 0, '.');
                } else {
                    document.getElementById('stok_'+index).value = 0;
                }
            }
        });
    }
    function numberFormat(number, decimals, dec_point, thousands_sep){
        number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
        var n = !isFinite(+number) ? 0 : +number,
            prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
            sep = typeof thousands_sep === 'undefined' ? ',' : thousands_sep,
            dec = typeof dec_point === 'undefined' ? '.' : dec_point,
            s = '',
            toFixedFix = function (n, prec) {
                var k = Math.pow(10, prec);
                return '' + Math.round(n * k) / k;
            };
        // Fix for IE parseFloat(0.55).toFixed(0) = 0;
        s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
        if (s[0].length > 3) {
            s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
        }
        if ((s[1] || '').length < prec) {
            s[1] = s[1] || '';
            s[1] += new Array(prec - s[1].length + 1).join('0');
        }
        return s.join(dec);
    }
    $('#apply_confirm_withdrawn').click(function () {
        var nilai_barang = document.getElementById("nilai_barang").value;
        var confirm_password = document.getElementById("confirm_password").value;
        var ids = document.getElementById("ids").value;
        if (nilai_barang == '') {
            alert('Nilai barang belum diisi');
        }       
        if (confirm_password == '') {
            alert('Password belum dimasukkan!');
        } 
        else {
            $.ajax({
                type: "POST",
                url: "<?= site_url('ic/pemusnahanbarangic/checkpassword')?>",
                cache: false,
                data: {
                    nb : nilai_barang,
                    id : ids,
                    cp : confirm_password
                },
                success: function (result) {
                    var data = JSON.parse(result);
                    var status = data["statusCode"];
                    if (status == 200) {
                        $('#musnah').trigger('click');  
                    } else {
                        alert('Password yang Anda masukkan salah');
                    }
                },
                error: function (html) {
                    console.log("Kode Error [" + html.status + "]<br/><br/>Status:" + html.statusText);
                }
            });
        }
    });
    </script>