<style>
th,
td {
    border-right: 0.5px solid #333;
}
</style>

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

<section>

    <main class="content">
        <div class="container-fluid p-0">

            <h2 class="h3 mb-3"> Dashboard Statistics</h2>

            <div class="row">
                <div class="col-lg-6 col-sm-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="row">
                                <div class="col mt-0">
                                    <h5 class="card-title" style="font-size: 20px;">Total Number of Transcripts</h5>
                                </div>

                                <div class="col-auto">
                                    <div class="stat text-primary">
                                        <i class="align-middle" data-feather="truck"></i>
                                    </div>
                                </div>
                            </div>
                            <h1 class="mt-1 mb-3" id="number_of_requested_documents"> 0 </h1>
                        </div>
                    </div>
                </div>
                <div class="col-lg-6 col-sm-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="row">
                                <div class="col mt-0">
                                    <h5 class="card-title" style="font-size: 20px;">Total Complaints</h5>
                                </div>

                                <div class="col-auto">
                                    <div class="stat text-primary">
                                        <i class="align-middle" data-feather="users"></i>
                                    </div>
                                </div>
                            </div>
                            <h1 class="mt-1 mb-3">0</h1>
                        </div>
                    </div>
                </div>
            </div>
            <?php echo $__env->make('ordered_transcripts.index', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        </div>


        </div>
    </main>
</section>
<?php $__env->stopSection(); ?>

 <script src="<?php echo e(asset('public/assets/js/jquery.min.js')); ?>"></script>
  <script src="<?php echo e(asset('public/assets/js/datatables/jquery.dataTables.min.js')); ?>"></script>
<script>
 function getOrderedDocuments() {
        $.ajax({
            url: `<?php echo e(url('/ordered-documents')); ?>`,
            method: 'GET',
            success: function(result_) {
                let programs = result_['programs'].map(p => p['value']);
                let ordered_documents = result_['ordered_documents'];
                ordered_documents = ordered_documents.filter(doc => {
                    for (let i = 0; i < programs.length; i++) {
                        let program = programs[i];
                        if (doc.type_of_document.includes(program)) {
                            return true;
                        } else {
                            return false;
                        }
                    }
                    return false;
                });
                
                document.getElementById('number_of_requested_documents').innerText = ordered_documents.length;
            }
        });
        
    }

getOrderedDocuments();

</script>
<?php echo $__env->make('master_view', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>