<?php $__env->startSection('css'); ?>
<style>
    .text-right{
        text-align: right;
        color: green;
        font-size: 20px;
    }
    .btn{
        margin-right: 2px;
    }
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<?php echo $__env->make('administrator.bank-agency.create', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php echo $__env->make('administrator.bank-agency.edit', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php Fun::lang() ?>
<div class="title-page">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="#">Agency</a></li>
            <li><a href="#">Bank</a></li>
        </ul>
    </div>
</div>

<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>Bank</h3>
                    </div>
                </div>
                <div class="pull-right">
                    <span class="button_sm button_primary btn btn-add-new"><i class="fa fa-plus"></i> Create New</span>
                </div>
            </div>
        </div>
    </div>
    <div class="box-body table-responsive">
        <table id="datatable_commission_list" class="table table-striped table-bordered table-hover nowrap">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Bank Name</th>
                    <th>Date</th>
                    <th>Description</th>
                    <th>Action</th>
                </tr>
            </thead>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?> <?php $__env->startSection('js'); ?>

<script type="text/javascript">
    $(document).ready(function() {
        $('.main-spinner').show();
        $('#datatable_commission_list').DataTable({
            "lengthMenu": [
                [20, 25, 50, 100, 500],
                [20, 25, 50, 100, 500]
            ],
            ordering: false,
            serverSide: false,
            ajax: "<?php echo e(route('bank-agency.index')); ?>",
            columns: [
                {
                    data: 'DT_RowIndex'
                },
                {
                    data: 'name'
                },
                {
                    data: 'date'
                },
                {
                    data: 'des'
                },
                {
                    data: 'action'
                }
            ],
            "initComplete": function(settings, json) {
                $('.main-spinner').hide();
            }
        });

        $.fn.dataTable.ext.errMode = 'throw';
    });
    $(document).on('click','.btn-add-new',function(){
        $('#myModal').modal('show');
    });
    $(document).on('click','.btn-edit',function(){
        var id = $(this).data('id');
        var name = $(this).data('name');
        var des = $(this).data('des');
        var route = "<?php echo e(route('bank-agency.update',':id')); ?>";
        route = route.replace(":id",id);
        $('#form-edit').attr('action',route);
        $('#name').val(name);
        $('#des').val(des);
        $('#myModalEdit').modal('show');
    });
    $(document).on('click','.btn-delete',function(){
        if(confirm("Are You Sure to Delete?")){
            var id = $(this).data('id');
            var route = "<?php echo e(route('bank-agency.destroy',':id')); ?>";
            route = route.replace(":id",id);
            $.ajax({
                type:"DELETE",
                dataType:"JSON",
                url:route,
                data:{
                    _token:"<?php echo e(csrf_token()); ?>"
                },
                success:function(data){
                    $('#datatable_commission_list').DataTable().ajax.reload();
                }
            });
        }
    });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>