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/pmm/storage/framework/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/elvh3918/public_html/pmm/storage/framework/views/44f8e7888256f440d65d23aeef3b54f3.php
<?php $__env->startSection('content-guest-page-1-item'); ?>
    

    <div class="mt-4 mb-3" id="history_id" hidden>
        <h2 class="font-monospace font-weight-bold text-center text-purple mb-4">History Items</h2>

        <table id="example1" class="table table-sm table-bordered">
            <thead>
                <tr>
                    <th class="text-center" hidden>visit</th>
                    <th class="text-center">Data</th>
                </tr>
            </thead>
            <tbody>
                
            </tbody>
        </table>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page-script-guest-page-1-item'); ?>
    <script>
        let table = $("#example1").DataTable({
            paging: true,
            lengthChange: true,
            searching: true,
            ordering: true,
            info: true,
            autoWidth: false,
            responsive: true,
            pageLength: 10,
            scrollY: true,
            order: [[0, 'desc']],

            columnDefs: [
                {
                    data: 'visit',
                    name: 'visit',
                    targets: 0,
                    className: 'dt-body-left',
                    visible: false,
                },
                {
                    data: 'data',
                    name: 'data',
                    targets: 1,
                    className: 'dt-body-left'
                }
            ],

            buttons: [
                'pageLength',
                {
                    extend: 'collection',
                    text: 'Control',
                    buttons: [
                        'copy', 'excel', 'print',
                        {
                            text: 'Visibility',
                            popoverTitle: 'Control',
                            extend: 'colvis',
                            collectionLayout: 'two-column',
                            postfixButtons: ['colvisRestore']
                        }
                    ]
                }
            ],
            layout: {
                topStart: ['buttons']
            }
        });

        function showVisitHistoryItem(customer_id) {
            // $.ajax({
            //     dataType: 'json',
            //     type: "GET",
            //     url: '<?php echo e(env('APP_URL')); ?>' + "/api/dashboard/guest/show-history-item/" + customer_id,

            //     beforeSend: function() {
            //         var html="";
            //         html +='<div class="col">';
            //             html +='<div class="flex animate-pulse space-x-4">';
            //                 html +='<div class="size-10 rounded-full bg-gray-200"></div>';
            //                 html +='<div class="flex-1 space-y-6 py-1">';
            //                     html +='<div class="h-2 rounded bg-gray-200"></div>';
            //                     html +='<div class="space-y-3">';
            //                         html +='<div class="grid grid-cols-3 gap-4">';
            //                             html +='<div class="col-span-2 h-2 rounded bg-gray-200"></div>';
            //                             html +='<div class="col-span-1 h-2 rounded bg-gray-200"></div>';
            //                         html +='</div>';
            //                         html +='<div class="h-2 rounded bg-gray-200"></div>';
            //                         html +='<div class="h-2 rounded bg-gray-200"></div>';
            //                         html +='<div class="h-2 rounded bg-gray-200"></div>';
            //                         html +='<div class="h-2 rounded bg-gray-200"></div>';
            //                         html +='<div class="h-2 rounded bg-gray-200"></div>';
            //                     html +='</div>';
            //                 html +='</div>';
            //             html +='</div>';
            //         html +='</div>';

            //         document.getElementById('history_card_id').innerHTML = html;
            //     },
            //     complete: function() {

            //     },
            //     success: function(res) {
            //         if (res.length == 0) {
            //             document.getElementById('history_card_id').innerHTML = 'No Data';
            //             return;
            //         } else {
            //             var html="";
            //             var col = "";
            //             var height = "150px";

            //             if (res.length == 1) {
            //                 col = 'col';
            //                 height = "200px";
            //             } else if (res.length == 2) {
            //                 col = 'col-md-6';
            //                 height = "200px";
            //             } else if (res.length == 3) {
            //                 col = 'col-md-4';
            //             } else {
            //                 col = 'col-md-3';
            //             }

            //             for (let index = 0; index < res.length; index++) {
            //                 html +='<div class="' + col + '">';
            //                     html +='<div class="card">';
            //                         var status="Active";
            //                         var status_bg="success";

            //                         if (res[index].is_active == 0) {
            //                             var status="Non Active";
            //                             var status_bg="secondary";
            //                         }

            //                         html +='<div class="ribbon-wrapper">';
            //                             html +='<div class="ribbon bg-' + status_bg + '">';
            //                                 html +=status;
            //                             html +='</div>';
            //                         html +='</div>';

            //                         if (res[index].image) {
            //                             var url = '<?php echo e(config('app.url')); ?>' + '/storage/' + '<?php echo e(config('app.dir_file_item')); ?>' + '/' + res[index].image;

            //                             if (fileExists(url)) {
            //                                 html +='<img src=' + url + ' class="bg-secondary" alt="image not found" style="height: ' + height + '; object-fit:contain;">';
            //                             } else {
            //                                 html +='<img src="<?php echo e(asset(config("app.img_not_found"))); ?>" class="bg-secondary" alt="image not found" style="height: ' + height + '; object-fit:contain;">';
            //                             }
            //                         } else {
            //                             html +='<img src="<?php echo e(asset(config("app.img_not_found"))); ?>" class="bg-secondary" alt="image not found" style="height: ' + height + '; object-fit:contain;">';
            //                         }

            //                         html +='<div class="card-body">';
            //                             html +='<div class="d-flex flex-column overflow-auto mb-1" style="height: 150px;">';
            //                                 html +='<span class="text-dark text-capitalize font-weight-bold" style="font-size: 18px;">' + res[index].name + '</span>';

            //                                 html +='<div class="text-capitalize text-dark" style="font-size: 15px;">';
            //                                     html +='Code: ' + res[index].code;
            //                                 html +='</div>';

            //                                 html +='<div class="text-capitalize text-dark" style="font-size: 15px;">';
            //                                     var first_visit = res[index].maintenance_min_date_trans ? moment(new Date(res[index].maintenance_min_date_trans)).format('DD-MMM-YYYY') : "none";
            //                                     html +='First Visit: ' + first_visit;
            //                                 html +='</div>';

            //                                 html +='<div class="text-capitalize text-dark" style="font-size: 15px;">';
            //                                     var last_visit = res[index].maintenance_max_date_trans ? moment(new Date(res[index].maintenance_max_date_trans)).format('DD-MMM-YYYY') : "none";
            //                                     html +='Last Visit: ' + last_visit;
            //                                 html +='</div>';

            //                                 html +='<div class="text-capitalize text-dark" style="font-size: 15px;">';
            //                                     html +='Total Visit: ' + res[index].maintenance_count + ' Visit';
            //                                 html +='</div>';

            //                                 html +='<div class="text-capitalize text-dark">';
            //                                     var last_service = '';
            //                                     for (let i = 0; i < res[index].maintenance.length; i++) {
            //                                         last_service = res[index].maintenance[i].service_type;
            //                                     }

            //                                     html +='Last Srvc: ' + last_service;
            //                                 html +='</div>';
            //                             html +='</div>';

            //                             html +='<a href="#" class="btn btn-primary w-full">Details</a>';
            //                         html +='</div>';
            //                     html +='</div>';
            //                 html +='</div>';
            //             }

            //             document.getElementById('history_card_id').innerHTML = html;
            //         }
            //     },
            //     error: function(xhr, status, error) {
            //         document.getElementById('history_card_id').innerHTML = error;
            //         return;
            //     }
            // });



            var table = new DataTable('#example1');
            table.clear().draw();

            $.ajax({
                dataType: 'json',
                type: "GET",
                url: '<?php echo e(env('APP_URL')); ?>' + "/api/dashboard/guest/show-history-item/" + customer_id,

                beforeSend: function() {
                    
                },
                complete: function() {

                },
                success: function(res) {
                    if (res.length > 0) {
                        const arr = res.map(col => {
                            return {
                                visit: col.maintenance_count,
                                data: showDetail(col),
                            }
                        })
                        
                        table.rows.add(arr).draw();
                    }
                },
                error: function(xhr, status, error) {
                    document.getElementById('history_card_id').innerHTML = error;
                    return;
                }
            });
        }

        function showDetail(data) {
            var html ="";
            
            html +='<div class="container my-2">';
                html +='<div class="row">';
                    html +='<div class="col-3 mb-2">';
                        if (data.image) {
                            var url = '<?php echo e(config('app.url')); ?>' + '/storage/' + '<?php echo e(config('app.dir_file_item')); ?>' + '/' + data.image;

                            if (fileExists(url)) {
                                html +='<img src=' + url + ' class="rounded">';
                            } else {
                                html +='<img src=<?php echo e(asset(config("app.img_not_found"))); ?> class="rounded">';
                            }
                        } else {
                            html +='<img src=<?php echo e(asset(config("app.img_not_found"))); ?> class="rounded">';
                        }
                    html +='</div>';

                    html +='<div class="col-9 mb-2">';
                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">code</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                html +='<span class="text-capitalize">: ' + data.code + '</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">name</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                html +='<span class="text-capitalize">: ' + data.name + '</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">status</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                var status = data.is_active == 1 ? "active" : "non active";
                                var color = data.is_active == 1 ? "text-primary" : "text-danger";
                                html +='<span class="text-capitalize ' + color + '">: ' + status + '</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">visit</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                html +='<span class="text-capitalize">: ' + data.maintenance_count + ' visited</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">first visit</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                var first_visit = data.maintenance_min_date_trans ? moment(new Date(data.maintenance_min_date_trans)).format('DD-MMM-YYYY') : "none";
                                html +='<span class="text-capitalize">: ' + first_visit + '</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">last visit</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                var last_visit = data.maintenance_max_date_trans ? moment(new Date(data.maintenance_max_date_trans)).format('DD-MMM-YYYY') : "none";
                                html +='<span class="text-capitalize">: ' + last_visit + '</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">last srv</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                var last_service = '';
                                for (let i = 0; i < data.maintenance.length; i++) {
                                    last_service = data.maintenance[i].service_type;
                                }

                                html +='<span class="text-capitalize">: ' + last_service + '</span>';
                            html +='</div>';
                        html +='</div>';

                        html +='<div class="row">';
                            html +='<div class="col-3 border-bottom">';
                                html +='<span class="text-capitalize">last mtc</span>';
                            html +='</div>';
                            html +='<div class="col-9 border-bottom">';
                                var last_mtc = '';
                                for (let i = 0; i < data.maintenance.length; i++) {
                                    last_mtc = data.maintenance[i].technician.name;
                                }

                                html +='<span class="text-capitalize">: ' + last_mtc + '</span>';
                            html +='</div>';
                        html +='</div>';
                    html +='</div>';
                html +='</div>';

                html +='<div class="row rounded" style="background-color: #F5F5F5;">';
                    html +='<div class="col-md-6 mb-2">';
                        html +='<div class="d-flex justify-content-md-start justify-content-center p-1">';
                            html +='<small class="text-muted text-capitalize mt-2">';
                                var last_note = '';
                                // for (let i = 0; i < data.maintenance.length; i++) {
                                //     last_note = data.maintenance[i].note;
                                //     if (last_note == null) {
                                //         last_note = '';
                                //     }
                                // }

                                    last_note = data.description;
                                    if (last_note == null) {
                                        last_note = '';
                                    }

                                html +='Note :' + last_note;
                            html +='</small>';
                        html +='</div>';
                    html +='</div>';
                    html +='<div class="col-md-6 mb-2">';
                        html +='<div class="d-flex justify-content-md-end justify-content-center p-1">';
                            html +='<button type="button" class="text-capitalize btn btn-primary btn-sm mt-2 mr-2" onclick="detailData(' + data.id + ')"><i class="fa fa-folder mr-2"></i>detail</button>';
                        html +='</div>';
                    html +='</div>';
                html +='</div>';
            html +='</div>';

            return html;
        }

        function detailData(id) {
            console.log(id);
        }
    </script>
<?php $__env->stopSection(); ?>
<?php /**PATH /home/elvh3918/public_html/pmm/resources/views/content/guest/partials/page-1/item.blade.php ENDPATH**/ ?>

Yohohohohohooho | Sanrei Aya