
<?php $__env->startSection('breadcrumb-first', $breadcrumb->first); ?>
<?php $__env->startSection('breadcrumb-second', $breadcrumb->second); ?>
<?php $__env->startSection('content'); ?>
<div class="row">
	<div class="col-lg-12">
        <?php echo $__env->make('user.order.filter', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <div class="row">
            <div class="col-lg-3">
                <div class="card stats-widget card m-b-30">
                    <div class="card-body">
                        <div class="float-left">
                            <span class="label label-warning mb-3">Total</span>
                            <h5 class="mt-2">
                                <div id="report_total">
                                    Rp <?php echo e(number_format($total['total'],0,',','.')); ?> (<?php echo e(number_format($total['count'],0,',','.')); ?>)
                                </div>
                            </h5>
                        </div>
                        <div class="float-right">
                            <div class="avatar-xs">
                                <span class="avatar-title rounded-circle bg-custom">
                                    <i class="mdi mdi-cart-outline"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-3">
                <div class="card stats-widget card m-b-30">
                    <div class="card-body">
                        <div class="float-left">
                            <span class="label label-warning mb-3">Tertunda</span>
                            <h5 class="mt-2">
                                <div id="report_pending">
                                    Rp <?php echo e(number_format($pending['total'],0,',','.')); ?> (<?php echo e(number_format($pending['count'],0,',','.')); ?>)
                                </div>
                            </h5>
                        </div>
                        <div class="float-right">
                            <div class="avatar-xs">
                                <span class="avatar-title rounded-circle bg-custom">
                                    <i class="mdi mdi-cart-outline"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-3">
                <div class="card stats-widget card m-b-30">
                    <div class="card-body">
                        <div class="float-left">
                            <span class="label label-warning mb-3">Gagal</span>
                            <h5 class="mt-2">
                                <div id="report_failed">
                                    Rp <?php echo e(number_format($failed['total'],0,',','.')); ?> (<?php echo e(number_format($failed['count'],0,',','.')); ?>)
                                </div>
                            </h5>
                        </div>
                        <div class="float-right">
                            <div class="avatar-xs">
                                <span class="avatar-title rounded-circle bg-custom">
                                    <i class="mdi mdi-cart-outline"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-3">
                <div class="card stats-widget card m-b-30">
                    <div class="card-body">
                        <div class="float-left">
                            <span class="label label-warning mb-3">Berhasil</span>
                            <h5 class="mt-2">
                                <div id="report_success">
                                    Rp <?php echo e(number_format($success['total'],0,',','.')); ?> (<?php echo e(number_format($success['count'],0,',','.')); ?>)
                                </div>
                            </h5>
                        </div>
                        <div class="float-right">
                            <div class="avatar-xs">
                                <span class="avatar-title rounded-circle bg-custom">
                                    <i class="mdi mdi-cart-outline"></i>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card card-custom">
            <div class="card-body">
                <div class="table-responsive">
                    <?php echo $dataTable->table(['class' => 'table table-striped table-borderless table-hover mb-0'], false); ?>

                </div>
			</div>
		</div>
	</div>
</div>
<?php echo $dataTable->scripts(); ?>

<script>
	$(document).ready(function () {
        document.getElementById("data-table").children[0].className = "thead-light";
        $('#filter_form').on('submit', function(element) {
            element.preventDefault();
            getReport()
            $('#preloader').fadeIn('slow');
            $.when(window.LaravelDataTables["data-table"].page.len($('#filter_row').val()).draw()).done(function() {
                $('#preloader').fadeOut('slow');
            });
        });
        $('#filter_form').on('reset', function(element) {
            $('[data-toggle="select2"], select, input').val(null).trigger('change');
            $('#filter_row').val('10').trigger('change');
            getReport()
            $('#preloader').fadeIn('slow');
            $.when(window.LaravelDataTables["data-table"].page.len('10').draw()).done(function() {
                $('#preloader').fadeOut('slow');
            });
        });
        function getReport() {
            $.ajax({
                type: "GET",
                url: "<?php echo e(url('order/report')); ?>",
                data: {
                    start_date : $('#filter_start_date').val(),
                    end_date   : $('#filter_end_date').val(),
                    service    : $('#filter_service').val(),
                    status     : $('#filter_status').val(),
                    is_api     : $('#filter_is_api').val(),
                    search     : $('#search').val(),
                },
                dataType: "json",
                success: function(response) {
                    $('#report_total').html(response.total);
                    $('#report_pending').html(response.pending);
                    $('#report_failed').html(response.failed);
                    $('#report_success').html(response.success);
                }, error: function() {
                    swal.fire("Gagal!", "Terjadi kesalahan.", "error");
                }
            });
        }
    });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('user.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/buzb2196/public_html/panel.buzzerinaja.com/resources/views/user/order/history.blade.php ENDPATH**/ ?>