<?php
if(count(get_included_files()) ==1) exit("Direct access not permitted.");
if(!$statuslogin) exit;
$mod = basename(__FILE__, '.php');
if(!$db->ceckUser()) header('Location: '.NPAGE);
$page->setJudul("Pengaturan Penomoran Surat");
$page->tbJs($mod);
$query="select * from tb_setting where id=15";
$rsnomor=$db->loadAssoc($query);
$pemisah="/";
if(isset($rsnomor['id'])){
	$arrdatanomor=json_decode($rsnomor['setting']);
	if(isset($arrdatanomor->batas)) {
		$pemisah=$arrdatanomor->batas;
		$reset=$arrdatanomor->reser;
		$dataurutan=$arrdatanomor->dataurutan;
		
	}
	$page->addLoad("nomorsurat.preload(".json_encode($arrdatanomor,true).")");
}
?>
<div class="box_main_konten">
	<h3>PENGATURAN NOMOR SURAT</h3>
	<div class="group_form">
		<title>Data Pemisah</title>
		<div class="col10">
			<input style="width: 60px;" id="pemisah" value="<?php echo $pemisah;?>" />
		</div>
	</div>
	<div class="group_form">
		<title>Reset Nomor</title>
		<div class="col10">
			<select id="sl_mode" style="width: 150px;">
				<option value="bulan">Bulanan</option>
				<option value="tahun">Tahunan</option>
			</select>
		</div>
	</div>
	<div class="group_form">
		<title>Urutan nomor</title>
		<div class="col10">
			<div id="grid_urutan"></div>
			<div class="box_button_bawah">
				<span class="btkuning medium" onclick="nomorsurat.tambahnomor()">Tambah urutan</span>
			</div>
		</div>
	</div>
	<div style="clear: both;"></div>
</div>
<div class="box_button_bawah">
	<div id="err_simpan" style="margin-bottom: 5px;margin-top: 3px;" class="error"></div>
	<span class="bthijau" onclick="nomorsurat.simpan()">SIMPAN PENGATURAN</span>
</div>
<div id="box_nomor_surat" class="boxwin boxwinhd">
	<div>
		<div class="group_form">
			<title>Mode Jenis Nomor</title>
			<div class="col10">
				<select id="sl_mode_surat" onchange="nomorsurat.jenisch()">
					<option value="kode">Kode Jenis Surat</option>
					<option value="nourut">No Urut Surat</option>
					<option value="bulanangka">Bulan Angka</option>
					<option value="bulanromawi">Bulan Romawi</option>
					<option value="tahun">Tahun</option>
					<option value="custom">Custom Text</option>
				</select>
			</div>
		</div>
		<div class="group_form" id="groupcustom" style="display: none">
			<title>Custom Text</title>
			<div class="col10">
				<input id="strcustom"/>
			</div>
		</div>
		<div class="group_form">
			<title>&nbsp;</title>
			<div class="col10">
				<span onclick="nomorsurat.bataltambah()" class="bthijau">Batal</span>&nbsp;&nbsp;
				<span onclick="nomorsurat.inputnomor()" class="btbiru">Proses</span>
			</div>
		</div>
		<div style="clear: both;"></div>
	</div>
</div>
<div id="bteditnomor" style="display: none">
	<span class="icon_del" onclick="nomorsurat.hapusjenis(##{jumlah_tabel},##{baris_tabel},this)"></span>
	<span class="icon_edit" onclick="nomorsurat.editjenis(##{jumlah_tabel},##{baris_tabel},this)"></span>
</div>