<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
?>

<?php if ($ac == '') { ?>
<?php
$skkb=fetch($koneksi,'skkb',['id'=>1]);
?>
    <div class='row'>
        <div class='col-md-12'>
           <div class="card">
             <div class="card-header">	
                    <h5 class='card-title'><i class="fas fa-envelope"></i> Managemen Surat</h5>
					</div>    
			 
                <div class='card-body'>
                   <form id="formskkb" enctype="multipart/form-data">
				   <div class='pull-right'>
                        <button type='submit' id='blockui-3' class='btn btn-primary'>Simpan</button>
                    </div>
                   <p>
                            <div class="col-md-12">
                                    <label class="bold">Header</label>
										<textarea id='editor2' name='header' class='form-control' rows='1' cols='80' style='width:100%;'><?= $skkb['header'] ?></textarea>
							
                            </div><p>
							<div class="col-md-12">
                               
                                    <label class="bold">Isi</label>
                                    
										<textarea id='editor2' name='isi' class='editor1' rows='5' cols='80' style='width:100%;'><?= $skkb['isi'] ?></textarea>
						
                            </div><p>
                            
								 <div class="col-md-12">
								 <label class="bold">Foter</label>
                                
										<textarea id='editor2' name='foter' class='editor1' rows='5' cols='80' style='width:100%;'><?= $skkb['foter'] ?></textarea>
									
                                    </div>
								 
                    </div>
                    
                </form>
				</div>
            </div>
        </div>
    </div>
	</div>
</div>	
	<script>
				  $('#formskkb').submit(function(e) {
        e.preventDefault();
        var data = new FormData(this);
      
        $.ajax({
            type: 'POST',
            url: 'cbtserver_skl/crud_skl.php?pg=skkb',
            enctype: 'multipart/form-data',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
          
                setTimeout(function() {
                    window.location.reload();
                }, 2000);

            }
        });
        return false;
    });
</script>
	<?php } ?>

			
		
	<script>
	tinymce.init({
		selector: '.editor1',
		
		plugins: [
			'advlist autolink lists link image charmap print preview hr anchor pagebreak',
			'searchreplace wordcount visualblocks visualchars code fullscreen',
			'insertdatetime media nonbreaking save table contextmenu directionality',
			'emoticons template paste textcolor colorpicker textpattern imagetools uploadimage paste formula'
		],

		toolbar: 'bold italic fontselect fontsizeselect | alignleft aligncenter alignright bullist numlist  backcolor forecolor | formula code | imagetools link image paste ',
		fontsize_formats: '8pt 10pt 12pt 14pt 18pt 24pt 36pt',
		paste_data_images: true,

		images_upload_handler: function(blobInfo, success, failure) {
			success('data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64());
		},
		image_class_list: [{
			title: 'Responsive',
			value: 'img-responsive'
		}],
	});
</script>