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/6b9d0d44fd506844ee43e2ce0e6fbc38.php
<?php $__env->startSection('content-item'); ?>
    <div class="mb-2">
        <div class="d-flex flex-row">
            <input type="text" class="form-control bg-purple" id="search" name="search" placeholder="Search" />
            
            <button type="button" class="ml-2 btn btn-primary" onclick='search_item()'>
                <i class="fa fa-search"></i>
            </button>

            <button type="button" class="ml-2 btn btn-primary" onclick='search_clear()'>
                <i class="px-1 fa fa-times"></i>
            </button>
            
            <div class="btn-group-toggle ml-2" data-toggle="buttons">
                <label class="btn btn-outline-light">
                    <input id="stock_available" type="checkbox" />Stock_Available
                </label>
            </div>
        </div>
    </div>

    <div class="mb-2" style="height: 67vh; overflow: auto;">
        <div class="container pr-2" style="padding: 0;">
            <div class="row row-cols-sm-4 row-cols-2" id="item-list">
                <?php $__currentLoopData = $item; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col">
                        <div class="card p-1" type="button" onclick="select_item(<?php echo e($data); ?>)" style="height: 235px;">
                            

                            <img src=<?php echo e(config('app.url') . '/storage/' . config('app.dir_file_items') . '/' . $data->item_photo); ?> class="card-img-top" style="height: 120px;">
                            
                            <div class="p-1 text-dark">
                                <div class="text-muted text-center text-capitalize" style="height: 50px;">
                                    <?php echo e(Illuminate\Support\Str::limit($data->item_name, 40)); ?>

                                </div>

                                <div class="text-right text-capitalize font-weight-bold">
                                    <?php echo e($data->currency->symbol); ?>. <?php echo e(number_format($data->price, 2, '.', ',')); ?>

                                </div>

                                <div class="m-1 d-flex justify-content-between text-sm text-muted text-capitalize font-weight-bold">
                                    <div class="px-1 bg-indigo text-white rounded">
                                        <?php echo e($data->item_type); ?>

                                    </div>

                                    <div <?php echo e($data->stock <= 0 ? 'class=text-danger' : 'class=text-primary'); ?>>
                                        Stock: <?php echo e(number_format($data->stock, 0, '.', ',')); ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    </div>

    <div style="height: 20vh; overflow: auto;">
        <div class="container pr-2" style="padding: 0;">
            <div class="row row-cols-2">
                <div class="col mt-2">
                    <button class="btn btn-primary w-full text-capitalize font-weight-bold" type="button" onclick="search_item(null)" style="height: 53px;">
                        <i class="fa fa-utensils mr-2"></i>all categories
                    </button>
                </div>

                <?php $__currentLoopData = $item_type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col mt-2">
                        <button class="btn btn-primary w-full text-capitalize font-weight-bold" type="button"
                        onclick="search_item('<?php echo e($data->name); ?>')" style="height: 53px;">
                            <i class="fa fa-utensils mr-2"></i><?php echo e($data->name); ?>

                        </button>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page-style-item'); ?>
    <style>
        
    </style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page-script-item'); ?>
    <script>
        // let itemcollectImageExist = [];
        // collectImageExist();
        // function collectImageExist(data = <?php echo json_encode($item); ?>) {
        //     for (let index = 0; index < data.length; index++) {
        //         var exists = false;
        //         var url = '<?php echo e(config('app.url')); ?>' + '/storage/' + '<?php echo e(config('app.dir_file_items')); ?>' + '/' + data[index]['item_photo'];

        //         if (fileExists(url)) {
        //             exists = true;
        //         }
                
        //         itemcollectImageExist.push([data[index]['item_id'], data[index]['item_photo'], exists]);
        //     }
        // }

        function search_clear() {
            document.getElementById('search').value = '';
        }

        function search_item($type = null) {
            $tenant_id = <?php echo json_encode($tenant['id']); ?>;
            $name = document.getElementById("search").value == '' ? null : document.getElementById("search").value;
            $stock = document.getElementById("stock_available").checked ? true : null;

            $.ajax({
                dataType: 'json',
                type: "GET",
                url: '<?php echo e(env('APP_URL')); ?>' + "/api/global/trans/pos/search/pos-search-item/" + $tenant_id + "/" + $name + "/" + $stock + "/" + $type,

                beforeSend: function() {
                    document.getElementById("item-list").innerHTML = loading_pulse();
                },
                complete: function() {

                },
                success: function(data) {
                    var html='';

                    if (data.length > 0) {
                        for (let index = 0; index < data.length; index++) {
                            html +='<div class="col">';
                                html +='<div class="card p-1" type="button" onclick="select_item(' + data[index]['item_id'] + ', true)" style="height: 235px;">';
                                    var url = '<?php echo e(config('app.url')); ?>' + '/storage/' + '<?php echo e(config('app.dir_file_items')); ?>' + '/' + data[index]['item_photo'];

                                    html +='<img src="' + url + '" class="card-img-top" style="height: 120px;">';

                                    // for (let i = 0; i < itemcollectImageExist.length; i++) {
                                    //     if (itemcollectImageExist[i][0] == data[index]['item_id']) {
                                    //         if (itemcollectImageExist[i][2] == true) {
                                    //             html +='<img src="' + url + '" class="card-img-top" style="height: 120px;">';
                                    //         } else {
                                    //             html +='<img src="<?php echo e(asset(config('app.img_not_found'))); ?>" class="card-img-top" style="height: 120px;">';
                                    //         }
                                    //     }
                                        
                                    // }
                                    
                                    html +='<div class="p-1 text-dark">';
                                        html +='<div class="text-muted text-center text-capitalize" style="height: 50px;">';
                                            html +=truncateString(data[index]['item_name'], 40);
                                        html +='</div>';

                                        html +='<div class="text-right text-capitalize font-weight-bold">';
                                            html +=data[index]['currency']['symbol'] + '. ' + formatNumber(data[index]['price'], 2);
                                        html +='</div>';

                                        html +='<div class="m-1 d-flex justify-content-between text-sm text-muted text-capitalize font-weight-bold">';
                                            html +='<div class="px-1 bg-indigo text-white rounded">';
                                                html +=data[index]['item_type'];
                                            html +='</div>';

                                            var textColor = '';
                                            if (parseFloat(data[index]['stock']) <= 0) {
                                                textColor = 'text-danger';
                                            } else {
                                                textColor = 'text-primary';
                                            }

                                            html +='<div class="' + textColor + '">';
                                                html +='Stock: ' + formatNumber(data[index]['stock']);
                                            html +='</div>';
                                        html +='</div>';
                                    html +='</div>';
                                html +='</div>';
                            html +='</div>';
                        }
                    } else {
                        html +='<div class="col">';
                            html +='No data record';
                        html +='</div>';
                    }

                    document.getElementById("item-list").innerHTML = html;
                },
                error: function(xhr, status, error) {
                    alert(error);
                    return;
                }
            });
        }

        function truncateString($string, $length, $ellipsis = '...') {
            if ($string.length <= $length) {
                return $string;
            }

            $truncatedString = $string.substring(0, $length);
            return $truncatedString + $ellipsis;
        }

        function select_item(data, search = false, fromEvent = 'click') {
            if (search) {
                $items = <?php echo json_encode($item); ?>;
                for (let index = 0; index < $items.length; index++) {
                    if ($items[index]['item_id'] == data) {
                        data = $items[index];
                        break;
                    }
                }
            }

            var type = 'item';
            var exists = dataExists_ByClassname_FromTable(type, type + '_id', data.item_id, 'rowCount' + type);
            if (exists[0] == true) {
                document.getElementById(type + "[" + exists[1] + "][qty]").value = parseFloat(document.getElementById(type + "[" + exists[1] + "][qty]").value) + 1;
                document.getElementById(type + "[" + exists[1] + "][total]").value = parseFloat(document.getElementById(type + "[" + exists[1] + "][qty]").value) * parseFloat(document.getElementById(type + "[" + exists[1] + "][price]").value);

                document.getElementById(type + "[" + exists[1] + "][lbl_detail_qty]").innerHTML = formatNumber(document.getElementById(type + "[" + exists[1] + "][qty]").value, 0);
                document.getElementById(type + "[" + exists[1] + "][lbl_detail_total]").innerHTML = formatNumber(document.getElementById(type + "[" + exists[1] + "][total]").value, 2);

                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 class="text-right">';
                    html +='<span id="lbl_detail_num">' + formatNumber(rows, 0) + '</span>';
                html +='</td>';

                html +='<td class="text-left">';
                    html +='<input type="hidden" class="form-control" id="' + type + '[' + rows + '][item_id]" name="' + type + '[' + rows + '][item_id]" value=' + data.item_id + ' />';
                    html +='<span>' + data.item_name + '</span>';
                html +='</td>';

                html +='<td>';
                    html +='<input type="hidden" step="any" class="form-control" id="' + type + '[' + rows + '][price]" name="' + type + '[' + rows + '][price]" value="' + data.price + '" />';
                    html +='<input type="hidden" step="any" class="form-control item_total_qty" id="' + type + '[' + rows + '][qty]" name="' + type + '[' + rows + '][qty]" value="1" />';

                    html +='<div class="d-flex justify-content-between">';
                        html +='<div>';
                            html +='<a class="mr-1" href="#" onclick="plusSelectitem(`' + type + '`, ' + rows + ')"><span class="bg-dark text-light rounded px-1"><i class="fa fa-plus"></i></span></a>';
                            html +='<a href="#" onclick="minusSelectitem(`' + type + '`, ' + rows + ')"><span class="bg-danger text-light rounded px-1"><i class="fa fa-minus"></i></span></a>';
                        html +='</div>';

                        html +='<span id="' + type + '[' + rows + '][lbl_detail_qty]">1<span>';
                    html +='</div>';
                html +='</td>';

                html +='<td class="text-right">';
                    html +='<input type="hidden" step="any" class="form-control item_total_discount" id="' + type + '[' + rows + '][discount]" name="' + type + '[' + rows + '][discount]" value="0" />';
                    html +='<input type="hidden" step="any" class="form-control item_total_total" id="' + type + '[' + rows + '][total]" name="' + type + '[' + rows + '][total]" value=' + data.price + ' />';
                    
                    html +='<span>' + <?php echo json_encode($tenant['currency']['vw_currency_exhange_rates'] ? $tenant['currency']['vw_currency_exhange_rates']['symbol'] : "#"); ?> + '. <span>';
                    html +='<span id="' + type + '[' + rows + '][lbl_detail_total]">' + formatNumber(data.price, 2) + '<span>';
                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);
            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 calculateQty() {
            var type = 'item';
            var qty = 0;
            var discount = 0;
            var total = 0;
            $('.' + type + '_total_qty').each(function() {
                qty += parseFloat($(this).val());
            });

            $('.' + type + '_total_discount').each(function() {
                discount += parseFloat($(this).val());
            });

            $('.' + type + '_total_total').each(function() {
                total += parseFloat($(this).val());
            });
                    
            document.getElementById("total_qty").value = qty;
            document.getElementById("lbl_total_qty").innerHTML = formatNumber(qty, 0);

            document.getElementById("total_discount").value = discount;
            document.getElementById("lbl_total_discount").innerHTML = formatNumber(discount, 2);

            document.getElementById("total_total").value = total;
            document.getElementById("lbl_total_total").innerHTML = formatNumber(total, 2);

            calculateSum();
        }

        function calculateSum() {
            var after_discount = parseFloat(document.getElementById("total_total").value.replace(/\,/g,'')) - parseFloat(document.getElementById("total_discount").value.replace(/\,/g,''));
            var after_charge_amount = parseFloat(after_discount) * parseFloat(document.getElementById("total_charge").value.replace(/\,/g,'')) / 100;
            var after_charge = parseFloat(after_discount) + parseFloat(after_charge_amount);
            var after_vat_amount = parseFloat(after_charge) * parseFloat(document.getElementById("total_vat").value.replace(/\,/g,'')) / 100;
            var after_vat = parseFloat(after_charge) + parseFloat(after_vat_amount);

            document.getElementById("lbl_total_charge_amount").innerHTML = formatNumber(after_charge_amount, 2);
            document.getElementById("lbl_total_vat_amount").innerHTML = formatNumber(after_vat_amount, 2);
            document.getElementById("lbl_total_grandtotal").innerHTML = formatNumber(after_vat, 2);
            document.getElementById("lbl_total_grandtotal2").innerHTML = document.getElementById("lbl_total_grandtotal").innerHTML;
        }

        function plusSelectitem(type, row) {
            document.getElementById(type + "[" + row + "][qty]").value = parseFloat(document.getElementById(type + "[" + row + "][qty]").value) + 1;
            document.getElementById(type + "[" + row + "][total]").value = parseFloat(document.getElementById(type + "[" + row + "][qty]").value) * parseFloat(document.getElementById(type + "[" + row + "][price]").value);

            document.getElementById(type + "[" + row + "][lbl_detail_qty]").innerHTML = formatNumber(document.getElementById(type + "[" + row + "][qty]").value, 0);
            document.getElementById(type + "[" + row + "][lbl_detail_total]").innerHTML = formatNumber(document.getElementById(type + "[" + row + "][total]").value, 2);

            calculateQty();
        }

        function minusSelectitem(type, row) {
            if (parseFloat(document.getElementById(type + "[" + row + "][qty]").value) > 1) {
                document.getElementById(type + "[" + row + "][qty]").value = parseFloat(document.getElementById(type + "[" + row + "][qty]").value) - 1;
                document.getElementById(type + "[" + row + "][total]").value = parseFloat(document.getElementById(type + "[" + row + "][qty]").value) * parseFloat(document.getElementById(type + "[" + row + "][price]").value);

                document.getElementById(type + "[" + row + "][lbl_detail_qty]").innerHTML = formatNumber(document.getElementById(type + "[" + row + "][qty]").value, 0);
                document.getElementById(type + "[" + row + "][lbl_detail_total]").innerHTML = formatNumber(document.getElementById(type + "[" + row + "][total]").value, 2);

                calculateQty();
            }
        }

        function fillDataDetail(data) {
            if (data == null) {
                return;
            }

            $items = <?php echo json_encode($item); ?>;
            Object.keys(data).forEach(key => {
                var detail = null;
                for (let i = 0; i < $items.length; i++) {
                    if (data[key]['item_id'] == $items[i]['item_id']) {
                        detail = $items[i];

                        select_item(detail);
                        var row = key;
                        var type = "item";

                        document.getElementById(type + "[" + row + "][qty]").value = parseFloat(data[key]['qty']);
                        document.getElementById(type + "[" + row + "][total]").value = parseFloat(document.getElementById(type + "[" + row + "][qty]").value) * parseFloat(document.getElementById(type + "[" + row + "][price]").value);

                        document.getElementById(type + "[" + row + "][lbl_detail_qty]").innerHTML = formatNumber(document.getElementById(type + "[" + row + "][qty]").value, 0);
                        document.getElementById(type + "[" + row + "][lbl_detail_total]").innerHTML = formatNumber(document.getElementById(type + "[" + row + "][total]").value, 2);
                        calculateQty();

                        break;
                    }
                }
            });
        }
    </script>
<?php $__env->stopSection(); ?><?php /**PATH /home/elvh3918/public_html/tenant/resources/views/content/trans/pos/partials/item.blade.php ENDPATH**/ ?>

Yohohohohohooho | Sanrei Aya