@extends('base.layout')

@section('content')
 <div class="wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-12">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-danger">Log Book Statistik</div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
                        <div class="form-group col-lg-6">
                            <div class="card-box ribbon-box">
                                <div class="ribbon ribbon-info">Log Book PPDS</div>
                                <p class="m-b-0"></p>
                                <div class="form-row">
                                    <div class="form-group col-lg-4">
                            	        <input type="text" name="tanggal" id="tanggal" class="form-control" placeholder="Range">
                                    </div>
                                    <div class="form-group col-lg-4">
                                        <select class="form-control select2" id="ppds" name="ppds">
                                            <option value="">Pilih</option>
                                            @foreach($allppds as $ppds)
                                                <option value="{{ $ppds->id }}">{{ $ppds->nama }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    <div class="form-group col-lg-4">
                                        <button type="button" class="btn btn-info" id="btnviewppds"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-lg-6">
                            <div class="card-box ribbon-box">
                                <div class="ribbon ribbon-warning">SPV Report</div>
                                <p class="m-b-0"></p>
                                <div class="form-row">
                                    <div class="form-group col-lg-6">
                                        <select class="form-control select2" id="spv" name="spv">
                                            <option value="">Pilih</option>
                                            @foreach($allspv as $spv)
                                                <option value="{{ $spv->id }}" id1="{{ $spv->nama }}" id2="{{ $spv->tandatangan }}">{{ $spv->nama }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <input type="text" name="mulai" id="mulai" class="form-control" placeholder="Start Date" data-mask="9999-99-99">
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <input type="text" name="akhir" id="akhir" class="form-control" placeholder="End Date" data-mask="9999-99-99">
                                    </div>
                                    <div class="form-group col-lg-2">
                                        <button type="button" class="btn btn-warning" id="btnviewcustom"><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-12" id="divreportspv">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-danger" id="judul">Log Book Statistik</div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
                        <div class="form-group col-lg-12">
                            <button class="btn btn-white btn-warning btn-round pull-right" id="btnexport">
								<i class="fa fa-print"></i>
								PRINT
							</button>
                            <div id="gridpencarian"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-12" id="divreportppds">
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-primary" id="judul">Log Book PPDS </div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
                        <div class="form-group col-lg-6">
                            <div id='grafikvindicate' style="width:100%; height:480px;"></div>
						</div>
                        <div class="form-group col-lg-6">
                            <div id='grafiksistemorgan' style="width:100%; height:480px;"></div>
						</div>
                    </div>
                </div>
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-danger" id="judul">Log Book PPDS as Junior</div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
                        <div class="form-group col-lg-12">
                            <button class="btn btn-white btn-warning btn-round pull-right" id="btnexportjunior">
								<i class="fa fa-print"></i>
								PRINT
							</button>
                            <div id="gridjunior"></div>
						</div>
                    </div>
                </div>
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-danger" id="judul">Log Book PPDS as Middle</div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
                        <div class="form-group col-lg-12">
                            <button class="btn btn-white btn-warning btn-round pull-right" id="btnexportmiddle">
								<i class="fa fa-print"></i>
								PRINT
							</button>
                            <div id="gridmiddle"></div>
						</div>
                    </div>
                </div>
                <div class="card-box ribbon-box">
                    <div class="ribbon ribbon-danger" id="judul">Log Book PPDS as Senior</div>
                    <p class="m-b-0"></p>
                    <div class="form-row">
                        <div class="form-group col-lg-12">
                            <button class="btn btn-white btn-warning btn-round pull-right" id="btnexportsenior">
								<i class="fa fa-print"></i>
								PRINT
							</button>
                            <div id="gridsenior"></div>
						</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="getuserid" value="{{ Session('id') }}">
<input type="hidden" id="getkelompok" value="{{ Session('previlage') }}">
<input type="hidden" id="getnama" value="{{ Session('nama') }}">
<input type="hidden" id="getsubmenu">
<input type="hidden" id="gettandatangan">

@endsection

@push('script')
<script type="text/javascript">
    jQuery.browser = {};
    (function () {
        jQuery.browser.msie = false;
        jQuery.browser.version = 0;
        if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
            jQuery.browser.msie = true;
            jQuery.browser.version = RegExp.$1;
        }
    })();
    $(function() {
        $('input[name="tanggal"]').daterangepicker({
            opens: 'left'
        }, function(start, end, label) {
            //console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
        });
    });
    $(document).ready(function() {
		$('#divreportspv').hide();
        $('#divreportppds').hide();
        $('#btnexport').click(function(){
            var tulisjudul	= document.getElementById('getsubmenu').value;
            var ppds		= document.getElementById('getnama').value;
            var tandatangan	= document.getElementById('gettandatangan').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("logo.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"></td></tr></thead></table>' +
                gridContent + 
                '<strong>RSUD dr. Saiful Anwar <br />Dokter Penanggung Jawab<br />'+
                '<strong><img src="'+tandatangan+'" width="120" height="100"><br />'+
                '<strong>'+ppds+'</body>\n</html>';
                cetak.write(pageContent);
                cetak.close();
        });
        $('#btnexportsenior').click(function(){
            var tulisjudul	= document.getElementById('getsubmenu').value;
            var ppds		= document.getElementById('getnama').value;
            var tandatangan	= document.getElementById('gettandatangan').value;
            var gridContent = $("#gridsenior").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("logo.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"></td></tr></thead></table>' +
                                    gridContent + 
                                    '</body>\n</html>';
                cetak.write(pageContent);
                cetak.close();
        });
        $('#btnexportmiddle').click(function(){
            var tulisjudul	= document.getElementById('getsubmenu').value;
            var ppds		= document.getElementById('getnama').value;
            var tandatangan	= document.getElementById('gettandatangan').value;
            var gridContent = $("#gridmiddle").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("logo.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"></td></tr></thead></table>' +
                                    gridContent + 
                                    '</body>\n</html>';
                cetak.write(pageContent);
                cetak.close();
        });
        $('#btnexportjunior').click(function(){
            var tulisjudul	= document.getElementById('getsubmenu').value;
            var ppds		= document.getElementById('getnama').value;
            var tandatangan	= document.getElementById('gettandatangan').value;
            var gridContent = $("#gridjunior").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("logo.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"></td></tr></thead></table>' +
                                    gridContent + 
                                    '</body>\n</html>';
                cetak.write(pageContent);
                cetak.close();
        });
        $("#btnviewppds").click(function(){
            var idppds  = document.getElementById('ppds').value;
            var tanggal	= document.getElementById('tanggal').value;
            $('#divreportspv').hide();
            $('#divreportppds').show();
            
            var sourcepasiencari1 = {
                datatype: "json",
                datafields: [
                    { name: 'id'},
                    { name: 'idpasien', type: 'text'},
                    { name: 'nofoto', type: 'text'},
                    { name: 'noregister', type: 'text'},
                    { name: 'nama', type: 'text'},
                    { name: 'jk', type: 'text'},
                    { name: 'usia', type: 'text'},
                    { name: 'urgensi', type: 'text'},
                    { name: 'tlsnofoto', type: 'text'},
                    { name: 'tlsnoregister', type: 'text'},
                    { name: 'tlsnama', type: 'text'},
                    { name: 'tlsjk', type: 'text'},
                    { name: 'tlsusia', type: 'text'},
                    { name: 'tlsurgensi', type: 'text'},
                    { name: 'tlsreques', type: 'text'},
                    { name: 'tlsruangan', type: 'text'},
                    { name: 'tlsdaftar', type: 'text'},
                    { name: 'tlsstatus', type: 'text'},
                    { name: 'poli', type: 'text'},
                    { name: 'ruangan', type: 'text'},
                    { name: 'daftartgl', type: 'text'},
                    { name: 'daftarjam', type: 'text'},
                    { name: 'status', type: 'text'},
                    { name: 'keterangan', type: 'text'},
                    { name: 'kesimpulan', type: 'text'},
                    { name: 'idruangan', type: 'text'},
                    { name: 'iddokter', type: 'text'},
                    { name: 'ppdssenior', type: 'text'},
                    { name: 'middleppds', type: 'text'},
                    { name: 'ppdsjunior', type: 'text'},
                    { name: 'nmppdssenior', type: 'text'},
                    { name: 'nmmiddleppds', type: 'text'},
                    { name: 'nmppdsjunior', type: 'text'},
                    { name: 'nmppdsmiddle2', type: 'text'},
                    { name: 'nmppdsjunior2', type: 'text'},
                    { name: 'diagnosa', type: 'text'},
                    { name: 'diagnosa2', type: 'text'},
                    { name: 'kd_spesimen', type: 'text'},
                    { name: 'nm_spesimen', type: 'text'},
                    { name: 'asalpasien', type: 'text'},
                    { name: 'klinis', type: 'text'},
                    { name: 'klinisi', type: 'text'},
                    { name: 'berat', type: 'text'},
                    { name: 'telpon', type: 'text'},
                    { name: 'dlp', type: 'text'},
                    { name: 'excutor', type: 'text'},
                    { name: 'analis', type: 'text'},
                    { name: 'nmexcutor', type: 'text'},
                    { name: 'nmanalis', type: 'text'},
                    { name: 'jumlah', type: 'text'},
                    { name: 'modality', type: 'text'},
                    { name: 'dokter', type: 'text'},
                    { name: 'ppds1', type: 'text'},
                    { name: 'ppds2', type: 'text'},
                    { name: 'timestamp1', type: 'text'},
                    { name: 'timestamp2', type: 'text'},
                    { name: 'durasi', type: 'text'},
                    { name: 'ppdsas', type: 'text'},
                    { name: 'otherppds', type: 'text'},
                ],
                updaterow	: function (rowid, rowdata, commit) {commit(true);},
                type		: 'GET',
                data		: {jenis:'junior', mulai:tanggal, akhir:'', valcari:idppds, poli:'', master:'logbook', _token: "{{ csrf_token() }}"},
                url			: '{{ route("getList") }}',
                root		: 'data',
                totalrecords: 'total',
                cache		: false,
                filter		: function () {$("#gridjunior").jqxGrid('updatebounddata', 'filter');},
                sort		: function () {$("#gridjunior").jqxGrid('updatebounddata', 'sort');},
                beforeprocessing: function (data) {
                    if (data != null) {
                        sourcepasiencari1.totalrecords = data.total;
                    }
                }
            };
            var dataAdapter1    = new $.jqx.dataAdapter(sourcepasiencari1);
            var rendergridrows1 = $('#gridjunior').jqxGrid('rendergridrows');
            $("#gridjunior").jqxGrid({
                width			: '100%',
                enablebrowserselection: true,
                filterable		: true,
                showfilterrow	: true,
                columnsresize	: true,
                virtualmode		: true,
                pageable		: true,
                pagesizeoptions	: ['10', '20', '30', '50'],
                rendergridrows	: function(obj) {
                    return obj.data;
                },
                sortable		: true,
                autoheight		: true,
                source			: dataAdapter1,
                theme			: "energyblue",
                selectionmode	: 'checkbox',
                altrows			: true,
                columns: [
                    { text: 'Report', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                        return "Print";
                        }, buttonclick: function (row) {
                            editrowjabatan = row;
                            var offset      = $("#gridjunior").offset();
                            var dataRecord  = $("#gridjunior").jqxGrid('getrowdata', editrowjabatan);
                            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.RM', datafield: 'tlsnoregister', width: 100, cellsalign: 'left', align: 'center' },
                    { text: 'Name', datafield: 'tlsnama', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Urgensi', filtertype: 'checkedlist', datafield: 'tlsurgensi', width: 110, cellsalign: 'left', align: 'center'  },
                    { text: 'Comming From', filtertype: 'checkedlist', datafield: 'asalpasien', width: 120, cellsalign: 'left', align: 'center'  },
                    { text: 'Service', datafield: 'tlsreques', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Room', filtertype: 'checkedlist', datafield: 'tlsruangan', width: 80, cellsalign: 'left', align: 'center'  },
                    { text: 'Status', filtertype: 'checkedlist', datafield: 'tlsstatus', width: 120, cellsalign: 'left', align: 'center'  },
                    { text: 'Junior', datafield: 'nmppdsjunior', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Middle', datafield: 'nmmiddleppds', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Senior', datafield: 'nmppdssenior', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Other', datafield: 'otherppds', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Register', filterable: false, datafield: 'timestamp1', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Verification', filterable: false, datafield: 'timestamp2', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Duration', datafield: 'durasi', width: 100, cellsalign: 'left', align: 'center'  },
                ]
            });
            var sourcepasiencari2 = {
                datatype: "json",
                datafields: [
                    { name: 'id'},
                    { name: 'idpasien', type: 'text'},
                    { name: 'nofoto', type: 'text'},
                    { name: 'noregister', type: 'text'},
                    { name: 'nama', type: 'text'},
                    { name: 'jk', type: 'text'},
                    { name: 'usia', type: 'text'},
                    { name: 'urgensi', type: 'text'},
                    { name: 'tlsnofoto', type: 'text'},
                    { name: 'tlsnoregister', type: 'text'},
                    { name: 'tlsnama', type: 'text'},
                    { name: 'tlsjk', type: 'text'},
                    { name: 'tlsusia', type: 'text'},
                    { name: 'tlsurgensi', type: 'text'},
                    { name: 'tlsreques', type: 'text'},
                    { name: 'tlsruangan', type: 'text'},
                    { name: 'tlsdaftar', type: 'text'},
                    { name: 'tlsstatus', type: 'text'},
                    { name: 'poli', type: 'text'},
                    { name: 'ruangan', type: 'text'},
                    { name: 'daftartgl', type: 'text'},
                    { name: 'daftarjam', type: 'text'},
                    { name: 'status', type: 'text'},
                    { name: 'keterangan', type: 'text'},
                    { name: 'kesimpulan', type: 'text'},
                    { name: 'idruangan', type: 'text'},
                    { name: 'iddokter', type: 'text'},
                    { name: 'ppdssenior', type: 'text'},
                    { name: 'middleppds', type: 'text'},
                    { name: 'ppdsjunior', type: 'text'},
                    { name: 'nmppdssenior', type: 'text'},
                    { name: 'nmmiddleppds', type: 'text'},
                    { name: 'nmppdsjunior', type: 'text'},
                    { name: 'nmppdsmiddle2', type: 'text'},
                    { name: 'nmppdsjunior2', type: 'text'},
                    { name: 'diagnosa', type: 'text'},
                    { name: 'diagnosa2', type: 'text'},
                    { name: 'kd_spesimen', type: 'text'},
                    { name: 'nm_spesimen', type: 'text'},
                    { name: 'asalpasien', type: 'text'},
                    { name: 'klinis', type: 'text'},
                    { name: 'klinisi', type: 'text'},
                    { name: 'berat', type: 'text'},
                    { name: 'telpon', type: 'text'},
                    { name: 'dlp', type: 'text'},
                    { name: 'excutor', type: 'text'},
                    { name: 'analis', type: 'text'},
                    { name: 'nmexcutor', type: 'text'},
                    { name: 'nmanalis', type: 'text'},
                    { name: 'jumlah', type: 'text'},
                    { name: 'modality', type: 'text'},
                    { name: 'dokter', type: 'text'},
                    { name: 'ppds1', type: 'text'},
                    { name: 'ppds2', type: 'text'},
                    { name: 'timestamp1', type: 'text'},
                    { name: 'timestamp2', type: 'text'},
                    { name: 'durasi', type: 'text'},
                    { name: 'ppdsas', type: 'text'},
                    { name: 'otherppds', type: 'text'},
                ],
                updaterow	: function (rowid, rowdata, commit) {commit(true);},
                type		: 'GET',
                data		: {jenis:'middle', mulai:tanggal, akhir:'', valcari:idppds, poli:'', master:'logbook', _token: "{{ csrf_token() }}"},
                url			: '{{ route("getList") }}',
                root		: 'data',
                totalrecords: 'total',
                cache		: false,
                filter		: function () {$("#gridmiddle").jqxGrid('updatebounddata', 'filter');},
                sort		: function () {$("#gridmiddle").jqxGrid('updatebounddata', 'sort');},
                beforeprocessing: function (data) {
                    if (data != null) {
                        sourcepasiencari2.totalrecords = data.total;
                    }
                }
            };
            var dataAdapter2    = new $.jqx.dataAdapter(sourcepasiencari2);
            var rendergridrows2 = $('#gridjunior').jqxGrid('rendergridrows');
            $("#gridmiddle").jqxGrid({
                width			: '100%',
                enablebrowserselection: true,
                filterable		: true,
                showfilterrow	: true,
                columnsresize	: true,
                virtualmode		: true,
                pageable		: true,
                pagesizeoptions	: ['10', '20', '30', '50'],
                rendergridrows	: function(obj) {
                    return obj.data;
                },
                sortable		: true,
                autoheight		: true,
                source			: dataAdapter2,
                theme			: "energyblue",
                selectionmode	: 'checkbox',
                altrows			: true,
                columns: [
                    { text: 'Report', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                        return "Print";
                        }, buttonclick: function (row) {
                            editrowjabatan = row;
                            var offset      = $("#gridmiddle").offset();
                            var dataRecord  = $("#gridmiddle").jqxGrid('getrowdata', editrowjabatan);
                            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.RM', datafield: 'tlsnoregister', width: 100, cellsalign: 'left', align: 'center' },
                    { text: 'Name', datafield: 'tlsnama', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Urgensi', filtertype: 'checkedlist', datafield: 'tlsurgensi', width: 110, cellsalign: 'left', align: 'center'  },
                    { text: 'Comming From', filtertype: 'checkedlist', datafield: 'asalpasien', width: 120, cellsalign: 'left', align: 'center'  },
                    { text: 'Service', datafield: 'tlsreques', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Room', filtertype: 'checkedlist', datafield: 'tlsruangan', width: 80, cellsalign: 'left', align: 'center'  },
                    { text: 'Status', filtertype: 'checkedlist', datafield: 'tlsstatus', width: 120, cellsalign: 'left', align: 'center'  },
                    { text: 'Junior', datafield: 'nmppdsjunior', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Middle', datafield: 'nmmiddleppds', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Senior', datafield: 'nmppdssenior', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Other', datafield: 'otherppds', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Register', filterable: false, datafield: 'timestamp1', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Verification', filterable: false, datafield: 'timestamp2', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Duration', datafield: 'durasi', width: 100, cellsalign: 'left', align: 'center'  },
                ]
            });
            var sourcepasiencari3 = {
                datatype: "json",
                datafields: [
                    { name: 'id'},
                    { name: 'idpasien', type: 'text'},
                    { name: 'nofoto', type: 'text'},
                    { name: 'noregister', type: 'text'},
                    { name: 'nama', type: 'text'},
                    { name: 'jk', type: 'text'},
                    { name: 'usia', type: 'text'},
                    { name: 'urgensi', type: 'text'},
                    { name: 'tlsnofoto', type: 'text'},
                    { name: 'tlsnoregister', type: 'text'},
                    { name: 'tlsnama', type: 'text'},
                    { name: 'tlsjk', type: 'text'},
                    { name: 'tlsusia', type: 'text'},
                    { name: 'tlsurgensi', type: 'text'},
                    { name: 'tlsreques', type: 'text'},
                    { name: 'tlsruangan', type: 'text'},
                    { name: 'tlsdaftar', type: 'text'},
                    { name: 'tlsstatus', type: 'text'},
                    { name: 'poli', type: 'text'},
                    { name: 'ruangan', type: 'text'},
                    { name: 'daftartgl', type: 'text'},
                    { name: 'daftarjam', type: 'text'},
                    { name: 'status', type: 'text'},
                    { name: 'keterangan', type: 'text'},
                    { name: 'kesimpulan', type: 'text'},
                    { name: 'idruangan', type: 'text'},
                    { name: 'iddokter', type: 'text'},
                    { name: 'ppdssenior', type: 'text'},
                    { name: 'middleppds', type: 'text'},
                    { name: 'ppdsjunior', type: 'text'},
                    { name: 'nmppdssenior', type: 'text'},
                    { name: 'nmmiddleppds', type: 'text'},
                    { name: 'nmppdsjunior', type: 'text'},
                    { name: 'nmppdsmiddle2', type: 'text'},
                    { name: 'nmppdsjunior2', type: 'text'},
                    { name: 'diagnosa', type: 'text'},
                    { name: 'diagnosa2', type: 'text'},
                    { name: 'kd_spesimen', type: 'text'},
                    { name: 'nm_spesimen', type: 'text'},
                    { name: 'asalpasien', type: 'text'},
                    { name: 'klinis', type: 'text'},
                    { name: 'klinisi', type: 'text'},
                    { name: 'berat', type: 'text'},
                    { name: 'telpon', type: 'text'},
                    { name: 'dlp', type: 'text'},
                    { name: 'excutor', type: 'text'},
                    { name: 'analis', type: 'text'},
                    { name: 'nmexcutor', type: 'text'},
                    { name: 'nmanalis', type: 'text'},
                    { name: 'jumlah', type: 'text'},
                    { name: 'modality', type: 'text'},
                    { name: 'dokter', type: 'text'},
                    { name: 'ppds1', type: 'text'},
                    { name: 'ppds2', type: 'text'},
                    { name: 'timestamp1', type: 'text'},
                    { name: 'timestamp2', type: 'text'},
                    { name: 'durasi', type: 'text'},
                    { name: 'ppdsas', type: 'text'},
                    { name: 'otherppds', type: 'text'},
                ],
                updaterow	: function (rowid, rowdata, commit) {commit(true);},
                type		: 'GET',
                data		: {jenis:'senior', mulai:tanggal, akhir:'', valcari:idppds, poli:'', master:'logbook', _token: "{{ csrf_token() }}"},
                url			: '{{ route("getList") }}',
                root		: 'data',
                totalrecords: 'total',
                cache		: false,
                filter		: function () {$("#gridsenior").jqxGrid('updatebounddata', 'filter');},
                sort		: function () {$("#gridsenior").jqxGrid('updatebounddata', 'sort');},
                beforeprocessing: function (data) {
                    if (data != null) {
                        sourcepasiencari3.totalrecords = data.total;
                    }
                }
            };
            var dataAdapter3    = new $.jqx.dataAdapter(sourcepasiencari3);
            var rendergridrows3 = $('#gridjunior').jqxGrid('rendergridrows');
            $("#gridsenior").jqxGrid({
                width			: '100%',
                enablebrowserselection: true,
                filterable		: true,
                showfilterrow	: true,
                columnsresize	: true,
                virtualmode		: true,
                pageable		: true,
                pagesizeoptions	: ['10', '20', '30', '50'],
                rendergridrows	: function(obj) {
                    return obj.data;
                },
                sortable		: true,
                autoheight		: true,
                source			: dataAdapter3,
                theme			: "energyblue",
                selectionmode	: 'checkbox',
                altrows			: true,
                columns: [
                    { text: 'Report', sortable: false, filterable: false, columntype: 'button', align: 'center', width: 70, cellsrenderer: function () {
                        return "Print";
                        }, buttonclick: function (row) {
                            editrowjabatan = row;
                            var offset      = $("#gridsenior").offset();
                            var dataRecord  = $("#gridsenior").jqxGrid('getrowdata', editrowjabatan);
                            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.RM', datafield: 'tlsnoregister', width: 100, cellsalign: 'left', align: 'center' },
                    { text: 'Name', datafield: 'tlsnama', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Urgensi', filtertype: 'checkedlist', datafield: 'tlsurgensi', width: 110, cellsalign: 'left', align: 'center'  },
                    { text: 'Comming From', filtertype: 'checkedlist', datafield: 'asalpasien', width: 120, cellsalign: 'left', align: 'center'  },
                    { text: 'Service', datafield: 'tlsreques', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Room', filtertype: 'checkedlist', datafield: 'tlsruangan', width: 80, cellsalign: 'left', align: 'center'  },
                    { text: 'Status', filtertype: 'checkedlist', datafield: 'tlsstatus', width: 120, cellsalign: 'left', align: 'center'  },
                    { text: 'Junior', datafield: 'nmppdsjunior', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Middle', datafield: 'nmmiddleppds', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Senior', datafield: 'nmppdssenior', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Other', datafield: 'otherppds', width: 180, cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Register', filterable: false, datafield: 'timestamp1', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Verification', filterable: false, datafield: 'timestamp2', width: 150, cellsalign: 'left', align: 'center'  },
                    { text: 'Duration', datafield: 'durasi', width: 100, cellsalign: 'left', align: 'center'  },
                ]
            });
            var sourcestatistik1 = {
                datatype: "json",
                datafields: [
                    { name: 'sebagai', type: 'text'},
                    { name: 'total', type: 'text'},
                ],
                type: 'POST',
                data: {val01:idppds, val02:'vindicate', val03:tanggal, _token: "{{ csrf_token() }}"},
                url: '{{ route("jsonViewlogbook") }}'
            };
            var DAstatistik1 = new $.jqx.dataAdapter(sourcestatistik1);	
            var settings1 = {
                title: "Grafik PPDS",
                description: 'Per VINDICATE',
                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'}
                            ]
                        },
                        
                    ]
            };
            $('#grafikvindicate').jqxChart(settings1);
            var sourcestatistik2 = {
                datatype: "json",
                datafields: [
                    { name: 'sebagai', type: 'text'},
                    { name: 'total', type: 'text'},
                ],
                type: 'POST',
                data: {val01:idppds, val02:'stase', val03:tanggal, _token: "{{ csrf_token() }}"},
                url: '{{ route("jsonViewlogbook") }}'
            };
            var DAstatistik2 = new $.jqx.dataAdapter(sourcestatistik2);	
            var settings2 = {
                title: "Grafik PPDS",
                description: 'Per Stase Organ',
                enableAnimations: true,
                padding: { left: 5, top: 5, right: 5, bottom: 5 },
                titlePadding: { left: 50, top: 0, right: 0, bottom: 10 },
                source: DAstatistik2,
                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'}
                            ]
                        },
                        
                    ]
            };
            $('#grafiksistemorgan').jqxChart(settings2);
		});
        $("#spv").on('change', function () {		
            var nama = $(this).find('option:selected').attr('id1');				
            var ttd = $(this).find('option:selected').attr('id2');				
            $("#getnama").val(nama);
            $("#gettandatangan").val(ttd);
            $('#divreportspv').hide();
        });
        $('#btnviewcustom').click(function () {
            var set01=document.getElementById('spv').value;
            var set02=document.getElementById('mulai').value;
            var set03=document.getElementById('akhir').value;
            var set04=document.getElementById('getnama').value;
            var set05=document.getElementById('gettandatangan').value;
 	        var tgl01=set02+' to '+set03;
            $("#getsubmenu").val(tgl01);
            $("#judul").html(set04);
            var source = {
                datatype: "json",
                datafields: [
                    { name: 'id',type: 'text'},
                    { name: 'nofoto',type: 'text'},
                    { name: 'telpon',type: 'text'},
                    { name: 'noregister',type: 'text'},
                    { name: 'noloket',type: 'text'},
                    { name: 'nama',type: 'text'},
                    { name: 'reques',type: 'text'},
                    { name: 'usia',type: 'text'},
                    { name: 'ruangan',type: 'text'},
                    { name: 'kesimpulan', type: 'text'},
                    { name: 'poli', type: 'text'},
                    { name: 'jkn', type: 'text'},
                    { name: 'umm', type: 'text'},
                    { name: 'swasta', type: 'text'},
                    { name: 'billing', type: 'text'},
                    { name: 'ele', type: 'text'},
                    { name: 'cito', type: 'text'},
                    { name: 'daftar', type: 'text'},
                    { name: 'foto',type: 'text'},
                    { name: 'baca',type: 'text'},
                    { name: 'cetak',type: 'text'},
                    { name: 'tanggal',type: 'text'},
                    { name: 'dokter',type: 'text'},
                    { name: 'ppds1',type: 'text'},
                    { name: 'ppds2',type: 'text'},
                    { name: 'ppds3',type: 'text'},
                    { name: 'diagnosa',type: 'text'},
                    { name: 'modality',type: 'text'},
                    { name: 'kd_spesimen',type: 'text'},
                    { name: 'nm_spesimen',type: 'text'},
                    { name: 'asalpasien',type: 'text'},
                    { name: 'status',type: 'text'},
                    { name: 'nmrs',type: 'text'},
                    { name: 'berat',type: 'text'},
                    { name: 'klinisi',type: 'text'},
                    { name: 'klinis',type: 'text'},
                    { name: 'analis',type: 'text'},
                    { name: 'durasi',type: 'text'},
                    { name: 'dokter',type: 'text'},
                    { name: 'timestamp1',type: 'text'},
                    { name: 'timestamp2',type: 'text'},
                ],
                type: 'POST',
                data: {val01:set01, val02:set02, val03:set03, val04:set04, _token: "{{ csrf_token() }}" },
                url: "logbook/jpencarianspv"
            };
            var dataAdapter = new $.jqx.dataAdapter(source);
            var editrow = -1;
            $('#divreportspv').show();
            $('#divreportppds').hide();
            $("#gridpencarian").jqxGrid({
                width: '100%',
                enablebrowserselection: true,
                filterable: true,
                showfilterrow: true,				
                source: dataAdapter,
                pageable: false,
                theme: "orange",
                columnsresize: true,
                selectionmode: 'multiplecellsextended',
                columns: [
                    { text: 'View', sortable: false, filterable: false, columntype: 'button', align: 'center', width: '7%', cellsrenderer: function () {
                        return "View";
                        }, buttonclick: function (row) {
                            editrowjabatan = row;
                            var offset      = $("#gridlist").offset();
                            var dataRecord  = $("#gridlist").jqxGrid('getrowdata', editrowjabatan);
                            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: 'id', width: '5%', cellsalign: 'left', align: 'center'  },
                    { text: 'Acc.No', datafield: 'nofoto', width: '8%', cellsalign: 'left', align: 'center'  },
                    { text: 'No.RM', datafield: 'noregister', width: '9%', align: 'center', cellsalign: 'left'},
                    { text: 'Nama', datafield: 'nama', width: '11%', cellsalign: 'left', align: 'center' },
                    { text: 'Order', datafield: 'reques', width: '11%', cellsalign: 'left', align: 'center'  },
                    { text: 'Senior PPDS', datafield: 'ppds1', width: '9%', cellsalign: 'left', align: 'center'  },
                    { text: 'Middle PPDS', datafield: 'ppds2', width: '9%', cellsalign: 'left', align: 'center'  },
                    { text: 'Junior PPDS', datafield: 'ppds3', width: '9%', cellsalign: 'left', align: 'center'  },
                	{ text: 'Timestamp Register', filterable: false, datafield: 'timestamp1', width: '8%', cellsalign: 'left', align: 'center'  },
                    { text: 'Timestamp Verification', filterable: false, datafield: 'timestamp2', width: '8%', cellsalign: 'left', align: 'center'  },
                    { text: 'Duration', datafield: 'durasi', width: '6%', cellsalign: 'left', align: 'center'  },
                ]
            });		
        });
    });
</script>
@endpush

