<div class="centering" style="width:600px;margin-top: 1%;">
    <div id='form_verzet' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
            <div>
                <form id="frm_add_arsip" method="post" enctype="multipart/form-data" action="<?php echo base_url().'manage_arsip_c/validateInputAddArsip';?>">
				<table id="tableDetilPerkara" style="font-size:14px;">
                		<col width="45%">
                        <col width="55%">
                        <tbody>
                            <tr>
                                <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center"><?php echo $act=='add'?"TAMBAH":"EDIT";?> DATA ARSIP</td>
                            </tr>
                            <tr>
                                <td id="first-child">Nomor Ruang</td>
                                <td>
                                    <span>
                                        <input type="text" id="no_ruang" name="no_ruang" value="<?php echo $no_ruang; ?>" class="standard-input"maxlength="50">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Nomor Rak/Lemari</td>
                                <td>
                                    <span>
                                        <input class="standard-input" type="text" id="no_lemari" name="no_lemari" value="<?php echo $no_lemari; ?>" maxlength="5">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Nomor Tingkat/Laci</td>
                                <td>
                                    <span>
                                        <input class="standard-input" type="text" id="no_rak" name="no_rak" value="<?php echo $no_rak; ?>" maxlength="5">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Nomor Boks</td>
                                <td>
                                    <span>
                                        <input class="standard-input" type="text" id="no_berkas" name="no_berkas" value="<?php echo $no_berkas; ?>" maxlength="5">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Nomor Arsip</td>
                                <td>
                                    <span>
                                        <input class="standard-input" type="text" id="nomor_arsip" name="nomor_arsip" value="<?php echo $nomor_arsip; ?>" maxlength="100">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Nomor Perkara</td>
                                <td>
                                    <span>
                                        <input class="standard-input" type="text" id="nomor_perkara" name="nomor_perkara" value="<?php echo $nomor_perkara; ?>" maxlength="50">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Tanggal Masuk</td>
                                <td>
                                    <span>
                                        <input class="standard-input" id="tgl_masuk_berkas" name="tgl_masuk_berkas" value="<?php echo $this->tanggalhelper->convertToInputDate($tanggal_masuk_arsip);?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Staff yang Menyerahkan Berkas</td>
                                <td>
                                    <span>
                                        <input class="standard-input" id="nama_penyerah" name="nama_penyerah" value="<?php echo $nama_penyerah;?>" maxlength="50">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Petugas yang Menerima Berkas</td>
                                <td>
                                    <span>
                                        <input class="standard-input" id="nama_penerima" name="nama_penerima" value="<?php echo $nama_penerima;?>" maxlength="50">
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Status</td>
                                <td>
                                    <span class="custom-dropdown custom-dropdown--emerald" style='width:250px;'>
                                        <select name="status_id" id="status_id" style='width:250px;' class="custom-dropdown__select custom-dropdown__select--white">
                                            <option value=0 <?php echo $status==0?"selected":""; ?>>Pilih Salah Satu</option>
                                            <option value=1 <?php echo $status==1?"selected":""; ?>>Ada</option>
                                            <option value=2 <?php echo $status==2?"selected":""; ?>>Dipinjam</option>
                                            <option value=3 <?php echo $status==3?"selected":""; ?>>Penghapusan</option>
                                        </select>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">E-Doc Arsip<br>Maksimal file 10Mb</td>           
                                <td style="padding:0px;padding-left:5px;">
                                    <input type="file" accept='application/pdf' id='edoc_arsip' name='edoc_arsip' class="standard-input" maxlength="150" style="width:400px;">
                                    <?php echo (!empty($edoc_arsip)? '[<a href="#" onClick="doDownload(\''.$enc.'\')">download</a>]||[<a href="#" onClick="doDelete()">hapus</a>]':'');?>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Keterangan</td>
                                <td>
                                    <textarea class="standard-input" id='keterangan' name='keterangan'><?php echo $keterangan;?></textarea>
                                    <input type="hidden" id="act" name="act" value="<?php echo $act;?>">
                                    <input type="hidden" id="enc" name="enc" value="<?php echo $enc;?>">
                                    <input type="hidden" id="curr_date" value="<?php echo $today;?>">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="background:white;" align="center">
                                    <input type="button" id='close_form_add_arsip' value="Kembali" class="btn close_form_add_arsip">
                                    <input id="simpan" class="btn" type="submit" value="Simpan">
                                </td>
                            </tr>
                        </tbody>
                	</table>               	
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function doDownload(param){
        window.open("<?php echo base_url('manage_arsip_c/doDownload/');?>"+'/'+param)
    }
    function doDelete(){
        var values = $('form').serializeArray();
        values = jQuery.param(values);
        var url = "<?php echo base_url('manage_arsip_c/doDelete/');?>";
        $.post(url,values, function(json){
            closeLoading()
            if(json.st==1){
                message_show(json.msg);
            }else{
                message_error_show_parent(json.msg);
            }
            $('.tutups').click(function(){
                refreshPage();
            });
        },'json');
    }
    $('.datepicker').ValidateDateInput();
    $('#frm_add_arsip_backup').SubmitHandling({
        refresh:'1',
        setRefresh:1,
        divRef:'#konten',
        clicked:1,
        btnClicked:'#close_form_add_arsip',
        whenStatus:1,
        upload:1,
        urlUpload:"<?php echo base_url('manage_arsip_c/upload');?>"
    });
    $('#close_form_add_arsip').closingFormWin();
    $('.close_form_add_arsip').click(function(event){
        if($('#refresh').val()==1){
            refreshPage();
        }
    });
    $('#tgl_masuk_berkas').datepicker({
        beforeShowDay: $.datepicker.noWeekends,
        inline: true,
        showOtherMonths: true,
        dateFormat: 'dd/mm/yy',
        dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
        onSelect: function(dateText, inst) {
            var error = 0;
                
            var tmp = $(this).val().split("/");
            var tmp2 = $('#curr_date').val().split("/");
            if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
                message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
                error = 1
            }

            if(error==1){
                message_error_show(message);
                $(this).css("background-color", "red");
            }else{
                $(this).css("background-color", "#dedbdb");
            }
            error = 0;
        }
    });
</script>
