

<?php $__env->startSection('title'); ?>
    All Inventories
<?php $__env->stopSection(); ?>

<?php $__env->startSection('breadcrumb'); ?>
    <ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i>Home</a></li>

        <li class="active">All Inventories</li>
    </ol>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('css'); ?>

    <link href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.min.css" rel="stylesheet">
    <link href="https://cdn.datatables.net/buttons/1.7.0/css/buttons.dataTables.min.css" rel="stylesheet">

    <style>
        table.dataTable thead .sorting_asc {
            background-image: none !important;
        }

        .table.dataTable,
        table.dataTable {
            width: 99.8% !important;
        }

        .graphbox {
            position: relative;
            width: 100%;
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            grid-gap: 30px;
            margin-bottom: 13px;
        }

        .graphbox .box {
            position: relative;
            background: #fff;
            padding: 10px;
            width: 100%;
            box-shadow: 0 7px 25px rgba(0, 0, 0, 0.08);
            border-radius: 5px;
        }

        #myChart {
            margin-left: 50px;
            margin-top: 10px;
        }

        #ThirdChart {
            margin-left: 50px;
            margin-top: 10px;
        }
        /* Responsivness */
        @media (max-width: 991px) {
            .graphbox {
                grid-template-columns: 1fr;
                height: auto;
            }
        }

        .chart-container {
  position: relative;
}

.chart-label {
  position: absolute;
   
  font-weight: bold;
}

    </style>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <?php
        
        $size = '';
        
        if ($projecttype == \App\ProjectType::society) {
            $size = \App\ProjectType::society_size;
        } else {
            $size = \App\ProjectType::high_rise_size;
        }
        
    ?>


    <?php
        $map = ' ';
        
        if ($projecttype == \App\ProjectType::society) {
            $map = \App\ProjectType::society_map;
        } else {
            $map = \App\ProjectType::high_rise_map;
        }
        
    ?>

    <div class="container-fluid">
        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('isSuperAdmin')): ?>
            <?php echo $__env->make('partial.multiproject_select', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <?php endif; ?>

        <!--./row-->


        <div id='updatecontent'>

            <input type='hidden' id='total_units_count' value='<?php echo e($total_units_count); ?>'>
            <input type='hidden' id='booked_units_count' value='<?php echo e($booked_units_count); ?>'>
            <input type='hidden' id='un_booked_units_count' value='<?php echo e($un_booked_units_count); ?>'>


            <input type='hidden' id='total_units_area' value='<?php echo e($total_units_area); ?>'>
            <input type='hidden' id='booked_units_area' value='<?php echo e($booked_units_area); ?>'>
            <input type='hidden' id='un_booked_units_area' value='<?php echo e($un_booked_units_area); ?>'>
            <input type='hidden' id='total_units_area_2' value='<?php echo e($total_units_area_2); ?>'>
            <input type='hidden' id='booked_units_area_2' value='<?php echo e($booked_units_area_2); ?>'>
            <input type='hidden' id='un_booked_units_area_2' value='<?php echo e($un_booked_units_area_2); ?>'>
            <input type='hidden' id='multiprojectype_val' value='<?php echo e($multiproject_type); ?>'>




            <input type='hidden' id='total_units_amount' value='<?php echo e($total_units_amount); ?>'>
            <input type='hidden' id='booked_units_amount' value='<?php echo e($booked_units_amount); ?>'>
            <input type='hidden' id='un_booked_units_amount' value='<?php echo e($un_booked_units_amount); ?>'>


            <input type='hidden' id='discount_val' value='<?php echo e($booked_units_amount - $total_cost_booked_units); ?>'>



            <!--.row-->
            <div class="row" style="margin-top: 30px;">
                <div class="col-md-12">
                    <div class="panel panel-info">
                        <div class="panel-heading">Search Inventory</div>
                        <div class="panel-wrapper collapse in" aria-expanded="true">
                            <div class="panel-body">
                                <form>
                                    <div class="form-body">
                                        <div class="row">
                                            <div class="col-md-3">
                                                <div class="form-group has-success" style="margin-bottom: 15px">
                                                    <label class="control-label">By Unit Number</label>
                                                    <select id="unit" class="form-control chosen-select">
                                                        <option value="0">None</option>
                                                        <?php $__currentLoopData = $unitNumbers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($p->id); ?>"><?php echo e($p->unit_number); ?>

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

                                                </div>
                                            </div>
                                            <!--/span-->
                                            <div class="col-md-3">
                                                <div class="form-group has-success" style="margin-bottom: 15px">
                                                    <label class="control-label">By <?php echo e($map); ?></label>

                                                    <select id="floor" class="form-control chosen-select">
                                                        <option value="0">None</option>
                                                        <?php $__currentLoopData = $floors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($b->id); ?>"><?php echo e($b->name); ?>

                                                            </option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </select>
                                                </div>
                                            </div>
                                            <!--/span-->
                                            <!--/span-->
                                            <div class="col-md-3">
                                                <div class="form-group has-success" style="margin-bottom: 15px">
                                                    <label class="control-label">By Size</label>

                                                    <select id="size" class="form-control chosen-select">
                                                        <option value="0">None</option>
                                                        <?php $__currentLoopData = $sizes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($s->id); ?>">
                                                                <?php echo e($s->name); ?> <?php echo e($size); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </select>


                                                    
                                                        
                                                            
                                                        
                                                    
                                                </div>
                                            </div>
                                            <!--/span-->

                                            <!--/span-->
                                            <div class="col-md-3">
                                                <div class="form-group has-success" style="margin-bottom: 15px">
                                                    <label class="control-label">By status</label>
                                                    <select id="status" class="form-control chosen-select">
                                                        <option value="0">None</option>

                                                        <option value="<?php echo e(\App\Inventory::open); ?>">Open</option>
                                                        <?php if (\Illuminate\Support\Facades\Blade::check('role', 'admin')): ?>
                                                            <!-- <option  value="<?php echo e(\App\Inventory::hold_client); ?>">Client Hold</option> -->
                                                            <option value="<?php echo e(\App\Inventory::hold_company); ?>">Company Hold
                                                            </option>
                                                            <option value="<?php echo e(\App\Inventory::token_hold); ?>">Token Hold
                                                            </option>
                                                            <option value="<?php echo e(\App\Inventory::temp_hold); ?>">Temporary Hold
                                                            </option>
                                                        <?php endif; ?>
                                                        <option value="<?php echo e(\App\Inventory::sold); ?>">Sold</option>

                                                    </select>
                                                </div>
                                            </div>
                                            <!--/span-->
                                        </div>

                                    </div>
                                    <div class="form-actions">
                                        <button type="button" class="btn btn-success search-customer"> <i
                                                class="fa fa-check"></i> Search</button>

                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>




            <div class="graphbox">
                <div class="box" style="height: 280px; ">
                    <div class="chart-label" style="font-size: 15px; font-weight: 600;">Total Units: <span id="total-units"></span></div>
                    <canvas id="myChart"></canvas>
                </div>
                <div class="box" style="height: 280px; ">
                    <canvas id="SecondChart"></canvas>
                </div>
                <div class="box" style="height: 280px; ">
                    <div class="chart-label" style="font-size: 15px; font-weight: 600;">Total Amount <span id="total-amount"></span></div>
                    <canvas id="ThirdChart"></canvas>
                </div>
            </div>


            <!-- <div class="row colorbox-group-widget">
                                    <div class="col-md-4 col-sm-6 info-color-box">
                                        <div class="white-box">
                                            <div class="media bg-primary">
                                                <div class="media-body">
                                                <canvas id="myChart"></canvas>
                                                    <h3 class="info-count"><?php echo e(number_format($total_units_count)); ?><span class="pull-right"><i
                                                                class="mdi mdi-checkbox-marked-circle-outline"></i></span></h3>
                                                    <p class="info-text font-12">Total Units</p>
                                                    <p class="info-ot font-15"><span class="label "
                                                            style="color:#58508d!important; background: #58508d!important">.</span></p>
                                                    <p class="info-ot font-15">Booked Units<span
                                                            class="label label-rounded"><?php echo e(number_format($booked_units_count)); ?></span></p>
                                                    <p class="info-ot font-15">Un-Booked Units<span
                                                            class="label label-rounded"><?php echo e(number_format($un_booked_units_count)); ?></span></p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                  
                                    <div class="col-md-4 col-sm-6 info-color-box">
                                        <div class="white-box">
                                            <div class="media bg-success">
                                                <div class="media-body">
                                                    <h3 class="info-count"><?php echo e(number_format($total_units_area)); ?> <?php echo e($size); ?><span
                                                            class="pull-right"><i class="mdi mdi-comment-text-outline"></i></span></h3>
                                                    <p class="info-text font-12">Total Area</p>
                                                    <p class="info-ot font-15"><span class="label "
                                                            style="color:#bc5090!important; background: #bc5090!important">.</span></p>
                                                    <p class="info-ot font-15">Booked Area<span
                                                            class="label label-rounded"><?php echo e(number_format($booked_units_area)); ?>

                                                            <?php echo e($size); ?></span></p>
                                                    <p class="info-ot font-15">Un-Booked Area<span
                                                            class="label label-rounded"><?php echo e(number_format($un_booked_units_area)); ?>

                                                            <?php echo e($size); ?></span></p>
                                                </div>
                                               
                                            </div>
                                        </div>
                                    </div>

                                   
                                    <div class="col-md-4 col-sm-6 info-color-box">
                                        <div class="white-box">
                                            <div class="media bg-danger">
                                                <div class="media-body">
                                                    <h3 class="info-count">Rs. <?php echo e(number_format($total_units_amount)); ?> <span
                                                            class="pull-right"><i class="mdi mdi-coin"></i></span></h3>
                                                    <p class="info-text font-12">Total Price</p>
                                                    <p class="info-ot font-15">Booked Price<span class="label label-rounded">Rs.
                                                            <?php echo e(number_format($booked_units_amount)); ?> </span></p>
                                                    <p class="info-ot font-15">Un-Booked Price<span class="label label-rounded">Rs.
                                                            <?php echo e(number_format($un_booked_units_amount)); ?> </span></p>
                                                    <p class="info-ot font-15">Discount<span class="label label-rounded">Rs.
                                                            <?php echo e(number_format($booked_units_amount - $total_cost_booked_units)); ?> </span></p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div> -->



            <!-- /row -->
            <div class="row" id="update-table">
                <div class="col-sm-12">
                    <div class="white-box">

                        <h3 class="box-title">All Inventories (<?php echo e(number_format($inventoryCount)); ?>)</h3>

                        <div class="table-responsive">
                            <table id="myTable" class="table table-striped">
                                <thead>
                                    <tr>
                                        <th>Sr #</th>
                                        <th>Project</th>
                                        <th>Unit #</th>
                                        <!-- <th>floor</th>
                                                                                    <th>Type</th> -->
                                        <th>Size</th>

                                        <th>Net Amount</th>
                                        <th>Status</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $count = 1; ?>
                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-inventory')): ?>
                                        <?php $view_inventory = true; ?>
                                    <?php else: ?>
                                        <?php $view_inventory = false; ?>
                                    <?php endif; ?>
                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'edit-inventory')): ?>
                                        <?php $edit_inventory = true; ?>
                                    <?php else: ?>
                                        <?php $edit_inventory = false; ?>
                                    <?php endif; ?>
                                    <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'delete-inventory')): ?>
                                        <?php $delete_inventory = true; ?>
                                    <?php else: ?>
                                        <?php $delete_inventory = false; ?>
                                    <?php endif; ?>
                                    <?php if (\Illuminate\Support\Facades\Blade::check('role', 'admin')): ?>
                                        <?php $admin = true; ?>
                                    <?php else: ?>
                                        <?php $admin = false; ?>
                                    <?php endif; ?>

                                    <?php $__currentLoopData = $allInventories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e($count++); ?></td>
                                            <td><?php echo e($i->multiProject ? $i->multiProject->name : 'None'); ?>


                                            </td>
                                            <td>
                                                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-inventory')): ?>
                                                    <a
                                                        href="<?php echo e(route('inventory.detail', ['id' => $i->id])); ?>"><?php echo e($i->unit_number); ?></a>
                                                <?php else: ?>
                                                    <?php echo e($i->unit_number); ?>

                                                <?php endif; ?>

                                            </td>

                                            <td><?php echo e($i->size ? $i->size->name : ''); ?>


                                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('isSuperAdmin')): ?>
                                                    <?php
                                                        if ($i->multiProject->type->id == \App\ProjectType::society) {
                                                            $size = \App\ProjectType::society_size;
                                                        } else {
                                                            $size = \App\ProjectType::high_rise_size;
                                                        }
                                                    ?>
                                                <?php endif; ?>

                                                <?php echo e($size); ?>

                                            </td>
                                            <td><?php echo e(number_format($i->total_price)); ?></td>

                                            <?php if($admin): ?>
                                                <?php if($i->status == \App\Inventory::open): ?>
                                                    <td><span class="label label-success">Open</span></td>
                                                <?php elseif($i->status == \App\Inventory::package_open_file): ?>
                                                    <td><span class="label label-success">Dealer Package
                                                            File (<?php echo e($i->dealerPackageOpenFileUnit->dealer->name); ?>)</span>
                                                    </td>
                                                <?php elseif($i->status == \App\Inventory::package_open_file_refunded): ?>
                                                    <td><span class="label label-success">Open/Dealer Package
                                                            Refunded
                                                            (<?php echo e($i->dealerPackageOpenFileUnit->dealer->name); ?>)</span>
                                                            </td>
                                                <?php elseif($i->status == \App\Inventory::sold): ?>
                                                    <td><span class="label label-danger">Sold</span></td>
                                                <?php elseif($i->status == \App\Inventory::hold_client): ?>
                                                    <td><span class="label label-primary">Client Hold</span></td>
                                                <?php elseif($i->status == \App\Inventory::hold_company): ?>
                                                    <td><span class="label label-primary">Company Hold</span></td>
                                                <?php elseif($i->status == \App\Inventory::token_hold): ?>
                                                    <td><span class="label label-primary">Token Hold</span></td>
                                                <?php elseif($i->status == \App\Inventory::temp_hold): ?>
                                                    <td><span class="label label-primary">Temporary Hold</span></td>
                                                    <?php elseif($i->status == \App\Inventory::block): ?>
                                                    <td><span class="label label-primary">Block</span></td>

                                                    
                                                <?php else: ?>
                                                    <td></td>
                                                <?php endif; ?>
                                            <?php else: ?>
                                                <?php if($i->status == \App\Inventory::open): ?>
                                                    <td><span class="label label-success">Open</span></td>
                                                <?php else: ?>
                                                    <td><span class="label label-danger">Sold</span></td>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                            <td class="text-nowrap">
                                                <?php if($view_inventory): ?>
                                                    <a href="<?php echo e(route('inventory.detail', ['id' => $i->id])); ?>"
                                                        data-toggle="tooltip" data-original-title="View"> <i
                                                            class="fa fa-eye text-inverse m-r-10"></i> </a>
                                                <?php endif; ?>

                                                <?php if($i->status != \App\Inventory::package_open_file): ?>
                                                    <?php if($edit_inventory): ?>
                                                        <a href="<?php echo e(route('inventory.editView', ['id' => $i->id])); ?>"
                                                            data-toggle="tooltip" data-original-title="Edit"> <i
                                                                class="fa fa-pencil text-inverse m-r-10"></i> </a>
                                                    <?php endif; ?>
                                                <?php endif; ?>

                                                
                                                <?php if($delete_inventory): ?>
                                                    <a data-toggle="confirmation" data-title="Are you sure to delete?"
                                                        href="<?php echo e(route('inventory.delete', ['id' => $i->id])); ?>"> <i
                                                            class="fa fa-close text-danger"></i> </a>
                                                <?php endif; ?>
                                            </td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                </tbody>

                            </table>
                            <div style="float: right;"><?php echo e($allInventories->links()); ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container-fluid -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>

    <script src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.0/js/dataTables.buttons.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.html5.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/1.7.0/js/buttons.print.min.js"></script>
    <!-- Char.js File -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.3.0/dist/chart.umd.min.js"></script>


    <script>
        $(function() {
            $('#myTable').DataTable({
                'pageLength': 25,
                'paging': false,
                'searching': false,
                'info': false,
                'dom': 'Bfrtip',
                'buttons': [
                    'copy', 'csv', 'excel', 'pdf', 'print'
                ]
            });
        });

        function callItBack() {


            $('.search-customer').on('click', function() {
                $('.preloader').fadeIn();
                unit = $('#unit').val();
                floor = $('#floor').val();
                size = $('#size').val();
                status = $('#status').val();
                var selectValue = "";
                if ($("#multipro").length > 0) {
                    if ($("#multipro").val() !== 'search') {
                        selectValue = $("#multipro").val();
                    }
                    // Do something with the value
                }


                if (unit == 0 && floor == 0 && size == 0 && status == 0) {
                    toastr.warning("please select any option.");
                    $('.preloader').fadeOut();
                    return false;
                }

                var data = {
                    'unit': unit,
                    'floor': floor,
                    'size': size,
                    'status': status,
                    'multipro_id': selectValue
                };

                $.get('/inventory/updateTable', data, function(data) {
                    document.getElementById('update-table').innerHTML = data;

                    $('#myTable').DataTable({
                        'pageLength': 50,
                        'paging': false,
                        'searching': false,
                        'info': true,
                        'dom': 'Bfrtip',
                        'buttons': [
                            'copy', 'csv', 'excel', 'pdf', 'print'
                        ]
                    });
                    toastr.success("Search updated.");


                    $('.preloader').fadeOut();
                });
            });



            // Graph Scrip Start Here
            const ctx = document.getElementById('myChart').getContext('2d');


            const totalUnitsCount = $('#total_units_count').val();
            const bookedUnitsCount = $('#booked_units_count').val();
            const unBookedUnitsCount = $('#un_booked_units_count').val();


            const colors = [
                // Red with 60% opacity
                'rgba(54, 162, 235, 0.6)', // Blue with 60% opacity
                'rgba(255, 206, 86, 0.6)', // Yellow with 60% opacity
            ];

            new Chart(ctx, {
                type: 'pie',
                data: {
                    labels: [
                        'Booked Units:' + bookedUnitsCount,
                        'Un-Booked Units:' + unBookedUnitsCount
                    ],
                    datasets: [{
                        data: [bookedUnitsCount, unBookedUnitsCount],
                        backgroundColor: colors,
                    }]
                },
                options: {
                    responsive: true,
                    // title: {
                    //     display: true,
                    //     text: 'Total Units: ' + 10000,
                    //     fontColor: 'black',
                    //     fontSize: 18,
                    //     padding: 20
                    // },
                    // legend: {
                    //     position: 'bottom',
                    //     labels: {
                    //         fontColor: 'black',
                    //         fontSize: 14,
                    //         padding: 20,
                    //         boxWidth: 12
                    //     }
                    // },
                    // elements: {
                    //     arc: {
                    //         borderWidth: 0,
                    //         hoverOffset: 0 // Keeps the same size on hover
                    //     }
                    // },
                    // tooltips: {
                    //     enabled: true,
                    //     callbacks: {
                    //         label: function(tooltipItem, data) {
                    //             var label = data.labels[tooltipItem.index] || '';

                    //             if (label) {
                    //                 label += ': ';
                    //             }
                    //             label += tooltipItem.yLabel.toLocaleString();
                    //             return label;
                    //         }
                    //     }
                    // }
                }
            });

// Set the total units count
document.getElementById('total-units').textContent = totalUnitsCount;
            //end chart 1
           

            const total_units_area = $('#total_units_area').val();
            const booked_units_area = $('#booked_units_area').val();
            const un_booked_units_area = $('#un_booked_units_area').val();

            const total_units_area_2 = $('#total_units_area_2').val();
            const booked_units_area_2 = $('#booked_units_area_2').val();
            const un_booked_units_area_2 = $('#un_booked_units_area_2').val();

            //chart 2

            const SecondChart = document.getElementById('SecondChart').getContext('2d');
            const colors2 = [
                'rgba(255, 99, 132, 0.6)', // Red with 60% opacity
                'rgba(54, 162, 235, 0.6)', // Blue with 60% opacity
                'rgba(255, 206, 86, 0.6)', // Yellow with 60% opacity
            ];

            let datasets = [];
            datasets.splice(0, datasets.length);
            const multiprojectype_val = $('#multiprojectype_val').val();
            if (multiprojectype_val == 'all') {
                datasets.push({
                    label: '<?php echo e(\App\ProjectType::society_size); ?>',
                    data: [total_units_area, booked_units_area, un_booked_units_area], // Example values for Marla
                    backgroundColor: 'rgba(255, 99, 132, 0.6)', // Bar color for Marla
                });
                datasets.push({
                    label: '<?php echo e(\App\ProjectType::high_rise_size); ?>',
                    data: [total_units_area_2, booked_units_area_2,
                    un_booked_units_area_2], // Example values for Marla
                    backgroundColor: 'rgba(54, 162, 235, 0.6)', // Bar color for Marla
                });
            } else if (multiprojectype_val == '<?php echo e(\App\ProjectType::society); ?>') {

                datasets.push({
                    label: '<?php echo e(\App\ProjectType::society_size); ?>',
                    data: [total_units_area, booked_units_area, un_booked_units_area], // Example values for Marla
                    backgroundColor: 'rgba(255, 99, 132, 0.6)', // Bar color for Marla
                });
            } else if (multiprojectype_val == '<?php echo e(\App\ProjectType::high_rise); ?>') {

                datasets.push({
                    label: '<?php echo e(\App\ProjectType::high_rise_size); ?>',
                    data: [total_units_area, booked_units_area,
                    un_booked_units_area], // Example values for Square Feet
                    backgroundColor: 'rgba(54, 162, 235, 0.6)', // Bar color for Square Feet
                });
            }



            new Chart(SecondChart, {
                type: 'bar',
                data: {
                    labels: ['Total Area', 'Booked', 'UnBooked'],
                    datasets: datasets,

                },
                options: {
                    responsive: true,
                    legend: {
                        position: 'bottom',
                        labels: {
                            fontColor: 'black',
                            fontSize: 14,
                            padding: 20,
                            boxWidth: 12
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true, // Start the Y-axis at zero
                            ticks: {
                                precision: 0, // Display whole numbers on the Y-axis
                                callback: function(value) {
                                    return value.toLocaleString(); // Format the Y-axis values with commas
                                }
                            }
                        }
                    },
                    tooltip: {
                        enabled: true,
                        intersect: true, // Ensure tooltips are shown only on the hovered bar
                        callbacks: {
                            label: function(tooltipItem, data) {
                                var datasetIndex = tooltipItem.datasetIndex;
                                var index = tooltipItem.index;
                                var label = data.labels[index] || '';
                                var value = data.datasets[datasetIndex].data[index].toLocaleString();
                                return label + ': ' + value;
                            }
                        }
                    }
                }
            });


            // endchart 2

            //chart 3
            // Data for the pie chart


            const total_units_amount = $('#total_units_amount').val();
            const booked_units_amount = $('#booked_units_amount').val();
            const un_booked_units_amount = $('#un_booked_units_amount').val();
            const discount_val = $('#discount_val').val();


            const data_val = [booked_units_amount, un_booked_units_amount, discount_val];

            const colors3 = [
                // Red with 60% opacity
                'rgba(54, 162, 235, 0.6)', // Blue with 60% opacity
                'rgba(255, 206, 86, 0.6)',
                'rgba(53, 206, 86, 0.6)', // Yellow with 60% opacity
            ];
            const data = {
                labels: [
                    'Booked Price Rs: ' + booked_units_amount,
                    'Un-Booked Price Rs: ' + un_booked_units_amount,
                    'Discount Rs: ' + discount_val
                ],
                datasets: [{
                    data: data_val,
                    backgroundColor: colors3,
                    hoverBackgroundColor: colors3
                }]
            };


            // Create the pie chart
            const ctxc = document.getElementById('ThirdChart').getContext('2d');
            const myChart = new Chart(ctxc, {
                type: 'pie',
                data: data,

            });
            //end chart 3
            document.getElementById('total-amount').textContent ='Rs:'+total_units_amount;
           
        }

        callItBack();

        function updateStatus(value) {
            $('.preloader').fadeIn();

            if (value === 'search') {

                $('.preloader').fadeOut();
                return false;
            }
            if (value == "") {
                $('.preloader').fadeOut();
                return false;
            }
            var data = {
                'multipro_id': value,
            };
            $.get('<?php echo e(route('inventory.all')); ?>', data, function(data) {
                $('.preloader').fadeOut();
                $('#myTable tbody').empty();

                $('.chosen-select').chosen('destroy');

                document.getElementById('updatecontent').innerHTML = data;
                $('.chosen-select').trigger('chosen:updated');
                callItBack();
                $('#myTable').DataTable({
                    'pageLength': 50,
                    'paging': false,
                    'searching': false,
                    'info': true,
                    'dom': 'Bfrtip',
                    'buttons': [
                        'copy', 'csv', 'excel', 'pdf', 'print'
                    ]
                });

                toastr.success("Search updated.");
                $('.preloader').fadeOut();
            });

        }
    </script>







<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\akram-city.projecterp.net\resources\views/inventory/index.blade.php ENDPATH**/ ?>