@extends('base.layout')

@section('content')
<div class="wrapper">
    <div class="container-fluid">
		<div class="row">
			<div class="col-sm-12">
				<!-- meta -->
				<div class="profile-user-box card-box bg-custom">
					<div class="row">
						<div class="col-sm-6">
							<span class="pull-left mr-3">
							<a href="#" id="btnubahfoto">
								<img src="{!! $masterphoto !!}" alt="" class="thumb-lg rounded-circle">
							</a>
							</span>
							<div class="media-body text-white">
								<h4 class="mt-1 mb-1 font-18">{!! $masternama !!}</h4>
								<p class="font-13 text-light">Logbook PPDS</p>
								<p class="text-light mb-0">FK.UB - RSSA Malang</p>
							</div>
						</div>
						<div class="col-sm-6">
							<div class="form-group">
								<span class="label label-lg label-primary arrowed-right">Logbook</span>
								<select id="id_loogbooklist" class="form-control">
									<option value="">Please Select</option>
									@foreach($alldata as $rdata)
										<option value="{{ $rdata->kode }}">{{ $rdata->kepanjangan }}</option>
									@endforeach
								</select>
							</div>
							<div class="form-group">
								<span class="label label-lg label-primary arrowed-right">Sub Menu</span>
								<div id='logboksubmenulist'></div>
							</div>
							<div class="form-group">
								<button class="btn btn-white btn-danger btn-round btn-block" id="btnshowlogbook">
									<i class="fa fa-search bigger-120 red"></i>
									VIEW
								</button>
							</div>
						</div>
					</div>
				</div>
				<!--/ meta -->
			</div>
		</div>
		<div class="row">
			<div id="divlogbook" class="col-lg-12">
				<div class="box-body">
					<button class="btn btn-white btn-danger btn-round" id="btnkembalidrlogbook">
						<i class="fa fa-backward bigger-120 red"></i>
						BACK
					</button>
					<button class="btn btn-white btn-warning btn-round pull-right" id="btnexportgridlogbook">
						<i class="fa fa-print"></i>
						PRINT
					</button>
					<div id='gridlogbook'></div>
				</div>
			</div>
			<div class="col-lg-12">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-success">Log Book as Junior</div>
                    <p class="m-b-0"></p>
                    <div class="form-group">
                        <div id="gridjunior"></div>
                    </div>
                </div>
            </div>
			<div class="col-lg-12">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-danger">Log Book as Midlle</div>
                    <p class="m-b-0"></p>
                    <div class="form-group">
                        <div id="gridmiddle"></div>
                    </div>
                </div>
            </div>
			<div class="col-lg-12">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-info">Log Book as Senior</div>
                    <p class="m-b-0"></p>
                    <div class="form-group">
                        <div id="gridsenior"></div>
                    </div>
                </div>
            </div>
			<div class="col-lg-12">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-warning">Statistik</div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
						<div class="form-group col-lg-4">
							<div id='grafiksebagai' style="width:100%; height:480px;"></div>
						</div>
						<div class="form-group col-lg-8">
							<div id='grafikkasusterbanyakbylayanan'></div>
							<div id='grafikkasusterbanyakbystase'></div>
							<div id='grafikkasusterbanyakbyorgan'></div>
						</div>
                    </div>
                </div>
            </div>
		</div>
        <div class="row" id="divsemula">
            <div class="col-lg-9">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-primary">Workarea</div>
                    <p class="m-b-0"></p>
                    <div id="divawal">
						<div class="box-body">
							<div id='gridk1'></div>
						</div>
					</div>
					<div id="divpenyakit">
						<div class="box-body">
							<button class="btn btn-white btn-danger btn-round" id="btnkembalidrpenyakit">
								<i class="fa fa-backward bigger-120 red"></i>
								BACK
							</button>
							<button class="btn btn-white btn-warning btn-round pull-right" id="btnexportgridpenyakit">
								<i class="fa fa-print"></i>
								PRINT
							</button>
							<div id='gridpenyakit'></div>
						</div>
					</div>
					<div id="divdetail">
						<div class="box-body">
							<button class="btn btn-white btn-danger btn-round" id="btnkembalidrdetail">
								<i class="fa fa-backward bigger-120 red"></i>
								BACK
							</button>
							<button class="btn btn-white btn-warning btn-round pull-right" id="btnexportgriddetail">
								<i class="fa fa-print"></i>
								PRINT
							</button>
							<div id='griddetail'></div>
						</div>
					</div>
					<div id="divpencarian">
						<div class="box-body">
							<button class="btn btn-white btn-danger btn-round" id="btnkembalidrcari">
								<i class="fa fa-backward bigger-120 red"></i>
								BACK
							</button>
							<button class="btn btn-white btn-warning btn-round pull-right" id="btnexportgridpencarian">
								<i class="fa fa-print"></i>
								PRINT
							</button>
							<div id='gridpencarian'></div>
						</div>
					</div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="modaladdstase" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">&times;</button>
				<h4 class="modal-title">Modal Add Stase</h4>
			</div>
			<div class="modal-body">
				<div class="form-group">
					<label>Code</label>
						<input type="text" id="id_kodene" class="form-control">
					</div>
					<div class="form-group">
						<label>Full Stase Name</label>
						<input type="text" id="id_stase" class="form-control">
					</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-warning pull-right" id="btnaddstase">Add Stase</button>
				<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>	
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="modalhapusdata" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">&times;</button>
				<h4 class="modal-title">Are you sure to delete this data</h4>
			</div>
			<div class="modal-body">
				<div class="form-group">
					<label>Title</label>
					<input type="text" id="del_nama" name="del_nama" class="form-control" disabled="disable">
				</div>	
				<div class="form-group">
					<label>If you do write "SURE" at this form</label>
					<input type="text" id="del_verifikasi" name="del_verifikasi" class="form-control">			  
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" class="form-control" id="del_id">
				<button type="button" class="btn btn-success pull-right" id="btnhapus">DEL</button>
				<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>	
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="modaladdlogbook" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">&times;</button>
				<h4 class="modal-title">Add To Log Book Data</h4>
			</div>
			<div class="modal-body">
				<div class="form-group">
					<div class="row">
						<div class="col-lg-4 col-md-4">
							<span class="label label-lg label-success arrowed-right">CL</span>
							<select id="add_ceel" class="form-control">
								<option value="">Please Select</option>
								<option value="SMT I">SMT I</option>
								<option value="SMT II">SMT II</option>
								<option value="SMT III">SMT III</option>
								<option value="SMT IV">SMT IV</option>
								<option value="SMT V">SMT V</option>
								<option value="SMT VI">SMT VI</option>
								<option value="SMT VII">SMT VII</option>
							</select>
						</div>
						<div class="col-lg-4 col-md-4">
							<span class="label label-lg label-success arrowed-right">As a PPDS.?</span>
							<select id="add_junior" class="form-control">
								<option value="1">PPDS Junior</option>
								<option value="2">PPDS Middle</option>
								<option value="0">PPDS Senior</option>
							</select>
						</div>
					</div>
				</div>
				<div class="form-group">
					<span class="label label-lg label-primary arrowed-right">Logbook</span>
					<select id="add_loogbooklist" class="form-control">
						<option value="">Please Select</option>
						@foreach($alldata as $rdata)
							<option value="{{ $rdata->kode }}">{{ $rdata->kepanjangan }}</option>
						@endforeach
					</select>
				</div>
				<div class="form-group">
					<span class="label label-lg label-primary arrowed-right">Sub Menu</span>
					<div id='add_logboksubmenulist'></div>
				</div>
				<div class="form-group">
					<span class="label label-warning arrowed-right">Supervisor</span>
					<select id="add_supervisor" class="form-control">
						@foreach($allspv as $rspv)
							<option value="{{ $rspv->id }}">{{ $rspv->nama }}</option>
						@endforeach
					</select>
				</div>
			</div>
			<div class="modal-footer">
				<input type="hidden" class="form-control" id="hid_tanggal">
				<input type="hidden" class="form-control" id="hid_namapasien">
				<input type="hidden" class="form-control" id="hid_idpasien">
				<input type="hidden" class="form-control" id="hid_submenu">
				<button type="button" class="btn btn-success pull-right" id="btnaddtologbook">ADD</button>
				<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>	
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<input type="hidden" id="getuserid" value="{{ $masterid }}">
<input type="hidden" id="getkelompok" value="{{ Session('previlage') }}">
<input type="hidden" id="getnama" value="{{ $masternama }}">
<input type="hidden" id="getsubmenu">
@endsection

@push('script')
<script type="text/javascript">
	function opendatalogbook( jQuery ){
		var set01=document.getElementById('getuserid').value;
		var set02='Examination';
		var set03=document.getElementById('getkelompok').value;
		var sourcedatalogbook = {
			datatype: "json",
			datafields: [
				{ name: 'id'},
				{ name: 'kode',type: 'text'},
				{ name: 'kepanjangan',type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:set02, val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonListlogbook") }}'
		};
		var jsondatalogbook = new $.jqx.dataAdapter(sourcedatalogbook);
		$("#gridk1").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			filterable: true,
			filtermode: 'excel',
			source: jsondatalogbook,
			columnsresize: true,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'Code', datafield: 'kode', width: '20%', align: 'center' },
				{ text: 'Full Name', datafield: 'kepanjangan', width: '70%', cellsalign: 'left', align: 'center' },
				{ text: 'Disease List', columntype: 'button', width: '10%', align: 'center', cellsrenderer: function () {
					return "View";
					}, buttonclick: function (row) {
					editrow = row;	
					var offset 		= $("#gridk1").offset();
					var dataRecord 	= $("#gridk1").jqxGrid('getrowdata', editrow);
					$("#getsubmenu").val(dataRecord.kepanjangan);
					var val01		= dataRecord.kode;
					var val02		= document.getElementById('getuserid').value;
					var source = {
						datatype: "json",
						datafields: [
							{ name: 'id2'},
							{ name: 'idppds'},
							{ name: 'tercapai'},
							{ name: 'tervalidasi'},
							{ name: 'tercapai2'},
							{ name: 'tervalidasi2'},
							{ name: 'tercapai3'},
							{ name: 'tervalidasi3'},
							{ name: 'kuota',type: 'text'},
							{ name: 'target',type: 'text'},
							{ name: 'kuota2',type: 'text'},
							{ name: 'target2',type: 'text'},
							{ name: 'kuota3',type: 'text'},
							{ name: 'target3',type: 'text'},
							{ name: 'kode2',type: 'text'},
							{ name: 'kepanjangan2',type: 'text'},
						],
						type: 'POST',
						data: {set01:val01, set02:val02, _token: "{{ csrf_token() }}"},
						url: '{{ route("jsonViewlistlogbookppds") }}'
					};
					$('#divpenyakit').show();
					$('#divawal').hide();
					var dataAdapter = new $.jqx.dataAdapter(source);
					$("#gridpenyakit").jqxGrid({
						width: '100%',
						enablebrowserselection: true,
						filterable: true,
						filtermode: 'excel',
						source: dataAdapter,
						columnsresize: true,
						theme: "orange",
						sortable: true,		
						autoheight: true,
						selectionmode: 'multiplecellsextended',
						columns: [
							{ text: 'Stase', datafield: 'kode2', width: '7%', cellsalign: 'left', align: 'center' },
							{ text: 'Full Disease Name', datafield: 'kepanjangan2', width: '23%', cellsalign: 'left', align: 'center' },
							{ text: 'Target', columngroup: 'senior', datafield: 'target', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Archieve', columngroup: 'senior', datafield: 'tercapai', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Verified', columngroup: 'senior', datafield: 'tervalidasi', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Target', columngroup: 'middle', datafield: 'target3', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Archieve', columngroup: 'middle', datafield: 'tercapai3', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Verified', columngroup: 'middle', datafield: 'tervalidasi3', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Target', columngroup: 'junior', datafield: 'target2', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Archieve', columngroup: 'junior', datafield: 'tercapai2', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Verified', columngroup: 'junior', datafield: 'tervalidasi2', width: '7%', align: 'center', cellsalign: 'center' },
							{ text: 'Detail', columntype: 'button', width: '7%', align: 'center', cellsrenderer: function () {
								return "Detail";
								}, buttonclick: function (row) {
								editrow = row;	
								var offset 		= $("#gridpenyakit").offset();
								var dataRecord 	= $("#gridpenyakit").jqxGrid('getrowdata', editrow);
								var val101		= dataRecord.idppds;
								var val102		= dataRecord.id2;
								var val103		= dataRecord.kepanjangan2;
								var source = {
									datatype: "json",
									datafields: [
										{ name: 'idne'},
										{ name: 'nomor'},
										{ name: 'stase', type: 'text'},
										{ name: 'judul', type: 'text'},
										{ name: 'tanggal', type: 'text'},
										{ name: 'supervisor', type: 'text'},
										{ name: 'tlssupervisor', type: 'text'},
										{ name: 'lampiran', type: 'text'},
										{ name: 'lampiran2', type: 'text'},
										{ name: 'lampiran3', type: 'text'},
										{ name: 'versi', type: 'text'},
										{ name: 'tlsversi', type: 'text'},
										{ name: 'semester', type: 'text'},
										{ name: 'studentname', type: 'text'},
										{ name: 'studenid', type: 'text'},
										{ name: 'kelompok', type: 'text'},
									],
									type: 'POST',
									data: {val01:val101,val02:val102,val03:val103, _token: "{{ csrf_token() }}"},
									url: '{{ route("jsonViewlogbook") }}'
								};
								$('#divdetail').show();
								$('#divpenyakit').hide();
								var dataAdapter = new $.jqx.dataAdapter(source);
								$("#griddetail").jqxGrid({
									width: '100%',
									enablebrowserselection: true,
									filterable: true,
									filtermode: 'excel',
									source: dataAdapter,
									columnsresize: true,
									theme: "orange",
									sortable: true,		
									autoheight: true,
									selectionmode: 'multiplecellsextended',
									columns: [
										{ text: 'NO', datafield: 'nomor', width: 50, cellsalign: 'center', align: 'center'  },
										{ text: 'View', columntype: 'button', width: 70, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
											return "View";
											}, buttonclick: function (row) {
												editrow = row;
												var offset 		= $("#griddetail").offset();
												var dataRecord 	= $("#griddetail").jqxGrid('getrowdata', editrow);
												$.post('{{ route("savePdf") }}', { id: dataRecord.idne, _token: token },
												function(data){
													var newWindow = window.open('', '', 'width=800, height=500'),
													document = newWindow.document.open(),
													pageContent =
														'<!DOCTYPE html>\n' +
														'<html>\n' +
														'<head>\n' +
														'<meta charset="utf-8" />\n' +
														'<title>'+dataRecord.judul+'</title>\n' +
														'</head>\n' +
														'<body>' + data + '</body>\n</html>';
													document.write(pageContent);
													document.close();
													newWindow.print();
													return false;
												});
											}
										},
										{ text: 'Semester', datafield: 'semester', width: 80, cellsalign: 'left', align: 'center'  },
										{ text: 'Stase', datafield: 'stase', width: 220, cellsalign: 'left', align: 'center'  },
										{ text: 'Disease', datafield: 'lampiran3', width: 200, cellsalign: 'left', align: 'center'  },
										{ text: 'Date', datafield: 'tanggal', width: 120, cellsalign: 'left', align: 'center'  },
										{ text: 'Supervisor', datafield: 'tlssupervisor', width: 150, cellsalign: 'left', align: 'center'  },
										{ text: 'Verification', datafield: 'tlsversi', width: 120, cellsalign: 'left', align: 'center'  },
										{ text: 'DEL', columntype: 'button', width: 70, align: 'center', cellsrenderer: function () {
											return "DEL";
											}, buttonclick: function (row) {
												editrow = row;	
												var offset 		= $("#gridlogbook").offset();
												var dataRecord 	= $("#gridlogbook").jqxGrid('getrowdata', editrow);
												var goook		= dataRecord.id;
												$("#del_nama").val(dataRecord.judul);
												$("#del_id").val(dataRecord.idne);
												$("#modalhapusdata").modal('show');
											}
										},
									]
								});
								}
							},
						],
						columngroups: 
						[
						{ text: 'Senior', align: 'center', name: 'senior' },
						{ text: 'Middle', align: 'center', name: 'middle' },
						{ text: 'Junior', align: 'center', name: 'junior' }
						]
					});
					}
				},
			],
		});
		var sourcejunior = {
			datatype: "json",
			datafields: [
				{ name: 'id'},
				{ name: 'idppds'},
				{ name: 'idkasus', type: 'text'},
				{ name: 'nomor', type: 'text'},
				{ name: 'sebagai', type: 'text'},
				{ name: 'namappds', type: 'text'},
				{ name: 'kelompokstase', type: 'text'},
				{ name: 'kodestase', type: 'text'},
				{ name: 'kepanjangan', type: 'text'},
				{ name: 'target', type: 'text'},
				{ name: 'idstase', type: 'text'},
				{ name: 'nofoto', type: 'text'},
				{ name: 'verifikasi', type: 'text'},
				{ name: 'supervisor', type: 'text'},
				{ name: 'layanan', type: 'text'},
				{ name: 'klinis', type: 'text'},
				{ name: 'modality', type: 'text'},
				{ name: 'ruangan', type: 'text'},
				{ name: 'durasi', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'junior', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAjunior = new $.jqx.dataAdapter(sourcejunior);	
		$("#gridjunior").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			filterable: true,
			source: DAjunior,
			columnsresize: true,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'View', columntype: 'button', width: 70, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
					return "View";
					}, buttonclick: function (row) {
						editrow = row;
						var offset 		= $("#gridjunior").offset();
						var dataRecord 	= $("#gridjunior").jqxGrid('getrowdata', editrow);
						var url 		= "{{URL::to("/")}}/hasil/"+dataRecord.nofoto;
						var windowName 	= dataRecord.nofoto;
						var windowSize 	= "width=800,height=800";
						window.open(url, windowName, windowSize);
						event.preventDefault();
						return false;
					}
				},
				{ text: 'NO', datafield: 'nomor', width: 50, cellsalign: 'center', align: 'center'  },
				{ text: 'Stase Konvensional', datafield: 'kepanjangan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Stase Sistem Organ', datafield: 'kodestase', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Klinis', datafield: 'klinis', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Layanan', datafield: 'layanan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Ruangan', datafield: 'ruangan', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Supervisor', datafield: 'supervisor', width: 150, cellsalign: 'left', align: 'center'  },
				{ text: 'Durasi', datafield: 'durasi', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Delete', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                    return "Delete";
                    }, buttonclick: function (row) {        
                        editrow         = row;   
                        var offset      = $("#gridjunior").offset();       
                        var dataRecord  = $("#gridjunior").jqxGrid('getrowdata', editrow);                      
                        swal({
							title: 'Are you sure?',
							text: "You won't be able to revert this!",
							type: 'warning',
							showCancelButton: true,
							confirmButtonClass: 'btn btn-confirm mt-2',
							cancelButtonClass: 'btn btn-cancel ml-2 mt-2',
							confirmButtonText: 'Yes, delete it!'
						}).then(function () {
							var set01		= dataRecord.id;
							var token   	= "{{ csrf_token() }}";		
							$.post('{{ route("exMenuslogbook") }}', { set01: set01, set02: '', set03: 'dellogbook', _token: token },	
								function(data){					
									var status  = data.status;
									var message = data.message;
									var warna 	= data.warna;
									var icon 	= data.icon;
									$.toast({
										heading: status,
										text: message,
										position: 'top-right',
										loaderBg: warna,
										icon: icon,
										hideAfter: 3000,
										stack: 1
									});
								$("#gridjunior").jqxGrid('updatebounddata', 'filter');
								return false;
							});
						});              
                    }
                },
			],
		});
		var sourcemiddle = {
			datatype: "json",
			datafields: [
				{ name: 'id'},
				{ name: 'idppds'},
				{ name: 'idkasus', type: 'text'},
				{ name: 'nomor', type: 'text'},
				{ name: 'sebagai', type: 'text'},
				{ name: 'namappds', type: 'text'},
				{ name: 'kelompokstase', type: 'text'},
				{ name: 'kodestase', type: 'text'},
				{ name: 'kepanjangan', type: 'text'},
				{ name: 'target', type: 'text'},
				{ name: 'idstase', type: 'text'},
				{ name: 'nofoto', type: 'text'},
				{ name: 'verifikasi', type: 'text'},
				{ name: 'supervisor', type: 'text'},
				{ name: 'layanan', type: 'text'},
				{ name: 'klinis', type: 'text'},
				{ name: 'modality', type: 'text'},
				{ name: 'ruangan', type: 'text'},
				{ name: 'durasi', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'midlle', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAmiddle = new $.jqx.dataAdapter(sourcemiddle);	
		$("#gridmiddle").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			filterable: true,
			source: DAmiddle,
			columnsresize: true,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'View', columntype: 'button', width: 70, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
					return "View";
					}, buttonclick: function (row) {
						editrow = row;
						var offset 		= $("#gridmiddle").offset();
						var dataRecord 	= $("#gridmiddle").jqxGrid('getrowdata', editrow);
						var url 		= "{{URL::to("/")}}/hasil/"+dataRecord.nofoto;
						var windowName 	= dataRecord.nofoto;
						var windowSize 	= "width=800,height=800";
						window.open(url, windowName, windowSize);
						event.preventDefault();
						return false;
					}
				},
				{ text: 'NO', datafield: 'nomor', width: 50, cellsalign: 'center', align: 'center'  },
				{ text: 'Stase Konvensional', datafield: 'kepanjangan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Stase Sistem Organ', datafield: 'kodestase', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Klinis', datafield: 'klinis', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Layanan', datafield: 'layanan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Ruangan', datafield: 'ruangan', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Supervisor', datafield: 'supervisor', width: 150, cellsalign: 'left', align: 'center'  },
				{ text: 'Durasi', datafield: 'durasi', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Delete', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                    return "Delete";
                    }, buttonclick: function (row) {        
                        editrow         = row;   
                        var offset      = $("#gridmiddle").offset();       
                        var dataRecord  = $("#gridmiddle").jqxGrid('getrowdata', editrow);                      
                        swal({
							title: 'Are you sure?',
							text: "You won't be able to revert this!",
							type: 'warning',
							showCancelButton: true,
							confirmButtonClass: 'btn btn-confirm mt-2',
							cancelButtonClass: 'btn btn-cancel ml-2 mt-2',
							confirmButtonText: 'Yes, delete it!'
						}).then(function () {
							var set01		= dataRecord.id;
							var token   	= "{{ csrf_token() }}";		
							$.post('{{ route("exMenuslogbook") }}', { set01: set01, set02: '', set03: 'dellogbook', _token: token },	
								function(data){					
									var status  = data.status;
									var message = data.message;
									var warna 	= data.warna;
									var icon 	= data.icon;
									$.toast({
										heading: status,
										text: message,
										position: 'top-right',
										loaderBg: warna,
										icon: icon,
										hideAfter: 3000,
										stack: 1
									});
								$("#gridmiddle").jqxGrid('updatebounddata', 'filter');
								return false;
							});
						});              
                    }
                },
			],
		});
		var sourcesenior = {
			datatype: "json",
			datafields: [
				{ name: 'id'},
				{ name: 'idppds'},
				{ name: 'idkasus', type: 'text'},
				{ name: 'nomor', type: 'text'},
				{ name: 'sebagai', type: 'text'},
				{ name: 'namappds', type: 'text'},
				{ name: 'kelompokstase', type: 'text'},
				{ name: 'kodestase', type: 'text'},
				{ name: 'kepanjangan', type: 'text'},
				{ name: 'target', type: 'text'},
				{ name: 'idstase', type: 'text'},
				{ name: 'nofoto', type: 'text'},
				{ name: 'verifikasi', type: 'text'},
				{ name: 'supervisor', type: 'text'},
				{ name: 'layanan', type: 'text'},
				{ name: 'klinis', type: 'text'},
				{ name: 'modality', type: 'text'},
				{ name: 'ruangan', type: 'text'},
				{ name: 'durasi', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'senior', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAsenior = new $.jqx.dataAdapter(sourcesenior);	
		$("#gridsenior").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			filterable: true,
			source: DAsenior,
			columnsresize: true,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'View', columntype: 'button', width: 70, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
					return "View";
					}, buttonclick: function (row) {
						editrow = row;
						var offset 		= $("#gridsenior").offset();
						var dataRecord 	= $("#gridsenior").jqxGrid('getrowdata', editrow);
						var url 		= "{{URL::to("/")}}/hasil/"+dataRecord.nofoto;
						var windowName 	= dataRecord.nofoto;
						var windowSize 	= "width=800,height=800";
						window.open(url, windowName, windowSize);
						event.preventDefault();
						return false;
					}
				},
				{ text: 'NO', datafield: 'nomor', width: 50, cellsalign: 'center', align: 'center'  },
				{ text: 'Stase Konvensional', datafield: 'kepanjangan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Stase Sistem Organ', datafield: 'kodestase', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Klinis', datafield: 'klinis', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Layanan', datafield: 'layanan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Ruangan', datafield: 'ruangan', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Supervisor', datafield: 'supervisor', width: 150, cellsalign: 'left', align: 'center'  },
				{ text: 'Durasi', datafield: 'durasi', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Delete', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                    return "Delete";
                    }, buttonclick: function (row) {        
                        editrow         = row;   
                        var offset      = $("#gridsenior").offset();       
                        var dataRecord  = $("#gridsenior").jqxGrid('getrowdata', editrow);                      
                        swal({
							title: 'Are you sure?',
							text: "You won't be able to revert this!",
							type: 'warning',
							showCancelButton: true,
							confirmButtonClass: 'btn btn-confirm mt-2',
							cancelButtonClass: 'btn btn-cancel ml-2 mt-2',
							confirmButtonText: 'Yes, delete it!'
						}).then(function () {
							var set01		= dataRecord.id;
							var token   	= "{{ csrf_token() }}";		
							$.post('{{ route("exMenuslogbook") }}', { set01: set01, set02: '', set03: 'dellogbook', _token: token },	
								function(data){					
									var status  = data.status;
									var message = data.message;
									var warna 	= data.warna;
									var icon 	= data.icon;
									$.toast({
										heading: status,
										text: message,
										position: 'top-right',
										loaderBg: warna,
										icon: icon,
										hideAfter: 3000,
										stack: 1
									});
								$("#gridsenior").jqxGrid('updatebounddata', 'filter');
								return false;
							});
						});              
                    }
                },
			],
		});
		var sourcestatistik1 = {
			datatype: "json",
			datafields: [
				{ name: 'sebagai', type: 'text'},
				{ name: 'total', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'statistik', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAstatistik1 = new $.jqx.dataAdapter(sourcestatistik1);	
		var settings1 = {
			title: "Grafik PPDS",
			description: 'Per Posisi',
			enableAnimations: true,
			padding: { left: 5, top: 5, right: 5, bottom: 5 },
			titlePadding: { left: 50, top: 0, right: 0, bottom: 10 },
			source: DAstatistik1,
			xAxis:
				{
					dataField: 'sebagai',
					displayText: 'Position',
					showGridLines: true,
					labels:
					{
						angle: 90,
						horizontalAlignment: 'right',
						verticalAlignment: 'left',
						rotationPoint: 'left',
						offset: { x: 0, y: 5 }
					}
				},
			colorScheme: 'scheme01',
			seriesGroups:
				[
					{
						type: 'column',
						columnsGapPercent: 50,
						seriesGapPercent: 0,
						valueAxis:
						{
							displayValueAxis: true,
							description: 'Kasus Yang di Kerjakan',
							axisSize: 'auto',
							tickMarksColor: '#888888'
						},
						series: [
							{ dataField: 'total', displayText: ' Kasus'}
						]
					},
					
				]
		};
		$('#grafiksebagai').jqxChart(settings1);
		var sourcestatistik2 = {
			datatype: "json",
			datafields: [
				{ name: 'nama', type: 'text'},
				{ name: 'total', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'terbanyakbylayanan', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAstatistik2 = new $.jqx.dataAdapter(sourcestatistik2);	
		$("#grafikkasusterbanyakbylayanan").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			source: DAstatistik2,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'Layanan', datafield: 'nama', width: '80%', cellsalign: 'left', align: 'center'  },
				{ text: 'Jumlah', datafield: 'total', width: '20%', cellsalign: 'center', align: 'center'  },
			],
		});
		var sourcestatistik3 = {
			datatype: "json",
			datafields: [
				{ name: 'nama', type: 'text'},
				{ name: 'total', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'terbanyakbystase', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAstatistik3 = new $.jqx.dataAdapter(sourcestatistik3);	
		$("#grafikkasusterbanyakbystase").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			source: DAstatistik3,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'Layanan', datafield: 'nama', width: '80%', cellsalign: 'left', align: 'center'  },
				{ text: 'Jumlah', datafield: 'total', width: '20%', cellsalign: 'center', align: 'center'  },
			],
		});
		var sourcestatistik4 = {
			datatype: "json",
			datafields: [
				{ name: 'nama', type: 'text'},
				{ name: 'total', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:'terbanyakbyorgan', val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var DAstatistik4 = new $.jqx.dataAdapter(sourcestatistik4);	
		$("#grafikkasusterbanyakbyorgan").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			source: DAstatistik4,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'Layanan', datafield: 'nama', width: '80%', cellsalign: 'left', align: 'center'  },
				{ text: 'Jumlah', datafield: 'total', width: '20%', cellsalign: 'center', align: 'center'  },
			],
		});
	}
	$(window).on('load', function () {
		opendatalogbook();
	});
$(document).ready(function () {
	$('#divsemula').hide();
	$('#divpencarian').hide();
	$('#divlogbook').hide();
	$('#divpenyakit').hide();
	$('#divdetail').hide();
	$('#btnexportgridlogbook').click(function(){
		var tulisjudul	= document.getElementById('getsubmenu').value;
		var ppds		= document.getElementById('getnama').value;
		var gridContent = $("#gridlogbook").jqxGrid('exportdata', 'html');			
		var newWindow 	= window.open('', '', 'width=1024, height=500'),
		cetak 			= newWindow.document.open(),
		pageContent 	=
			'<!DOCTYPE html>\n' +
			'<html>\n' +
			'<head>\n' +
			'<meta charset="utf-8" />\n' +
			'<title>Export Data</title>\n' +
			'</head>\n' +
			'<body>' +
			'<table id="printiki" width="100%" border="0" cellspacing="0" cellpadding="0">' +
			'<thead><tr>' +
			'<td width="171" rowspan="4" align="center"><img src="{{ asset("radiologi.png") }}" width="102" height="96" alt=""/></td>' +
			'<td colspan="8" ><b>Laboratory Information System - RSSA</td></tr>' +
			'<td colspan="8" ><b>'+ tulisjudul + ' Logbook</td></tr>' +
			'<tr><td colspan="8" align="left"><b>' + ppds + 
			'</b></td></tr></thead></table>' +
			gridContent + 
			'<strong>NB : <font color=red>To Save On Excell Please [Ctrl + A] Then [Ctrl + C] and [Ctrl + v] on Your Excell Worksheet</font></strong><br /></body>\n</html>';
			cetak.write(pageContent);
			cetak.close();
	});
	$('#btnexportgridpencarian').click(function(){
		var tulisjudul	= document.getElementById('getsubmenu').value;
		var ppds		= document.getElementById('getnama').value;
		var gridContent = $("#gridpencarian").jqxGrid('exportdata', 'html');			
		var newWindow 	= window.open('', '', 'width=1024, height=500'),
		cetak 		= newWindow.document.open(),
		pageContent 	=
			'<!DOCTYPE html>\n' +
			'<html>\n' +
			'<head>\n' +
			'<meta charset="utf-8" />\n' +
			'<title>Export Data</title>\n' +
			'</head>\n' +
			'<body>' +
			'<table id="printiki" width="100%" border="0" cellspacing="0" cellpadding="0">' +
			'<thead><tr>' +
			'<td width="171" rowspan="4" align="center"><img src="{{ asset("radiologi.png") }}" width="102" height="96" alt=""/></td>' +
			'<td colspan="8" ><b>Laboratory Information System - RSSA</td></tr>' +
			'<td colspan="8" ><b>'+ tulisjudul + ' Logbook / Stase</td></tr>' +
			'<tr><td colspan="8" align="left"><b>' + ppds + 
			'</b></td></tr></thead></table>' +
			gridContent + 
			'<strong>NB : <font color=red>To Save On Excell Please [Ctrl + A] Then [Ctrl + C] and [Ctrl + v] on Your Excell Worksheet</font></strong><br /></body>\n</html>';
			cetak.write(pageContent);
			cetak.close();
	});
	$('#btnexportgriddetail').click(function(){
		var tulisjudul	= document.getElementById('getsubmenu').value;
		var ppds		= document.getElementById('getnama').value;
		var gridContent = $("#griddetail").jqxGrid('exportdata', 'html');			
		var newWindow 	= window.open('', '', 'width=1024, height=500'),
		cetak 		= newWindow.document.open(),
		pageContent 	=
			'<!DOCTYPE html>\n' +
			'<html>\n' +
			'<head>\n' +
			'<meta charset="utf-8" />\n' +
			'<title>Export Data</title>\n' +
			'</head>\n' +
			'<body>' +
			'<table id="printiki" width="100%" border="0" cellspacing="0" cellpadding="0">' +
			'<thead><tr>' +
			'<td width="171" rowspan="4" align="center"><img src="{{ asset("radiologi.png") }}" width="102" height="96" alt=""/></td>' +
			'<td colspan="8" ><b>Laboratory Information System - RSSA</td></tr>' +
			'<td colspan="8" ><b>'+ tulisjudul + ' Logbook Detail</td></tr>' +
			'<tr><td colspan="8" align="left"><b>' + ppds + 
			'</b></td></tr></thead></table>' +
			gridContent + 
			'<strong>NB : <font color=red>To Save On Excell Please [Ctrl + A] Then [Ctrl + C] and [Ctrl + v] on Your Excell Worksheet</font></strong><br /></body>\n</html>';
			cetak.write(pageContent);
			cetak.close();
	});
	$('#btnexportgridpenyakit').click(function(){
		var tulisjudul	= document.getElementById('getsubmenu').value;
		var ppds		= document.getElementById('getnama').value;
		var gridContent = $("#gridpenyakit").jqxGrid('exportdata', 'html');			
		var newWindow 	= window.open('', '', 'width=1024, height=500'),
		cetak 		= newWindow.document.open(),
		pageContent 	=
			'<!DOCTYPE html>\n' +
			'<html>\n' +
			'<head>\n' +
			'<meta charset="utf-8" />\n' +
			'<title>Export Data</title>\n' +
			'</head>\n' +
			'<body>' +
			'<table id="printiki" width="100%" border="0" cellspacing="0" cellpadding="0">' +
			'<thead><tr>' +
			'<td width="171" rowspan="4" align="center"><img src="{{ asset("radiologi.png") }}" width="102" height="96" alt=""/></td>' +
			'<td colspan="8" ><b>Laboratory Information System - RSSA</td></tr>' +
			'<td colspan="8" ><b>'+ tulisjudul + ' Logbook Detail</td></tr>' +
			'<tr><td colspan="8" align="left"><b>' + ppds + 
			'</b></td></tr></thead></table>' +
			gridContent + 
			'<strong>NB : <font color=red>To Save On Excell Please [Ctrl + A] Then [Ctrl + C] and [Ctrl + v] on Your Excell Worksheet</font></strong><br /></body>\n</html>';
			cetak.write(pageContent);
			cetak.close();
	});
	$("#id_loogbooklist").on('change', function () {		
		var idmat = $(this).find('option:selected').attr('value');				
		if (idmat != ''){
			var sourcekelas =
			{
				datatype: "json",
				datafields: [
					{ name: 'id2'},
					{ name: 'kode2',type: 'text'},
					{ name: 'kepanjangan2',type: 'text'},
					],
					type: 'POST',
					data: {set01:idmat, _token: "{{ csrf_token() }}"},
					url: '{{ route("jsonViewlistlogbook") }}'
			};
			var kelasnya = new $.jqx.dataAdapter(sourcekelas);
			$("#logboksubmenulist").jqxComboBox({ selectedIndex: 0, source: kelasnya, displayMember: "kepanjangan2", valueMember: "kepanjangan2", width: '100%', height: 30});
		}
	});
	$("#add_loogbooklist").on('change', function () {		
		var idmat = $(this).find('option:selected').attr('value');				
		if (idmat != ''){
			var sourcekelas =
			{
				datatype: "json",
				datafields: [
					{ name: 'id2'},
					{ name: 'kode2',type: 'text'},
					{ name: 'kepanjangan2',type: 'text'},
					],
					type: 'POST',
					data: {set01:idmat, _token: "{{ csrf_token() }}"},
					url: '{{ route("jsonViewlistlogbook") }}'
			};
			var kelasnya = new $.jqx.dataAdapter(sourcekelas);
			$("#add_logboksubmenulist").jqxComboBox({ selectedIndex: 0, source: kelasnya, displayMember: "kepanjangan2", valueMember: "kepanjangan2", width: '100%', height: 30});
		}
	});
	$("#logboksubmenulist").on('select', function (event) {
		if (event.args) {
			var item = event.args.item;
			if (item) {
				$("#getsubmenu").val(item.value);
			}
		}
	});
	$("#add_logboksubmenulist").on('select', function (event) {
		if (event.args) {
			var item = event.args.item;
			if (item) {
				$("#hid_submenu").val(item.value);
			}
		}
	});
	$('#btncaridata').click(function () {
		var set01=document.getElementById('set_value').value;
		var set02=document.getElementById('set_kategori').value;
		var source = {
			datatype: "json",
			datafields: [
				{ name: 'id'},
				{ name: 'idpasien'},
				{ name: 'norm',type: 'text'},
				{ name: 'tanggal',type: 'text'},
				{ name: 'nama',type: 'text'},
				{ name: 'diagnosis',type: 'text'},
				{ name: 'modality',type: 'text'},
				{ name: 'organ',type: 'text'},
				{ name: 'usia',type: 'text'},
				{ name: 'iddokter',type: 'text'},
				{ name: 'dokter',type: 'text'},
				{ name: 'idspv',type: 'text'},
				{ name: 'timestamp',type: 'text'},
			],
			type: 'POST',
			data: {val01:set01, val02:set02, _token: "{{ csrf_token() }}" },
			url: '{{ route("jsonPencarian") }}'
		};
		var dataAdapter = new $.jqx.dataAdapter(source);
		var editrow = -1;
		$('#divpencarian').show();
		$('#divlogbook').hide();
		$('#divawal').hide();
		$("#gridpencarian").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			filterable: true,
			showfilterrow: true,				
			source: dataAdapter,
			pageable: false,
			theme: "orange",
			columnsresize: true,
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'ADD TO ', columntype: 'button', width: 90, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
					return "LOGBOOK";
					}, buttonclick: function (row) {
					editrow = row;
					var offset 		= $("#gridpencarian").offset();
					var dataRecord 	= $("#gridpencarian").jqxGrid('getrowdata', editrow);
					$("#hid_idpasien").val(dataRecord.idpasien);
					$("#hid_namapasien").val(dataRecord.nama);
					$("#hid_submenu").val('');
					$("#hid_tanggal").val(dataRecord.tanggal);
					$("#add_ceel").val('');
					$("#add_supervisor").val(dataRecord.idspv);
					$("#modaladdlogbook").modal('show');
					}
				},
				{ text: 'Name', datafield: 'nama', width: 160, cellsalign: 'left', align: 'center' },
				{ text: 'ID', datafield: 'norm', width: 70, align: 'center' },
				{ text: 'Study Date', datafield: 'tanggal', width: 140, cellsalign: 'left', align: 'center' },
				{ text: 'Modality', datafield: 'modality', width: 180, cellsalign: 'left', align: 'center' },
				{ text: 'Organ', datafield: 'organ', width: 180, cellsalign: 'left', align: 'center' },
				{ text: 'Diagnosis', datafield: 'diagnosis', width: 180, cellsalign: 'left', align: 'center' },
				{ text: 'View', columntype: 'button', width: 70, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
					return "View";
					}, buttonclick: function (row) {
					editrow = row;
					var offset 		= $("#gridpencarian").offset();
					var dataRecord 	= $("#gridpencarian").jqxGrid('getrowdata', editrow);
					$("#idpasien2").val(dataRecord.idpasien);
					$("#tglcekup2").val(dataRecord.tanggal);
					$("#formriwayat2").submit();
					}
				},
			]
		});		
	});
	$('#btnshowlogbook').click(function () {
		$('#divlogbook').show();
	
		var set01=document.getElementById('getuserid').value;
		var set02=document.getElementById('id_loogbooklist').value;
		var set03=document.getElementById('getsubmenu').value;
		var source = {
			datatype: "json",
			datafields: [
				{ name: 'id'},
				{ name: 'idppds'},
				{ name: 'idkasus', type: 'text'},
				{ name: 'nomor', type: 'text'},
				{ name: 'sebagai', type: 'text'},
				{ name: 'namappds', type: 'text'},
				{ name: 'kelompokstase', type: 'text'},
				{ name: 'kodestase', type: 'text'},
				{ name: 'kepanjangan', type: 'text'},
				{ name: 'target', type: 'text'},
				{ name: 'idstase', type: 'text'},
				{ name: 'nofoto', type: 'text'},
				{ name: 'verifikasi', type: 'text'},
				{ name: 'supervisor', type: 'text'},
				{ name: 'layanan', type: 'text'},
				{ name: 'klinis', type: 'text'},
				{ name: 'modality', type: 'text'},
				{ name: 'ruangan', type: 'text'},
				{ name: 'durasi', type: 'text'},
			],
			type: 'POST',
			data: {val01:set01,val02:set02,val03:set03, _token: "{{ csrf_token() }}"},
			url: '{{ route("jsonViewlogbook") }}'
		};
		var dataAdapter = new $.jqx.dataAdapter(source);	
		$("#gridlogbook").jqxGrid({
			width: '100%',
			enablebrowserselection: true,
			pageable: true,
			autoheight: true,
			filterable: true,
			filtermode: 'excel',
			source: dataAdapter,
			columnsresize: true,
			theme: "energyblue",
			selectionmode: 'multiplecellsextended',
			columns: [
				{ text: 'View', columntype: 'button', width: 70, align: 'center', editable: false, sortable: false, filterable: false, cellsrenderer: function () {
					return "View";
					}, buttonclick: function (row) {
						editrow = row;
						var offset 		= $("#gridlogbook").offset();
						var dataRecord 	= $("#gridlogbook").jqxGrid('getrowdata', editrow);
						var url 		= "{{URL::to("/")}}/hasil/"+dataRecord.nofoto;
						var windowName 	= dataRecord.nofoto;
						var windowSize 	= "width=800,height=800";
						window.open(url, windowName, windowSize);
						event.preventDefault();
						return false;
					}
				},
				{ text: 'NO', datafield: 'nomor', width: 50, cellsalign: 'center', align: 'center'  },
				{ text: 'Stase Konvensional', datafield: 'kepanjangan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Stase Sistem Organ', datafield: 'kodestase', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Klinis', datafield: 'klinis', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Layanan', datafield: 'layanan', width: 200, cellsalign: 'left', align: 'center'  },
				{ text: 'Ruangan', datafield: 'ruangan', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Supervisor', datafield: 'supervisor', width: 150, cellsalign: 'left', align: 'center'  },
				{ text: 'Durasi', datafield: 'durasi', width: 120, cellsalign: 'left', align: 'center'  },
				{ text: 'Delete', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                    return "Delete";
                    }, buttonclick: function (row) {        
                        editrow         = row;   
                        var offset      = $("#gridlogbook").offset();       
                        var dataRecord  = $("#gridlogbook").jqxGrid('getrowdata', editrow);                      
                        swal({
							title: 'Are you sure?',
							text: "You won't be able to revert this!",
							type: 'warning',
							showCancelButton: true,
							confirmButtonClass: 'btn btn-confirm mt-2',
							cancelButtonClass: 'btn btn-cancel ml-2 mt-2',
							confirmButtonText: 'Yes, delete it!'
						}).then(function () {
							var set01		= dataRecord.id;
							var token   	= "{{ csrf_token() }}";		
							$.post('{{ route("exMenuslogbook") }}', { set01: set01, set02: '', set03: 'dellogbook', _token: token },	
								function(data){					
									var status  = data.status;
									var message = data.message;
									var warna 	= data.warna;
									var icon 	= data.icon;
									$.toast({
										heading: status,
										text: message,
										position: 'top-right',
										loaderBg: warna,
										icon: icon,
										hideAfter: 3000,
										stack: 1
									});
								$("#gridlogbook").jqxGrid('updatebounddata', 'filter');
								return false;
							});
						});              
                    }
                },
			],
		});
	});
	$('#btnkembalidrdetail').on('click', function (){
		$('#divpenyakit').show();
		$('#divdetail').hide();
		$('#divpencarian').hide();
		$('#divlogbook').hide();
		$('#divawal').hide();
	});
	$('#btnkembalidrpenyakit').on('click', function (){
		$('#divpenyakit').hide();
		$('#divdetail').hide();
		$('#divpencarian').hide();
		$('#divlogbook').hide();
		$('#divawal').show();
	});
	$('#btnkembalidrcari').on('click', function (){
		$('#divpenyakit').hide();
		$('#divpencarian').hide();
		$('#divlogbook').hide();
		$('#divdetail').hide();
		$('#divawal').show();
		$("#gridk1").jqxGrid('updatebounddata');
	});
	$('#btnkembalidrlogbook').on('click', function (){
		$('#divlogbook').hide();
	});
	
	$("#btnhapus").click(function(){
		var val01=document.getElementById('del_id').value;
		var val02=document.getElementById('del_verifikasi').value;
		var val03='delpenugasan';
		var val04=document.getElementById('getuserid').value;
		$.post('{{ route("exMenuslogbook") }}', { _token: "{{ csrf_token() }}", set01: val01, set02: val02, set03: val03, set04: val04, set05: '', set06: '', set07: '', set08: '', set09: '' },
		function(data){
			$("#modalhapusdata").modal('hide');
			$("#griddetail").jqxGrid('updatebounddata');
			$.toast({
				heading: data.status,
				text: data.message,
				position: 'top-right',
				loaderBg: data.warna,
				icon: data.icon,
				hideAfter: 5000,
				stack: 1
			});
			return false;
		});
	});
});
</script>
@endpush
