<?php Fun::lang() ?>

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

    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3><?php echo e(__('administrator.ledger_list')); ?></h3>
                        </div>
                        <div class="pull-right">
                        <!-- <a href="<?php echo e(route('journal.create')); ?>" class="btn btn-info fa fa-plus"> Add New</a> -->
                        </div>
                    </div>
                </div>
                <div class="col-sm-12 block-action">
                    <p class="pull-right btn-action btn btn-xs btn-info" data-toggle="tooltip" data-placement="top"
                       title="Hide/Show"><i class="fa fa-caret-down" aria-hidden="true"></i></p>
                    
                    <button type="submit" class="pull-right btn btn-xs btn-warning" data-toggle="tooltip"
                            data-placement="top" title="Print Voucher"><i class="fa fa-print" aria-hidden="true"></i>
                    </button>
                    
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12" id="block-action" style="display:none">
                    <div class="content-action">
                        <?php echo Form::open(['class'=>'form_search']); ?>

                        <div class="col-sm-5">
                            <div class="col-sm-4">
                                <label for="">Reference Number</label>
                            </div>
                            <div class="col-sm-8">
                                <div class="form-group">
                                    <?php if(isset($acc_code)): ?>
                                        <?php echo Form::select('acc_chart', $account_chart, $acc_code, ['class' => 'form-control select2 acc_type','required','id'=>'acc_code']); ?>

                                    <?php else: ?>
                                        <?php echo Form::select('acc_chart', $account_chart, null, ['class' => 'form-control select2 acc_type','required','id'=>'acc_code']); ?>

                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="col-sm-4">
                                <label for="">Start Date</label>
                            </div>
                            <?php
                            $from = (isset($start_date)) ? date('d-m-Y', strtotime($start_date)) : '';
                            $to = (isset($end_date)) ? date('d-m-Y', strtotime($end_date)) : '';
                            ?>
                            <div class="col-sm-8">
                                <input type="text" class="form-control date_picker start_date" value="<?php echo e($from); ?>">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="col-sm-4">
                                <label for="">End Date</label>
                            </div>
                            <div class="col-sm-8">
                                <input type="text" class="form-control date_picker end_date" value="<?php echo e($to); ?>">
                            </div>
                        </div>
                        <?php echo Form::close(); ?>

                        <div class="col-sm-1">
                            <button type="button" class="button_primary button_lg fa fa-search button_search"> Search
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12 col-xs-12">
                <div class="form-wrapper">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="table-responsive">
                                <table id="table_journal"
                                       class="table table-bordered table-striped table table-condensed table-hover">
                                    <thead>
                                    <tr>
                                        <th>No</th>
                                        <th><?php echo e(__('administrator.project')); ?></th>
                                        <th><?php echo e(__('administrator.type')); ?></th>
                                        <th><?php echo e(__('administrator.date')); ?></th>
                                        <th><?php echo e(__('administrator.reference_number')); ?></th>
                                        <th><?php echo e(__('administrator.name')); ?></th>
                                        <th><?php echo e(__('administrator.description')); ?></th>
                                        <th><?php echo e(__('administrator.created_by')); ?></th>
                                        <th><?php echo e(__('administrator.debit')); ?></th>
                                        <th><?php echo e(__('administrator.credit')); ?></th>
                                        <th><?php echo e(__('administrator.amount')); ?></th>
                                    </tr>
                                    </thead>
                                    <tbody id="tbody"></tbody>
                                    <tfoot id="tfoot">
                                    <tr>

                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade bs-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dm">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h3 class="modal-title text-danger">Warning...!</h3>
                </div>
                <br/>
                <div class="row">
                    <div class="col-md-12">
                        <div class="col-md-10">
                            <h4>Receivable amount must be smaller than or equal available amount.</h4>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" data-dismiss="modal" class="button_primary"><i class="fa fa-close"></i> Close
                    </button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

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

<?php $__env->startSection('script'); ?>
    <script type="text/javascript">
        $(document).on('click', '.btn-action', function () {
            $('#block-action').toggle("fast");
        });
        $(document).ready(function () {
            getTable();
            $('.button_search').on('click',function () {
                getTable();
            });
        });
        function getTable() {
            let form = $('.form_search').serialize();
            $.ajax({
                url: "<?php echo e(route('get-accounting-report.ledger')); ?>?"+form,
                method: "get",
                dataType: "text",
                success: function (data) {
                    $('#tbody').append(data);
                }
            });
        }
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app-accounting', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/Accounting/reports/ledger.blade.php ENDPATH**/ ?>