<?php echo $this->extend('/template'); ?>
<?php echo $this->section('content') ?>

<head>
    <title>
    <?php 
    echo ($balik == 0) ?  'DATA WARGA MUDIK DELETED':  "DATA WARGA ARUS BALIK DELETED";
    ?>
    </title>

</head>

<div class="containers">

    <table id="dg" title="DAFTAR PEMUDIK" class="easyui-datagrid" style="width:100%;height:600px" url="/wargadatadeleted" toolbar="#toolbar" rownumbers="true" fitColumns="true" singleSelect="true" data-options="
            pagination:true,
            scrollbarSize:0,
            nowrap:false,
            remoteFilter:true,
            fitColumns:true,
            pageSize:20,
            noWrap:false,
            queryParams: {'<?php echo csrf_token() ?>': '<?php echo csrf_hash() ?>','balik':'<?php echo $balik; ?>'},
            ">
        <thead>
            <tr>
                <th field="koded" width="35" sortable="true">KODE<BR />DAFTAR</th>
                <th field="nik" width="40" align="left">NIK</th>
                <!--
                <th field="nokk" width="40">NO KK</th>
-->
                <th field="nama" width="45">NAMA</th>
                <th field="lahir_tempat" width="30" align="left">TEMPAT LAHIR/<br />PEKERJAAN</th>
                <th field="usia" width="15" align="center">USIA</th>
                <th field="nowa" width="30" align="left">NOMOR WA</th>
                <th field="wilayaht" width="45" align="left"><?php echo $balik == 0 ? "TUJUAN MUDIK" : "ASAL DARI"; ?></th>
                <th field="nobus" width="25" align="center">NO BUS</th>
                <th field="tanggal" width="40" align="left">WAKTU</th>
                <th field="user" width="40" align="left">OLEH</th>
            </tr>
        </thead>
    </table>

</div>

<script>
    $(document).ready(function() {
        $('#nik').textbox('readonly', false);

    });

 
    function onLoadSuccess(data) {
        var merges = [{
            index: 2,
            rowspan: 2
        }, {
            index: 5,
            rowspan: 2
        }, {
            index: 7,
            rowspan: 2
        }];

        for (var i = 0; i < merges.length; i++) {
            $(this).datagrid('mergeCells', {
                index: merges[i].index,
                field: 'koded',
                rowspan: merges[i].rowspan
            });
        }
    }

</script>

<script type="text/javascript">
    $(function() {
        var dg = $('#dg').datagrid();
        dg.datagrid('enableFilter', [{
                field: 'nik',
                type: 'textbox'
            }, {
                field: 'nokk',
                type: 'textbox'
            }, {
                field: 'nama',
                type: 'textbox'
            }, {
                field: 'koded',
                type: 'textbox'
            }, {
                field: 'lahir_tempat',
                type: 'label'
            }, {
                field: 'usia',
                type: 'label'
            }, {
                field: 'nobus',
                type: 'combobox',
                trigger: 'none',
                options: {
                    editable: true,
                    panelHeight: '500px',
                    panelWidth:'300px',
                    selectOnNavigation: false,
                    queryParams: {
                        '<?php echo csrf_token() ?>': '<?php echo csrf_hash() ?>',
                        'balik': '<?php echo $balik; ?>'
                    },
                    url: '/nobus_combo',
                    onChange: function(value) {
                        if (value == '') {
                            dg.datagrid('removeFilterRule', 'armada_id');
                        } else {
                            dg.datagrid('addFilterRule', {
                                field: 'armada_id',
                                op: 'equal',
                                value: value
                            });
                        }
                        dg.datagrid('doFilter');
                    }
                }
            }, {
                field: 'datadukungt',
                type: 'label'
            }, {
                field: 'aksi',
                type: 'label'
            }, {
                field: 'nowa',
                type: 'textbox'
            }, {
                field: 'statust',
                type: 'combobox',
                trigger: 'none',
                options: {
                    panelHeight: '300px',
                    selectOnNavigation: false,
                    queryParams: {
                        '<?php echo csrf_token() ?>': '<?php echo csrf_hash() ?>'
                    },
                    url: '/status_combo',
                    onChange: function(value) {
                        if (value == '') {
                            dg.datagrid('removeFilterRule', 'status');
                        } else {
                            dg.datagrid('addFilterRule', {
                                field: 'status',
                                value: value
                            });
                        }

                        dg.datagrid('doFilter');
                    }

                }
            }, {
                field: 'wilayaht',
                type: 'combobox',
                trigger: 'none',
                options: {
                    editable: true,
                    panelHeight: '300px',
                    selectOnNavigation: false,
                    queryParams: {
                        '<?php echo csrf_token() ?>': '<?php echo csrf_hash() ?>',
                        'balik': '<?php echo $balik; ?>'
                    },
                    url: '/wilayah_combo',
                    onChange: function(value) {
                        if (value == '') {
                            dg.datagrid('removeFilterRule', 'wilayah_id');
                        } else {
                            dg.datagrid('addFilterRule', {
                                field: 'wilayah_id',
                                op: 'equal',
                                value: value
                            });
                        }
                        dg.datagrid('doFilter');
                    }
                }
            },




        ]);
    });


</script>



<style>
    .easyui-dialog {
        background-color: #f7d9d9;
    }

    .pulkanan {
        display: inline-block;
        text-align: right;
        float: inline-end;
        font-weight: bold;
    }
</style>

<?php echo $this->endSection() ?>