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

    <div class="container-fluid">
        <div class="">
            <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.other_income_expense')); ?> </h3>
                            </div>
                            <div class="pull-right">
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Other Income Expense Create')): ?>
                                    <a data-href="<?php echo e(route('other-income-expenses.create')); ?>" class="button_primary getHtmlForm">
                                        <span class="fa fa-plus"></span> <?php echo e(__('administrator.income')); ?> / <?php echo e(__('administrator.expense')); ?>

                                    </a>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="wrapper-table">
                <form class="row form_data" style="padding-top: 20px;padding-bottom: 20px">
                    <div class="col-lg-3">
                        <label class="required"><?php echo app('translator')->getFromJson('administrator.from_date'); ?></label>
                        <?php echo Form::text('from_date', date('01-m-Y'), array('placeholder' => __('administrator.from_date'),'class' => 'form-control date_picker')); ?>

                    </div>
                    <div class="col-lg-3">
                        <label class="required"><?php echo app('translator')->getFromJson('administrator.to_date'); ?></label>
                        <?php echo Form::text('to_date', date('d-m-Y'), array('placeholder' => __('administrator.to_date'),'class' => 'form-control date_picker')); ?>

                    </div>
                    <div class="col-lg-3">
                        <label class="required"><?php echo app('translator')->getFromJson('administrator.type'); ?></label>
                        <?php echo Form::select('type', ['income'=>__('administrator.income'),'expense'=>__('administrator.expense')],null, array('placeholder' => __('administrator.please_select'),'class' => 'form-control')); ?>

                    </div>
                    <div class="col-lg-3">
                        <label class="required"><?php echo app('translator')->getFromJson('administrator.user'); ?></label>
                        <?php
                            $user = \App\Model\OtherIncomeExpense::groupBy('user_id')->pluck('user_id');
                            $user = \App\User::whereIn('id',$user)->pluck('name','id');
                        ?>
                        <?php echo Form::select('user_id',$user,null, array('placeholder' => __('administrator.please_select'),'class' => 'form-control')); ?>

                    </div>
                </form>
                <table id="datatable_products" class="table  table-striped table-hover">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th><?php echo e(__('administrator.type')); ?></th>
                        <th><?php echo e(__('administrator.title')); ?></th>
                        <th><?php echo e(__('administrator.amount')); ?></th>
                        <th><?php echo e(__('administrator.date')); ?></th>
                        <th><?php echo e(__('administrator.description')); ?></th>
                        <th><?php echo e(__('administrator.user')); ?></th>
                        <th><?php echo e(__('administrator.action')); ?></th>
                    </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.form_data').on('change','input,select',function () {
                getTable();
            })
            getTable();
        })
        function getTable() {
            $('#datatable_products').DataTable().destroy()
            $('#datatable_products').DataTable({
                "oLanguage": {
                    "sSearch": "<?php echo e(__('administrator.search')); ?>:",
                    "sLengthMenu": "<?php echo e(__('administrator.display')); ?> _MENU_ <?php echo e(__('administrator.record_per_page')); ?>",
                    "sZeroRecords": "<?php echo e(__('administrator.Nothing_foundsorry')); ?>",
                    "sInfo": "<?php echo e(__('administrator.showing')); ?> _START_ <?php echo e(__('administrator.to')); ?> _END_ <?php echo e(__('administrator.of')); ?> _TOTAL_ <?php echo e(__('administrator.record')); ?>",
                    "sInfoEmpty": "<?php echo e(__('administrator.showing')); ?> 0 <?php echo e(__('administrator.to')); ?> 0 <?php echo e(__('administrator.of')); ?> 0 <?php echo e(__('administrator.record')); ?>",
                    "sInfoFiltered": "(<?php echo e(__('administrator.filter_form')); ?> _MAX_ <?php echo e(__('administrator.total_records')); ?>)",
                    "oPaginate": {
                        "sFirst": "<?php echo e(__('administrator.first')); ?>",
                        "sLast": "<?php echo e(__('administrator.last')); ?>",
                        "sNext": "<?php echo e(__('administrator.next')); ?>",
                        "sPrevious": "<?php echo e(__('administrator.previous')); ?>"
                    },
                },
                ordering: true,
                serverSide: true,
                lengthMenu: tbLeng,
                ajax: {
                    url: "?"+$('.form_data').serialize(),
                },
                columns:
                    [
                        {data: 'DT_RowIndex', searchable: false, "orderable": "false"},
                        {data: 'type'},
                        {data: 'title'},
                        {data: 'amount'},
                        {data: 'date'},
                        {data: 'note'},
                        {data: 'user_id'},
                        {data: 'action',searchable:false},

                    ],
                "initComplete": function (settings, json) {
                }

            });

        }
    </script>
<?php $__env->stopSection(); ?>



<?php echo $__env->make(branchMenu(), \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/administrator/payment/other-income-expense/index.blade.php ENDPATH**/ ?>