
<?php $__env->startSection('content'); ?>
<style>
    .input_upload {
        width:100px;
        height:35px;
        position:absolute;
        bottom:-34px;
        right:350px;
    }
    .account-sidebar {
        position: sticky;
        top: 20px;
        height: calc(100vh - 100px);
    }
    .account-sidebar .nav-link {
        border-radius: 0;
        padding: 12px 15px;
        color: #495057;
    }
    .account-sidebar .nav-link.active {
        background-color: #f8f9fa;
        color: #0d6efd;
        border-left: 3px solid #0d6efd;
        font-weight: 500;
    }
    .account-sidebar .nav-link:hover:not(.active) {
        background-color: #f8f9fa;
    }
</style>
<!-- begin::main content -->
<main class="main-content">
    <div class="container-fluid">
        <div class="row">
            <!-- Sidebar for account types -->
            <div class="col-md-3 col-lg-2">
                <?php echo $__env->make('accounting.accountant.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            </div>

            <!-- Main content area -->
            <div class="col-md-9 col-lg-10">
                <div class="page-header">
                    <h3><?php echo e(ucfirst(isset($type) ? $type : '')); ?> Accounts</h3>
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="<?php echo e(asset('dashboard')); ?>"><?php echo e(__('message.dashboard')); ?></a></li>
                            <li class="breadcrumb-item active" aria-current="page"><?php echo e(ucfirst(isset($type) ? $type : '')); ?></li>
                        </ol>
                    </nav>
                </div>
                
                <div class="card">
                    <div class="card-header">
                        <form action="<?php echo e(asset('account/fetch-gst-received')); ?>" method="get">
                            <div class="row mt-3">
                                <div class="col-md-12">   
                                    <div class="row">
                                        <div class="form-group col-md-3">
                                            <lable>Start Date</label>
                                            <input type="date" name="start_date" value="<?php echo e(request('start_date')); ?>" class="form-control">
                                        </div>
                                        <div class="form-group col-md-3">
                                            <lable>End Date</label>
                                            <input type="date" name="end_date" value="<?php echo e(request('end_date')); ?>" class="form-control">
                                        </div>
                                        
                                        <div class="input-group col-md-3"> 
                                            <div class="pt-3">                                       
                                                <button class="btn border" type="submit">
                                                    <i class="ti ti-search fa-lg"></i>
                                                </button>
                                                <a class="btn btn-white border" href="<?php echo e(asset('account/fetch-gst-received')); ?>">
                                                    <i class="ti ti-reload fa-lg"></i>
                                                </a>
                                            </div>
                                        </div> 
                                    </div>                                     
                                                                           
                                </div>
                                <div class="col-md-12">
                                    
                                    <div class="card col-5">
                                        <div class="card-body">
                                            <div class="total-balance-box p-2 py-3 text-center">
                                                <h5 class="mb-0">Total Balance: <span class="text-success">₹ <?php echo e(isset($banks) ? $banks->sum('igst_total','cgst_total','sgst_total') : ''); ?></span></h5>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    
                                </div>
                                
                            </div>
                        </form>
                    </div>
                    
                        <div class="card-body">
                            <?php if(isset($banks)): ?>
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered">
                                        <thead class="">
                                            <tr>
                                                
                                                <th class="wrap">S.NO</th>
                                                <th>Invoice Number</th>
                                                <th> Date</th>  
                                                <th>SGST</th>
                                                <th>CGST</th>
                                                <th>IGST</th>            
                                                <th>Total</th>
                                                
                                                
                                                
                                            </tr>
                                        </thead>
                                        <tbody>
                                            
                                            <?php if(!empty($banks)): ?>
                                                <?php $__currentLoopData = $banks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            
                                                <tr>
                                                    <td><?php echo e(++$key); ?></td>
                                                    <td><?php echo e($account->invoice_number); ?></td>
                                                    <td><?php echo e($account->invoice_date); ?></td> 
                                                    <td><?php echo e($account->sgst_total); ?></td> 
                                                    <td><?php echo e($account->cgst_total); ?></td> 
                                                    <td><?php echo e($account->igst_total); ?></td>                                                                                              
                                                    <td>                                                            
                                                        ₹ <?php echo e($account->sgst_total + $account->cgst_total + $account->igst_total); ?>                                                            
                                                    </td>               
                                                                                                        
                                                        
                                                </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            
                                            <?php endif; ?>
                                        </tbody>
                                        <tfoot>
                                            <tr>  
                                                                       
                                                <td colspan="6" class="text-right font-weight-bold">Balance</td>
                                                <td colspan="1" class="text-right font-weight-bold">₹ <?php echo e(isset($banks) ? $banks->sum('igst_total','cgst_total','sgst_total') : ''); ?></td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div>
                                
                                <div class="mt-3 d-flex justify-content-center">
                                    <?php echo e($banks->links('pagination::bootstrap-4')); ?> 
                                </div>
                            <?php endif; ?>
                        </div>
                    
                </div>
            </div>
        </div>
    </div>

</main>
<!-- end::main content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('footer-script'); ?>
    <!-- begin::dataTable -->
    <script src="<?php echo e(asset('public/admin/js/examples/datatable.js')); ?>"></script>
    <!-- end::dataTable -->
    <script>
        $(document).ready(function() {
            $(".filter-company-btn").click(function(){
                $(".filter-form-box").toggleClass("d-none");
            });

            $("#checkAll").click(function() {
                $('.item_check:checkbox').not(this).prop('checked', this.checked);
            });
            

            $(".input_file_upload").on("change", function(){
                $(".import-form").submit();
            });

            $(".import-form").on("submit", function(event) {
                event.preventDefault();
                
                $.ajax({
                    type: "POST",
                    url: $(this).attr('action'),
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },                       
                    data: new FormData(this), 
                    processData: false,
                    contentType: false,
                    cache: false,
                    beforeSend: function() {
                        $(".import-content").html("<h5>Please wait uploading...</h5>");
                    },
                    success: function(response) {
                        if(response.message == "success") {
                            var div = `<div class='text-success text-center' style='font-size:50px'>
                                <i class='fa fa-check-circle' ></i>
                                <p style='font-size:20px'>Accounts Imported Successfully!</p>
                            </div>`;
                            $(".import-content").html(div);
                            setTimeout(function(){
                                window.location.reload();
                            }, 3000);
                        } else {
                            var div = `<div class='text-danger text-center' style='font-size:50px'>
                                <i class='fa fa-times-circle' ></i>
                                <p style='font-size:20px'>${response.message || 'Please check the datasheet!'}</p>
                            </div>`;
                            $(".import-content").html(div);
                        }
                    },
                    error: function(xhr, status, error) {
                        var div = `<div class='text-danger text-center' style='font-size:50px'>
                            <i class='fa fa-times-circle' ></i>
                            <p style='font-size:20px'>${xhr.responseJSON?.message || 'Please check the datasheet!'}</p>
                        </div>`;
                        $(".import-content").html(div);
                    }
                });
            });
        });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/peoplebee.in/accounts-admin/resources/views/accounting/accountant/gst_received.blade.php ENDPATH**/ ?>