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

<?php echo $this->section('content') ?>

<head>
    <title>PROFILE PEGAWAI</title>
</head>

<?php helper('form'); ?>


<?php
$tgllahir = $data['jbt_tgllahir'];
$jbt_atasan = intval($data['jbt_atasan']);
$tgllahir = date('d-m-Y', strtotime($tgllahir));

$tmt = $data['jbt_tmt'];
if ($tmt !== '0000-00-00')
    $tmt = date('d-m-Y', strtotime($tmt));
else $tmt = '';

$tmtgol = $data['jbt_tmtgol'];
if ($tmtgol !== '0000-00-00')
    $tmtgol = date('d-m-Y', strtotime($tmtgol));
else $tmtgol = '';

$picedit = '<span class="fa fa-edit" style="font-size:20px;color:#2f9f62"></span>';

$pedit = '<a href="#" class="easyui-linkbutton" style="float:right;" plain="true" onclick="phone_edit()"><small>' . $picedit . '</small></a>';

if (in_array($role, array('admin', 'pegawai')) && $beda == 0) {
    $photoedit = '<a href="#" class="easyui-linkbutton" style="float:right;" plain="true" onclick="photo_edit()"><small>' . $picedit . '</small></a>';

    $skkpedit = '<a href="#" class="easyui-linkbutton" style="float:right;" plain="true" onclick="skkp_edit()"><small>' . $picedit . '</small></a>';

    $pddkedit = '<a href="#" class="easyui-linkbutton" style="float:right;" plain="true" onclick="pddk_edit()"><small>' . $picedit . '</small></a>';

    $lantikedit = '<a href="#" class="easyui-linkbutton" style="float:right;" plain="true" onclick="lantik_edit()"><small>' . $picedit . '</small></a>';

    //$lainedit = '<a href="#" class="easyui-linkbutton" style="float:right;" plain="true" onclick="lain_edit()"><small>' . $picedit . '</small></a>';
    $lainedit = '<a href="#"  class="easyui-linkbutton"  style="float:right;"  onclick="lainw(' . $data['user_id'] . ')"><small>' . $picedit . '</small></a>';
} else {
    $photoedit = '';
    $skkpedit = '';
    $pddkedit = '';
    $lantikedit = '';
    $lainedit = '';
    $pedit = '';
}


//foto folder 
if (trim($data['skkp_photo']) == '')
    $skkp_dd = '<span class="fa fa-folder-o fa-2x"></span>';
else
    $skkp_dd = '<a href="#"  class="easyui-linkbutton" onclick="skkpw(' . $data['user_id'] . ')"><span class="fa fa-folder fa-2x" style="color:blue;"></span></a>';
//$skkp_dd = '<div id="skkpdd"><a href="'.base_url().'/assets/images/bawaslu/profile/'.$data['skkp_photo'].'" target="_blank" ><span class="fa fa-folder fa-2x" style="color:blue;"></span></a></div>';

if (trim($data['pddk_photo']) == '')
    $pddk_dd = '<span class="fa fa-folder-o fa-2x"></span>';
else
    $pddk_dd = '<a href="#"  class="easyui-linkbutton" onclick="pddkw(' . $data['user_id'] . ')"><span class="fa fa-folder fa-2x" style="color:blue;"></span></a>';
//$pddk_dd = '<a href="'.base_url().'/assets/images/bawaslu/profile/'.$data['pddk_photo'].'" target="_blank"><span class="fa fa-folder fa-2x" style="color:blue;"></span></a>';

if (trim($data['sklantik_photo']) == '')
    $lantik_dd = '<span class="fa fa-folder-o fa-2x"></span>';
else
    $lantik_dd = '<a   href="#"  class="easyui-linkbutton" onclick="lantikw(' . $data['user_id'] . ')"><span class="fa fa-folder fa-2x" style="color:blue;"></span></a>';
//$lantik_dd = '<a href="'.base_url().'/assets/images/bawaslu/profile/'.$data['sklantik_photo'].'" target="_blank"><span class="fa fa-folder fa-2x" style="color:blue;"></span></a>';

//    if (trim($data['slain_photo']) == '')
//    $lain_dd = '<span class="fa fa-folder-o fa-2x"></span>';
//    else
$lain_dd = '<a href="#"  class="easyui-linkbutton" onclick="lainw(' . $data['user_id'] . ')"><span class="fa fa-folder fa-2x" style="color:blue;"></span></a>';

?>

<div class="container">

    <h2>
        <div class='glyphicon glyphicon-th-large'></div>&nbsp;&nbsp;<b>PROFILE PEGAWAI
    </h2>
</div>
<br />
<div class="row">
    <div class="col-md-4">
        <center>
            <br />
            <?php echo $photoedit; ?>
            <div class="cards" style="background-color:#eee;border-style:solid;border-width:1px;padding:10px;width:auto;border-color:#ddd;height:auto;">
                <img id='fprof' src='<?php echo base_url(); ?>/assets/images/bawaslu/profile/<?php echo $data["user_photo"]; ?>' alt="Foto Pegawai" width="200px">
                <h4><?php echo strtoupper($data['urealname']); ?></h4>
                <p> <?php echo strtoupper($data['unip']); ?></p>
                <hr />
                <table class="table">
                    <tr>
                        <th></th>
                        <th></th>
                        <th></th>
                    </tr>
                    <tr>
                        <td>SK KP</td>
                        <td><?php echo $skkp_dd; ?></td>
                        <td><?php echo $skkpedit; ?></td>
                    </tr>
                    <tr>
                        <td>Pendidikan Terakhir</td>
                        <td><?php echo $pddk_dd; ?></td>
                        <td><?php echo $pddkedit; ?></td>
                    </tr>
                    <tr>
                        <td>SK Pelantikan</td>
                        <td><?php echo $lantik_dd; ?></td>
                        <td><?php echo $lantikedit; ?></td>
                    </tr>
                    <tr>
                        <td>Dokumen Lainnya</td>
                        <td><?php echo $lain_dd; ?></td>
                        <td><?php echo $lainedit; ?></td>
                    </tr>
                </table>

            </div>
        </center>
    </div>


    <div class="col-md-8">
        <table class="table table-bordered">
            <?php

            echo '<tr><td width="30%"><small>ID</small><td>:</td></td><td>' . esc(strtoupper($data['user_id'])) . '</td></tr>';
            echo '<tr><td width="30%"><small>Nama User</small><td>:</td></td><td>' . esc($data['username']) . '</td></tr>';
            echo '<tr><td><small>Nama Lengkap</small><i>' . $pedit . '</i></td><td>:</td><td><b>' . esc(strtoupper($data['urealname'])) . '</b></td></tr>';
            echo '<tr><td><small>NIP</small></td><td>:</td><td>' . $data['unip'] . '</td></tr>';

            if ($data['jbt_tgllahir'] !== '0000-00-00')
                echo '<tr><td><small>Tempat/ Tgl. Lahir</small></td><td>:</td><td>' . $data['jbt_tptlahir'] . '/ ' . date_format(date_create($data['jbt_tgllahir']), 'd-m-Y') . '</td></tr>';
            else
                echo '<tr><td><small>Tempat/ Tgl. Lahir</small></td><td>:</td><td>-</td></tr>';



            echo '<tr><td><small>Jenis Kelamin</small></td><td>:</td><td>' . $data['jbt_kelamin'] . '</td></tr>';

            echo '<tr><td><small>Nomor Kartu Pegawai</small></td><td>:</td><td>' . $data['jbt_nkp'] . '</td></tr>';
            echo '<tr><td><small>Nama Jabatan</small></td><td>:</td><td>' . esc(strtoupper($data['jbt_nama'])) . '</td></tr>';
            echo '<tr><td><small>Jenjang</small></td><td>:</td><td>' . esc(strtoupper($data['jenjang'])) . '</td></tr>';
            echo '<tr><td><small>Pangkat/Golongan</small></td><td>:</td><td>' . esc(strtoupper($data['pangkat'])) . '</td></tr>';

            if ($data['jbt_tmt'] !== '0000-00-00')
                echo '<tr><td><small>TMT Jabatan</small></td><td>:</td><td>' . date_format(date_create($data['jbt_tmt']), 'd-m-Y') . '</td></tr>';
            else
                echo '<tr><td><small>TMT Golongan</small></td><td>:</td><td>-</td></tr>';

            if ($data['jbt_tmtgol'] !== '0000-00-00')
                echo '<tr><td><small>TMT Golongan</small></td><td>:</td><td>' . date_format(date_create($data['jbt_tmtgol']), 'd-m-Y') . '</td></tr>';
            else
                echo '<tr><td><small>TMT Golongan</small></td><td>:</td><td>-</td></tr>';

            echo '<tr><td><small>Mekanisme Jabatan</small></td><td>:</td><td>' . esc(strtoupper($data['mekanisme'])) . '</td></tr>';
            echo '<tr><td><small>Phone/Mobile</small></td><td>:</td><td><div id="ph">' . $data['user_phone'] . '</div></td></tr>';
            echo '<tr><td><small>Pendidikan Terakhir</small></td><td>:</td><td>' . $data['pendidikan'] . '</td></tr>';
            echo '<tr><td><small>e-Mail</small></td><td>:</td><td>' . $data['email'] . '</td></tr>';
            echo '<tr><td><small>UNIT KERJA</small></td><td>:</td><td><b>' . esc(strtoupper($data['uk_nama'])) . '</b></td></tr>';
            echo '<tr><td><small>ATASAN LANGSUNG</small></td><td>:</td><td><b>' . esc(strtoupper($data['atasan'])) . '</b></td></tr>';

            ?>
        </table>
    </div>
</div>
<hr />

<div id="dlgphone" class="easyui-dialog" style="width:600px;height:550px;padding:10px 10px" closed="true" buttons="#dlgphone-buttons">
    <form id="fmphone" method="post" novalidate>

    <div class="fitem">
            <input id="urealname" name="urealname" label="Nama Lengkap" labelPosition="left" LabelWidth="130px" style="width:100%" class="easyui-textbox">
        </div>
        <div class="fitem">
            <input id="unip" name="unip" label="NIP" labelPosition="left" LabelWidth="130px" style="width:100%" class="easyui-textbox">
        </div>
        <div class="fitem">
            <input id="jbt_tptlahir" name="jbt_tptlahir" label="Tempat Lahir" labelPosition="left" LabelWidth="130px" style="width:100%"  class="easyui-textbox">
        </div>
        <div class="fitem">
            <input id="jbt_tgllahir" name="jbt_tgllahir" class="easyui-datebox" multiline="false" label="Tanggal Lahir" labelPosition="left" labelWidth="130px" style="width:80%;" prompt="Format  : dd-mm-yyyy (contoh: 31-12-1987)" data-options="formatter:myformatter,parser:myparser">
        </div>

        <div class="fitem">
            <input class="easyui-combobox" id="jbt_kelamin" name="jbt_kelamin" style="width:80%;" label="Jenis Kelamin" labelPosition="left" labelWidth="130px" data-options="
    		    url:'/kelamincombo',
    		    method:'get',
    		    valueField:'nama',
    		    textField:'nama',
    		    fitColumn:'true',
    		    panelHeight:'auto',
    		">
        </div>
        <div class="fitem">
            <input id="jbt_tmt" name="jbt_tmt" class="easyui-datebox" multiline="false" label="TMT Jabatan" labelPosition="left" labelWidth="130px" style="width:80%;" prompt="Format  : dd-mm-yyyy (contoh: 31-12-1987)" data-options="formatter:myformatter,parser:myparser">
        </div>
        <div class="fitem">
            <input id="jbt_tmtgol" name="jbt_tmtgol" class="easyui-datebox" multiline="false" label="TMT Golongan" labelPosition="left" labelWidth="130px" prompt="Format  : dd-mm-yyyy (contoh: 31-12-1987)" style="width:80%;" data-options="formatter:myformatter,parser:myparser">
        </div>

        <div class="fitem">
            <input class="easyui-combobox" id="jbt_pddk" name="jbt_pddk" style="width:80%;" label="Pendidikan Terakhir" labelPosition="left" labelWidth="130px" data-options="
    		    url:'/pddkcombo',
    		    method:'get',
    		    valueField:'id',
    		    textField:'nama',
    		    fitColumn:'true',
    		    panelHeight:'auto',
    		">
        </div>
        <div class="fitem">
            <input class="easyui-combobox" id="jbt_uk" name="jbt_uk" style="width:100%;" label="Unit Kerja" labelPosition="left" labelWidth="130px" data-options="
    		    url:'/ukcombo',
    		    method:'post',
                queryParams: {'<?php echo csrf_token() ?>': '<?php echo csrf_hash() ?>'},
    		    valueField:'id',
    		    textField:'uk_nama',
    		    fitColumn:'true',
    		    panelHeight:'auto',
                onSelect: function(rec){
                var url = '/atasancombo/'+rec.id;
                $('#jbt_atasan').combobox('setValue','<?php echo $jbt_atasan; ?>');
                $('#jbt_atasan').combobox('reload', url);}
          ">
        </div>

        <div class="fitem">
            <input class="easyui-combobox" id='jbt_atasan' name="jbt_atasan" style="width:100%" data-options="
          method:'post',
          queryParams: {'<?php echo csrf_token() ?>': '<?php echo csrf_hash() ?>'},
          valueField:'id',
          textField:'atasan',
          multiple:false,
          panelHeight:'auto',
          editable:false,
          nowrap:false,
          label: 'Atasan:',
          labelPosition: 'left',
          labelWidth:'130px'
          ">
        </div>

        <div class="fitem">
            <input id="phone" name="phone" label="Phone/HP" labelPosition="left" labelWidth="130px" style="width:100%;" class="easyui-textbox">
        </div>
</div>
</form>
</div>
<div id="dlgphone-buttons">
    <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="simpanphone()" style="width:90px">Simpan</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgphone').dialog('close')" style="width:90px">Cancel</a>
</div>


<div id="dlg_photo" class="easyui-dialog" style="width:400px;height:200px;padding:15px 15px" closed="true" buttons="#dlg_photo-buttons">
    <?php
    $attributes = array('id' => 'fmphoto', 'class' => 'form-horizontal', 'role' => 'form');
    echo form_open_multipart('upload_profile', $attributes);
    ?>
    <b><i>Upload foto Profile (ukuran 200X200)</i></b><br /><br />
    <input type="hidden" name="uid" id="uid">
    <input type="file" class="custom-file-input" name="filephoto" style="border-width:0px;" multiple />

</div>
</form>

<div id="dlg_photo-buttons">
    <a href="javascript:void(0)" id="photosimpan" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="photo_simpan()" style="width:90px">Simpan</a>
    <div class="lds-hourglass"></div>
    <a href="javascript:void(0)" id="photosimpanc" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_photo').dialog('close')" style="width:90px">Tutup</a>
</div>

<div id="dlg_skkp" class="easyui-dialog" style="width:400px;height:200px;padding:15px 15px" closed="true" buttons="#dlg_skkp-buttons">
    <?php
    $attributes = array('id' => 'fmskkp', 'class' => 'form-horizontal', 'role' => 'form');
    echo form_open_multipart('upload_skkp', $attributes);
    ?>
    <b><i>Upload SKKP </i></b><br /><br />

    <input type="hidden" name="uid" id="uid">
    <input type="file" class="custom-file-input" name="fileskkp" style="border-width:0px;" multiple />
</div>
</form>

<div id="dlg_skkp-buttons">
    <a href="javascript:void(0)" id="skkpsimpan" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="skkp_simpan()" style="width:90px">Simpan</a>
    <div class="lds-hourglass"></div>
    <a href="javascript:void(0)" id="skkpsimpanc" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_skkp').dialog('close')" style="width:90px">Tutup</a>
</div>


<div id="dlg_pddk" class="easyui-dialog" style="width:400px;height:200px;padding:15px 15px" closed="true" buttons="#dlg_pddk-buttons">
    <?php
    $attributes = array('id' => 'fmpddk', 'class' => 'form-horizontal', 'role' => 'form');
    echo form_open_multipart('upload_pddk', $attributes);
    ?>
    <b><i>Upload Pendidikan Terakhir</i></b><br /><br />

    <input type="hidden" name="uid" id="uid">
    <input type="file" class="custom-file-input" name="filepddk" style="border-width:0px;" multiple />
</div>
</form>

<div id="dlg_pddk-buttons">
    <a href="javascript:void(0)" id="pddksimpan" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="pddk_simpan()" style="width:90px">Simpan</a>
    <div class="lds-hourglass"></div>
    <a href="javascript:void(0)" id="pddksimpanc" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_pddk').dialog('close')" style="width:90px">Tutup</a>
</div>


<div id="dlg_lantik" class="easyui-dialog" style="width:400px;height:200px;padding:15px 15px" closed="true" buttons="#dlg_lantik-buttons">
    <?php
    $attributes = array('id' => 'fmlantik', 'class' => 'form-horizontal', 'role' => 'form');
    echo form_open_multipart('upload_lantik', $attributes);
    ?>

    <input type="hidden" name="uid" id="uid">
    <input type="file" class="custom-file-input" name="filelantik" style="border-width:0px;" multiple />
</div>
</form>

<div id="dlg_lantik-buttons">
    <a href="javascript:void(0)" id="lantiksimpan" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="lantik_simpan()" style="width:90px">Simpan</a>
    <div class="lds-hourglass"></div>
    <a href="javascript:void(0)" id="lantiksimpanc" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_lantik').dialog('close')" style="width:90px">Tutup</a>
</div>


<div id="skkpw" class="easyui-window" title=" " data-options="modal:true,closed:true" style="width:1000px;height:700px;padding:5px;">
    <iframe width="100%" height="100%" style="border:0px;" src="<?php echo base_url(); ?>/assets/images/bawaslu/profile/<?php echo $data['skkp_photo']; ?>"></iframe>
</div>

<div id="pddkw" class="easyui-window" title=" " data-options="modal:true,closed:true" style="width:800px;height:auto;padding:5px;">
    <iframe width="100%" height="100%" style="border:0px;" src="<?php echo base_url(); ?>/assets/images/bawaslu/profile/<?php echo $data['pddk_photo']; ?>"></iframe>

</div>

<div id="lantikw" class="easyui-window" title=" " data-options="modal:true,closed:true" style="width:800px;height:auto;padding:5px;">
    <iframe width="100%" height="100%" style="border:0px;" src="<?php echo base_url(); ?>/assets/images/bawaslu/profile/<?php echo $data['sklantik_photo']; ?>"></iframe>
</div>

<div id="lainw" class="easyui-window" title=" " data-options="modal:false,closed:true" style="width:800px;height:500px;padding:5px;">
    dsfsdf
</div>




<script>
    $(document).ready(function() {

        $.extend($.fn.window.methods, {
        moveTo: function(jq, param){
            return jq.each(function(){
                var win = $(this).window('window');
                var width = win.outerWidth();
                var height = win.outerHeight();
                var left = undefined;
                var top = undefined;
                if (param.indexOf('left') >= 0){
                    left = $(document).scrollLeft();
                }
                if (param.indexOf('right') >= 0){
                    left = $(window).outerWidth() - width + $(document).scrollLeft();
                }
                if (param.indexOf('top') >= 0){
                    top = $(document).scrollTop();
                }
                if (param.indexOf('bottom') >= 0){
                    top = $(window).outerHeight() - height + $(document).scrollTop();
                }
                $(this).window('move', {
                    left: left,
                    top: top
                });
            })
        }
    });


    });    

    function skkpw() {
        //$('#skkpw').window('fixed');
        $('#skkpw').window('open');
    }

    function pddkw() {
        //$('#pddkw').window('fixed');
        $('#pddkw').window('open');

    }

    function lantikw() {
        //$('#lantikw').window('fixed');
        $('#lantikw').window('open');
    }

    function lainw(uid) {
        var beda = <?php echo $beda; ?>;
        $('#lainw').window('refresh', '/doklain/' + uid + '/' + beda);
        //$('#lainw').window('fixed');
        $('#lainw').window('open');
    }


    function phone_edit() {
        //$('#dlgphone').window('fixed');
        $('#dlgphone').dialog('open').dialog('setTitle', ' ');
        $('#fmphone').form('clear');
        $('#urealname').textbox('setValue', '<?php echo $data['urealname']; ?>');
        $('#unip').textbox('setValue', '<?php echo $data['unip']; ?>');
        $('#phone').textbox('setValue', '<?php echo $data['user_phone']; ?>');
        $('#jbt_tptlahir').textbox('setValue', '<?php echo $data['jbt_tptlahir']; ?>');
        $('#jbt_tgllahir').textbox('setValue', '<?php echo $tgllahir; ?>');
        $('#jbt_tmt').textbox('setValue', '<?php echo $tmt; ?>');
        $('#jbt_tmtgol').textbox('setValue', '<?php echo $tmtgol; ?>');
        $('#jbt_pddk').combobox('setValue', '<?php echo $data['jbt_pddk']; ?>');
        $('#jbt_kelamin').combobox('setValue', '<?php echo $data['jbt_kelamin']; ?>');
        $('#jbt_uk').combobox('setValue', '<?php echo $data['jbt_uk']; ?>');
        //url = 'simpanphone';
    }

    function simpanphone() {
        $('#fmphone').form('submit', {
            url: '/simpanph',
            onSubmit: function(param) {
                param.csrftoken_erb2021 = '<?= csrf_hash() ?>';
                param.id = '<?php echo $data["user_id"]; ?>';
                return $(this).form('validate');
            },
            success: function(result) {
                if (result.errorMsg) {
                    alert(result.errorMsg);
                } else {
                    $('#ph').text($('#phone').val());
                    $('#dlgphone').dialog('close');
                    location.reload();

                }
            }
        });

    }


    function photo_edit() {
        //$('#dlg_photo').window('fixed');
        $('#dlg_photo').dialog('open').dialog('setTitle', '');
        $('#fmphoto').form('clear');
    }


    function photo_simpan() {
        $('#photosimpan').linkbutton('disable');
        $('#photosimpanc').linkbutton('disable');
        $('.lds-hourglass').css('display', 'inline-block');
        setTimeout(() => {
            $('#fmphoto').form('submit', {
                url: '/Dashboard/upload_profile',
                onSubmit: function(param) {
                    param.csrftoken_erb2021 = '<?= csrf_hash() ?>';
                    param.user_id = '<?php echo $data["user_id"]; ?>';
                    return $(this).form('validate');
                },
                success: function(result) {
                    $('#photosimpan').linkbutton('enable');
                    $('#photosimpanc').linkbutton('enable');
                    $('.lds-hourglass').css('display', 'none');
                    var res = JSON.parse(result);
                    if (res.errorMsg == '1') {
                        alert(res.data.errors.filephoto);
                    } else {
                        $('#dlg_photo').dialog('close'); // close the dialog
                        $(".cards").load(location.href + " .cards>*", "");
                    }
                }
            });

        }, 100);

    }


    function skkp_edit() {
        //$('#dlg_skkp').window('fixed');
        $('#dlg_skkp').dialog('open').dialog('setTitle', '');
        $('#fmskkp').form('clear');
    }


    function skkp_simpan() {
        $('#skkpsimpan').linkbutton('disable');
        $('#skkpsimpanc').linkbutton('disable');
        $('.lds-hourglass').css('display', 'inline-block');

        $('#fmskkp').form('submit', {
            url: '/Dashboard/upload_skkp',
            onSubmit: function(param) {
                param.csrftoken_erb2021 = '<?= csrf_hash() ?>';
                param.user_id = '<?php echo $data["user_id"]; ?>';
                return $(this).form('validate');
            },
            success: function(result) {
                $('#skkpsimpan').linkbutton('enable');
                $('#skkpsimpanc').linkbutton('enable');
                $('.lds-hourglass').css('display', 'none');

                var res = JSON.parse(result);
                if (res.errorMsg == '1') {
                    alert(res.data.errors.fileskkp);
                } else {
                    $('#dlg_skkp').dialog('close'); // close the dialog
                    $("#skkpdd").load(location.href + " #skkpdd>*", "");
                    location.reload();

                }
            }

        });

    }

    function pddk_edit() {
        //$('#dlg_pddk').window('fixed');
        $('#dlg_pddk').dialog('open').dialog('setTitle', '');
        $('#fmpddk').form('clear');
    }


    function pddk_simpan() {
        $('#pddksimpan').linkbutton('disable');
        $('#pddksimpanc').linkbutton('disable');
        $('.lds-hourglass').css('display', 'inline-block');

        $('#fmpddk').form('submit', {
            url: '/Dashboard/upload_pddk',
            onSubmit: function(param) {
                param.csrftoken_erb2021 = '<?= csrf_hash() ?>';
                param.user_id = '<?php echo $data["user_id"]; ?>';
                return $(this).form('validate');
            },

            success: function(result) {
                $('#pddksimpan').linkbutton('enable');
                $('#pddksimpanc').linkbutton('enable');
                $('.lds-hourglass').css('display', 'none');
                location.reload();


                var res = JSON.parse(result);
                if (res.errorMsg == '1') {
                    alert(res.data.errors.filepddk);
                } else {
                    $('#dlg_pddk').dialog('close'); // close the dialog
                    $("#pddkw").load(location.href + " #pddkw>*", "");
                }
            }

        });

    }

    function lantik_edit() {
        //$('#dlg_lantik').window('fixed');
        $('#dlg_lantik').dialog('open').dialog('setTitle', '');
        $('#fmlantik').form('clear');
    }


    function lantik_simpan() {
        $('#lantiksimpan').linkbutton('disable');
        $('#lantiksimpanc').linkbutton('disable');
        $('.lds-hourglass').css('display', 'inline-block');

        $('#fmlantik').form('submit', {
            url: '/Dashboard/upload_lantik',
            onSubmit: function(param) {
                param.csrftoken_erb2021 = '<?= csrf_hash() ?>';
                param.user_id = '<?php echo $data["user_id"]; ?>';
                return $(this).form('validate');
            },
            success: function(result) {
                $('#lantiksimpan').linkbutton('enable');
                $('#lantiksimpanc').linkbutton('enable');
                $('.lds-hourglass').css('display', 'inline-block');

                var res = JSON.parse(result);
                if (res.errorMsg == '1') {
                    alert(res.data.errors.filelantik);
                } else {
                    $('#dlg_lantik').dialog('close'); // close the dialog
                    $("#lantikw").load(location.href + " #lantikw>*", "");
                    location.reload();

                }
            }

        });

    }



</script>
<script>
    function myformatter(date) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        var d = date.getDate();
        //        return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
        return (d < 10 ? ('0' + d) : d) + '-' + (m < 10 ? ('0' + m) : m) + '-' + y;
    }

    function myparser(s) {
        if (!s) return new Date();
        var ss = (s.split('-'));
        var y = parseInt(ss[2], 10);
        var m = parseInt(ss[1], 10);
        var d = parseInt(ss[0], 10);
        if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
            return new Date(y, m - 1, d);
        } else {
            return new Date();
        }
    }
</script>
<style>
    table {
        font-size: 16px;
        font-weight: lighter;
    }

    .lds-hourglass {
        /*display: inline-block;*/
        display: none;
        position: relative;
        width: 30px;
        height: 30px;
    }

    .lds-hourglass:after {
        content: " ";
        display: block;
        border-radius: 50%;
        width: 0;
        height: 0;
        margin: 2px;
        box-sizing: border-box;
        border: 16px solid #fff;
        border-color: #88f transparent #88f transparent;
        animation: lds-hourglass 1.2s infinite;
    }

    @keyframes lds-hourglass {
        0% {
            transform: rotate(0);
            animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
        }

        50% {
            transform: rotate(900deg);
            animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        }
 
        100% {
            transform: rotate(1800deg);
        }
    }
</style>
<?php echo $this->endSection() ?>